aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-06 20:55:28 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-06 20:55:28 +0000
commit61c39c60565b386e0e12ea669556b030e8cd7180 (patch)
tree59109aeab8297bdc996faca8c4e38ec7426c36cf /src
parent780eb09dd8040ecf8649d40ddf8314464e0fc48e (diff)
downloadgnunet-61c39c60565b386e0e12ea669556b030e8cd7180.tar.gz
gnunet-61c39c60565b386e0e12ea669556b030e8cd7180.zip
-remove trailing whitespace
Diffstat (limited to 'src')
-rw-r--r--src/arm/arm.h14
-rw-r--r--src/arm/arm_api.c60
-rw-r--r--src/arm/arm_monitor_api.c2
-rw-r--r--src/arm/do_start_process.c2
-rw-r--r--src/arm/gnunet-arm.c52
-rw-r--r--src/arm/gnunet-service-arm.c54
-rw-r--r--src/arm/test_arm_api.c24
-rw-r--r--src/arm/test_exponential_backoff.c10
-rw-r--r--src/arm/test_gnunet_service_arm.c20
-rw-r--r--src/ats-tool/gnunet-ats.c6
-rw-r--r--src/ats/gnunet-service-ats-solver_mlp.c50
-rw-r--r--src/ats/gnunet-service-ats-solver_proportional.c4
-rwxr-xr-xsrc/ats/gnunet-service-ats-solver_ril.c2
-rw-r--r--src/ats/gnunet-service-ats_addresses.c26
-rw-r--r--src/ats/gnunet-service-ats_normalization.c8
-rw-r--r--src/ats/gnunet-service-ats_reservations.c2
-rw-r--r--src/ats/perf_ats_mlp.c18
-rw-r--r--src/ats/test_ats_api_bandwidth_consumption.c2
-rw-r--r--src/ats/test_ats_api_performance_address_info.c2
-rw-r--r--src/ats/test_ats_api_performance_feedback.c2
-rw-r--r--src/ats/test_ats_api_scheduling_add_address.c2
-rw-r--r--src/ats/test_ats_api_scheduling_add_address_duplicate.c2
-rw-r--r--src/ats/test_ats_api_scheduling_add_address_inbound.c2
-rw-r--r--src/ats/test_ats_api_scheduling_add_session.c2
-rw-r--r--src/ats/test_ats_api_scheduling_block_and_reset.c36
-rw-r--r--src/ats/test_ats_api_scheduling_destroy_address.c2
-rw-r--r--src/ats/test_ats_api_scheduling_destroy_address_twice.c2
-rw-r--r--src/ats/test_ats_api_scheduling_destroy_inbound_connection.c2
-rw-r--r--src/ats/test_ats_api_scheduling_destroy_session.c2
-rw-r--r--src/ats/test_ats_api_scheduling_init.c2
-rw-r--r--src/ats/test_ats_api_scheduling_min_bw.c2
-rw-r--r--src/block/block.c6
-rw-r--r--src/block/plugin_block_template.c2
-rw-r--r--src/block/plugin_block_test.c2
-rw-r--r--src/consensus/consensus_api.c10
-rw-r--r--src/consensus/gnunet-consensus-profiler.c2
-rw-r--r--src/consensus/gnunet-service-consensus.c22
-rw-r--r--src/consensus/test_consensus_api.c2
-rw-r--r--src/conversation/conversation.h8
-rw-r--r--src/conversation/conversation_api.c56
-rw-r--r--src/conversation/gnunet-conversation-test.c12
-rw-r--r--src/conversation/gnunet-conversation.c58
-rw-r--r--src/conversation/gnunet-helper-audio-playback.c54
-rw-r--r--src/conversation/gnunet-helper-audio-record.c64
-rw-r--r--src/conversation/gnunet-service-conversation.c70
-rw-r--r--src/conversation/microphone.c16
-rw-r--r--src/conversation/speaker.c18
-rw-r--r--src/conversation/test_conversation_api.c2
-rw-r--r--src/core/core_api.c8
-rw-r--r--src/core/gnunet-core.c2
-rw-r--r--src/core/gnunet-service-core.c4
-rw-r--r--src/core/gnunet-service-core_clients.c12
-rw-r--r--src/core/gnunet-service-core_kx.c62
-rw-r--r--src/core/gnunet-service-core_neighbours.c4
-rw-r--r--src/core/gnunet-service-core_sessions.c2
-rw-r--r--src/core/test_core_api.c6
-rw-r--r--src/core/test_core_api_reliability.c2
-rw-r--r--src/core/test_core_api_send_to_self.c4
-rw-r--r--src/core/test_core_api_start_only.c2
-rw-r--r--src/core/test_core_quota_compliance.c2
-rw-r--r--src/datacache/datacache.c12
-rw-r--r--src/datacache/perf_datacache.c2
-rw-r--r--src/datacache/plugin_datacache_heap.c18
-rw-r--r--src/datacache/plugin_datacache_postgres.c20
-rw-r--r--src/datacache/plugin_datacache_sqlite.c12
-rw-r--r--src/datacache/test_datacache.c8
-rw-r--r--src/datastore/datastore_api.c8
-rw-r--r--src/datastore/gnunet-datastore.c18
-rw-r--r--src/datastore/gnunet-service-datastore.c8
-rw-r--r--src/datastore/perf_datastore_api.c2
-rw-r--r--src/datastore/perf_plugin_datastore.c6
-rw-r--r--src/datastore/plugin_datastore_heap.c56
-rw-r--r--src/datastore/plugin_datastore_mysql.c10
-rw-r--r--src/datastore/plugin_datastore_postgres.c8
-rw-r--r--src/datastore/test_datastore_api.c4
-rw-r--r--src/datastore/test_datastore_api_management.c2
-rw-r--r--src/datastore/test_plugin_datastore.c2
-rw-r--r--src/dht/dht.h4
-rw-r--r--src/dht/dht_api.c56
-rw-r--r--src/dht/dht_test_lib.c16
-rw-r--r--src/dht/dht_test_lib.h2
-rw-r--r--src/dht/gnunet-dht-get.c4
-rw-r--r--src/dht/gnunet-dht-monitor.c12
-rw-r--r--src/dht/gnunet-service-dht_clients.c14
-rw-r--r--src/dht/gnunet-service-dht_clients.h4
-rw-r--r--src/dht/gnunet-service-dht_datacache.c4
-rw-r--r--src/dht/gnunet-service-dht_hello.c4
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c34
-rw-r--r--src/dht/gnunet-service-dht_neighbours.h2
-rw-r--r--src/dht/gnunet-service-dht_routing.c4
-rw-r--r--src/dht/test_dht_api.c2
-rw-r--r--src/dht/test_dht_monitor.c32
-rw-r--r--src/dht/test_dht_topo.c44
-rw-r--r--src/dns/dns.h4
-rw-r--r--src/dns/dns_api.c34
-rw-r--r--src/dns/dnsparser.c86
-rw-r--r--src/dns/dnsstub.c40
-rw-r--r--src/dns/gnunet-dns-monitor.c12
-rw-r--r--src/dns/gnunet-dns-redirector.c14
-rw-r--r--src/dns/gnunet-helper-dns.c82
-rw-r--r--src/dns/gnunet-service-dns.c64
-rw-r--r--src/dns/plugin_block_dns.c10
-rw-r--r--src/dv/dv.h4
-rw-r--r--src/dv/dv_api.c26
-rw-r--r--src/dv/gnunet-dv.c10
-rw-r--r--src/dv/gnunet-service-dv.c128
-rw-r--r--src/dv/plugin_transport_dv.c46
-rw-r--r--src/dv/test_transport_blacklist.c2
-rw-r--r--src/env/env.c16
-rw-r--r--src/env/test_env.c2
-rw-r--r--src/exit/exit.h8
-rw-r--r--src/exit/gnunet-daemon-exit.c292
-rw-r--r--src/exit/gnunet-helper-exit-windows.c250
-rw-r--r--src/exit/gnunet-helper-exit.c50
-rw-r--r--src/experimentation/gnunet-daemon-experimentation.h96
-rw-r--r--src/experimentation/gnunet-daemon-experimentation_experiments.c96
-rw-r--r--src/experimentation/gnunet-daemon-experimentation_nodes.c128
-rw-r--r--src/experimentation/gnunet-daemon-experimentation_scheduler.c4
-rw-r--r--src/experimentation/test_experimentation_clique_connect.c2
-rw-r--r--src/fragmentation/defragmentation.c8
-rw-r--r--src/fragmentation/fragmentation.c10
-rw-r--r--src/fragmentation/test_fragmentation.c4
-rw-r--r--src/fs/fs_api.c34
-rw-r--r--src/fs/fs_api.h14
-rw-r--r--src/fs/fs_dirmetascan.c52
-rw-r--r--src/fs/fs_download.c24
-rw-r--r--src/fs/fs_namespace.c26
-rw-r--r--src/fs/fs_publish.c48
-rw-r--r--src/fs/fs_publish_ksk.c8
-rw-r--r--src/fs/fs_publish_ublock.c14
-rw-r--r--src/fs/fs_publish_ublock.h4
-rw-r--r--src/fs/fs_search.c52
-rw-r--r--src/fs/fs_sharetree.c16
-rw-r--r--src/fs/fs_test_lib.c30
-rw-r--r--src/fs/fs_unindex.c22
-rw-r--r--src/fs/fs_uri.c24
-rw-r--r--src/fs/gnunet-auto-share.c26
-rw-r--r--src/fs/gnunet-daemon-fsprofiler.c42
-rw-r--r--src/fs/gnunet-download.c8
-rw-r--r--src/fs/gnunet-fs-profiler.c6
-rw-r--r--src/fs/gnunet-helper-fs-publish.c46
-rw-r--r--src/fs/gnunet-publish.c36
-rw-r--r--src/fs/gnunet-service-fs.c8
-rw-r--r--src/fs/gnunet-service-fs_cp.c24
-rw-r--r--src/fs/gnunet-service-fs_indexing.c4
-rw-r--r--src/fs/gnunet-service-fs_lc.c2
-rw-r--r--src/fs/gnunet-service-fs_mesh.h2
-rw-r--r--src/fs/gnunet-service-fs_mesh_client.c30
-rw-r--r--src/fs/gnunet-service-fs_mesh_server.c32
-rw-r--r--src/fs/gnunet-service-fs_pe.c6
-rw-r--r--src/fs/gnunet-service-fs_pe.h2
-rw-r--r--src/fs/gnunet-service-fs_pr.c38
-rw-r--r--src/fs/gnunet-service-fs_put.c6
-rw-r--r--src/fs/perf_gnunet_service_fs_p2p.c20
-rw-r--r--src/fs/perf_gnunet_service_fs_p2p_respect.c18
-rw-r--r--src/fs/test_fs_download.c10
-rw-r--r--src/fs/test_fs_download_persistence.c2
-rw-r--r--src/fs/test_fs_namespace.c6
-rw-r--r--src/fs/test_fs_namespace_list_updateable.c2
-rw-r--r--src/fs/test_fs_publish.c2
-rw-r--r--src/fs/test_fs_publish_persistence.c4
-rw-r--r--src/fs/test_fs_search.c2
-rw-r--r--src/fs/test_fs_search_probes.c2
-rw-r--r--src/fs/test_fs_start_stop.c2
-rw-r--r--src/fs/test_fs_test_lib.c12
-rw-r--r--src/fs/test_fs_unindex_persistence.c2
-rw-r--r--src/fs/test_gnunet_service_fs_migration.c4
-rw-r--r--src/fs/test_gnunet_service_fs_p2p.c12
-rw-r--r--src/gns/gns.h6
-rw-r--r--src/gns/gns_api.c54
-rw-r--r--src/gns/gnunet-dns2gns.c40
-rw-r--r--src/gns/gnunet-gns-helper-service-w32.c10
-rw-r--r--src/gns/gnunet-gns-proxy.c308
-rw-r--r--src/gns/gnunet-gns.c38
-rw-r--r--src/gns/gnunet-service-gns.c88
-rw-r--r--src/gns/gnunet-service-gns_interceptor.c38
-rw-r--r--src/gns/gnunet-service-gns_resolver.c154
-rw-r--r--src/gns/gnunet-service-gns_resolver.h2
-rw-r--r--src/gns/gnunet-service-gns_shorten.c40
-rw-r--r--src/gns/gnunet_w32nsp_lib.h16
-rw-r--r--src/gns/nss/nss_gns.c40
-rw-r--r--src/gns/nss/nss_gns_query.c12
-rw-r--r--src/gns/plugin_block_gns.c4
-rw-r--r--src/gns/test_gns_proxy.c26
-rw-r--r--src/gns/test_gns_pseu_shorten.c36
-rw-r--r--src/gns/test_gns_revocation.c6
-rw-r--r--src/gns/test_gns_simple_shorten.c18
-rw-r--r--src/gns/test_gns_simple_srv_lookup.c6
-rw-r--r--src/gns/test_gns_simple_zkey_lookup.c12
-rw-r--r--src/gns/w32nsp-install.c162
-rw-r--r--src/gns/w32nsp-resolve.c8
-rw-r--r--src/gns/w32nsp-uninstall.c58
-rw-r--r--src/hello/gnunet-hello.c14
-rw-r--r--src/hello/hello.c24
-rw-r--r--src/hostlist/hostlist-client.c2
-rw-r--r--src/hostlist/hostlist-server.c6
-rw-r--r--src/hostlist/test_gnunet_daemon_hostlist_reconnect.c2
-rw-r--r--src/identity/gnunet-identity.c12
-rw-r--r--src/identity/gnunet-service-identity.c68
-rw-r--r--src/identity/identity.h6
-rw-r--r--src/identity/identity_api.c44
-rw-r--r--src/identity/identity_api_lookup.c16
-rw-r--r--src/identity/test_identity.c28
-rw-r--r--src/identity/test_identity_defaults.c32
-rw-r--r--src/include/block_regex.h2
-rw-r--r--src/include/gnunet_arm_service.h28
-rw-r--r--src/include/gnunet_bio_lib.h2
-rw-r--r--src/include/gnunet_block_lib.h4
-rw-r--r--src/include/gnunet_block_plugin.h2
-rw-r--r--src/include/gnunet_client_lib.h2
-rw-r--r--src/include/gnunet_common.h14
-rw-r--r--src/include/gnunet_configuration_lib.h6
-rw-r--r--src/include/gnunet_consensus_service.h4
-rw-r--r--src/include/gnunet_constants.h2
-rw-r--r--src/include/gnunet_container_lib.h104
-rw-r--r--src/include/gnunet_conversation_service.h20
-rw-r--r--src/include/gnunet_core_service.h2
-rw-r--r--src/include/gnunet_crypto_lib.h18
-rw-r--r--src/include/gnunet_datastore_plugin.h4
-rw-r--r--src/include/gnunet_dht_service.h18
-rw-r--r--src/include/gnunet_disk_lib.h36
-rw-r--r--src/include/gnunet_dns_service.h8
-rw-r--r--src/include/gnunet_dnsparser_lib.h46
-rw-r--r--src/include/gnunet_dnsstub_lib.h4
-rw-r--r--src/include/gnunet_env_lib.h68
-rw-r--r--src/include/gnunet_fs_service.h24
-rw-r--r--src/include/gnunet_helper_lib.h8
-rw-r--r--src/include/gnunet_identity_service.h32
-rw-r--r--src/include/gnunet_lockmanager_service.h6
-rw-r--r--src/include/gnunet_mesh_service.h24
-rw-r--r--src/include/gnunet_mesh_service_enc.h20
-rw-r--r--src/include/gnunet_microphone_lib.h6
-rw-r--r--src/include/gnunet_mq_lib.h22
-rw-r--r--src/include/gnunet_multicast_service.h114
-rw-r--r--src/include/gnunet_mysql_lib.h2
-rw-r--r--src/include/gnunet_namestore_plugin.h10
-rw-r--r--src/include/gnunet_namestore_service.h40
-rw-r--r--src/include/gnunet_nat_lib.h2
-rw-r--r--src/include/gnunet_network_lib.h2
-rw-r--r--src/include/gnunet_os_lib.h10
-rw-r--r--src/include/gnunet_peerinfo_service.h2
-rw-r--r--src/include/gnunet_postgres_lib.h6
-rw-r--r--src/include/gnunet_protocols.h10
-rw-r--r--src/include/gnunet_psyc_service.h86
-rw-r--r--src/include/gnunet_psycstore_plugin.h38
-rw-r--r--src/include/gnunet_psycstore_service.h70
-rw-r--r--src/include/gnunet_regex_service.h6
-rw-r--r--src/include/gnunet_resolver_service.h2
-rw-r--r--src/include/gnunet_revocation_service.h2
-rw-r--r--src/include/gnunet_scalarproduct_service.h12
-rw-r--r--src/include/gnunet_scheduler_lib.h2
-rw-r--r--src/include/gnunet_server_lib.h14
-rw-r--r--src/include/gnunet_service_lib.h6
-rw-r--r--src/include/gnunet_set_service.h6
-rw-r--r--src/include/gnunet_social_service.h94
-rw-r--r--src/include/gnunet_speaker_lib.h6
-rw-r--r--src/include/gnunet_strings_lib.h50
-rw-r--r--src/include/gnunet_testbed_logger_service.h2
-rw-r--r--src/include/gnunet_testbed_service.h8
-rw-r--r--src/include/gnunet_testing_lib.h22
-rw-r--r--src/include/gnunet_time_lib.h6
-rw-r--r--src/include/gnunet_transport_plugin.h2
-rw-r--r--src/include/gnunet_tun_lib.h98
-rw-r--r--src/include/gnunet_vpn_service.h8
-rw-r--r--src/include/tap-windows.h160
-rw-r--r--src/integration-tests/connection_watchdog.c52
-rw-r--r--src/mesh/gnunet-mesh.c2
-rw-r--r--src/mesh/gnunet-service-mesh-enc.c34
-rw-r--r--src/mesh/gnunet-service-mesh.c94
-rw-r--r--src/mesh/gnunet-service-mesh_channel.c14
-rw-r--r--src/mesh/gnunet-service-mesh_channel.h2
-rw-r--r--src/mesh/gnunet-service-mesh_connection.c22
-rw-r--r--src/mesh/gnunet-service-mesh_connection.h2
-rw-r--r--src/mesh/gnunet-service-mesh_local.c12
-rw-r--r--src/mesh/gnunet-service-mesh_local.h4
-rw-r--r--src/mesh/gnunet-service-mesh_peer.c50
-rw-r--r--src/mesh/mesh.h8
-rw-r--r--src/mesh/mesh_api.c34
-rw-r--r--src/mesh/mesh_api_enc.c26
-rw-r--r--src/mesh/mesh_enc.h4
-rw-r--r--src/mesh/mesh_protocol.h4
-rw-r--r--src/mesh/mesh_protocol_enc.h2
-rw-r--r--src/mesh/mesh_test_lib.c14
-rw-r--r--src/mesh/mesh_test_lib.h2
-rw-r--r--src/mesh/mesh_tunnel_tree.c2
-rw-r--r--src/mesh/test_mesh_local.c12
-rw-r--r--src/mesh/test_mesh_single.c12
-rw-r--r--src/mesh/test_mesh_small.c20
-rw-r--r--src/multicast/multicast.h6
-rw-r--r--src/multicast/multicast_api.c78
-rw-r--r--src/namestore/gnunet-namestore-fcfsd.c58
-rw-r--r--src/namestore/gnunet-namestore.c78
-rw-r--r--src/namestore/gnunet-service-namestore.c128
-rw-r--r--src/namestore/namestore.h10
-rw-r--r--src/namestore/namestore_api.c116
-rw-r--r--src/namestore/namestore_api_common.c116
-rw-r--r--src/namestore/namestore_api_monitor.c8
-rw-r--r--src/namestore/plugin_namestore_postgres.c84
-rw-r--r--src/namestore/plugin_namestore_sqlite.c156
-rw-r--r--src/namestore/test_namestore_api_cache_block.c8
-rw-r--r--src/namestore/test_namestore_api_lookup_public.c10
-rw-r--r--src/namestore/test_namestore_api_monitoring.c10
-rw-r--r--src/namestore/test_namestore_api_monitoring_existing.c10
-rw-r--r--src/namestore/test_namestore_api_put.c6
-rw-r--r--src/namestore/test_namestore_api_remove.c22
-rw-r--r--src/namestore/test_namestore_api_remove_not_existing_record.c2
-rw-r--r--src/namestore/test_namestore_api_store.c10
-rw-r--r--src/namestore/test_namestore_api_store_update.c18
-rw-r--r--src/namestore/test_namestore_api_zone_iteration.c6
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c2
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_stop.c2
-rw-r--r--src/namestore/test_namestore_api_zone_to_name.c2
-rw-r--r--src/namestore/test_plugin_namestore.c10
-rw-r--r--src/nat/gnunet-helper-nat-client-windows.c18
-rw-r--r--src/nat/gnunet-helper-nat-server-windows.c6
-rw-r--r--src/nat/gnunet-helper-nat-server.c2
-rw-r--r--src/nat/nat.c2
-rw-r--r--src/nat/nat_auto.c30
-rw-r--r--src/nse/gnunet-nse-profiler.c48
-rw-r--r--src/nse/gnunet-service-nse.c72
-rw-r--r--src/nse/nse_api.c12
-rw-r--r--src/nse/perf_kdf.c2
-rw-r--r--src/nse/test_nse_api.c2
-rw-r--r--src/nse/test_nse_multipeer.c18
-rw-r--r--src/peerinfo-tool/gnunet-peerinfo.c42
-rw-r--r--src/peerinfo/gnunet-service-peerinfo.c52
-rw-r--r--src/peerinfo/peerinfo_api.c14
-rwxr-xr-xsrc/peerinfo/perf_peerinfo_api.c2
-rw-r--r--src/peerinfo/test_peerinfo_api.c2
-rw-r--r--src/peerinfo/test_peerinfo_api_friend_only.c2
-rw-r--r--src/peerinfo/test_peerinfo_api_notify_friend_only.c2
-rw-r--r--src/peerinfo/test_peerinfo_shipped_hellos.c2
-rw-r--r--src/psyc/gnunet-service-psyc.c2
-rw-r--r--src/psyc/psyc_api.c56
-rw-r--r--src/psycstore/gnunet-service-psycstore.c2
-rw-r--r--src/psycstore/plugin_psycstore_sqlite.c72
-rw-r--r--src/psycstore/psycstore_api.c52
-rw-r--r--src/pt/gnunet-daemon-pt.c76
-rw-r--r--src/pt/test_gns_vpn.c66
-rw-r--r--src/pt/test_gnunet_vpn.c16
-rw-r--r--src/regex/gnunet-daemon-regexprofiler.c4
-rw-r--r--src/regex/gnunet-regex-profiler.c16
-rw-r--r--src/regex/gnunet-service-regex.c18
-rw-r--r--src/regex/perf-regex.c12
-rw-r--r--src/regex/plugin_block_regex.c4
-rw-r--r--src/regex/regex_api.c32
-rw-r--r--src/regex/regex_block_lib.c32
-rw-r--r--src/regex/regex_block_lib.h4
-rw-r--r--src/regex/regex_internal.c112
-rw-r--r--src/regex/regex_internal_dht.c58
-rw-r--r--src/regex/regex_internal_lib.h12
-rw-r--r--src/regex/regex_ipc.h4
-rw-r--r--src/regex/regex_test_lib.c14
-rw-r--r--src/regex/regex_test_lib.h6
-rw-r--r--src/regex/test_regex_api.c4
-rw-r--r--src/regex/test_regex_iterate_api.c2
-rw-r--r--src/revocation/gnunet-revocation.c20
-rw-r--r--src/revocation/gnunet-service-revocation.c60
-rw-r--r--src/revocation/revocation_api.c14
-rw-r--r--src/scalarproduct/gnunet-scalarproduct.c14
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct.c122
-rw-r--r--src/scalarproduct/scalarproduct.h18
-rw-r--r--src/scalarproduct/scalarproduct_api.c34
-rw-r--r--src/scalarproduct/scalarproduct_testing.h22
-rw-r--r--src/scalarproduct/test_scalarproduct_api.c38
-rw-r--r--src/set/gnunet-service-set.c12
-rw-r--r--src/set/gnunet-service-set.h2
-rw-r--r--src/set/gnunet-service-set_intersection.c30
-rw-r--r--src/set/gnunet-service-set_union.c28
-rw-r--r--src/set/gnunet-set-ibf-profiler.c2
-rw-r--r--src/set/gnunet-set-profiler.c2
-rw-r--r--src/set/ibf.c2
-rw-r--r--src/set/ibf.h2
-rw-r--r--src/set/set_api.c6
-rw-r--r--src/set/test_set_api.c2
-rw-r--r--src/statistics/gnunet-service-statistics.c6
-rw-r--r--src/statistics/gnunet-statistics.c14
-rw-r--r--src/statistics/statistics_api.c44
-rw-r--r--src/statistics/test_statistics_api.c4
-rw-r--r--src/statistics/test_statistics_api_loop.c2
-rw-r--r--src/statistics/test_statistics_api_watch.c4
-rw-r--r--src/testbed/gnunet-daemon-testbed-blacklist.c8
-rw-r--r--src/testbed/gnunet-helper-testbed.c18
-rw-r--r--src/testbed/gnunet-service-test-barriers.c6
-rw-r--r--src/testbed/gnunet-service-testbed-logger.c4
-rw-r--r--src/testbed/gnunet-service-testbed.c12
-rw-r--r--src/testbed/gnunet-service-testbed_barriers.c52
-rw-r--r--src/testbed/gnunet-service-testbed_barriers.h2
-rw-r--r--src/testbed/gnunet-service-testbed_cache.c6
-rw-r--r--src/testbed/gnunet-service-testbed_connectionpool.c24
-rw-r--r--src/testbed/gnunet-service-testbed_connectionpool.h4
-rw-r--r--src/testbed/gnunet-service-testbed_cpustatus.c14
-rw-r--r--src/testbed/gnunet-service-testbed_links.c42
-rw-r--r--src/testbed/gnunet-service-testbed_oc.c42
-rw-r--r--src/testbed/gnunet-service-testbed_peers.c46
-rw-r--r--src/testbed/gnunet-testbed-profiler.c4
-rw-r--r--src/testbed/gnunet_testbed_mpi_spawn.c16
-rw-r--r--src/testbed/test_getcwd.c2
-rw-r--r--src/testbed/test_testbed_api.c2
-rw-r--r--src/testbed/test_testbed_api_barriers.c18
-rw-r--r--src/testbed/test_testbed_api_hosts.c6
-rw-r--r--src/testbed/test_testbed_api_operations.c8
-rw-r--r--src/testbed/test_testbed_api_peer_reconfiguration.c10
-rw-r--r--src/testbed/test_testbed_api_peers_manage_services.c6
-rw-r--r--src/testbed/test_testbed_api_sd.c4
-rw-r--r--src/testbed/test_testbed_api_statistics.c10
-rw-r--r--src/testbed/test_testbed_api_testbed_run.c2
-rw-r--r--src/testbed/test_testbed_logger_api.c8
-rw-r--r--src/testbed/testbed.h10
-rw-r--r--src/testbed/testbed_api.c48
-rw-r--r--src/testbed/testbed_api.h4
-rw-r--r--src/testbed/testbed_api_barriers.c28
-rw-r--r--src/testbed/testbed_api_barriers.h2
-rw-r--r--src/testbed/testbed_api_hosts.c40
-rw-r--r--src/testbed/testbed_api_hosts.h4
-rw-r--r--src/testbed/testbed_api_operations.c50
-rw-r--r--src/testbed/testbed_api_peers.c16
-rw-r--r--src/testbed/testbed_api_peers.h6
-rw-r--r--src/testbed/testbed_api_sd.c2
-rw-r--r--src/testbed/testbed_api_sd.h2
-rw-r--r--src/testbed/testbed_api_statistics.c24
-rw-r--r--src/testbed/testbed_api_testbed.c22
-rw-r--r--src/testbed/testbed_api_topology.c16
-rw-r--r--src/testbed/testbed_logger_api.c12
-rw-r--r--src/testing/gnunet-testing.c12
-rw-r--r--src/testing/test_testing_peerstartup.c10
-rw-r--r--src/testing/test_testing_peerstartup2.c18
-rw-r--r--src/testing/test_testing_sharedservices.c8
-rw-r--r--src/testing/testing.c122
-rw-r--r--src/topology/gnunet-daemon-topology.c10
-rw-r--r--src/topology/test_gnunet_daemon_topology.c4
-rw-r--r--src/transport/gnunet-helper-transport-bluetooth.c440
-rw-r--r--src/transport/gnunet-helper-transport-wlan-dummy.c2
-rw-r--r--src/transport/gnunet-helper-transport-wlan.c146
-rw-r--r--src/transport/gnunet-service-transport.c2
-rw-r--r--src/transport/gnunet-service-transport_blacklist.c14
-rw-r--r--src/transport/gnunet-service-transport_clients.c2
-rw-r--r--src/transport/gnunet-service-transport_hello.c4
-rw-r--r--src/transport/gnunet-service-transport_manipulation.c34
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c150
-rw-r--r--src/transport/gnunet-service-transport_validation.c6
-rw-r--r--src/transport/gnunet-transport-certificate-creation.c8
-rw-r--r--src/transport/gnunet-transport-wlan-receiver.c8
-rw-r--r--src/transport/gnunet-transport-wlan-sender.c18
-rw-r--r--src/transport/gnunet-transport.c8
-rw-r--r--src/transport/plugin_transport_bluetooth.c106
-rw-r--r--src/transport/plugin_transport_http.c4
-rw-r--r--src/transport/plugin_transport_http_client.c26
-rw-r--r--src/transport/plugin_transport_http_server.c14
-rw-r--r--src/transport/plugin_transport_tcp.c102
-rw-r--r--src/transport/plugin_transport_template.c2
-rw-r--r--src/transport/plugin_transport_udp.c84
-rw-r--r--src/transport/plugin_transport_unix.c92
-rw-r--r--src/transport/plugin_transport_wlan.c102
-rw-r--r--src/transport/plugin_transport_wlan.h2
-rw-r--r--src/transport/test_plugin_transport.c2
-rw-r--r--src/transport/test_transport_api_limited_sockets.c2
-rw-r--r--src/transport/test_transport_api_timeout.c4
-rw-r--r--src/transport/transport_api.c8
-rw-r--r--src/transport/transport_api_address_lookup.c8
-rw-r--r--src/tun/regex.c10
-rw-r--r--src/tun/test_tun.c2
-rw-r--r--src/tun/tun.c22
-rw-r--r--src/util/bandwidth.c8
-rw-r--r--src/util/bio.c28
-rw-r--r--src/util/client.c36
-rw-r--r--src/util/common_allocation.c6
-rw-r--r--src/util/common_endian.c10
-rw-r--r--src/util/common_logging.c28
-rw-r--r--src/util/configuration.c30
-rw-r--r--src/util/connection.c18
-rw-r--r--src/util/container_bloomfilter.c4
-rw-r--r--src/util/container_meta_data.c2
-rw-r--r--src/util/container_multihashmap.c36
-rw-r--r--src/util/container_multihashmap32.c4
-rw-r--r--src/util/container_multipeermap.c36
-rw-r--r--src/util/crypto_ecc.c58
-rw-r--r--src/util/crypto_hash.c8
-rw-r--r--src/util/crypto_random.c8
-rw-r--r--src/util/crypto_symmetric.c34
-rw-r--r--src/util/disk.c20
-rw-r--r--src/util/gnunet-config.c8
-rw-r--r--src/util/gnunet-ecc.c6
-rw-r--r--src/util/gnunet-resolver.c6
-rw-r--r--src/util/gnunet-service-resolver.c22
-rw-r--r--src/util/gnunet-uri.c6
-rw-r--r--src/util/helper.c60
-rw-r--r--src/util/mq.c16
-rw-r--r--src/util/network.c22
-rw-r--r--src/util/os_installation.c26
-rw-r--r--src/util/os_network.c2
-rw-r--r--src/util/os_priority.c30
-rw-r--r--src/util/peer.c2
-rw-r--r--src/util/perf_malloc.c2
-rw-r--r--src/util/resolver_api.c4
-rw-r--r--src/util/scheduler.c22
-rw-r--r--src/util/server.c16
-rw-r--r--src/util/server_nc.c2
-rw-r--r--src/util/service.c34
-rw-r--r--src/util/speedup.c8
-rw-r--r--src/util/strings.c46
-rw-r--r--src/util/test_common_logging_runtime_loglevels.c2
-rw-r--r--src/util/test_configuration.c6
-rw-r--r--src/util/test_crypto_ecc.c6
-rw-r--r--src/util/test_crypto_symmetric.c6
-rw-r--r--src/util/test_mq.c2
-rw-r--r--src/util/test_os_start_process.c8
-rw-r--r--src/util/test_peer.c2
-rw-r--r--src/util/test_plugin.c2
-rw-r--r--src/util/test_resolver_api.c8
-rw-r--r--src/util/test_scheduler_delay.c2
-rw-r--r--src/util/test_server_mst_interrupt.c4
-rw-r--r--src/util/test_service.c4
-rw-r--r--src/util/test_speedup.c20
-rw-r--r--src/util/test_strings.c2
-rw-r--r--src/util/test_strings_to_data.c4
-rw-r--r--src/util/time.c6
-rw-r--r--src/util/win.c8
-rw-r--r--src/vpn/gnunet-helper-vpn-windows.c234
-rw-r--r--src/vpn/gnunet-helper-vpn.c2
-rw-r--r--src/vpn/gnunet-service-vpn.c258
-rw-r--r--src/vpn/gnunet-vpn.c10
-rw-r--r--src/vpn/vpn.h12
-rw-r--r--src/vpn/vpn_api.c34
524 files changed, 6539 insertions, 6539 deletions
diff --git a/src/arm/arm.h b/src/arm/arm.h
index aad16fd71..7010a0842 100644
--- a/src/arm/arm.h
+++ b/src/arm/arm.h
@@ -42,10 +42,10 @@ struct GNUNET_ARM_StatusMessage
42{ 42{
43 43
44 /** 44 /**
45 * Reply to client, of type is GNUNET_MESSAGE_TYPE_ARM_STATUS. 45 * Reply to client, of type is GNUNET_MESSAGE_TYPE_ARM_STATUS.
46 */ 46 */
47 struct GNUNET_MessageHeader header; 47 struct GNUNET_MessageHeader header;
48 48
49 /** 49 /**
50 * Status from the 'enum GNUNET_ARM_ServiceStatus' 50 * Status from the 'enum GNUNET_ARM_ServiceStatus'
51 */ 51 */
@@ -58,12 +58,12 @@ struct GNUNET_ARM_Message
58{ 58{
59 /** 59 /**
60 * Reply to client, type is GNUNET_MESSAGE_TYPE_ARM_RESULT or 60 * Reply to client, type is GNUNET_MESSAGE_TYPE_ARM_RESULT or
61 * GNUNET_MESSAGE_TYPE_ARM_LIST_RESULT. 61 * GNUNET_MESSAGE_TYPE_ARM_LIST_RESULT.
62 * OR 62 * OR
63 * Request from client, type is GNUNET_MESSAGE_TYPE_ARM_REQUEST 63 * Request from client, type is GNUNET_MESSAGE_TYPE_ARM_REQUEST
64 */ 64 */
65 struct GNUNET_MessageHeader header; 65 struct GNUNET_MessageHeader header;
66 66
67 /** 67 /**
68 * ID of a request that is being replied to. 68 * ID of a request that is being replied to.
69 * OR 69 * OR
@@ -85,7 +85,7 @@ struct GNUNET_ARM_ResultMessage
85 * Reply to client, of type is GNUNET_MESSAGE_TYPE_ARM_RESULT, with an ID. 85 * Reply to client, of type is GNUNET_MESSAGE_TYPE_ARM_RESULT, with an ID.
86 */ 86 */
87 struct GNUNET_ARM_Message arm_msg; 87 struct GNUNET_ARM_Message arm_msg;
88 88
89 /** 89 /**
90 * Result from the 'enum GNUNET_ARM_Result' 90 * Result from the 'enum GNUNET_ARM_Result'
91 */ 91 */
@@ -93,8 +93,8 @@ struct GNUNET_ARM_ResultMessage
93}; 93};
94 94
95/** 95/**
96 * Reply from ARM to client for the 96 * Reply from ARM to client for the
97 * GNUNET_MESSAGE_TYPE_ARM_LIST request followed by count 97 * GNUNET_MESSAGE_TYPE_ARM_LIST request followed by count
98 * '\0' terminated strings. header->size contains the 98 * '\0' terminated strings. header->size contains the
99 * total size (including all strings). 99 * total size (including all strings).
100 */ 100 */
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c
index f844551e4..6dfe65702 100644
--- a/src/arm/arm_api.c
+++ b/src/arm/arm_api.c
@@ -243,7 +243,7 @@ reconnect_arm_later (struct GNUNET_ARM_Handle *h)
243 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task); 243 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task);
244 h->reconnect_task = 244 h->reconnect_task =
245 GNUNET_SCHEDULER_add_delayed (h->retry_backoff, &reconnect_arm_task, h); 245 GNUNET_SCHEDULER_add_delayed (h->retry_backoff, &reconnect_arm_task, h);
246 /* Don't clear pending messages on disconnection, deliver them later 246 /* Don't clear pending messages on disconnection, deliver them later
247 clear_pending_messages (h, GNUNET_ARM_REQUEST_DISCONNECTED); 247 clear_pending_messages (h, GNUNET_ARM_REQUEST_DISCONNECTED);
248 GNUNET_assert (NULL == h->control_pending_head); 248 GNUNET_assert (NULL == h->control_pending_head);
249 */ 249 */
@@ -285,7 +285,7 @@ arm_termination_handler (void *cls, const struct GNUNET_MessageHeader *msg)
285 285
286 if (NULL != msg) 286 if (NULL != msg)
287 { 287 {
288 GNUNET_break (0); 288 GNUNET_break (0);
289 GNUNET_CLIENT_receive (h->client, &arm_termination_handler, h, 289 GNUNET_CLIENT_receive (h->client, &arm_termination_handler, h,
290 GNUNET_TIME_UNIT_FOREVER_REL); 290 GNUNET_TIME_UNIT_FOREVER_REL);
291 return; 291 return;
@@ -296,10 +296,10 @@ arm_termination_handler (void *cls, const struct GNUNET_MessageHeader *msg)
296 GNUNET_CLIENT_disconnect (h->client); 296 GNUNET_CLIENT_disconnect (h->client);
297 h->client = NULL; 297 h->client = NULL;
298 if (NULL != cm->result_cont) 298 if (NULL != cm->result_cont)
299 cm->result_cont (cm->cont_cls, 299 cm->result_cont (cm->cont_cls,
300 GNUNET_ARM_REQUEST_SENT_OK, 300 GNUNET_ARM_REQUEST_SENT_OK,
301 (const char *) &cm->msg[1], 301 (const char *) &cm->msg[1],
302 GNUNET_ARM_RESULT_STOPPED); 302 GNUNET_ARM_RESULT_STOPPED);
303 GNUNET_free (cm->msg); 303 GNUNET_free (cm->msg);
304 GNUNET_free (cm); 304 GNUNET_free (cm);
305} 305}
@@ -354,7 +354,7 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
354 { 354 {
355 LOG (GNUNET_ERROR_TYPE_DEBUG, "Message with unknown id %llu\n", id); 355 LOG (GNUNET_ERROR_TYPE_DEBUG, "Message with unknown id %llu\n", id);
356 return; 356 return;
357 } 357 }
358 fail = GNUNET_NO; 358 fail = GNUNET_NO;
359 switch (ntohs (msg->type)) 359 switch (ntohs (msg->type))
360 { 360 {
@@ -377,7 +377,7 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
377 rcount = ntohs (lres->count); 377 rcount = ntohs (lres->count);
378 { 378 {
379 unsigned int i; 379 unsigned int i;
380 380
381 list = GNUNET_malloc (sizeof (const char *) * rcount); 381 list = GNUNET_malloc (sizeof (const char *) * rcount);
382 pos = (const char *)&lres[1]; 382 pos = (const char *)&lres[1];
383 for (i = 0; i < rcount; i++) 383 for (i = 0; i < rcount; i++)
@@ -429,9 +429,9 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
429 if (NULL != h->thm) 429 if (NULL != h->thm)
430 { 430 {
431 GNUNET_break (0); 431 GNUNET_break (0);
432 cm->result_cont (h->thm->cont_cls, 432 cm->result_cont (h->thm->cont_cls,
433 GNUNET_ARM_REQUEST_SENT_OK, 433 GNUNET_ARM_REQUEST_SENT_OK,
434 (const char *) &h->thm->msg[1], 434 (const char *) &h->thm->msg[1],
435 GNUNET_ARM_RESULT_IS_NOT_KNOWN); 435 GNUNET_ARM_RESULT_IS_NOT_KNOWN);
436 GNUNET_free (h->thm->msg); 436 GNUNET_free (h->thm->msg);
437 GNUNET_free (h->thm); 437 GNUNET_free (h->thm);
@@ -440,12 +440,12 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
440 GNUNET_CLIENT_receive (h->client, &arm_termination_handler, h, 440 GNUNET_CLIENT_receive (h->client, &arm_termination_handler, h,
441 GNUNET_TIME_UNIT_FOREVER_REL); 441 GNUNET_TIME_UNIT_FOREVER_REL);
442 return; 442 return;
443 } 443 }
444 GNUNET_CLIENT_receive (h->client, &client_notify_handler, h, 444 GNUNET_CLIENT_receive (h->client, &client_notify_handler, h,
445 GNUNET_TIME_UNIT_FOREVER_REL); 445 GNUNET_TIME_UNIT_FOREVER_REL);
446 switch (ntohs (msg->type)) 446 switch (ntohs (msg->type))
447 { 447 {
448 case GNUNET_MESSAGE_TYPE_ARM_RESULT: 448 case GNUNET_MESSAGE_TYPE_ARM_RESULT:
449 res = (const struct GNUNET_ARM_ResultMessage *) msg; 449 res = (const struct GNUNET_ARM_ResultMessage *) msg;
450 LOG (GNUNET_ERROR_TYPE_DEBUG, 450 LOG (GNUNET_ERROR_TYPE_DEBUG,
451 "Received response from ARM for service `%s': %u\n", 451 "Received response from ARM for service `%s': %u\n",
@@ -461,7 +461,7 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
461 list); 461 list);
462 GNUNET_free (list); 462 GNUNET_free (list);
463 break; 463 break;
464 } 464 }
465 GNUNET_free (cm->msg); 465 GNUNET_free (cm->msg);
466 GNUNET_free (cm); 466 GNUNET_free (cm);
467} 467}
@@ -473,7 +473,7 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
473 * @param cls closure with the 'struct GNUNET_ARM_Handle' 473 * @param cls closure with the 'struct GNUNET_ARM_Handle'
474 * @param size number of bytes available in buf 474 * @param size number of bytes available in buf
475 * @param buf where the callee should write the message 475 * @param buf where the callee should write the message
476 * @return number of bytes written to buf 476 * @return number of bytes written to buf
477 */ 477 */
478static size_t 478static size_t
479transmit_arm_message (void *cls, size_t size, void *buf) 479transmit_arm_message (void *cls, size_t size, void *buf)
@@ -490,7 +490,7 @@ transmit_arm_message (void *cls, size_t size, void *buf)
490 "transmit_arm_message is running with %p buffer of size %lu. ARM is known to be %s\n", 490 "transmit_arm_message is running with %p buffer of size %lu. ARM is known to be %s\n",
491 buf, size, h->currently_down ? "unconnected" : "connected"); 491 buf, size, h->currently_down ? "unconnected" : "connected");
492 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task); 492 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task);
493 h->cth = NULL; 493 h->cth = NULL;
494 if ((GNUNET_YES == h->currently_down) && (NULL != buf)) 494 if ((GNUNET_YES == h->currently_down) && (NULL != buf))
495 { 495 {
496 h->currently_down = GNUNET_NO; 496 h->currently_down = GNUNET_NO;
@@ -658,14 +658,14 @@ void
658GNUNET_ARM_disconnect_and_free (struct GNUNET_ARM_Handle *h) 658GNUNET_ARM_disconnect_and_free (struct GNUNET_ARM_Handle *h)
659{ 659{
660 struct ARMControlMessage *cm; 660 struct ARMControlMessage *cm;
661 661
662 LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from ARM service\n"); 662 LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from ARM service\n");
663 if (NULL != h->cth) 663 if (NULL != h->cth)
664 { 664 {
665 GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth); 665 GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth);
666 h->cth = NULL; 666 h->cth = NULL;
667 } 667 }
668 while ((NULL != (cm = h->control_pending_head)) 668 while ((NULL != (cm = h->control_pending_head))
669 || (NULL != (cm = h->control_sent_head)) ) 669 || (NULL != (cm = h->control_sent_head)) )
670 { 670 {
671 if (NULL != h->control_pending_head) 671 if (NULL != h->control_pending_head)
@@ -764,13 +764,13 @@ arm_service_report (void *cls,
764 if ((GNUNET_YES == test_is_active) && 764 if ((GNUNET_YES == test_is_active) &&
765 (GNUNET_YES == result)) 765 (GNUNET_YES == result))
766 { 766 {
767 LOG (GNUNET_ERROR_TYPE_DEBUG, 767 LOG (GNUNET_ERROR_TYPE_DEBUG,
768 "Looks like `%s' is already running.\n", 768 "Looks like `%s' is already running.\n",
769 "gnunet-service-arm"); 769 "gnunet-service-arm");
770 /* arm is running! */ 770 /* arm is running! */
771 if (cm->result_cont) 771 if (cm->result_cont)
772 cm->result_cont (cm->cont_cls, 772 cm->result_cont (cm->cont_cls,
773 GNUNET_ARM_REQUEST_SENT_OK, "arm", 773 GNUNET_ARM_REQUEST_SENT_OK, "arm",
774 GNUNET_ARM_RESULT_IS_STARTED_ALREADY); 774 GNUNET_ARM_RESULT_IS_STARTED_ALREADY);
775 } 775 }
776 if (GNUNET_NO == test_is_active) 776 if (GNUNET_NO == test_is_active)
@@ -802,8 +802,8 @@ arm_service_report (void *cls,
802 { 802 {
803 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, "arm", "BINARY"); 803 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, "arm", "BINARY");
804 if (cm->result_cont) 804 if (cm->result_cont)
805 cm->result_cont (cm->cont_cls, 805 cm->result_cont (cm->cont_cls,
806 GNUNET_ARM_REQUEST_SENT_OK, "arm", 806 GNUNET_ARM_REQUEST_SENT_OK, "arm",
807 GNUNET_ARM_RESULT_IS_NOT_KNOWN); 807 GNUNET_ARM_RESULT_IS_NOT_KNOWN);
808 GNUNET_free (cm); 808 GNUNET_free (cm);
809 GNUNET_free (loprefix); 809 GNUNET_free (loprefix);
@@ -935,9 +935,9 @@ change_service (struct GNUNET_ARM_Handle *h, const char *service_name,
935 */ 935 */
936void 936void
937GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, 937GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h,
938 const char *service_name, 938 const char *service_name,
939 enum GNUNET_OS_InheritStdioFlags std_inheritance, 939 enum GNUNET_OS_InheritStdioFlags std_inheritance,
940 struct GNUNET_TIME_Relative timeout, 940 struct GNUNET_TIME_Relative timeout,
941 GNUNET_ARM_ResultCallback cont, 941 GNUNET_ARM_ResultCallback cont,
942 void *cont_cls) 942 void *cont_cls)
943{ 943{
@@ -1026,14 +1026,14 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h,
1026 */ 1026 */
1027void 1027void
1028GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h, 1028GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h,
1029 const char *service_name, 1029 const char *service_name,
1030 struct GNUNET_TIME_Relative timeout, 1030 struct GNUNET_TIME_Relative timeout,
1031 GNUNET_ARM_ResultCallback cont, 1031 GNUNET_ARM_ResultCallback cont,
1032 void *cont_cls) 1032 void *cont_cls)
1033{ 1033{
1034 LOG (GNUNET_ERROR_TYPE_DEBUG, 1034 LOG (GNUNET_ERROR_TYPE_DEBUG,
1035 "Stopping service `%s' within %s\n", 1035 "Stopping service `%s' within %s\n",
1036 service_name, 1036 service_name,
1037 GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_NO)); 1037 GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_NO));
1038 change_service (h, service_name, timeout, cont, cont_cls, 1038 change_service (h, service_name, timeout, cont, cont_cls,
1039 GNUNET_MESSAGE_TYPE_ARM_STOP); 1039 GNUNET_MESSAGE_TYPE_ARM_STOP);
@@ -1051,14 +1051,14 @@ GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h,
1051void 1051void
1052GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h, 1052GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h,
1053 struct GNUNET_TIME_Relative timeout, 1053 struct GNUNET_TIME_Relative timeout,
1054 GNUNET_ARM_ServiceListCallback cont, 1054 GNUNET_ARM_ServiceListCallback cont,
1055 void *cont_cls) 1055 void *cont_cls)
1056{ 1056{
1057 struct ARMControlMessage *cm; 1057 struct ARMControlMessage *cm;
1058 struct GNUNET_ARM_Message *msg; 1058 struct GNUNET_ARM_Message *msg;
1059 1059
1060 LOG (GNUNET_ERROR_TYPE_DEBUG, 1060 LOG (GNUNET_ERROR_TYPE_DEBUG,
1061 "Requesting LIST from ARM service with timeout: %s\n", 1061 "Requesting LIST from ARM service with timeout: %s\n",
1062 GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_YES)); 1062 GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_YES));
1063 cm = GNUNET_malloc (sizeof (struct ARMControlMessage)); 1063 cm = GNUNET_malloc (sizeof (struct ARMControlMessage));
1064 cm->h = h; 1064 cm->h = h;
diff --git a/src/arm/arm_monitor_api.c b/src/arm/arm_monitor_api.c
index f8d41e790..7b403fde8 100644
--- a/src/arm/arm_monitor_api.c
+++ b/src/arm/arm_monitor_api.c
@@ -167,7 +167,7 @@ init_timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
167 * @param cls closure with the 'struct GNUNET_ARM_MonitorHandle' 167 * @param cls closure with the 'struct GNUNET_ARM_MonitorHandle'
168 * @param size number of bytes available in buf 168 * @param size number of bytes available in buf
169 * @param buf where the callee should write the message 169 * @param buf where the callee should write the message
170 * @return number of bytes written to buf 170 * @return number of bytes written to buf
171 */ 171 */
172static size_t 172static size_t
173transmit_monitoring_init_message (void *cls, size_t size, void *buf) 173transmit_monitoring_init_message (void *cls, size_t size, void *buf)
diff --git a/src/arm/do_start_process.c b/src/arm/do_start_process.c
index 95ec74405..d8ee1f0c3 100644
--- a/src/arm/do_start_process.c
+++ b/src/arm/do_start_process.c
@@ -122,7 +122,7 @@ do_start_process (int pipe_control, unsigned int std_inheritance,
122 va_end (ap); 122 va_end (ap);
123 argv[argv_size] = NULL; 123 argv[argv_size] = NULL;
124 binary_path = argv[0]; 124 binary_path = argv[0];
125 proc = GNUNET_OS_start_process_v (pipe_control, std_inheritance, lsocks, 125 proc = GNUNET_OS_start_process_v (pipe_control, std_inheritance, lsocks,
126 binary_path, argv); 126 binary_path, argv);
127 while (argv_size > 0) 127 while (argv_size > 0)
128 GNUNET_free (argv[--argv_size]); 128 GNUNET_free (argv[--argv_size]);
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c
index 85cb1f45d..80d3e9c03 100644
--- a/src/arm/gnunet-arm.c
+++ b/src/arm/gnunet-arm.c
@@ -167,7 +167,7 @@ delete_files ()
167 { 167 {
168 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 168 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
169 _("Failed to remove servicehome directory %s\n"), dir); 169 _("Failed to remove servicehome directory %s\n"), dir);
170 170
171 } 171 }
172} 172}
173 173
@@ -269,7 +269,7 @@ ret_string (enum GNUNET_ARM_Result result)
269 * @param cls closure 269 * @param cls closure
270 * @param tc scheudler context 270 * @param tc scheudler context
271 */ 271 */
272static void 272static void
273action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); 273action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
274 274
275 275
@@ -283,11 +283,11 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
283 * GNUNET_SYSERR on error. 283 * GNUNET_SYSERR on error.
284 */ 284 */
285static void 285static void
286conn_status (void *cls, 286conn_status (void *cls,
287 int connected) 287 int connected)
288{ 288{
289 static int once; 289 static int once;
290 290
291 if ( (GNUNET_SYSERR == connected) && 291 if ( (GNUNET_SYSERR == connected) &&
292 (0 == once) ) 292 (0 == once) )
293 { 293 {
@@ -335,7 +335,7 @@ start_callback (void *cls,
335 GNUNET_free (msg); 335 GNUNET_free (msg);
336 GNUNET_SCHEDULER_shutdown (); 336 GNUNET_SCHEDULER_shutdown ();
337 return; 337 return;
338 } 338 }
339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ARM service [re]start successful\n"); 339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ARM service [re]start successful\n");
340 start = 0; 340 start = 0;
341 GNUNET_SCHEDULER_add_now (action_loop, NULL); 341 GNUNET_SCHEDULER_add_now (action_loop, NULL);
@@ -355,7 +355,7 @@ start_callback (void *cls,
355 * according to ARM 355 * according to ARM
356 */ 356 */
357static void 357static void
358stop_callback (void *cls, 358stop_callback (void *cls,
359 enum GNUNET_ARM_RequestStatus rs, const char *service, 359 enum GNUNET_ARM_RequestStatus rs, const char *service,
360 enum GNUNET_ARM_Result result) 360 enum GNUNET_ARM_Result result)
361{ 361{
@@ -363,7 +363,7 @@ stop_callback (void *cls,
363 363
364 if (GNUNET_ARM_REQUEST_SENT_OK != rs) 364 if (GNUNET_ARM_REQUEST_SENT_OK != rs)
365 { 365 {
366 GNUNET_asprintf (&msg, "%s", 366 GNUNET_asprintf (&msg, "%s",
367 _("Failed to send a stop request to the ARM service: %s\n")); 367 _("Failed to send a stop request to the ARM service: %s\n"));
368 FPRINTF (stdout, msg, req_string (rs)); 368 FPRINTF (stdout, msg, req_string (rs));
369 GNUNET_free (msg); 369 GNUNET_free (msg);
@@ -380,14 +380,14 @@ stop_callback (void *cls,
380 GNUNET_SCHEDULER_shutdown (); 380 GNUNET_SCHEDULER_shutdown ();
381 return; 381 return;
382 } 382 }
383 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 383 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
384 "ARM service shutdown successful\n"); 384 "ARM service shutdown successful\n");
385 end = 0; 385 end = 0;
386 if (restart) 386 if (restart)
387 { 387 {
388 restart = 0; 388 restart = 0;
389 start = 1; 389 start = 1;
390 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 390 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
391 "Initiating an ARM restart\n"); 391 "Initiating an ARM restart\n");
392 } 392 }
393 GNUNET_SCHEDULER_add_now (&action_loop, NULL); 393 GNUNET_SCHEDULER_add_now (&action_loop, NULL);
@@ -407,12 +407,12 @@ stop_callback (void *cls,
407 * according to ARM 407 * according to ARM
408 */ 408 */
409static void 409static void
410init_callback (void *cls, 410init_callback (void *cls,
411 enum GNUNET_ARM_RequestStatus rs, const char *service, 411 enum GNUNET_ARM_RequestStatus rs, const char *service,
412 enum GNUNET_ARM_Result result) 412 enum GNUNET_ARM_Result result)
413{ 413{
414 char *msg; 414 char *msg;
415 415
416 if (GNUNET_ARM_REQUEST_SENT_OK != rs) 416 if (GNUNET_ARM_REQUEST_SENT_OK != rs)
417 { 417 {
418 GNUNET_asprintf (&msg, _("Failed to send a request to start the `%s' service: %%s\n"), init); 418 GNUNET_asprintf (&msg, _("Failed to send a request to start the `%s' service: %%s\n"), init);
@@ -431,8 +431,8 @@ init_callback (void *cls,
431 GNUNET_SCHEDULER_shutdown (); 431 GNUNET_SCHEDULER_shutdown ();
432 return; 432 return;
433 } 433 }
434 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 434 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
435 "Service %s [re]started successfully\n", 435 "Service %s [re]started successfully\n",
436 init); 436 init);
437 init = NULL; 437 init = NULL;
438 GNUNET_SCHEDULER_add_now (&action_loop, NULL); 438 GNUNET_SCHEDULER_add_now (&action_loop, NULL);
@@ -452,7 +452,7 @@ init_callback (void *cls,
452 * according to ARM 452 * according to ARM
453 */ 453 */
454static void 454static void
455term_callback (void *cls, 455term_callback (void *cls,
456 enum GNUNET_ARM_RequestStatus rs, const char *service, 456 enum GNUNET_ARM_RequestStatus rs, const char *service,
457 enum GNUNET_ARM_Result result) 457 enum GNUNET_ARM_Result result)
458{ 458{
@@ -470,7 +470,7 @@ term_callback (void *cls,
470 if ((GNUNET_ARM_RESULT_STOPPED != result) && 470 if ((GNUNET_ARM_RESULT_STOPPED != result) &&
471 (GNUNET_ARM_RESULT_IS_STOPPED_ALREADY != result)) 471 (GNUNET_ARM_RESULT_IS_STOPPED_ALREADY != result))
472 { 472 {
473 GNUNET_asprintf (&msg, 473 GNUNET_asprintf (&msg,
474 _("Failed to kill the `%s' service: %s\n"), 474 _("Failed to kill the `%s' service: %s\n"),
475 term, ret_string (result)); 475 term, ret_string (result));
476 FPRINTF (stdout, msg, service); 476 FPRINTF (stdout, msg, service);
@@ -479,7 +479,7 @@ term_callback (void *cls,
479 return; 479 return;
480 } 480 }
481 481
482 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 482 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
483 "Service %s stopped successfully\n", term); 483 "Service %s stopped successfully\n", term);
484 term = NULL; 484 term = NULL;
485 GNUNET_SCHEDULER_add_now (&action_loop, NULL); 485 GNUNET_SCHEDULER_add_now (&action_loop, NULL);
@@ -497,7 +497,7 @@ term_callback (void *cls,
497 * @param list list of services that are running 497 * @param list list of services that are running
498 */ 498 */
499static void 499static void
500list_callback (void *cls, 500list_callback (void *cls,
501 enum GNUNET_ARM_RequestStatus rs, unsigned int count, 501 enum GNUNET_ARM_RequestStatus rs, unsigned int count,
502 const char *const*list) 502 const char *const*list)
503{ 503{
@@ -546,7 +546,7 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
546 if (NULL != term) 546 if (NULL != term)
547 { 547 {
548 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Termination action\n"); 548 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Termination action\n");
549 GNUNET_ARM_request_service_stop (h, term, 549 GNUNET_ARM_request_service_stop (h, term,
550 (0 == timeout.rel_value_us) ? STOP_TIMEOUT : timeout, 550 (0 == timeout.rel_value_us) ? STOP_TIMEOUT : timeout,
551 &term_callback, NULL); 551 &term_callback, NULL);
552 return; 552 return;
@@ -556,7 +556,7 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
556 if (end || restart) 556 if (end || restart)
557 { 557 {
558 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "End action\n"); 558 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "End action\n");
559 GNUNET_ARM_request_service_stop (h, "arm", 559 GNUNET_ARM_request_service_stop (h, "arm",
560 (0 == timeout.rel_value_us) ? STOP_TIMEOUT_ARM : timeout, 560 (0 == timeout.rel_value_us) ? STOP_TIMEOUT_ARM : timeout,
561 &stop_callback, NULL); 561 &stop_callback, NULL);
562 return; 562 return;
@@ -585,7 +585,7 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
585 } 585 }
586 break; 586 break;
587 case 4: 587 case 4:
588 if (list) 588 if (list)
589 { 589 {
590 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 590 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
591 "Going to list all running services controlled by ARM.\n"); 591 "Going to list all running services controlled by ARM.\n");
@@ -593,10 +593,10 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
593 (0 == timeout.rel_value_us) ? LIST_TIMEOUT : timeout, 593 (0 == timeout.rel_value_us) ? LIST_TIMEOUT : timeout,
594 &list_callback, &list); 594 &list_callback, &list);
595 return; 595 return;
596 } 596 }
597 break; 597 break;
598 case 5: 598 case 5:
599 if (monitor) 599 if (monitor)
600 { 600 {
601 if (! quiet) 601 if (! quiet)
602 fprintf (stderr, 602 fprintf (stderr,
@@ -621,7 +621,7 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
621 * @param status status of the service 621 * @param status status of the service
622 */ 622 */
623static void 623static void
624srv_status (void *cls, 624srv_status (void *cls,
625 const char *service, enum GNUNET_ARM_ServiceStatus status) 625 const char *service, enum GNUNET_ARM_ServiceStatus status)
626{ 626{
627 const char *msg; 627 const char *msg;
@@ -663,8 +663,8 @@ srv_status (void *cls,
663 * @param c configuration 663 * @param c configuration
664 */ 664 */
665static void 665static void
666run (void *cls, 666run (void *cls,
667 char *const *args, 667 char *const *args,
668 const char *cfgfile, 668 const char *cfgfile,
669 const struct GNUNET_CONFIGURATION_Handle *c) 669 const struct GNUNET_CONFIGURATION_Handle *c)
670{ 670{
@@ -672,7 +672,7 @@ run (void *cls,
672 672
673 cfg = GNUNET_CONFIGURATION_dup (c); 673 cfg = GNUNET_CONFIGURATION_dup (c);
674 config_file = cfgfile; 674 config_file = cfgfile;
675 if (GNUNET_OK != 675 if (GNUNET_OK !=
676 GNUNET_CONFIGURATION_get_value_string (cfg, "PATHS", "SERVICEHOME", &dir)) 676 GNUNET_CONFIGURATION_get_value_string (cfg, "PATHS", "SERVICEHOME", &dir))
677 { 677 {
678 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, 678 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c
index 906f0adde..1196b20aa 100644
--- a/src/arm/gnunet-service-arm.c
+++ b/src/arm/gnunet-service-arm.c
@@ -259,7 +259,7 @@ write_result (void *cls, size_t size, void *buf)
259 return 0; /* error, not much we can do */ 259 return 0; /* error, not much we can do */
260 } 260 }
261 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 261 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
262 "Sending status response %u to client\n", 262 "Sending status response %u to client\n",
263 (unsigned int) msg->result); 263 (unsigned int) msg->result);
264 msize = msg->arm_msg.header.size; 264 msize = msg->arm_msg.header.size;
265 GNUNET_assert (size >= msize); 265 GNUNET_assert (size >= msize);
@@ -275,7 +275,7 @@ write_result (void *cls, size_t size, void *buf)
275 275
276/** 276/**
277 * Transmit the list of running services. 277 * Transmit the list of running services.
278 * 278 *
279 * @param cls pointer to `struct GNUNET_ARM_ListResultMessage` with the message 279 * @param cls pointer to `struct GNUNET_ARM_ListResultMessage` with the message
280 * @param size number of bytes available in @a buf 280 * @param size number of bytes available in @a buf
281 * @param buf where to copy the message, NULL on error 281 * @param buf where to copy the message, NULL on error
@@ -286,7 +286,7 @@ write_list_result (void *cls, size_t size, void *buf)
286{ 286{
287 struct GNUNET_ARM_ListResultMessage *msg = cls; 287 struct GNUNET_ARM_ListResultMessage *msg = cls;
288 size_t rslt_size; 288 size_t rslt_size;
289 289
290 if (buf == NULL) 290 if (buf == NULL)
291 { 291 {
292 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 292 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -294,14 +294,14 @@ write_list_result (void *cls, size_t size, void *buf)
294 GNUNET_free (msg); 294 GNUNET_free (msg);
295 return 0; /* error, not much we can do */ 295 return 0; /* error, not much we can do */
296 } 296 }
297 297
298 rslt_size = msg->arm_msg.header.size; 298 rslt_size = msg->arm_msg.header.size;
299 GNUNET_assert (size >= rslt_size); 299 GNUNET_assert (size >= rslt_size);
300 msg->arm_msg.header.size = htons (msg->arm_msg.header.size); 300 msg->arm_msg.header.size = htons (msg->arm_msg.header.size);
301 msg->arm_msg.header.type = htons (msg->arm_msg.header.type); 301 msg->arm_msg.header.type = htons (msg->arm_msg.header.type);
302 msg->arm_msg.request_id = GNUNET_htonll (msg->arm_msg.request_id); 302 msg->arm_msg.request_id = GNUNET_htonll (msg->arm_msg.request_id);
303 msg->count = htons (msg->count); 303 msg->count = htons (msg->count);
304 304
305 memcpy (buf, msg, rslt_size); 305 memcpy (buf, msg, rslt_size);
306 GNUNET_free (msg); 306 GNUNET_free (msg);
307 return rslt_size; 307 return rslt_size;
@@ -319,7 +319,7 @@ write_list_result (void *cls, size_t size, void *buf)
319 * @return NULL if it was not found 319 * @return NULL if it was not found
320 */ 320 */
321static void 321static void
322signal_result (struct GNUNET_SERVER_Client *client, 322signal_result (struct GNUNET_SERVER_Client *client,
323 const char *name, 323 const char *name,
324 uint64_t request_id, 324 uint64_t request_id,
325 enum GNUNET_ARM_Result result) 325 enum GNUNET_ARM_Result result)
@@ -335,7 +335,7 @@ signal_result (struct GNUNET_SERVER_Client *client,
335 msg->arm_msg.request_id = request_id; 335 msg->arm_msg.request_id = request_id;
336 336
337 GNUNET_SERVER_notify_transmit_ready (client, msize, 337 GNUNET_SERVER_notify_transmit_ready (client, msize,
338 GNUNET_TIME_UNIT_FOREVER_REL, 338 GNUNET_TIME_UNIT_FOREVER_REL,
339 write_result, msg); 339 write_result, msg);
340} 340}
341 341
@@ -492,7 +492,7 @@ start_process (struct ServiceList *sl, struct GNUNET_SERVER_Client *client, uint
492 if (NULL == sl->config) 492 if (NULL == sl->config)
493 sl->proc = 493 sl->proc =
494 do_start_process (sl->pipe_control, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 494 do_start_process (sl->pipe_control, GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
495 lsocks, loprefix, binary, 495 lsocks, loprefix, binary,
496 options, NULL); 496 options, NULL);
497 else 497 else
498 sl->proc = 498 sl->proc =
@@ -693,7 +693,7 @@ handle_start (void *cls, struct GNUNET_SERVER_Client *client,
693 uint64_t request_id; 693 uint64_t request_id;
694 struct GNUNET_ARM_Message *amsg; 694 struct GNUNET_ARM_Message *amsg;
695 695
696 amsg = (struct GNUNET_ARM_Message *) message; 696 amsg = (struct GNUNET_ARM_Message *) message;
697 request_id = GNUNET_ntohll (amsg->request_id); 697 request_id = GNUNET_ntohll (amsg->request_id);
698 size = ntohs (amsg->header.size); 698 size = ntohs (amsg->header.size);
699 size -= sizeof (struct GNUNET_ARM_Message); 699 size -= sizeof (struct GNUNET_ARM_Message);
@@ -762,7 +762,7 @@ handle_stop (void *cls, struct GNUNET_SERVER_Client *client,
762 uint64_t request_id; 762 uint64_t request_id;
763 struct GNUNET_ARM_Message *amsg; 763 struct GNUNET_ARM_Message *amsg;
764 764
765 amsg = (struct GNUNET_ARM_Message *) message; 765 amsg = (struct GNUNET_ARM_Message *) message;
766 request_id = GNUNET_ntohll (amsg->request_id); 766 request_id = GNUNET_ntohll (amsg->request_id);
767 size = ntohs (amsg->header.size); 767 size = ntohs (amsg->header.size);
768 size -= sizeof (struct GNUNET_ARM_Message); 768 size -= sizeof (struct GNUNET_ARM_Message);
@@ -847,10 +847,10 @@ handle_list (void *cls, struct GNUNET_SERVER_Client *client,
847 size_t total_size; 847 size_t total_size;
848 struct ServiceList *sl; 848 struct ServiceList *sl;
849 uint16_t count; 849 uint16_t count;
850 850
851 if (NULL == client) 851 if (NULL == client)
852 return; 852 return;
853 853
854 request = (struct GNUNET_ARM_Message *) message; 854 request = (struct GNUNET_ARM_Message *) message;
855 count = 0; 855 count = 0;
856 string_list_size = 0; 856 string_list_size = 0;
@@ -866,16 +866,16 @@ handle_list (void *cls, struct GNUNET_SERVER_Client *client,
866 } 866 }
867 } 867 }
868 868
869 total_size = sizeof (struct GNUNET_ARM_ListResultMessage) 869 total_size = sizeof (struct GNUNET_ARM_ListResultMessage)
870 + string_list_size; 870 + string_list_size;
871 msg = GNUNET_malloc (total_size); 871 msg = GNUNET_malloc (total_size);
872 msg->arm_msg.header.size = total_size; 872 msg->arm_msg.header.size = total_size;
873 msg->arm_msg.header.type = GNUNET_MESSAGE_TYPE_ARM_LIST_RESULT; 873 msg->arm_msg.header.type = GNUNET_MESSAGE_TYPE_ARM_LIST_RESULT;
874 msg->arm_msg.request_id = GNUNET_ntohll (request->request_id); 874 msg->arm_msg.request_id = GNUNET_ntohll (request->request_id);
875 msg->count = count; 875 msg->count = count;
876 876
877 char *pos = (char *)&msg[1]; 877 char *pos = (char *)&msg[1];
878 for (sl = running_head; sl != NULL; sl = sl->next) 878 for (sl = running_head; sl != NULL; sl = sl->next)
879 { 879 {
880 if (sl->proc != NULL) 880 if (sl->proc != NULL)
881 { 881 {
@@ -884,7 +884,7 @@ handle_list (void *cls, struct GNUNET_SERVER_Client *client,
884 pos += s; 884 pos += s;
885 } 885 }
886 } 886 }
887 887
888 GNUNET_SERVER_notify_transmit_ready (client, 888 GNUNET_SERVER_notify_transmit_ready (client,
889 total_size, 889 total_size,
890 GNUNET_TIME_UNIT_FOREVER_REL, 890 GNUNET_TIME_UNIT_FOREVER_REL,
@@ -926,7 +926,7 @@ list_count (struct ServiceList *running_head)
926 unsigned int res = 0; 926 unsigned int res = 0;
927 927
928 for (res = 0, i = running_head; i; i = i->next, res++) 928 for (res = 0, i = running_head; i; i = i->next, res++)
929 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 929 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
930 "%s\n", 930 "%s\n",
931 i->name); 931 i->name);
932 return res; 932 return res;
@@ -946,7 +946,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
946 struct ServiceList *nxt; 946 struct ServiceList *nxt;
947 struct ServiceListeningInfo *sli; 947 struct ServiceListeningInfo *sli;
948 948
949 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 949 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
950 "First shutdown phase\n"); 950 "First shutdown phase\n");
951 if (GNUNET_SCHEDULER_NO_TASK != child_restart_task) 951 if (GNUNET_SCHEDULER_NO_TASK != child_restart_task)
952 { 952 {
@@ -979,7 +979,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
979 nxt = pos->next; 979 nxt = pos->next;
980 if (pos->proc != NULL) 980 if (pos->proc != NULL)
981 { 981 {
982 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 982 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
983 "Stopping service `%s'\n", 983 "Stopping service `%s'\n",
984 pos->name); 984 pos->name);
985 pos->killed_at = GNUNET_TIME_absolute_get (); 985 pos->killed_at = GNUNET_TIME_absolute_get ();
@@ -996,7 +996,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
996 do_shutdown (); 996 do_shutdown ();
997 else 997 else
998 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 998 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
999 "Delaying shutdown, have %u childs still running\n", 999 "Delaying shutdown, have %u childs still running\n",
1000 list_count (running_head)); 1000 list_count (running_head));
1001} 1001}
1002 1002
@@ -1063,12 +1063,12 @@ delayed_restart_task (void *cls,
1063 } 1063 }
1064 if (lowestRestartDelay.rel_value_us != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) 1064 if (lowestRestartDelay.rel_value_us != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us)
1065 { 1065 {
1066 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1066 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1067 "Will restart process in %s\n", 1067 "Will restart process in %s\n",
1068 GNUNET_STRINGS_relative_time_to_string (lowestRestartDelay, GNUNET_YES)); 1068 GNUNET_STRINGS_relative_time_to_string (lowestRestartDelay, GNUNET_YES));
1069 child_restart_task = 1069 child_restart_task =
1070 GNUNET_SCHEDULER_add_delayed_with_priority (lowestRestartDelay, 1070 GNUNET_SCHEDULER_add_delayed_with_priority (lowestRestartDelay,
1071 GNUNET_SCHEDULER_PRIORITY_IDLE, 1071 GNUNET_SCHEDULER_PRIORITY_IDLE,
1072 &delayed_restart_task, NULL); 1072 &delayed_restart_task, NULL);
1073 } 1073 }
1074} 1074}
@@ -1275,7 +1275,7 @@ setup_service (void *cls, const char *section)
1275 { 1275 {
1276 if (NULL != config) 1276 if (NULL != config)
1277 { 1277 {
1278 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, 1278 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
1279 section, "CONFIG", 1279 section, "CONFIG",
1280 STRERROR (errno)); 1280 STRERROR (errno));
1281 GNUNET_free (config); 1281 GNUNET_free (config);
@@ -1293,7 +1293,7 @@ setup_service (void *cls, const char *section)
1293#else 1293#else
1294 if (GNUNET_CONFIGURATION_have_value (cfg, section, "PIPECONTROL")) 1294 if (GNUNET_CONFIGURATION_have_value (cfg, section, "PIPECONTROL"))
1295 sl->pipe_control = GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "PIPECONTROL"); 1295 sl->pipe_control = GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "PIPECONTROL");
1296#endif 1296#endif
1297 GNUNET_CONTAINER_DLL_insert (running_head, running_tail, sl); 1297 GNUNET_CONTAINER_DLL_insert (running_head, running_tail, sl);
1298 if (GNUNET_YES != 1298 if (GNUNET_YES !=
1299 GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "AUTOSTART")) 1299 GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "AUTOSTART"))
@@ -1363,9 +1363,9 @@ run (void *cls, struct GNUNET_SERVER_Handle *serv,
1363 static const struct GNUNET_SERVER_MessageHandler handlers[] = { 1363 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
1364 {&handle_start, NULL, GNUNET_MESSAGE_TYPE_ARM_START, 0}, 1364 {&handle_start, NULL, GNUNET_MESSAGE_TYPE_ARM_START, 0},
1365 {&handle_stop, NULL, GNUNET_MESSAGE_TYPE_ARM_STOP, 0}, 1365 {&handle_stop, NULL, GNUNET_MESSAGE_TYPE_ARM_STOP, 0},
1366 {&handle_monitor, NULL, GNUNET_MESSAGE_TYPE_ARM_MONITOR, 1366 {&handle_monitor, NULL, GNUNET_MESSAGE_TYPE_ARM_MONITOR,
1367 sizeof (struct GNUNET_MessageHeader)}, 1367 sizeof (struct GNUNET_MessageHeader)},
1368 {&handle_list, NULL, GNUNET_MESSAGE_TYPE_ARM_LIST, 1368 {&handle_list, NULL, GNUNET_MESSAGE_TYPE_ARM_LIST,
1369 sizeof (struct GNUNET_ARM_Message)}, 1369 sizeof (struct GNUNET_ARM_Message)},
1370 {NULL, NULL, 0, 0} 1370 {NULL, NULL, 0, 0}
1371 }; 1371 };
@@ -1456,7 +1456,7 @@ main (int argc, char *const *argv)
1456 GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); 1456 GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death);
1457 ret = 1457 ret =
1458 (GNUNET_OK == 1458 (GNUNET_OK ==
1459 GNUNET_SERVICE_run (argc, argv, "arm", 1459 GNUNET_SERVICE_run (argc, argv, "arm",
1460 GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN, &run, NULL)) ? 0 : 1; 1460 GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN, &run, NULL)) ? 0 : 1;
1461 GNUNET_SIGNAL_handler_uninstall (shc_chld); 1461 GNUNET_SIGNAL_handler_uninstall (shc_chld);
1462 shc_chld = NULL; 1462 shc_chld = NULL;
diff --git a/src/arm/test_arm_api.c b/src/arm/test_arm_api.c
index a36d5939b..cdb173d5c 100644
--- a/src/arm/test_arm_api.c
+++ b/src/arm/test_arm_api.c
@@ -43,9 +43,9 @@ static int ok = 1;
43static int phase = 0; 43static int phase = 0;
44 44
45static void 45static void
46arm_stop_cb (void *cls, 46arm_stop_cb (void *cls,
47 enum GNUNET_ARM_RequestStatus status, 47 enum GNUNET_ARM_RequestStatus status,
48 const char *servicename, 48 const char *servicename,
49 enum GNUNET_ARM_Result result) 49 enum GNUNET_ARM_Result result)
50{ 50{
51 /* (6), a stop request should be sent to ARM successfully */ 51 /* (6), a stop request should be sent to ARM successfully */
@@ -59,8 +59,8 @@ arm_stop_cb (void *cls,
59 59
60 60
61static void 61static void
62resolver_stop_cb (void *cls, 62resolver_stop_cb (void *cls,
63 enum GNUNET_ARM_RequestStatus status, 63 enum GNUNET_ARM_RequestStatus status,
64 const char *servicename, enum GNUNET_ARM_Result result) 64 const char *servicename, enum GNUNET_ARM_Result result)
65{ 65{
66 /* (5), a stop request should be sent to ARM successfully. 66 /* (5), a stop request should be sent to ARM successfully.
@@ -104,9 +104,9 @@ dns_notify (void *cls, const struct sockaddr *addr, socklen_t addrlen)
104 104
105 105
106static void 106static void
107resolver_start_cb (void *cls, 107resolver_start_cb (void *cls,
108 enum GNUNET_ARM_RequestStatus status, 108 enum GNUNET_ARM_RequestStatus status,
109 const char *servicename, 109 const char *servicename,
110 enum GNUNET_ARM_Result result) 110 enum GNUNET_ARM_Result result)
111{ 111{
112 /* (2), the start request for resolver should be sent successfully 112 /* (2), the start request for resolver should be sent successfully
@@ -129,7 +129,7 @@ trigger_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
129 129
130 130
131static void 131static void
132arm_conn (void *cls, 132arm_conn (void *cls,
133 int connected) 133 int connected)
134{ 134{
135 if (GNUNET_SYSERR == connected) 135 if (GNUNET_SYSERR == connected)
@@ -163,9 +163,9 @@ arm_conn (void *cls,
163 163
164 164
165static void 165static void
166arm_start_cb (void *cls, 166arm_start_cb (void *cls,
167 enum GNUNET_ARM_RequestStatus status, 167 enum GNUNET_ARM_RequestStatus status,
168 const char *servicename, 168 const char *servicename,
169 enum GNUNET_ARM_Result result) 169 enum GNUNET_ARM_Result result)
170{ 170{
171 /* (0) The request should be "sent" successfully 171 /* (0) The request should be "sent" successfully
diff --git a/src/arm/test_exponential_backoff.c b/src/arm/test_exponential_backoff.c
index 08c4fd8ee..0561c3ea8 100644
--- a/src/arm/test_exponential_backoff.c
+++ b/src/arm/test_exponential_backoff.c
@@ -122,12 +122,12 @@ service_shutdown_handler (void *cls, const struct GNUNET_MessageHeader *msg)
122{ 122{
123 struct ShutdownContext *shutdown_ctx = cls; 123 struct ShutdownContext *shutdown_ctx = cls;
124 124
125 if (NULL == msg) 125 if (NULL == msg)
126 { 126 {
127 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service shutdown complete.\n"); 127 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service shutdown complete.\n");
128 if (shutdown_ctx->cont != NULL) 128 if (shutdown_ctx->cont != NULL)
129 shutdown_ctx->cont (shutdown_ctx->cont_cls, GNUNET_NO); 129 shutdown_ctx->cont (shutdown_ctx->cont_cls, GNUNET_NO);
130 130
131 GNUNET_SCHEDULER_cancel (shutdown_ctx->cancel_task); 131 GNUNET_SCHEDULER_cancel (shutdown_ctx->cancel_task);
132 GNUNET_CLIENT_disconnect (shutdown_ctx->sock); 132 GNUNET_CLIENT_disconnect (shutdown_ctx->sock);
133 GNUNET_free (shutdown_ctx); 133 GNUNET_free (shutdown_ctx);
@@ -253,7 +253,7 @@ kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc)
253 if (NULL != cbData) 253 if (NULL != cbData)
254 { 254 {
255 waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt); 255 waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt);
256 LOG ("Waited for: %s\n", 256 LOG ("Waited for: %s\n",
257 GNUNET_STRINGS_relative_time_to_string (waitedFor, GNUNET_YES)); 257 GNUNET_STRINGS_relative_time_to_string (waitedFor, GNUNET_YES));
258 } 258 }
259 else 259 else
@@ -347,7 +347,7 @@ arm_start_cb (void *cls, enum GNUNET_ARM_RequestStatus status, const char *servi
347 GNUNET_break (status == GNUNET_ARM_REQUEST_SENT_OK); 347 GNUNET_break (status == GNUNET_ARM_REQUEST_SENT_OK);
348 GNUNET_break (result == GNUNET_ARM_RESULT_STARTING); 348 GNUNET_break (result == GNUNET_ARM_RESULT_STARTING);
349 GNUNET_break (phase == 0); 349 GNUNET_break (phase == 0);
350 LOG ("Sent 'START' request for arm to ARM %s\n", 350 LOG ("Sent 'START' request for arm to ARM %s\n",
351 (status == GNUNET_ARM_REQUEST_SENT_OK) ? "successfully" : "unsuccessfully"); 351 (status == GNUNET_ARM_REQUEST_SENT_OK) ? "successfully" : "unsuccessfully");
352} 352}
353 353
@@ -431,7 +431,7 @@ init ()
431 return GNUNET_SYSERR; 431 return GNUNET_SYSERR;
432 GNUNET_assert (0 < GNUNET_asprintf (&binary, "%s/%s", pwd, BINARY)); 432 GNUNET_assert (0 < GNUNET_asprintf (&binary, "%s/%s", pwd, BINARY));
433 GNUNET_CONFIGURATION_set_value_string (cfg, SERVICE, "BINARY", binary); 433 GNUNET_CONFIGURATION_set_value_string (cfg, SERVICE, "BINARY", binary);
434 GNUNET_free (binary); 434 GNUNET_free (binary);
435 if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg, CFGFILENAME)) 435 if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg, CFGFILENAME))
436 { 436 {
437 GNUNET_CONFIGURATION_destroy (cfg); 437 GNUNET_CONFIGURATION_destroy (cfg);
diff --git a/src/arm/test_gnunet_service_arm.c b/src/arm/test_gnunet_service_arm.c
index e53322aa5..60feb9c19 100644
--- a/src/arm/test_gnunet_service_arm.c
+++ b/src/arm/test_gnunet_service_arm.c
@@ -18,7 +18,7 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20/** 20/**
21 * @file arm/test_gnunet_service_arm.c 21 * @file arm/test_gnunet_service_arm.c
22 * @brief testcase for gnunet-service-arm.c; tests ARM by making it start the resolver 22 * @brief testcase for gnunet-service-arm.c; tests ARM by making it start the resolver
23 * @author Safey 23 * @author Safey
24 * @author Christian Grothoff 24 * @author Christian Grothoff
@@ -55,9 +55,9 @@ trigger_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
55 55
56 56
57static void 57static void
58arm_stop_cb (void *cls, 58arm_stop_cb (void *cls,
59 enum GNUNET_ARM_RequestStatus status, 59 enum GNUNET_ARM_RequestStatus status,
60 const char *servicename, 60 const char *servicename,
61 enum GNUNET_ARM_Result result) 61 enum GNUNET_ARM_Result result)
62{ 62{
63 GNUNET_break (status == GNUNET_ARM_REQUEST_SENT_OK); 63 GNUNET_break (status == GNUNET_ARM_REQUEST_SENT_OK);
@@ -69,12 +69,12 @@ arm_stop_cb (void *cls,
69 69
70 70
71static void 71static void
72service_list (void *cls, 72service_list (void *cls,
73 enum GNUNET_ARM_RequestStatus rs, 73 enum GNUNET_ARM_RequestStatus rs,
74 unsigned int count, const char *const*list) 74 unsigned int count, const char *const*list)
75{ 75{
76 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 76 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
77 "%u services are are currently running\n", 77 "%u services are are currently running\n",
78 count); 78 count);
79 GNUNET_break (count == 1); 79 GNUNET_break (count == 1);
80 GNUNET_break (0 == strcasecmp (list[0], "resolver (gnunet-service-resolver)")); 80 GNUNET_break (0 == strcasecmp (list[0], "resolver (gnunet-service-resolver)"));
@@ -107,9 +107,9 @@ hostNameResolveCB (void *cls, const struct sockaddr *addr, socklen_t addrlen)
107 107
108 108
109static void 109static void
110arm_start_cb (void *cls, 110arm_start_cb (void *cls,
111 enum GNUNET_ARM_RequestStatus status, 111 enum GNUNET_ARM_RequestStatus status,
112 const char *servicename, 112 const char *servicename,
113 enum GNUNET_ARM_Result result) 113 enum GNUNET_ARM_Result result)
114{ 114{
115 GNUNET_break (status == GNUNET_ARM_REQUEST_SENT_OK); 115 GNUNET_break (status == GNUNET_ARM_REQUEST_SENT_OK);
diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c
index 710931321..90523652d 100644
--- a/src/ats-tool/gnunet-ats.c
+++ b/src/ats-tool/gnunet-ats.c
@@ -110,7 +110,7 @@ static struct PendingResolutions *head;
110static struct PendingResolutions *tail; 110static struct PendingResolutions *tail;
111 111
112 112
113static void 113static void
114end (void *cls, 114end (void *cls,
115 const struct GNUNET_SCHEDULER_TaskContext *tc) 115 const struct GNUNET_SCHEDULER_TaskContext *tc)
116{ 116{
@@ -149,7 +149,7 @@ end (void *cls,
149} 149}
150 150
151 151
152static void 152static void
153transport_addr_to_str_cb (void *cls, const char *address) 153transport_addr_to_str_cb (void *cls, const char *address)
154{ 154{
155 struct PendingResolutions * pr = cls; 155 struct PendingResolutions * pr = cls;
@@ -226,7 +226,7 @@ transport_addr_to_str_cb (void *cls, const char *address)
226} 226}
227 227
228 228
229static void 229static void
230ats_perf_cb (void *cls, 230ats_perf_cb (void *cls,
231 const struct GNUNET_HELLO_Address *address, 231 const struct GNUNET_HELLO_Address *address,
232 int active, 232 int active,
diff --git a/src/ats/gnunet-service-ats-solver_mlp.c b/src/ats/gnunet-service-ats-solver_mlp.c
index f36a3808e..f32ad101a 100644
--- a/src/ats/gnunet-service-ats-solver_mlp.c
+++ b/src/ats/gnunet-service-ats-solver_mlp.c
@@ -177,8 +177,8 @@ mlp_term_hook (void *info, const char *s)
177 * @return GNUNET_OK 177 * @return GNUNET_OK
178 */ 178 */
179static int 179static int
180reset_peers (void *cls, 180reset_peers (void *cls,
181 const struct GNUNET_PeerIdentity *key, 181 const struct GNUNET_PeerIdentity *key,
182 void *value) 182 void *value)
183 { 183 {
184 struct ATS_Peer *peer = value; 184 struct ATS_Peer *peer = value;
@@ -239,7 +239,7 @@ mlp_delete_problem (struct GAS_MLP_Handle *mlp)
239 mlp->p.ci = MLP_UNDEFINED; 239 mlp->p.ci = MLP_UNDEFINED;
240 240
241 241
242 GNUNET_CONTAINER_multipeermap_iterate (mlp->requested_peers, 242 GNUNET_CONTAINER_multipeermap_iterate (mlp->requested_peers,
243 &reset_peers, NULL); 243 &reset_peers, NULL);
244} 244}
245 245
@@ -393,7 +393,7 @@ struct CountContext
393}; 393};
394 394
395static int 395static int
396mlp_create_problem_count_addresses_it (void *cls, 396mlp_create_problem_count_addresses_it (void *cls,
397 const struct GNUNET_PeerIdentity *key, 397 const struct GNUNET_PeerIdentity *key,
398 void *value) 398 void *value)
399{ 399{
@@ -406,7 +406,7 @@ mlp_create_problem_count_addresses_it (void *cls,
406} 406}
407 407
408 408
409static int 409static int
410mlp_create_problem_count_addresses (const struct GNUNET_CONTAINER_MultiPeerMap *peers, 410mlp_create_problem_count_addresses (const struct GNUNET_CONTAINER_MultiPeerMap *peers,
411 const struct GNUNET_CONTAINER_MultiPeerMap *addresses) 411 const struct GNUNET_CONTAINER_MultiPeerMap *addresses)
412{ 412{
@@ -414,7 +414,7 @@ mlp_create_problem_count_addresses (const struct GNUNET_CONTAINER_MultiPeerMap *
414 414
415 cctx.peers = peers; 415 cctx.peers = peers;
416 cctx.result = 0; 416 cctx.result = 0;
417 GNUNET_CONTAINER_multipeermap_iterate (addresses, 417 GNUNET_CONTAINER_multipeermap_iterate (addresses,
418 &mlp_create_problem_count_addresses_it, &cctx); 418 &mlp_create_problem_count_addresses_it, &cctx);
419 return cctx.result; 419 return cctx.result;
420} 420}
@@ -600,8 +600,8 @@ mlp_create_problem_create_constraint (struct MLP_Problem *p, char *name,
600 * - Set address dependent entries in problem matrix as well 600 * - Set address dependent entries in problem matrix as well
601 */ 601 */
602static int 602static int
603mlp_create_problem_add_address_information (void *cls, 603mlp_create_problem_add_address_information (void *cls,
604 const struct GNUNET_PeerIdentity *key, 604 const struct GNUNET_PeerIdentity *key,
605 void *value) 605 void *value)
606{ 606{
607 struct GAS_MLP_Handle *mlp = cls; 607 struct GAS_MLP_Handle *mlp = cls;
@@ -842,7 +842,7 @@ mlp_create_problem (struct GAS_MLP_Handle *mlp)
842 LOG (GNUNET_ERROR_TYPE_DEBUG, 842 LOG (GNUNET_ERROR_TYPE_DEBUG,
843 "Rebuilding problem for %u peer(s) and %u addresse(s) and %u quality metrics == %u elements\n", 843 "Rebuilding problem for %u peer(s) and %u addresse(s) and %u quality metrics == %u elements\n",
844 p->num_peers, 844 p->num_peers,
845 p->num_addresses, 845 p->num_addresses,
846 mlp->pv.m_q, 846 mlp->pv.m_q,
847 p->num_elements); 847 p->num_elements);
848 848
@@ -874,8 +874,8 @@ mlp_create_problem (struct GAS_MLP_Handle *mlp)
874 mlp_create_problem_add_invariant_rows (mlp, p); 874 mlp_create_problem_add_invariant_rows (mlp, p);
875 875
876 /* Adding address dependent columns constraint rows */ 876 /* Adding address dependent columns constraint rows */
877 GNUNET_CONTAINER_multipeermap_iterate (mlp->addresses, 877 GNUNET_CONTAINER_multipeermap_iterate (mlp->addresses,
878 &mlp_create_problem_add_address_information, 878 &mlp_create_problem_add_address_information,
879 mlp); 879 mlp);
880 880
881 /* Load the matrix */ 881 /* Load the matrix */
@@ -961,8 +961,8 @@ mlp_solve_mlp_problem (struct GAS_MLP_Handle *mlp)
961 * @return #GNUNET_OK to continue 961 * @return #GNUNET_OK to continue
962 */ 962 */
963int 963int
964mlp_propagate_results (void *cls, 964mlp_propagate_results (void *cls,
965 const struct GNUNET_PeerIdentity *key, 965 const struct GNUNET_PeerIdentity *key,
966 void *value) 966 void *value)
967{ 967{
968 struct GAS_MLP_Handle *mlp = cls; 968 struct GAS_MLP_Handle *mlp = cls;
@@ -973,7 +973,7 @@ mlp_propagate_results (void *cls,
973 double mlp_use = MLP_NaN; 973 double mlp_use = MLP_NaN;
974 974
975 /* Check if we have to add this peer due to a pending request */ 975 /* Check if we have to add this peer due to a pending request */
976 if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (mlp->requested_peers, 976 if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (mlp->requested_peers,
977 key)) 977 key))
978 { 978 {
979 return GNUNET_OK; 979 return GNUNET_OK;
@@ -1224,12 +1224,12 @@ GAS_mlp_address_add (void *solver,
1224 address->solver_information = GNUNET_new (struct MLP_information); 1224 address->solver_information = GNUNET_new (struct MLP_information);
1225 } 1225 }
1226 else 1226 else
1227 LOG (GNUNET_ERROR_TYPE_ERROR, 1227 LOG (GNUNET_ERROR_TYPE_ERROR,
1228 _("Adding address for peer `%s' multiple times\n"), 1228 _("Adding address for peer `%s' multiple times\n"),
1229 GNUNET_i2s(&address->peer)); 1229 GNUNET_i2s(&address->peer));
1230 1230
1231 /* Is this peer included in the problem? */ 1231 /* Is this peer included in the problem? */
1232 if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers, 1232 if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers,
1233 &address->peer))) 1233 &address->peer)))
1234 { 1234 {
1235 LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding address for peer `%s' without address request \n", GNUNET_i2s(&address->peer)); 1235 LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding address for peer `%s' without address request \n", GNUNET_i2s(&address->peer));
@@ -1529,8 +1529,8 @@ GAS_mlp_address_delete (void *solver,
1529 * @return GNUNET_OK 1529 * @return GNUNET_OK
1530 */ 1530 */
1531static int 1531static int
1532mlp_get_preferred_address_it (void *cls, 1532mlp_get_preferred_address_it (void *cls,
1533 const struct GNUNET_PeerIdentity *key, 1533 const struct GNUNET_PeerIdentity *key,
1534 void *value) 1534 void *value)
1535{ 1535{
1536 static int counter = 0; 1536 static int counter = 0;
@@ -1563,7 +1563,7 @@ mlp_get_preferred_address_it (void *cls,
1563} 1563}
1564 1564
1565 1565
1566static double 1566static double
1567get_peer_pref_value (struct GAS_MLP_Handle *mlp, const struct GNUNET_PeerIdentity *peer) 1567get_peer_pref_value (struct GAS_MLP_Handle *mlp, const struct GNUNET_PeerIdentity *peer)
1568{ 1568{
1569 double res; 1569 double res;
@@ -1616,8 +1616,8 @@ GAS_mlp_get_preferred_address (void *solver,
1616 p = GNUNET_malloc (sizeof (struct ATS_Peer)); 1616 p = GNUNET_malloc (sizeof (struct ATS_Peer));
1617 p->id = (*peer); 1617 p->id = (*peer);
1618 p->f = get_peer_pref_value (mlp, peer); 1618 p->f = get_peer_pref_value (mlp, peer);
1619 GNUNET_CONTAINER_multipeermap_put (mlp->requested_peers, 1619 GNUNET_CONTAINER_multipeermap_put (mlp->requested_peers,
1620 peer, p, 1620 peer, p,
1621 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); 1621 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
1622 1622
1623 /* Added new peer, we have to rebuild problem before solving */ 1623 /* Added new peer, we have to rebuild problem before solving */
@@ -1780,7 +1780,7 @@ GAS_mlp_address_preference_feedback (void *solver,
1780 1780
1781 1781
1782static int 1782static int
1783mlp_free_peers (void *cls, 1783mlp_free_peers (void *cls,
1784 const struct GNUNET_PeerIdentity *key, void *value) 1784 const struct GNUNET_PeerIdentity *key, void *value)
1785{ 1785{
1786 struct GNUNET_CONTAINER_MultiPeerMap *map = cls; 1786 struct GNUNET_CONTAINER_MultiPeerMap *map = cls;
@@ -1807,8 +1807,8 @@ GAS_mlp_done (void *solver)
1807 LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down mlp solver\n"); 1807 LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down mlp solver\n");
1808 mlp_delete_problem (mlp); 1808 mlp_delete_problem (mlp);
1809 1809
1810 GNUNET_CONTAINER_multipeermap_iterate (mlp->requested_peers, 1810 GNUNET_CONTAINER_multipeermap_iterate (mlp->requested_peers,
1811 &mlp_free_peers, 1811 &mlp_free_peers,
1812 mlp->requested_peers); 1812 mlp->requested_peers);
1813 GNUNET_CONTAINER_multipeermap_destroy (mlp->requested_peers); 1813 GNUNET_CONTAINER_multipeermap_destroy (mlp->requested_peers);
1814 mlp->requested_peers = NULL; 1814 mlp->requested_peers = NULL;
diff --git a/src/ats/gnunet-service-ats-solver_proportional.c b/src/ats/gnunet-service-ats-solver_proportional.c
index e9a553ad6..db9fcff85 100644
--- a/src/ats/gnunet-service-ats-solver_proportional.c
+++ b/src/ats/gnunet-service-ats-solver_proportional.c
@@ -576,7 +576,7 @@ find_property_index (uint32_t type)
576 * @return GNUNET_OK (continue to iterate) 576 * @return GNUNET_OK (continue to iterate)
577 */ 577 */
578static int 578static int
579find_best_address_it (void *cls, 579find_best_address_it (void *cls,
580 const struct GNUNET_PeerIdentity *key, 580 const struct GNUNET_PeerIdentity *key,
581 void *value) 581 void *value)
582{ 582{
@@ -721,7 +721,7 @@ get_network (struct GAS_PROPORTIONAL_Handle *s, uint32_t type)
721 * @return #GNUNET_NO on double active address else #GNUNET_YES; 721 * @return #GNUNET_NO on double active address else #GNUNET_YES;
722 */ 722 */
723static int 723static int
724get_active_address_it (void *cls, 724get_active_address_it (void *cls,
725 const struct GNUNET_PeerIdentity *key, 725 const struct GNUNET_PeerIdentity *key,
726 void *value) 726 void *value)
727{ 727{
diff --git a/src/ats/gnunet-service-ats-solver_ril.c b/src/ats/gnunet-service-ats-solver_ril.c
index 4cc19092d..1a9614fd3 100755
--- a/src/ats/gnunet-service-ats-solver_ril.c
+++ b/src/ats/gnunet-service-ats-solver_ril.c
@@ -1033,7 +1033,7 @@ ril_get_agent (struct GAS_RIL_Handle *solver, const struct GNUNET_PeerIdentity *
1033 1033
1034 for (cur = solver->agents_head; NULL != cur; cur = cur->next) 1034 for (cur = solver->agents_head; NULL != cur; cur = cur->next)
1035 { 1035 {
1036 if (0 == memcmp (peer, 1036 if (0 == memcmp (peer,
1037 &cur->peer, 1037 &cur->peer,
1038 sizeof (struct GNUNET_PeerIdentity))) 1038 sizeof (struct GNUNET_PeerIdentity)))
1039 { 1039 {
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c
index 8e3692b8e..f55bb4611 100644
--- a/src/ats/gnunet-service-ats_addresses.c
+++ b/src/ats/gnunet-service-ats_addresses.c
@@ -584,8 +584,8 @@ struct CompareAddressContext
584 * @return #GNUNET_YES to continue, #GNUNET_NO if address is founce 584 * @return #GNUNET_YES to continue, #GNUNET_NO if address is founce
585 */ 585 */
586static int 586static int
587compare_address_it (void *cls, 587compare_address_it (void *cls,
588 const struct GNUNET_PeerIdentity *key, 588 const struct GNUNET_PeerIdentity *key,
589 void *value) 589 void *value)
590{ 590{
591 struct CompareAddressContext *cac = cls; 591 struct CompareAddressContext *cac = cls;
@@ -675,7 +675,7 @@ find_equivalent_address (struct GAS_Addresses_Handle *handle,
675 cac.base_address = NULL; 675 cac.base_address = NULL;
676 cac.search = addr; 676 cac.search = addr;
677 GNUNET_CONTAINER_multipeermap_get_multiple (handle->addresses, 677 GNUNET_CONTAINER_multipeermap_get_multiple (handle->addresses,
678 peer, 678 peer,
679 &compare_address_it, &cac); 679 &compare_address_it, &cac);
680 680
681 if (cac.exact_address == NULL) 681 if (cac.exact_address == NULL)
@@ -1076,7 +1076,7 @@ destroy_by_session_id (void *cls,
1076 1076
1077 /* Notify solver about deletion */ 1077 /* Notify solver about deletion */
1078 GNUNET_assert( 1078 GNUNET_assert(
1079 GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (handle->addresses, 1079 GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (handle->addresses,
1080 &aa->peer, aa)); 1080 &aa->peer, aa));
1081 handle->s_del (handle->solver, aa, GNUNET_NO); 1081 handle->s_del (handle->solver, aa, GNUNET_NO);
1082 free_address (aa); 1082 free_address (aa);
@@ -1321,16 +1321,16 @@ GAS_addresses_request_address (struct GAS_Addresses_Handle *handle,
1321 * @return #GNUNET_OK to continue 1321 * @return #GNUNET_OK to continue
1322 */ 1322 */
1323static int 1323static int
1324reset_address_it (void *cls, 1324reset_address_it (void *cls,
1325 const struct GNUNET_PeerIdentity *key, 1325 const struct GNUNET_PeerIdentity *key,
1326 void *value) 1326 void *value)
1327{ 1327{
1328 struct ATS_Address *aa = value; 1328 struct ATS_Address *aa = value;
1329 1329
1330 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 1330 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1331 "Resetting interval for peer `%s' address %p from %llu to 0\n", 1331 "Resetting interval for peer `%s' address %p from %llu to 0\n",
1332 GNUNET_i2s (&aa->peer), 1332 GNUNET_i2s (&aa->peer),
1333 aa, 1333 aa,
1334 aa->block_interval); 1334 aa->block_interval);
1335 aa->blocked_until = GNUNET_TIME_UNIT_ZERO_ABS; 1335 aa->blocked_until = GNUNET_TIME_UNIT_ZERO_ABS;
1336 aa->block_interval = GNUNET_TIME_UNIT_ZERO; 1336 aa->block_interval = GNUNET_TIME_UNIT_ZERO;
@@ -1846,7 +1846,7 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
1846 GNUNET_ATS_NetworkTypeCount); 1846 GNUNET_ATS_NetworkTypeCount);
1847 1847
1848 ah->solver = ah->s_init (cfg, stats, ah->addresses, quotas, quotas_in, 1848 ah->solver = ah->s_init (cfg, stats, ah->addresses, quotas, quotas_in,
1849 quotas_out, quota_count, 1849 quotas_out, quota_count,
1850 &bandwidth_changed_cb, ah, &get_preferences_cb, 1850 &bandwidth_changed_cb, ah, &get_preferences_cb,
1851 NULL, &get_property_cb, NULL ); 1851 NULL, &get_property_cb, NULL );
1852 if (NULL == ah->solver) 1852 if (NULL == ah->solver)
@@ -1873,7 +1873,7 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
1873 * @return #GNUNET_OK (continue to iterate) 1873 * @return #GNUNET_OK (continue to iterate)
1874 */ 1874 */
1875static int 1875static int
1876destroy_all_address_it (void *cls, 1876destroy_all_address_it (void *cls,
1877 const struct GNUNET_PeerIdentity *key, 1877 const struct GNUNET_PeerIdentity *key,
1878 void *value) 1878 void *value)
1879{ 1879{
@@ -1881,7 +1881,7 @@ destroy_all_address_it (void *cls,
1881 struct ATS_Address *aa = value; 1881 struct ATS_Address *aa = value;
1882 1882
1883 /* Remove */ 1883 /* Remove */
1884 GNUNET_assert(GNUNET_YES == 1884 GNUNET_assert(GNUNET_YES ==
1885 GNUNET_CONTAINER_multipeermap_remove (handle->addresses, key, value)); 1885 GNUNET_CONTAINER_multipeermap_remove (handle->addresses, key, value));
1886 /* Notify */ 1886 /* Notify */
1887 handle->s_del (handle->solver, aa, GNUNET_NO); 1887 handle->s_del (handle->solver, aa, GNUNET_NO);
@@ -1958,7 +1958,7 @@ struct PeerIteratorContext
1958 * @return #GNUNET_OK to continue 1958 * @return #GNUNET_OK to continue
1959 */ 1959 */
1960static int 1960static int
1961peer_it (void *cls, 1961peer_it (void *cls,
1962 const struct GNUNET_PeerIdentity *key, 1962 const struct GNUNET_PeerIdentity *key,
1963 void *value) 1963 void *value)
1964{ 1964{
@@ -2000,7 +2000,7 @@ GAS_addresses_iterate_peers (struct GAS_Addresses_Handle *handle,
2000 ip_ctx.it_cls = p_it_cls; 2000 ip_ctx.it_cls = p_it_cls;
2001 ip_ctx.peers_returned = GNUNET_CONTAINER_multipeermap_create (size, 2001 ip_ctx.peers_returned = GNUNET_CONTAINER_multipeermap_create (size,
2002 GNUNET_NO); 2002 GNUNET_NO);
2003 GNUNET_CONTAINER_multipeermap_iterate (handle->addresses, 2003 GNUNET_CONTAINER_multipeermap_iterate (handle->addresses,
2004 &peer_it, 2004 &peer_it,
2005 &ip_ctx); 2005 &ip_ctx);
2006 GNUNET_CONTAINER_multipeermap_destroy (ip_ctx.peers_returned); 2006 GNUNET_CONTAINER_multipeermap_destroy (ip_ctx.peers_returned);
diff --git a/src/ats/gnunet-service-ats_normalization.c b/src/ats/gnunet-service-ats_normalization.c
index bd9dcb706..954f2b5f5 100644
--- a/src/ats/gnunet-service-ats_normalization.c
+++ b/src/ats/gnunet-service-ats_normalization.c
@@ -654,7 +654,7 @@ find_min_max_it (void *cls,
654 654
655 655
656static int 656static int
657normalize_address (void *cls, 657normalize_address (void *cls,
658 const struct GNUNET_PeerIdentity *h, 658 const struct GNUNET_PeerIdentity *h,
659 void *k) 659 void *k)
660{ 660{
@@ -693,8 +693,8 @@ normalize_address (void *cls,
693 */ 693 */
694static void 694static void
695property_normalize (struct GNUNET_CONTAINER_MultiPeerMap *addresses, 695property_normalize (struct GNUNET_CONTAINER_MultiPeerMap *addresses,
696 struct Property *p, 696 struct Property *p,
697 struct ATS_Address *address, 697 struct ATS_Address *address,
698 uint32_t avg_value) 698 uint32_t avg_value)
699{ 699{
700 struct FindMinMaxCtx find_ctx; 700 struct FindMinMaxCtx find_ctx;
@@ -762,7 +762,7 @@ property_normalize (struct GNUNET_CONTAINER_MultiPeerMap *addresses,
762 */ 762 */
763void 763void
764GAS_normalization_normalize_property (struct GNUNET_CONTAINER_MultiPeerMap *addresses, 764GAS_normalization_normalize_property (struct GNUNET_CONTAINER_MultiPeerMap *addresses,
765 struct ATS_Address *address, 765 struct ATS_Address *address,
766 const struct GNUNET_ATS_Information *atsi, 766 const struct GNUNET_ATS_Information *atsi,
767 uint32_t atsi_count) 767 uint32_t atsi_count)
768{ 768{
diff --git a/src/ats/gnunet-service-ats_reservations.c b/src/ats/gnunet-service-ats_reservations.c
index c75577cf9..bf5e62cae 100644
--- a/src/ats/gnunet-service-ats_reservations.c
+++ b/src/ats/gnunet-service-ats_reservations.c
@@ -137,7 +137,7 @@ GAS_reservations_init ()
137 * @return GNUNET_OK (continue to iterate) 137 * @return GNUNET_OK (continue to iterate)
138 */ 138 */
139static int 139static int
140free_tracker (void *cls, 140free_tracker (void *cls,
141 const struct GNUNET_PeerIdentity *key, void *value) 141 const struct GNUNET_PeerIdentity *key, void *value)
142{ 142{
143 struct GNUNET_BANDWIDTH_Tracker *tracker = value; 143 struct GNUNET_BANDWIDTH_Tracker *tracker = value;
diff --git a/src/ats/perf_ats_mlp.c b/src/ats/perf_ats_mlp.c
index 5d370104b..190635c77 100644
--- a/src/ats/perf_ats_mlp.c
+++ b/src/ats/perf_ats_mlp.c
@@ -374,10 +374,10 @@ check (void *cls, char *const *args, const char *cfgfile,
374 (GLP_YES == full_lp_presolv) ? "YES" : "NO", 374 (GLP_YES == full_lp_presolv) ? "YES" : "NO",
375 (GNUNET_OK == full_mip_presolv) ? "YES" : "NO", 375 (GNUNET_OK == full_mip_presolv) ? "YES" : "NO",
376 (unsigned long long) full_build_dur.rel_value_us, 376 (unsigned long long) full_build_dur.rel_value_us,
377 (unsigned long long) full_lp_dur.rel_value_us, 377 (unsigned long long) full_lp_dur.rel_value_us,
378 (unsigned long long) full_mip_dur.rel_value_us); 378 (unsigned long long) full_mip_dur.rel_value_us);
379 if ((0 < opt_update_quantity) || (0 < opt_update_percent)) 379 if ((0 < opt_update_quantity) || (0 < opt_update_percent))
380 fprintf (stderr, 380 fprintf (stderr,
381 "Update: %03u peers each %02u addresses; rebuild: LP/MIP state [%3s/%3s] presolv [%3s/%3s], (build/LP/MIP in us) %04llu / %04llu / %04llu\n", 381 "Update: %03u peers each %02u addresses; rebuild: LP/MIP state [%3s/%3s] presolv [%3s/%3s], (build/LP/MIP in us) %04llu / %04llu / %04llu\n",
382 cp + 1, ca, 382 cp + 1, ca,
383 (GNUNET_OK == update_lp_res) ? "OK" : "FAIL", 383 (GNUNET_OK == update_lp_res) ? "OK" : "FAIL",
@@ -385,31 +385,31 @@ check (void *cls, char *const *args, const char *cfgfile,
385 (GLP_YES == update_lp_presolv) ? "YES" : "NO", 385 (GLP_YES == update_lp_presolv) ? "YES" : "NO",
386 (GNUNET_OK == update_mip_presolv) ? "YES" : "NO", 386 (GNUNET_OK == update_mip_presolv) ? "YES" : "NO",
387 (unsigned long long) update_build_dur.rel_value_us, 387 (unsigned long long) update_build_dur.rel_value_us,
388 (unsigned long long) update_lp_dur.rel_value_us, 388 (unsigned long long) update_lp_dur.rel_value_us,
389 (unsigned long long) update_mip_dur.rel_value_us); 389 (unsigned long long) update_mip_dur.rel_value_us);
390 } 390 }
391 else 391 else
392 { 392 {
393 fprintf (stderr, 393 fprintf (stderr,
394 "Rebuild;%u;%u;%s;%s;%s;%s;%04llu;%04llu;%04llu\n", 394 "Rebuild;%u;%u;%s;%s;%s;%s;%04llu;%04llu;%04llu\n",
395 cp + 1, ca, 395 cp + 1, ca,
396 (GNUNET_OK == full_lp_res) ? "OK" : "FAIL", 396 (GNUNET_OK == full_lp_res) ? "OK" : "FAIL",
397 (GNUNET_OK == full_mip_res) ? "OK" : "FAIL", 397 (GNUNET_OK == full_mip_res) ? "OK" : "FAIL",
398 (GLP_YES == full_lp_presolv) ? "YES" : "NO", 398 (GLP_YES == full_lp_presolv) ? "YES" : "NO",
399 (GNUNET_OK == full_mip_presolv) ? "YES" : "NO", 399 (GNUNET_OK == full_mip_presolv) ? "YES" : "NO",
400 (unsigned long long) full_build_dur.rel_value_us, 400 (unsigned long long) full_build_dur.rel_value_us,
401 (unsigned long long) full_lp_dur.rel_value_us, 401 (unsigned long long) full_lp_dur.rel_value_us,
402 (unsigned long long) full_mip_dur.rel_value_us); 402 (unsigned long long) full_mip_dur.rel_value_us);
403 if ((0 < opt_update_quantity) || (0 < opt_update_percent)) 403 if ((0 < opt_update_quantity) || (0 < opt_update_percent))
404 fprintf (stderr, 404 fprintf (stderr,
405 "Update;%u;%u;%s;%s;%s;%s;%04llu;%04llu;%04llu\n", 405 "Update;%u;%u;%s;%s;%s;%s;%04llu;%04llu;%04llu\n",
406 cp + 1, ca, 406 cp + 1, ca,
407 (GNUNET_OK == update_lp_res) ? "OK" : "FAIL", 407 (GNUNET_OK == update_lp_res) ? "OK" : "FAIL",
408 (GNUNET_OK == update_mip_res) ? "OK" : "FAIL", 408 (GNUNET_OK == update_mip_res) ? "OK" : "FAIL",
409 (GLP_YES == update_lp_presolv) ? "YES" : "NO", 409 (GLP_YES == update_lp_presolv) ? "YES" : "NO",
410 (GNUNET_OK == update_mip_presolv) ? "YES" : "NO", 410 (GNUNET_OK == update_mip_presolv) ? "YES" : "NO",
411 (unsigned long long) update_build_dur.rel_value_us, 411 (unsigned long long) update_build_dur.rel_value_us,
412 (unsigned long long) update_lp_dur.rel_value_us, 412 (unsigned long long) update_lp_dur.rel_value_us,
413 (unsigned long long) update_mip_dur.rel_value_us); 413 (unsigned long long) update_mip_dur.rel_value_us);
414 } 414 }
415 } 415 }
diff --git a/src/ats/test_ats_api_bandwidth_consumption.c b/src/ats/test_ats_api_bandwidth_consumption.c
index 772d044a5..74ee22cfb 100644
--- a/src/ats/test_ats_api_bandwidth_consumption.c
+++ b/src/ats/test_ats_api_bandwidth_consumption.c
@@ -174,7 +174,7 @@ address_suggest_cb (void *cls, const struct GNUNET_PeerIdentity *peer,
174 174
175 175
176static void 176static void
177run (void *cls, 177run (void *cls,
178 const struct GNUNET_CONFIGURATION_Handle *cfg, 178 const struct GNUNET_CONFIGURATION_Handle *cfg,
179 struct GNUNET_TESTING_Peer *peer) 179 struct GNUNET_TESTING_Peer *peer)
180{ 180{
diff --git a/src/ats/test_ats_api_performance_address_info.c b/src/ats/test_ats_api_performance_address_info.c
index 7cdbc4e37..294d09192 100644
--- a/src/ats/test_ats_api_performance_address_info.c
+++ b/src/ats/test_ats_api_performance_address_info.c
@@ -226,7 +226,7 @@ static void next (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
226} 226}
227 227
228static void 228static void
229run (void *cls, 229run (void *cls,
230 const struct GNUNET_CONFIGURATION_Handle *mycfg, 230 const struct GNUNET_CONFIGURATION_Handle *mycfg,
231 struct GNUNET_TESTING_Peer *peer) 231 struct GNUNET_TESTING_Peer *peer)
232{ 232{
diff --git a/src/ats/test_ats_api_performance_feedback.c b/src/ats/test_ats_api_performance_feedback.c
index 35d31c495..f946e674a 100644
--- a/src/ats/test_ats_api_performance_feedback.c
+++ b/src/ats/test_ats_api_performance_feedback.c
@@ -208,7 +208,7 @@ static void next (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
208} 208}
209 209
210static void 210static void
211run (void *cls, 211run (void *cls,
212 const struct GNUNET_CONFIGURATION_Handle *mycfg, 212 const struct GNUNET_CONFIGURATION_Handle *mycfg,
213 struct GNUNET_TESTING_Peer *peer) 213 struct GNUNET_TESTING_Peer *peer)
214{ 214{
diff --git a/src/ats/test_ats_api_scheduling_add_address.c b/src/ats/test_ats_api_scheduling_add_address.c
index d9bd0d6e1..ce9f9fcbd 100644
--- a/src/ats/test_ats_api_scheduling_add_address.c
+++ b/src/ats/test_ats_api_scheduling_add_address.c
@@ -150,7 +150,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
150 150
151 151
152static void 152static void
153run (void *cls, 153run (void *cls,
154 const struct GNUNET_CONFIGURATION_Handle *cfg, 154 const struct GNUNET_CONFIGURATION_Handle *cfg,
155 struct GNUNET_TESTING_Peer *peer) 155 struct GNUNET_TESTING_Peer *peer)
156{ 156{
diff --git a/src/ats/test_ats_api_scheduling_add_address_duplicate.c b/src/ats/test_ats_api_scheduling_add_address_duplicate.c
index 9fd4d2096..e7b4fb6fe 100644
--- a/src/ats/test_ats_api_scheduling_add_address_duplicate.c
+++ b/src/ats/test_ats_api_scheduling_add_address_duplicate.c
@@ -161,7 +161,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
161 161
162 162
163static void 163static void
164run (void *cls, 164run (void *cls,
165 const struct GNUNET_CONFIGURATION_Handle *cfg, 165 const struct GNUNET_CONFIGURATION_Handle *cfg,
166 struct GNUNET_TESTING_Peer *peer) 166 struct GNUNET_TESTING_Peer *peer)
167{ 167{
diff --git a/src/ats/test_ats_api_scheduling_add_address_inbound.c b/src/ats/test_ats_api_scheduling_add_address_inbound.c
index f0368c1ae..4cb560982 100644
--- a/src/ats/test_ats_api_scheduling_add_address_inbound.c
+++ b/src/ats/test_ats_api_scheduling_add_address_inbound.c
@@ -156,7 +156,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
156 156
157 157
158static void 158static void
159run (void *cls, 159run (void *cls,
160 const struct GNUNET_CONFIGURATION_Handle *cfg, 160 const struct GNUNET_CONFIGURATION_Handle *cfg,
161 struct GNUNET_TESTING_Peer *peer) 161 struct GNUNET_TESTING_Peer *peer)
162{ 162{
diff --git a/src/ats/test_ats_api_scheduling_add_session.c b/src/ats/test_ats_api_scheduling_add_session.c
index eafb6fbe2..c415b57e2 100644
--- a/src/ats/test_ats_api_scheduling_add_session.c
+++ b/src/ats/test_ats_api_scheduling_add_session.c
@@ -163,7 +163,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
163 163
164 164
165static void 165static void
166run (void *cls, 166run (void *cls,
167 const struct GNUNET_CONFIGURATION_Handle *cfg, 167 const struct GNUNET_CONFIGURATION_Handle *cfg,
168 struct GNUNET_TESTING_Peer *peer) 168 struct GNUNET_TESTING_Peer *peer)
169{ 169{
diff --git a/src/ats/test_ats_api_scheduling_block_and_reset.c b/src/ats/test_ats_api_scheduling_block_and_reset.c
index d5bd58031..c4dd8b4bb 100644
--- a/src/ats/test_ats_api_scheduling_block_and_reset.c
+++ b/src/ats/test_ats_api_scheduling_block_and_reset.c
@@ -150,7 +150,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
150 if (3 == stage) 150 if (3 == stage)
151 { 151 {
152 /* Suggestion after resetting block interval */ 152 /* Suggestion after resetting block interval */
153 reset_block_duration = GNUNET_TIME_absolute_get_difference (reset_block_start, 153 reset_block_duration = GNUNET_TIME_absolute_get_difference (reset_block_start,
154 GNUNET_TIME_absolute_get()); 154 GNUNET_TIME_absolute_get());
155 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 155 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
156 "Address suggestion after resetting blocking took about %s!\n", 156 "Address suggestion after resetting blocking took about %s!\n",
@@ -180,7 +180,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
180 if (((initial_duration.rel_value_us * 3) <= block_duration.rel_value_us) && 180 if (((initial_duration.rel_value_us * 3) <= block_duration.rel_value_us) &&
181 ((reset_block_duration.rel_value_us * 3) <= block_duration.rel_value_us)) 181 ((reset_block_duration.rel_value_us * 3) <= block_duration.rel_value_us))
182 { 182 {
183 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 183 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
184 "Address suggestion after resetting blocking and initial suggestion (%llu us) much faster than with blocking (%llu us)\n", 184 "Address suggestion after resetting blocking and initial suggestion (%llu us) much faster than with blocking (%llu us)\n",
185 (unsigned long long) initial_duration.rel_value_us, 185 (unsigned long long) initial_duration.rel_value_us,
186 (unsigned long long) block_duration.rel_value_us); 186 (unsigned long long) block_duration.rel_value_us);
@@ -188,7 +188,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
188 } 188 }
189 else 189 else
190 { 190 {
191 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 191 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
192 "Address suggestion after resetting blocking and initial suggestion (%llu us) not faster than with blocking (%llu us)\n", 192 "Address suggestion after resetting blocking and initial suggestion (%llu us) not faster than with blocking (%llu us)\n",
193 (unsigned long long) initial_duration.rel_value_us, 193 (unsigned long long) initial_duration.rel_value_us,
194 (unsigned long long) block_duration.rel_value_us); 194 (unsigned long long) block_duration.rel_value_us);
@@ -211,7 +211,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
211 211
212 if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) 212 if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session))
213 { 213 {
214 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 214 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
215 "Stage %u: Callback with correct address `%s'\n", stage, 215 "Stage %u: Callback with correct address `%s'\n", stage,
216 GNUNET_i2s (&address->peer)); 216 GNUNET_i2s (&address->peer));
217 ret = 0; 217 ret = 0;
@@ -228,7 +228,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
228 228
229 if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)) 229 if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count))
230 { 230 {
231 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 231 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
232 "Stage %u: Callback with incorrect ats info \n"); 232 "Stage %u: Callback with incorrect ats info \n");
233 GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); 233 GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id);
234 GNUNET_SCHEDULER_add_now (&end, NULL); 234 GNUNET_SCHEDULER_add_now (&end, NULL);
@@ -246,16 +246,16 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
246 /* Initial suggestion */ 246 /* Initial suggestion */
247 if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) 247 if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session))
248 { 248 {
249 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 249 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
250 "Stage %u: Callback with correct address `%s'\n", 250 "Stage %u: Callback with correct address `%s'\n",
251 stage, 251 stage,
252 GNUNET_i2s (&address->peer)); 252 GNUNET_i2s (&address->peer));
253 ret = 0; 253 ret = 0;
254 } 254 }
255 else 255 else
256 { 256 {
257 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 257 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
258 "Stage %u: Callback with invalid address `%s'\n", 258 "Stage %u: Callback with invalid address `%s'\n",
259 stage, 259 stage,
260 GNUNET_i2s (&address->peer)); 260 GNUNET_i2s (&address->peer));
261 GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); 261 GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id);
@@ -265,7 +265,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
265 265
266 if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)) 266 if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count))
267 { 267 {
268 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 268 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
269 "Stage %u: Callback with incorrect ats info\n", 269 "Stage %u: Callback with incorrect ats info\n",
270 stage); 270 stage);
271 GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); 271 GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id);
@@ -274,8 +274,8 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
274 } 274 }
275 stage++; 275 stage++;
276 initial_duration = GNUNET_TIME_absolute_get_difference(initial_start, GNUNET_TIME_absolute_get()); 276 initial_duration = GNUNET_TIME_absolute_get_difference(initial_start, GNUNET_TIME_absolute_get());
277 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 277 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
278 "Stage %u: Initial suggestion took about %s\n", 278 "Stage %u: Initial suggestion took about %s\n",
279 stage, 279 stage,
280 GNUNET_STRINGS_relative_time_to_string (block_duration, 280 GNUNET_STRINGS_relative_time_to_string (block_duration,
281 GNUNET_YES)); 281 GNUNET_YES));
@@ -288,8 +288,8 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
288 /* Startup suggestion */ 288 /* Startup suggestion */
289 if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) 289 if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session))
290 { 290 {
291 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 291 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
292 "Stage %u: Callback with correct address `%s'\n", 292 "Stage %u: Callback with correct address `%s'\n",
293 stage, 293 stage,
294 GNUNET_i2s (&address->peer)); 294 GNUNET_i2s (&address->peer));
295 ret = 0; 295 ret = 0;
@@ -297,7 +297,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
297 else 297 else
298 { 298 {
299 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 299 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
300 "Stage %u: Callback with invalid address `%s'\n", 300 "Stage %u: Callback with invalid address `%s'\n",
301 stage, 301 stage,
302 GNUNET_i2s (&address->peer)); 302 GNUNET_i2s (&address->peer));
303 GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); 303 GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id);
@@ -307,7 +307,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
307 307
308 if (GNUNET_OK != compare_ats (atsi, ats_count, test_ats_info, test_ats_count)) 308 if (GNUNET_OK != compare_ats (atsi, ats_count, test_ats_info, test_ats_count))
309 { 309 {
310 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 310 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
311 "Stage %u: Callback with incorrect ats info\n", 311 "Stage %u: Callback with incorrect ats info\n",
312 stage); 312 stage);
313 GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); 313 GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id);
@@ -325,7 +325,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
325 325
326 326
327static void 327static void
328run (void *cls, 328run (void *cls,
329 const struct GNUNET_CONFIGURATION_Handle *cfg, 329 const struct GNUNET_CONFIGURATION_Handle *cfg,
330 struct GNUNET_TESTING_Peer *peer) 330 struct GNUNET_TESTING_Peer *peer)
331{ 331{
@@ -336,7 +336,7 @@ run (void *cls,
336 sched_ats = GNUNET_ATS_scheduling_init (cfg, &address_suggest_cb, NULL); 336 sched_ats = GNUNET_ATS_scheduling_init (cfg, &address_suggest_cb, NULL);
337 if (sched_ats == NULL) 337 if (sched_ats == NULL)
338 { 338 {
339 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 339 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
340 "Could not connect to ATS scheduling!\n"); 340 "Could not connect to ATS scheduling!\n");
341 ret = 1; 341 ret = 1;
342 end (); 342 end ();
diff --git a/src/ats/test_ats_api_scheduling_destroy_address.c b/src/ats/test_ats_api_scheduling_destroy_address.c
index 78005fe84..aa70f6b5a 100644
--- a/src/ats/test_ats_api_scheduling_destroy_address.c
+++ b/src/ats/test_ats_api_scheduling_destroy_address.c
@@ -161,7 +161,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
161 161
162 162
163static void 163static void
164run (void *cls, 164run (void *cls,
165 const struct GNUNET_CONFIGURATION_Handle *cfg, 165 const struct GNUNET_CONFIGURATION_Handle *cfg,
166 struct GNUNET_TESTING_Peer *peer) 166 struct GNUNET_TESTING_Peer *peer)
167{ 167{
diff --git a/src/ats/test_ats_api_scheduling_destroy_address_twice.c b/src/ats/test_ats_api_scheduling_destroy_address_twice.c
index e3cd2cd2c..ef03674df 100644
--- a/src/ats/test_ats_api_scheduling_destroy_address_twice.c
+++ b/src/ats/test_ats_api_scheduling_destroy_address_twice.c
@@ -163,7 +163,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
163 163
164 164
165static void 165static void
166run (void *cls, 166run (void *cls,
167 const struct GNUNET_CONFIGURATION_Handle *cfg, 167 const struct GNUNET_CONFIGURATION_Handle *cfg,
168 struct GNUNET_TESTING_Peer *peer) 168 struct GNUNET_TESTING_Peer *peer)
169{ 169{
diff --git a/src/ats/test_ats_api_scheduling_destroy_inbound_connection.c b/src/ats/test_ats_api_scheduling_destroy_inbound_connection.c
index 100bfd249..90a8d070f 100644
--- a/src/ats/test_ats_api_scheduling_destroy_inbound_connection.c
+++ b/src/ats/test_ats_api_scheduling_destroy_inbound_connection.c
@@ -162,7 +162,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
162 162
163 163
164static void 164static void
165run (void *cls, 165run (void *cls,
166 const struct GNUNET_CONFIGURATION_Handle *cfg, 166 const struct GNUNET_CONFIGURATION_Handle *cfg,
167 struct GNUNET_TESTING_Peer *peer) 167 struct GNUNET_TESTING_Peer *peer)
168{ 168{
diff --git a/src/ats/test_ats_api_scheduling_destroy_session.c b/src/ats/test_ats_api_scheduling_destroy_session.c
index 523822667..dc53a894d 100644
--- a/src/ats/test_ats_api_scheduling_destroy_session.c
+++ b/src/ats/test_ats_api_scheduling_destroy_session.c
@@ -167,7 +167,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
167 167
168 168
169static void 169static void
170run (void *cls, 170run (void *cls,
171 const struct GNUNET_CONFIGURATION_Handle *cfg, 171 const struct GNUNET_CONFIGURATION_Handle *cfg,
172 struct GNUNET_TESTING_Peer *peer) 172 struct GNUNET_TESTING_Peer *peer)
173{ 173{
diff --git a/src/ats/test_ats_api_scheduling_init.c b/src/ats/test_ats_api_scheduling_init.c
index 7fd954eb5..aab5f2373 100644
--- a/src/ats/test_ats_api_scheduling_init.c
+++ b/src/ats/test_ats_api_scheduling_init.c
@@ -117,7 +117,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
117 117
118 118
119static void 119static void
120run (void *cls, 120run (void *cls,
121 const struct GNUNET_CONFIGURATION_Handle *cfg, 121 const struct GNUNET_CONFIGURATION_Handle *cfg,
122 struct GNUNET_TESTING_Peer *peer) 122 struct GNUNET_TESTING_Peer *peer)
123{ 123{
diff --git a/src/ats/test_ats_api_scheduling_min_bw.c b/src/ats/test_ats_api_scheduling_min_bw.c
index 5a59c23bb..4da07628c 100644
--- a/src/ats/test_ats_api_scheduling_min_bw.c
+++ b/src/ats/test_ats_api_scheduling_min_bw.c
@@ -117,7 +117,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
117} 117}
118 118
119static void 119static void
120run (void *cls, 120run (void *cls,
121 const struct GNUNET_CONFIGURATION_Handle *cfg, 121 const struct GNUNET_CONFIGURATION_Handle *cfg,
122 struct GNUNET_TESTING_Peer *peer) 122 struct GNUNET_TESTING_Peer *peer)
123{ 123{
diff --git a/src/block/block.c b/src/block/block.c
index d2c7a067b..f38e7e0bf 100644
--- a/src/block/block.c
+++ b/src/block/block.c
@@ -97,15 +97,15 @@ GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode *in,
97 * @param lib_ret the plugin API 97 * @param lib_ret the plugin API
98 */ 98 */
99static void 99static void
100add_plugin (void *cls, 100add_plugin (void *cls,
101 const char *library_name, 101 const char *library_name,
102 void *lib_ret) 102 void *lib_ret)
103{ 103{
104 struct GNUNET_BLOCK_Context *ctx = cls; 104 struct GNUNET_BLOCK_Context *ctx = cls;
105 struct GNUNET_BLOCK_PluginFunctions *api = lib_ret; 105 struct GNUNET_BLOCK_PluginFunctions *api = lib_ret;
106 struct Plugin *plugin; 106 struct Plugin *plugin;
107 107
108 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 108 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
109 "Loading block plugin `%s'\n", 109 "Loading block plugin `%s'\n",
110 library_name); 110 library_name);
111 plugin = GNUNET_new (struct Plugin); 111 plugin = GNUNET_new (struct Plugin);
diff --git a/src/block/plugin_block_template.c b/src/block/plugin_block_template.c
index 1675fdb1c..7c62de6b1 100644
--- a/src/block/plugin_block_template.c
+++ b/src/block/plugin_block_template.c
@@ -56,7 +56,7 @@ block_plugin_template_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
56 struct GNUNET_HashCode chash; 56 struct GNUNET_HashCode chash;
57 struct GNUNET_HashCode mhash; 57 struct GNUNET_HashCode mhash;
58 /* FIXME: check validity first... */ 58 /* FIXME: check validity first... */
59 59
60 /* mandatory duplicate-detection code... */ 60 /* mandatory duplicate-detection code... */
61 if (NULL != bf) 61 if (NULL != bf)
62 { 62 {
diff --git a/src/block/plugin_block_test.c b/src/block/plugin_block_test.c
index 130c2ac3c..9390562a4 100644
--- a/src/block/plugin_block_test.c
+++ b/src/block/plugin_block_test.c
@@ -116,7 +116,7 @@ block_plugin_test_get_key (void *cls, enum GNUNET_BLOCK_Type type,
116 * Entry point for the plugin. 116 * Entry point for the plugin.
117 * 117 *
118 * @param cls NULL 118 * @param cls NULL
119 * @return the exported block API 119 * @return the exported block API
120 */ 120 */
121void * 121void *
122libgnunet_plugin_block_test_init (void *cls) 122libgnunet_plugin_block_test_init (void *cls)
diff --git a/src/consensus/consensus_api.c b/src/consensus/consensus_api.c
index b2b3694d6..d8e65c52f 100644
--- a/src/consensus/consensus_api.c
+++ b/src/consensus/consensus_api.c
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file consensus/consensus_api.c 22 * @file consensus/consensus_api.c
23 * @brief 23 * @brief
24 * @author Florian Dold 24 * @author Florian Dold
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
@@ -103,7 +103,7 @@ struct InsertDoneInfo
103 103
104/** 104/**
105 * Called when the server has sent is a new element 105 * Called when the server has sent is a new element
106 * 106 *
107 * @param cls consensus handle 107 * @param cls consensus handle
108 * @param mh element message 108 * @param mh element message
109 */ 109 */
@@ -129,7 +129,7 @@ handle_new_element (void *cls,
129/** 129/**
130 * Called when the server has announced 130 * Called when the server has announced
131 * that the conclusion is over. 131 * that the conclusion is over.
132 * 132 *
133 * @param cls consensus handle 133 * @param cls consensus handle
134 * @param msg conclude done message 134 * @param msg conclude done message
135 */ 135 */
@@ -220,7 +220,7 @@ idc_adapter (void *cls)
220 * 220 *
221 * @param consensus handle for the consensus session 221 * @param consensus handle for the consensus session
222 * @param element the element to be inserted 222 * @param element the element to be inserted
223 * @param idc function called when we are done with this element and it 223 * @param idc function called when we are done with this element and it
224 * is thus allowed to call GNUNET_CONSENSUS_insert again 224 * is thus allowed to call GNUNET_CONSENSUS_insert again
225 * @param idc_cls closure for 'idc' 225 * @param idc_cls closure for 'idc'
226 */ 226 */
@@ -240,7 +240,7 @@ GNUNET_CONSENSUS_insert (struct GNUNET_CONSENSUS_Handle *consensus,
240 GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_INSERT); 240 GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_INSERT);
241 241
242 memcpy (&element_msg[1], element->data, element->size); 242 memcpy (&element_msg[1], element->data, element->size);
243 243
244 if (NULL != idc) 244 if (NULL != idc)
245 { 245 {
246 i = GNUNET_new (struct InsertDoneInfo); 246 i = GNUNET_new (struct InsertDoneInfo);
diff --git a/src/consensus/gnunet-consensus-profiler.c b/src/consensus/gnunet-consensus-profiler.c
index 00e017246..bade332b5 100644
--- a/src/consensus/gnunet-consensus-profiler.c
+++ b/src/consensus/gnunet-consensus-profiler.c
@@ -206,7 +206,7 @@ new_element_cb (void *cls,
206 int idx = chp - consensus_handles; 206 int idx = chp - consensus_handles;
207 207
208 GNUNET_assert (NULL != cls); 208 GNUNET_assert (NULL != cls);
209 209
210 results_for_peer[idx]++; 210 results_for_peer[idx]++;
211 211
212 GNUNET_assert (sizeof (struct GNUNET_HashCode) == element->size); 212 GNUNET_assert (sizeof (struct GNUNET_HashCode) == element->size);
diff --git a/src/consensus/gnunet-service-consensus.c b/src/consensus/gnunet-service-consensus.c
index 74f758034..914943f11 100644
--- a/src/consensus/gnunet-service-consensus.c
+++ b/src/consensus/gnunet-service-consensus.c
@@ -147,7 +147,7 @@ struct ConsensusSession
147 * Only valid once the current round is not CONSENSUS_ROUND_BEGIN. 147 * Only valid once the current round is not CONSENSUS_ROUND_BEGIN.
148 */ 148 */
149 struct GNUNET_TIME_Relative conclude_timeout; 149 struct GNUNET_TIME_Relative conclude_timeout;
150 150
151 /** 151 /**
152 * Timeout task identifier for the current round. 152 * Timeout task identifier for the current round.
153 */ 153 */
@@ -286,7 +286,7 @@ have_exp_subround_finished (const struct ConsensusSession *session)
286{ 286{
287 int not_finished; 287 int not_finished;
288 not_finished = 0; 288 not_finished = 0;
289 if ( (NULL != session->partner_outgoing) && 289 if ( (NULL != session->partner_outgoing) &&
290 (GNUNET_NO == session->partner_outgoing->exp_subround_finished) ) 290 (GNUNET_NO == session->partner_outgoing->exp_subround_finished) )
291 not_finished++; 291 not_finished++;
292 if ( (NULL != session->partner_incoming) && 292 if ( (NULL != session->partner_incoming) &&
@@ -300,7 +300,7 @@ have_exp_subround_finished (const struct ConsensusSession *session)
300 300
301/** 301/**
302 * Destroy a session, free all resources associated with it. 302 * Destroy a session, free all resources associated with it.
303 * 303 *
304 * @param session the session to destroy 304 * @param session the session to destroy
305 */ 305 */
306static void 306static void
@@ -404,7 +404,7 @@ send_to_client_iter (void *cls,
404 * @param tc task context, for when this task is invoked by the scheduler, 404 * @param tc task context, for when this task is invoked by the scheduler,
405 * NULL if invoked for another reason 405 * NULL if invoked for another reason
406 */ 406 */
407static void 407static void
408round_over (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 408round_over (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
409{ 409{
410 struct ConsensusSession *session; 410 struct ConsensusSession *session;
@@ -459,7 +459,7 @@ shuffle (struct ConsensusSession *session)
459 if (NULL == session->shuffle_inv) 459 if (NULL == session->shuffle_inv)
460 session->shuffle_inv = GNUNET_malloc (session->num_peers * sizeof (*session->shuffle_inv)); 460 session->shuffle_inv = GNUNET_malloc (session->num_peers * sizeof (*session->shuffle_inv));
461 461
462 GNUNET_CRYPTO_kdf (randomness, sizeof (randomness), 462 GNUNET_CRYPTO_kdf (randomness, sizeof (randomness),
463 &session->exp_round, sizeof (uint32_t), 463 &session->exp_round, sizeof (uint32_t),
464 &session->global_id, sizeof (struct GNUNET_HashCode), 464 &session->global_id, sizeof (struct GNUNET_HashCode),
465 NULL); 465 NULL);
@@ -559,7 +559,7 @@ find_partners (struct ConsensusSession *session)
559 * @param element a result element, only valid if status is GNUNET_SET_STATUS_OK 559 * @param element a result element, only valid if status is GNUNET_SET_STATUS_OK
560 * @param status see enum GNUNET_SET_Status 560 * @param status see enum GNUNET_SET_Status
561 */ 561 */
562static void 562static void
563set_result_cb (void *cls, 563set_result_cb (void *cls,
564 const struct GNUNET_SET_Element *element, 564 const struct GNUNET_SET_Element *element,
565 enum GNUNET_SET_Status status) 565 enum GNUNET_SET_Status status)
@@ -674,7 +674,7 @@ subround_over (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
674 GNUNET_SCHEDULER_cancel (session->round_timeout_tid); 674 GNUNET_SCHEDULER_cancel (session->round_timeout_tid);
675 session->round_timeout_tid = GNUNET_SCHEDULER_NO_TASK; 675 session->round_timeout_tid = GNUNET_SCHEDULER_NO_TASK;
676 } 676 }
677 677
678 if (session->exp_round >= NUM_EXP_ROUNDS) 678 if (session->exp_round >= NUM_EXP_ROUNDS)
679 { 679 {
680 round_over (session, NULL); 680 round_over (session, NULL);
@@ -700,7 +700,7 @@ subround_over (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
700 session->exp_subround = 0; 700 session->exp_subround = 0;
701 shuffle (session); 701 shuffle (session);
702 } 702 }
703 else 703 else
704 { 704 {
705 session->exp_subround++; 705 session->exp_subround++;
706 } 706 }
@@ -810,7 +810,7 @@ get_peer_idx (const struct GNUNET_PeerIdentity *peer, const struct ConsensusSess
810 * @param session_id local id of the consensus session 810 * @param session_id local id of the consensus session
811 */ 811 */
812static void 812static void
813compute_global_id (struct ConsensusSession *session, 813compute_global_id (struct ConsensusSession *session,
814 const struct GNUNET_HashCode *session_id) 814 const struct GNUNET_HashCode *session_id)
815{ 815{
816 int i; 816 int i;
@@ -865,7 +865,7 @@ initialize_session_peer_list (struct ConsensusSession *session,
865 865
866 /* peers in the join message, may or may not include the local peer */ 866 /* peers in the join message, may or may not include the local peer */
867 listed_peers = ntohl (join_msg->num_peers); 867 listed_peers = ntohl (join_msg->num_peers);
868 868
869 session->num_peers = listed_peers; 869 session->num_peers = listed_peers;
870 870
871 msg_peers = (struct GNUNET_PeerIdentity *) &join_msg[1]; 871 msg_peers = (struct GNUNET_PeerIdentity *) &join_msg[1];
@@ -1025,7 +1025,7 @@ initialize_session (struct ConsensusSession *session,
1025 other_session = sessions_head; 1025 other_session = sessions_head;
1026 while (NULL != other_session) 1026 while (NULL != other_session)
1027 { 1027 {
1028 if ((other_session != session) && 1028 if ((other_session != session) &&
1029 (0 == GNUNET_CRYPTO_hash_cmp (&session->global_id, &other_session->global_id))) 1029 (0 == GNUNET_CRYPTO_hash_cmp (&session->global_id, &other_session->global_id)))
1030 { 1030 {
1031 if (CONSENSUS_ROUND_FINISH != other_session->current_round) 1031 if (CONSENSUS_ROUND_FINISH != other_session->current_round)
diff --git a/src/consensus/test_consensus_api.c b/src/consensus/test_consensus_api.c
index 37a5eb692..9b6f71f7a 100644
--- a/src/consensus/test_consensus_api.c
+++ b/src/consensus/test_consensus_api.c
@@ -82,7 +82,7 @@ on_shutdown (void *cls,
82 82
83 83
84static void 84static void
85run (void *cls, 85run (void *cls,
86 const struct GNUNET_CONFIGURATION_Handle *cfg, 86 const struct GNUNET_CONFIGURATION_Handle *cfg,
87 struct GNUNET_TESTING_Peer *peer) 87 struct GNUNET_TESTING_Peer *peer)
88{ 88{
diff --git a/src/conversation/conversation.h b/src/conversation/conversation.h
index 685d98d16..4b42277a5 100644
--- a/src/conversation/conversation.h
+++ b/src/conversation/conversation.h
@@ -116,7 +116,7 @@ struct ClientPhonePickupMessage
116 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICK_UP 116 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICK_UP
117 */ 117 */
118 struct GNUNET_MessageHeader header; 118 struct GNUNET_MessageHeader header;
119 119
120 /* followed by variable length 0-terminated string with meta data */ 120 /* followed by variable length 0-terminated string with meta data */
121 121
122}; 122};
@@ -132,7 +132,7 @@ struct ClientPhoneHangupMessage
132 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP 132 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP
133 */ 133 */
134 struct GNUNET_MessageHeader header; 134 struct GNUNET_MessageHeader header;
135 135
136 /* followed by variable length 0-terminated string with meta data */ 136 /* followed by variable length 0-terminated string with meta data */
137 137
138}; 138};
@@ -190,7 +190,7 @@ struct ClientPhonePickedupMessage
190 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP 190 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP
191 */ 191 */
192 struct GNUNET_MessageHeader header; 192 struct GNUNET_MessageHeader header;
193 193
194 /* followed by variable length 0-terminated string with meta data */ 194 /* followed by variable length 0-terminated string with meta data */
195 195
196}; 196};
@@ -233,7 +233,7 @@ struct MeshPhoneRingMessage
233 233
234 /** 234 /**
235 * When does the signature expire? 235 * When does the signature expire?
236 */ 236 */
237 struct GNUNET_TIME_AbsoluteNBO expiration_time; 237 struct GNUNET_TIME_AbsoluteNBO expiration_time;
238 238
239 /** 239 /**
diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c
index 11eb2b7e7..6e1cbe3fb 100644
--- a/src/conversation/conversation_api.c
+++ b/src/conversation/conversation_api.c
@@ -1,17 +1,17 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2013 Christian Grothoff (and other contributing authors) 3 (C) 2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version. 8 option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
@@ -75,7 +75,7 @@ struct GNUNET_CONVERSATION_Phone
75 * Our configuration. 75 * Our configuration.
76 */ 76 */
77 const struct GNUNET_CONFIGURATION_Handle *cfg; 77 const struct GNUNET_CONFIGURATION_Handle *cfg;
78 78
79 /** 79 /**
80 * Handle to talk with CONVERSATION service. 80 * Handle to talk with CONVERSATION service.
81 */ 81 */
@@ -103,7 +103,7 @@ struct GNUNET_CONVERSATION_Phone
103 103
104 /** 104 /**
105 * Connection to NAMESTORE (for reverse lookup). 105 * Connection to NAMESTORE (for reverse lookup).
106 */ 106 */
107 struct GNUNET_NAMESTORE_Handle *ns; 107 struct GNUNET_NAMESTORE_Handle *ns;
108 108
109 /** 109 /**
@@ -119,7 +119,7 @@ struct GNUNET_CONVERSATION_Phone
119 /** 119 /**
120 * This phone's record. 120 * This phone's record.
121 */ 121 */
122 struct GNUNET_CONVERSATION_PhoneRecord my_record; 122 struct GNUNET_CONVERSATION_PhoneRecord my_record;
123 123
124 /** 124 /**
125 * My GNS zone. 125 * My GNS zone.
@@ -316,7 +316,7 @@ handle_phone_audio_message (void *cls,
316 316
317 317
318/** 318/**
319 * We encountered an error talking with the conversation service. 319 * We encountered an error talking with the conversation service.
320 * 320 *
321 * @param cls the `struct GNUNET_CONVERSATION_Phone` 321 * @param cls the `struct GNUNET_CONVERSATION_Phone`
322 * @param error details about the error 322 * @param error details about the error
@@ -326,7 +326,7 @@ phone_error_handler (void *cls,
326 enum GNUNET_MQ_Error error) 326 enum GNUNET_MQ_Error error)
327{ 327{
328 struct GNUNET_CONVERSATION_Phone *phone = cls; 328 struct GNUNET_CONVERSATION_Phone *phone = cls;
329 329
330 GNUNET_break (0); 330 GNUNET_break (0);
331 FPRINTF (stderr, 331 FPRINTF (stderr,
332 _("Internal error %d\n"), 332 _("Internal error %d\n"),
@@ -346,15 +346,15 @@ reconnect_phone (struct GNUNET_CONVERSATION_Phone *phone)
346 static struct GNUNET_MQ_MessageHandler handlers[] = 346 static struct GNUNET_MQ_MessageHandler handlers[] =
347 { 347 {
348 { &handle_phone_ring, 348 { &handle_phone_ring,
349 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING, 349 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING,
350 sizeof (struct ClientPhoneRingMessage) }, 350 sizeof (struct ClientPhoneRingMessage) },
351 { &handle_phone_hangup, 351 { &handle_phone_hangup,
352 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP, 352 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP,
353 0 }, 353 0 },
354 { &handle_phone_audio_message, 354 { &handle_phone_audio_message,
355 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO, 355 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO,
356 0 }, 356 0 },
357 { NULL, 0, 0 } 357 { NULL, 0, 0 }
358 }; 358 };
359 struct GNUNET_MQ_Envelope *e; 359 struct GNUNET_MQ_Envelope *e;
360 struct ClientPhoneRegisterMessage *reg; 360 struct ClientPhoneRegisterMessage *reg;
@@ -408,7 +408,7 @@ GNUNET_CONVERSATION_phone_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
408 unsigned long long line; 408 unsigned long long line;
409 409
410 if (GNUNET_OK != 410 if (GNUNET_OK !=
411 GNUNET_CONFIGURATION_get_value_number (cfg, 411 GNUNET_CONFIGURATION_get_value_number (cfg,
412 "CONVERSATION", 412 "CONVERSATION",
413 "LINE", 413 "LINE",
414 &line)) 414 &line))
@@ -478,7 +478,7 @@ transmit_phone_audio (void *cls,
478 struct ClientAudioMessage *am; 478 struct ClientAudioMessage *am;
479 479
480 GNUNET_assert (PS_ACTIVE == phone->state); 480 GNUNET_assert (PS_ACTIVE == phone->state);
481 e = GNUNET_MQ_msg_extra (am, 481 e = GNUNET_MQ_msg_extra (am,
482 data_size, 482 data_size,
483 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO); 483 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO);
484 memcpy (&am[1], data, data_size); 484 memcpy (&am[1], data, data_size);
@@ -487,7 +487,7 @@ transmit_phone_audio (void *cls,
487 487
488 488
489/** 489/**
490 * Picks up a (ringing) phone. This will connect the speaker 490 * Picks up a (ringing) phone. This will connect the speaker
491 * to the microphone of the other party, and vice versa. 491 * to the microphone of the other party, and vice versa.
492 * 492 *
493 * @param phone phone to pick up 493 * @param phone phone to pick up
@@ -630,7 +630,7 @@ struct GNUNET_CONVERSATION_Call
630 * Our configuration. 630 * Our configuration.
631 */ 631 */
632 const struct GNUNET_CONFIGURATION_Handle *cfg; 632 const struct GNUNET_CONFIGURATION_Handle *cfg;
633 633
634 /** 634 /**
635 * Handle to talk with CONVERSATION service. 635 * Handle to talk with CONVERSATION service.
636 */ 636 */
@@ -655,7 +655,7 @@ struct GNUNET_CONVERSATION_Call
655 * Our microphone. 655 * Our microphone.
656 */ 656 */
657 struct GNUNET_MICROPHONE_Handle *mic; 657 struct GNUNET_MICROPHONE_Handle *mic;
658 658
659 /** 659 /**
660 * Function to call with events. 660 * Function to call with events.
661 */ 661 */
@@ -673,7 +673,7 @@ struct GNUNET_CONVERSATION_Call
673 673
674 /** 674 /**
675 * Connection to GNS (can be NULL). 675 * Connection to GNS (can be NULL).
676 */ 676 */
677 struct GNUNET_GNS_Handle *gns; 677 struct GNUNET_GNS_Handle *gns;
678 678
679 /** 679 /**
@@ -754,7 +754,7 @@ transmit_call_audio (void *cls,
754 struct ClientAudioMessage *am; 754 struct ClientAudioMessage *am;
755 755
756 GNUNET_assert (CS_ACTIVE == call->state); 756 GNUNET_assert (CS_ACTIVE == call->state);
757 e = GNUNET_MQ_msg_extra (am, 757 e = GNUNET_MQ_msg_extra (am,
758 data_size, 758 data_size,
759 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO); 759 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO);
760 memcpy (&am[1], data, data_size); 760 memcpy (&am[1], data, data_size);
@@ -782,7 +782,7 @@ handle_call_picked_up (void *cls,
782 metadata = (const char *) &am[1]; 782 metadata = (const char *) &am[1];
783 if ( (0 == size) || 783 if ( (0 == size) ||
784 ('\0' != metadata[size - 1]) ) 784 ('\0' != metadata[size - 1]) )
785 metadata = NULL; 785 metadata = NULL;
786 switch (call->state) 786 switch (call->state)
787 { 787 {
788 case CS_LOOKUP: 788 case CS_LOOKUP:
@@ -830,7 +830,7 @@ handle_call_hangup (void *cls,
830 reason = (const char *) &am[1]; 830 reason = (const char *) &am[1];
831 if ( (0 == size) || 831 if ( (0 == size) ||
832 ('\0' != reason[size - 1]) ) 832 ('\0' != reason[size - 1]) )
833 reason = NULL; 833 reason = NULL;
834 switch (call->state) 834 switch (call->state)
835 { 835 {
836 case CS_LOOKUP: 836 case CS_LOOKUP:
@@ -900,7 +900,7 @@ handle_call_audio_message (void *cls,
900 * @param rd_count number of records in @a rd 900 * @param rd_count number of records in @a rd
901 * @param rd the records in reply 901 * @param rd the records in reply
902 */ 902 */
903static void 903static void
904handle_gns_response (void *cls, 904handle_gns_response (void *cls,
905 uint32_t rd_count, 905 uint32_t rd_count,
906 const struct GNUNET_NAMESTORE_RecordData *rd) 906 const struct GNUNET_NAMESTORE_RecordData *rd)
@@ -919,7 +919,7 @@ handle_gns_response (void *cls,
919 { 919 {
920 GNUNET_break_op (0); 920 GNUNET_break_op (0);
921 continue; 921 continue;
922 } 922 }
923 memcpy (&call->phone_record, 923 memcpy (&call->phone_record,
924 rd[i].data, 924 rd[i].data,
925 rd[i].data_size); 925 rd[i].data_size);
@@ -942,7 +942,7 @@ handle_gns_response (void *cls,
942 942
943 943
944/** 944/**
945 * We encountered an error talking with the conversation service. 945 * We encountered an error talking with the conversation service.
946 * 946 *
947 * @param cls the `struct GNUNET_CONVERSATION_Call` 947 * @param cls the `struct GNUNET_CONVERSATION_Call`
948 * @param error details about the error 948 * @param error details about the error
@@ -972,18 +972,18 @@ reconnect_call (struct GNUNET_CONVERSATION_Call *call)
972 static struct GNUNET_MQ_MessageHandler handlers[] = 972 static struct GNUNET_MQ_MessageHandler handlers[] =
973 { 973 {
974 { &handle_call_busy, 974 { &handle_call_busy,
975 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_BUSY, 975 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_BUSY,
976 sizeof (struct ClientPhoneBusyMessage) }, 976 sizeof (struct ClientPhoneBusyMessage) },
977 { &handle_call_picked_up, 977 { &handle_call_picked_up,
978 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP, 978 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP,
979 0 }, 979 0 },
980 { &handle_call_hangup, 980 { &handle_call_hangup,
981 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP, 981 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP,
982 0 }, 982 0 },
983 { &handle_call_audio_message, 983 { &handle_call_audio_message,
984 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO, 984 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO,
985 0 }, 985 0 },
986 { NULL, 0, 0 } 986 { NULL, 0, 0 }
987 }; 987 };
988 struct GNUNET_CRYPTO_EccPublicSignKey my_zone; 988 struct GNUNET_CRYPTO_EccPublicSignKey my_zone;
989 989
@@ -1013,7 +1013,7 @@ reconnect_call (struct GNUNET_CONVERSATION_Call *call)
1013 call->state = CS_LOOKUP; 1013 call->state = CS_LOOKUP;
1014 GNUNET_IDENTITY_ego_get_public_key (call->caller_id, 1014 GNUNET_IDENTITY_ego_get_public_key (call->caller_id,
1015 &my_zone); 1015 &my_zone);
1016 call->gns_lookup = GNUNET_GNS_lookup (call->gns, 1016 call->gns_lookup = GNUNET_GNS_lookup (call->gns,
1017 call->callee, 1017 call->callee,
1018 &my_zone, 1018 &my_zone,
1019 GNUNET_NAMESTORE_TYPE_PHONE, 1019 GNUNET_NAMESTORE_TYPE_PHONE,
diff --git a/src/conversation/gnunet-conversation-test.c b/src/conversation/gnunet-conversation-test.c
index 1f44ca1fc..cc831a3ab 100644
--- a/src/conversation/gnunet-conversation-test.c
+++ b/src/conversation/gnunet-conversation-test.c
@@ -25,8 +25,8 @@
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_speaker_lib.h" 28#include "gnunet_speaker_lib.h"
29#include "gnunet_microphone_lib.h" 29#include "gnunet_microphone_lib.h"
30 30
31/** 31/**
32 * How long do we record before we replay? 32 * How long do we record before we replay?
@@ -117,7 +117,7 @@ do_shutdown (void *cls,
117 rec); 117 rec);
118 GNUNET_free (rec); 118 GNUNET_free (rec);
119 } 119 }
120 fprintf (stderr, 120 fprintf (stderr,
121 _("\nEnd of transmission. Have a GNU day.\n")); 121 _("\nEnd of transmission. Have a GNU day.\n"));
122} 122}
123 123
@@ -145,7 +145,7 @@ switch_to_speaker (void *cls,
145 GNUNET_SCHEDULER_shutdown (); 145 GNUNET_SCHEDULER_shutdown ();
146 return; 146 return;
147 } 147 }
148 fprintf (stderr, 148 fprintf (stderr,
149 _("\nWe are now playing your recording back. If you can hear it, your audio settings are working...")); 149 _("\nWe are now playing your recording back. If you can hear it, your audio settings are working..."));
150 for (rec=rec_head; NULL != rec; rec = rec->next) 150 for (rec=rec_head; NULL != rec; rec = rec->next)
151 { 151 {
@@ -170,7 +170,7 @@ switch_to_speaker (void *cls,
170 * @param data_size number of bytes in @a data 170 * @param data_size number of bytes in @a data
171 * @param data audio data to play 171 * @param data audio data to play
172 */ 172 */
173static void 173static void
174record (void *cls, 174record (void *cls,
175 size_t data_size, 175 size_t data_size,
176 const void *data) 176 const void *data)
@@ -211,7 +211,7 @@ run (void *cls, char *const *args, const char *cfgfile,
211 st = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 211 st = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
212 &do_shutdown, 212 &do_shutdown,
213 NULL); 213 NULL);
214 fprintf (stderr, 214 fprintf (stderr,
215 _("We will now be recording you for %s. After that time, the recording will be played back to you..."), 215 _("We will now be recording you for %s. After that time, the recording will be played back to you..."),
216 GNUNET_STRINGS_relative_time_to_string (TIMEOUT, GNUNET_YES)); 216 GNUNET_STRINGS_relative_time_to_string (TIMEOUT, GNUNET_YES));
217 if (GNUNET_OK != 217 if (GNUNET_OK !=
diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c
index ad91d3007..113c10098 100644
--- a/src/conversation/gnunet-conversation.c
+++ b/src/conversation/gnunet-conversation.c
@@ -1,17 +1,17 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2013 Christian Grothoff (and other contributing authors) 3 (C) 2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version. 8 option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
@@ -173,7 +173,7 @@ phone_event_handler (void *cls,
173 ...) 173 ...)
174{ 174{
175 va_list va; 175 va_list va;
176 176
177 va_start (va, code); 177 va_start (va, code);
178 switch (code) 178 switch (code)
179 { 179 {
@@ -268,7 +268,7 @@ call_event_handler (void *cls,
268 ...) 268 ...)
269{ 269{
270 va_list va; 270 va_list va;
271 271
272 va_start (va, code); 272 va_start (va, code);
273 switch (code) 273 switch (code)
274 { 274 {
@@ -338,7 +338,7 @@ struct VoipCommand
338 * Command the user needs to enter. 338 * Command the user needs to enter.
339 */ 339 */
340 const char *command; 340 const char *command;
341 341
342 /** 342 /**
343 * Function to call on command. 343 * Function to call on command.
344 */ 344 */
@@ -380,8 +380,8 @@ do_quit (const char *args)
380static void 380static void
381do_unknown (const char *msg) 381do_unknown (const char *msg)
382{ 382{
383 FPRINTF (stderr, 383 FPRINTF (stderr,
384 _("Unknown command `%s'\n"), 384 _("Unknown command `%s'\n"),
385 msg); 385 msg);
386} 386}
387 387
@@ -403,7 +403,7 @@ do_call (const char *arg)
403 } 403 }
404 switch (state) 404 switch (state)
405 { 405 {
406 case CS_LOOKUP_EGO: 406 case CS_LOOKUP_EGO:
407 FPRINTF (stderr, 407 FPRINTF (stderr,
408 _("Ego `%s' not available\n"), 408 _("Ego `%s' not available\n"),
409 ego_name); 409 ego_name);
@@ -470,7 +470,7 @@ do_accept (const char *args)
470{ 470{
471 switch (state) 471 switch (state)
472 { 472 {
473 case CS_LOOKUP_EGO: 473 case CS_LOOKUP_EGO:
474 case CS_LISTEN: 474 case CS_LISTEN:
475 case CS_ERROR: 475 case CS_ERROR:
476 FPRINTF (stderr, 476 FPRINTF (stderr,
@@ -497,7 +497,7 @@ do_accept (const char *args)
497 return; 497 return;
498 } 498 }
499 GNUNET_assert (NULL != phone); 499 GNUNET_assert (NULL != phone);
500 GNUNET_CONVERSATION_phone_pick_up (phone, 500 GNUNET_CONVERSATION_phone_pick_up (phone,
501 args, 501 args,
502 speaker, 502 speaker,
503 mic); 503 mic);
@@ -536,7 +536,7 @@ do_status (const char *args)
536{ 536{
537 switch (state) 537 switch (state)
538 { 538 {
539 case CS_LOOKUP_EGO: 539 case CS_LOOKUP_EGO:
540 FPRINTF (stdout, 540 FPRINTF (stdout,
541 _("We are currently trying to locate the private key for the ego `%s'.\n"), 541 _("We are currently trying to locate the private key for the ego `%s'.\n"),
542 ego_name); 542 ego_name);
@@ -586,7 +586,7 @@ do_reject (const char *args)
586{ 586{
587 switch (state) 587 switch (state)
588 { 588 {
589 case CS_LOOKUP_EGO: 589 case CS_LOOKUP_EGO:
590 case CS_LISTEN: 590 case CS_LISTEN:
591 case CS_ERROR: 591 case CS_ERROR:
592 FPRINTF (stderr, 592 FPRINTF (stderr,
@@ -604,7 +604,7 @@ do_reject (const char *args)
604 if (NULL == call) 604 if (NULL == call)
605 { 605 {
606 GNUNET_assert (NULL != phone); 606 GNUNET_assert (NULL != phone);
607 GNUNET_CONVERSATION_phone_hang_up (phone, 607 GNUNET_CONVERSATION_phone_hang_up (phone,
608 args); 608 args);
609 state = CS_LISTEN; 609 state = CS_LISTEN;
610 } 610 }
@@ -621,9 +621,9 @@ do_reject (const char *args)
621 * List of supported commands. 621 * List of supported commands.
622 */ 622 */
623static struct VoipCommand commands[] = { 623static struct VoipCommand commands[] = {
624 {"/address", &do_address, 624 {"/address", &do_address,
625 gettext_noop ("Use `/address' to find out which address this phone should have in GNS")}, 625 gettext_noop ("Use `/address' to find out which address this phone should have in GNS")},
626 {"/call", &do_call, 626 {"/call", &do_call,
627 gettext_noop ("Use `/call USER.gnu' to call USER")}, 627 gettext_noop ("Use `/call USER.gnu' to call USER")},
628 {"/accept", &do_accept, 628 {"/accept", &do_accept,
629 gettext_noop ("Use `/accept MESSAGE' to accept an incoming call")}, 629 gettext_noop ("Use `/accept MESSAGE' to accept an incoming call")},
@@ -631,11 +631,11 @@ static struct VoipCommand commands[] = {
631 gettext_noop ("Use `/cancel MESSAGE' to reject or terminate a call")}, 631 gettext_noop ("Use `/cancel MESSAGE' to reject or terminate a call")},
632 {"/status", &do_status, 632 {"/status", &do_status,
633 gettext_noop ("Use `/status' to print status information")}, 633 gettext_noop ("Use `/status' to print status information")},
634 {"/quit", &do_quit, 634 {"/quit", &do_quit,
635 gettext_noop ("Use `/quit' to terminate gnunet-conversation")}, 635 gettext_noop ("Use `/quit' to terminate gnunet-conversation")},
636 {"/help", &do_help, 636 {"/help", &do_help,
637 gettext_noop ("Use `/help command' to get help for a specific command")}, 637 gettext_noop ("Use `/help command' to get help for a specific command")},
638 {"", &do_unknown, 638 {"", &do_unknown,
639 NULL}, 639 NULL},
640 {NULL, NULL, NULL}, 640 {NULL, NULL, NULL},
641}; 641};
@@ -650,8 +650,8 @@ static void
650do_help (const char *args) 650do_help (const char *args)
651{ 651{
652 unsigned int i; 652 unsigned int i;
653 653
654 i = 0; 654 i = 0;
655 while ( (NULL != args) && 655 while ( (NULL != args) &&
656 (0 != strlen (args)) && 656 (0 != strlen (args)) &&
657 (commands[i].Action != &do_help)) 657 (commands[i].Action != &do_help))
@@ -659,7 +659,7 @@ do_help (const char *args)
659 if (0 == 659 if (0 ==
660 strncasecmp (&args[1], &commands[i].command[1], strlen (args) - 1)) 660 strncasecmp (&args[1], &commands[i].command[1], strlen (args) - 1))
661 { 661 {
662 FPRINTF (stdout, 662 FPRINTF (stdout,
663 "%s\n", 663 "%s\n",
664 gettext (commands[i].helptext)); 664 gettext (commands[i].helptext));
665 return; 665 return;
@@ -667,13 +667,13 @@ do_help (const char *args)
667 i++; 667 i++;
668 } 668 }
669 i = 0; 669 i = 0;
670 FPRINTF (stdout, 670 FPRINTF (stdout,
671 "%s", 671 "%s",
672 "Available commands:\n"); 672 "Available commands:\n");
673 while (commands[i].Action != &do_help) 673 while (commands[i].Action != &do_help)
674 { 674 {
675 FPRINTF (stdout, 675 FPRINTF (stdout,
676 "%s\n", 676 "%s\n",
677 gettext (commands[i].command)); 677 gettext (commands[i].command));
678 i++; 678 i++;
679 } 679 }
@@ -710,7 +710,7 @@ do_stop_task (void *cls,
710 { 710 {
711 GNUNET_SCHEDULER_cancel (handle_cmd_task); 711 GNUNET_SCHEDULER_cancel (handle_cmd_task);
712 handle_cmd_task = GNUNET_SCHEDULER_NO_TASK; 712 handle_cmd_task = GNUNET_SCHEDULER_NO_TASK;
713 } 713 }
714 if (NULL != id) 714 if (NULL != id)
715 { 715 {
716 GNUNET_IDENTITY_disconnect (id); 716 GNUNET_IDENTITY_disconnect (id);
@@ -799,7 +799,7 @@ identity_cb (void *cls,
799 ego_name)) 799 ego_name))
800 return; 800 return;
801 if (NULL == ego) 801 if (NULL == ego)
802 { 802 {
803 if (verbose) 803 if (verbose)
804 FPRINTF (stdout, 804 FPRINTF (stdout,
805 _("Our ego `%s' was deleted!\n"), 805 _("Our ego `%s' was deleted!\n"),
@@ -826,7 +826,7 @@ identity_cb (void *cls,
826 */ 826 */
827static void 827static void
828run (void *cls, 828run (void *cls,
829 char *const *args, 829 char *const *args,
830 const char *cfgfile, 830 const char *cfgfile,
831 const struct GNUNET_CONFIGURATION_Handle *c) 831 const struct GNUNET_CONFIGURATION_Handle *c)
832{ 832{
@@ -851,7 +851,7 @@ run (void *cls,
851} 851}
852 852
853 853
854/** 854/**
855 * The main function to conversation. 855 * The main function to conversation.
856 * 856 *
857 * @param argc number of arguments from the command line 857 * @param argc number of arguments from the command line
diff --git a/src/conversation/gnunet-helper-audio-playback.c b/src/conversation/gnunet-helper-audio-playback.c
index c0ef217cd..97abd4430 100644
--- a/src/conversation/gnunet-helper-audio-playback.c
+++ b/src/conversation/gnunet-helper-audio-playback.c
@@ -102,7 +102,7 @@ static int ready_pipe[2];
102 * Message callback 102 * Message callback
103 */ 103 */
104static int 104static int
105stdin_receiver (void *cls, 105stdin_receiver (void *cls,
106 void *client, 106 void *client,
107 const struct GNUNET_MessageHeader *msg) 107 const struct GNUNET_MessageHeader *msg)
108{ 108{
@@ -113,7 +113,7 @@ stdin_receiver (void *cls,
113 { 113 {
114 case GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO: 114 case GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO:
115 audio = (struct AudioMessage *) msg; 115 audio = (struct AudioMessage *) msg;
116 116
117 ret = opus_decode_float (dec, 117 ret = opus_decode_float (dec,
118 (const unsigned char *) &audio[1], 118 (const unsigned char *) &audio[1],
119 ntohs (audio->header.size) - sizeof (struct AudioMessage), 119 ntohs (audio->header.size) - sizeof (struct AudioMessage),
@@ -132,12 +132,12 @@ stdin_receiver (void *cls,
132 if (pa_stream_write 132 if (pa_stream_write
133 (stream_out, pcm_buffer, pcm_length, NULL, 0, 133 (stream_out, pcm_buffer, pcm_length, NULL, 0,
134 PA_SEEK_RELATIVE) < 0) 134 PA_SEEK_RELATIVE) < 0)
135 { 135 {
136 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 136 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
137 _("pa_stream_write() failed: %s\n"), 137 _("pa_stream_write() failed: %s\n"),
138 pa_strerror (pa_context_errno (context))); 138 pa_strerror (pa_context_errno (context)));
139 return GNUNET_OK; 139 return GNUNET_OK;
140 } 140 }
141 break; 141 break;
142 default: 142 default:
143 break; 143 break;
@@ -161,8 +161,8 @@ quit (int ret)
161 * Callback when data is there for playback 161 * Callback when data is there for playback
162 */ 162 */
163static void 163static void
164stream_write_callback (pa_stream * s, 164stream_write_callback (pa_stream * s,
165 size_t length, 165 size_t length,
166 void *userdata) 166 void *userdata)
167{ 167{
168 /* unblock 'main' */ 168 /* unblock 'main' */
@@ -192,7 +192,7 @@ exit_signal_callback (pa_mainloop_api * m, pa_signal_event * e, int sig,
192 * Pulseaudio stream state callback 192 * Pulseaudio stream state callback
193 */ 193 */
194static void 194static void
195context_state_callback (pa_context * c, 195context_state_callback (pa_context * c,
196 void *userdata) 196 void *userdata)
197{ 197{
198 int p; 198 int p;
@@ -203,7 +203,7 @@ context_state_callback (pa_context * c,
203 case PA_CONTEXT_CONNECTING: 203 case PA_CONTEXT_CONNECTING:
204 case PA_CONTEXT_AUTHORIZING: 204 case PA_CONTEXT_AUTHORIZING:
205 case PA_CONTEXT_SETTING_NAME: 205 case PA_CONTEXT_SETTING_NAME:
206 break; 206 break;
207 case PA_CONTEXT_READY: 207 case PA_CONTEXT_READY:
208 { 208 {
209 GNUNET_assert (!stream_out); 209 GNUNET_assert (!stream_out);
@@ -216,12 +216,12 @@ context_state_callback (pa_context * c,
216 _("pa_stream_new() failed: %s\n"), 216 _("pa_stream_new() failed: %s\n"),
217 pa_strerror (pa_context_errno (c))); 217 pa_strerror (pa_context_errno (c)));
218 goto fail; 218 goto fail;
219 } 219 }
220 pa_stream_set_write_callback (stream_out, 220 pa_stream_set_write_callback (stream_out,
221 &stream_write_callback, 221 &stream_write_callback,
222 NULL); 222 NULL);
223 if ((p = 223 if ((p =
224 pa_stream_connect_playback (stream_out, NULL, 224 pa_stream_connect_playback (stream_out, NULL,
225 NULL, 225 NULL,
226 PA_STREAM_ADJUST_LATENCY | PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE, 226 PA_STREAM_ADJUST_LATENCY | PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE,
227 NULL, NULL)) < 0) 227 NULL, NULL)) < 0)
@@ -232,19 +232,19 @@ context_state_callback (pa_context * c,
232 goto fail; 232 goto fail;
233 } 233 }
234 break; 234 break;
235 } 235 }
236 case PA_CONTEXT_TERMINATED: 236 case PA_CONTEXT_TERMINATED:
237 quit (0); 237 quit (0);
238 break; 238 break;
239 239
240 case PA_CONTEXT_FAILED: 240 case PA_CONTEXT_FAILED:
241 default: 241 default:
242 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 242 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
243 _("Connection failure: %s\n"), 243 _("Connection failure: %s\n"),
244 pa_strerror (pa_context_errno (c))); 244 pa_strerror (pa_context_errno (c)));
245 goto fail; 245 goto fail;
246 } 246 }
247 return; 247 return;
248 fail: 248 fail:
249 quit (1); 249 quit (1);
250} 250}
@@ -260,13 +260,13 @@ pa_init ()
260 260
261 if (!pa_sample_spec_valid (&sample_spec)) 261 if (!pa_sample_spec_valid (&sample_spec))
262 { 262 {
263 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 263 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
264 _("Wrong Spec\n")); 264 _("Wrong Spec\n"));
265 } 265 }
266 /* set up threaded playback mainloop */ 266 /* set up threaded playback mainloop */
267 if (!(m = pa_threaded_mainloop_new ())) 267 if (!(m = pa_threaded_mainloop_new ()))
268 { 268 {
269 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 269 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
270 _("pa_mainloop_new() failed.\n")); 270 _("pa_mainloop_new() failed.\n"));
271 } 271 }
272 mainloop_api = pa_threaded_mainloop_get_api (m); 272 mainloop_api = pa_threaded_mainloop_get_api (m);
@@ -280,9 +280,9 @@ pa_init ()
280 /* connect to the main pulseaudio context */ 280 /* connect to the main pulseaudio context */
281 if (!(context = pa_context_new (mainloop_api, "GNUnet VoIP"))) 281 if (!(context = pa_context_new (mainloop_api, "GNUnet VoIP")))
282 { 282 {
283 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 283 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
284 _("pa_context_new() failed.\n")); 284 _("pa_context_new() failed.\n"));
285 } 285 }
286 pa_context_set_state_callback (context, context_state_callback, NULL); 286 pa_context_set_state_callback (context, context_state_callback, NULL);
287 287
288 if (pa_context_connect (context, NULL, 0, NULL) < 0) 288 if (pa_context_connect (context, NULL, 0, NULL) < 0)
@@ -290,10 +290,10 @@ pa_init ()
290 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 290 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
291 _("pa_context_connect() failed: %s\n"), 291 _("pa_context_connect() failed: %s\n"),
292 pa_strerror (pa_context_errno (context))); 292 pa_strerror (pa_context_errno (context)));
293 } 293 }
294 if (pa_threaded_mainloop_start (m) < 0) 294 if (pa_threaded_mainloop_start (m) < 0)
295 { 295 {
296 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 296 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
297 _("pa_mainloop_run() failed.\n")); 297 _("pa_mainloop_run() failed.\n"));
298 } 298 }
299} 299}
@@ -354,7 +354,7 @@ main (int argc, char *argv[])
354 ready_pipe[1] = -1; 354 ready_pipe[1] = -1;
355 while (1) 355 while (1)
356 { 356 {
357 ret = read (0, readbuf, sizeof (readbuf)); 357 ret = read (0, readbuf, sizeof (readbuf));
358 toff += ret; 358 toff += ret;
359 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 359 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
360 "Received %d bytes of audio data (total: %llu)\n", 360 "Received %d bytes of audio data (total: %llu)\n",
@@ -363,10 +363,10 @@ main (int argc, char *argv[])
363 if (0 > ret) 363 if (0 > ret)
364 { 364 {
365 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 365 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
366 _("Read error from STDIN: %s\n"), 366 _("Read error from STDIN: %s\n"),
367 strerror (errno)); 367 strerror (errno));
368 break; 368 break;
369 } 369 }
370 if (0 == ret) 370 if (0 == ret)
371 break; 371 break;
372 GNUNET_SERVER_mst_receive (stdin_mst, NULL, 372 GNUNET_SERVER_mst_receive (stdin_mst, NULL,
diff --git a/src/conversation/gnunet-helper-audio-record.c b/src/conversation/gnunet-helper-audio-record.c
index 54c9b7909..5e42de2b5 100644
--- a/src/conversation/gnunet-helper-audio-record.c
+++ b/src/conversation/gnunet-helper-audio-record.c
@@ -92,7 +92,7 @@ static unsigned char *opus_data;
92static float *pcm_buffer; 92static float *pcm_buffer;
93 93
94/** 94/**
95 * Length of the pcm data needed for one OPUS frame 95 * Length of the pcm data needed for one OPUS frame
96 */ 96 */
97static int pcm_length; 97static int pcm_length;
98 98
@@ -151,7 +151,7 @@ packetizer ()
151 size_t off; 151 size_t off;
152 ssize_t ret; 152 ssize_t ret;
153 int len; // FIXME: int? 153 int len; // FIXME: int?
154 size_t msg_size; 154 size_t msg_size;
155 155
156 while (transmit_buffer_length >= transmit_buffer_index + pcm_length) 156 while (transmit_buffer_length >= transmit_buffer_index + pcm_length)
157 { 157 {
@@ -195,9 +195,9 @@ packetizer ()
195 if (0 != new_size) 195 if (0 != new_size)
196 { 196 {
197 nbuf = pa_xmalloc (new_size); 197 nbuf = pa_xmalloc (new_size);
198 memmove (nbuf, 198 memmove (nbuf,
199 &transmit_buffer[transmit_buffer_index], 199 &transmit_buffer[transmit_buffer_index],
200 new_size); 200 new_size);
201 pa_xfree (transmit_buffer); 201 pa_xfree (transmit_buffer);
202 transmit_buffer = nbuf; 202 transmit_buffer = nbuf;
203 } 203 }
@@ -207,7 +207,7 @@ packetizer ()
207 transmit_buffer = NULL; 207 transmit_buffer = NULL;
208 } 208 }
209 transmit_buffer_index = 0; 209 transmit_buffer_index = 0;
210 transmit_buffer_length = new_size; 210 transmit_buffer_length = new_size;
211} 211}
212 212
213 213
@@ -216,7 +216,7 @@ packetizer ()
216 */ 216 */
217static void 217static void
218stream_read_callback (pa_stream * s, 218stream_read_callback (pa_stream * s,
219 size_t length, 219 size_t length,
220 void *userdata) 220 void *userdata)
221{ 221{
222 const void *data; 222 const void *data;
@@ -233,7 +233,7 @@ stream_read_callback (pa_stream * s,
233 233
234 if (pa_stream_peek (s, (const void **) &data, &length) < 0) 234 if (pa_stream_peek (s, (const void **) &data, &length) < 0)
235 { 235 {
236 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 236 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
237 _("pa_stream_peek() failed: %s\n"), 237 _("pa_stream_peek() failed: %s\n"),
238 pa_strerror (pa_context_errno (context))); 238 pa_strerror (pa_context_errno (context)));
239 quit (1); 239 quit (1);
@@ -243,9 +243,9 @@ stream_read_callback (pa_stream * s,
243 GNUNET_assert (length > 0); 243 GNUNET_assert (length > 0);
244 if (NULL != transmit_buffer) 244 if (NULL != transmit_buffer)
245 { 245 {
246 transmit_buffer = pa_xrealloc (transmit_buffer, 246 transmit_buffer = pa_xrealloc (transmit_buffer,
247 transmit_buffer_length + length); 247 transmit_buffer_length + length);
248 memcpy (&transmit_buffer[transmit_buffer_length], 248 memcpy (&transmit_buffer[transmit_buffer_length],
249 data, 249 data,
250 length); 250 length);
251 transmit_buffer_length += length; 251 transmit_buffer_length += length;
@@ -266,12 +266,12 @@ stream_read_callback (pa_stream * s,
266 * Exit callback for SIGTERM and SIGINT 266 * Exit callback for SIGTERM and SIGINT
267 */ 267 */
268static void 268static void
269exit_signal_callback (pa_mainloop_api * m, 269exit_signal_callback (pa_mainloop_api * m,
270 pa_signal_event * e, 270 pa_signal_event * e,
271 int sig, 271 int sig,
272 void *userdata) 272 void *userdata)
273{ 273{
274 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 274 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
275 _("Got signal, exiting.\n")); 275 _("Got signal, exiting.\n"));
276 quit (1); 276 quit (1);
277} 277}
@@ -289,17 +289,17 @@ stream_state_callback (pa_stream * s, void *userdata)
289 { 289 {
290 case PA_STREAM_CREATING: 290 case PA_STREAM_CREATING:
291 case PA_STREAM_TERMINATED: 291 case PA_STREAM_TERMINATED:
292 break; 292 break;
293 case PA_STREAM_READY: 293 case PA_STREAM_READY:
294 { 294 {
295 const pa_buffer_attr *a; 295 const pa_buffer_attr *a;
296 296
297 char cmt[PA_CHANNEL_MAP_SNPRINT_MAX], 297 char cmt[PA_CHANNEL_MAP_SNPRINT_MAX],
298 sst[PA_SAMPLE_SPEC_SNPRINT_MAX]; 298 sst[PA_SAMPLE_SPEC_SNPRINT_MAX];
299 299
300 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 300 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
301 _("Stream successfully created.\n")); 301 _("Stream successfully created.\n"));
302 302
303 if (!(a = pa_stream_get_buffer_attr (s))) 303 if (!(a = pa_stream_get_buffer_attr (s)))
304 { 304 {
305 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 305 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -313,24 +313,24 @@ stream_state_callback (pa_stream * s, void *userdata)
313 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 313 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
314 _("Buffer metrics: maxlength=%u, fragsize=%u\n"), 314 _("Buffer metrics: maxlength=%u, fragsize=%u\n"),
315 a->maxlength, a->fragsize); 315 a->maxlength, a->fragsize);
316 } 316 }
317 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 317 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
318 _("Using sample spec '%s', channel map '%s'.\n"), 318 _("Using sample spec '%s', channel map '%s'.\n"),
319 pa_sample_spec_snprint (sst, sizeof (sst), 319 pa_sample_spec_snprint (sst, sizeof (sst),
320 pa_stream_get_sample_spec (s)), 320 pa_stream_get_sample_spec (s)),
321 pa_channel_map_snprint (cmt, sizeof (cmt), 321 pa_channel_map_snprint (cmt, sizeof (cmt),
322 pa_stream_get_channel_map (s))); 322 pa_stream_get_channel_map (s)));
323 323
324 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 324 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
325 _("Connected to device %s (%u, %ssuspended).\n"), 325 _("Connected to device %s (%u, %ssuspended).\n"),
326 pa_stream_get_device_name (s), 326 pa_stream_get_device_name (s),
327 pa_stream_get_device_index (s), 327 pa_stream_get_device_index (s),
328 pa_stream_is_suspended (s) ? "" : "not "); 328 pa_stream_is_suspended (s) ? "" : "not ");
329 } 329 }
330 break; 330 break;
331 case PA_STREAM_FAILED: 331 case PA_STREAM_FAILED:
332 default: 332 default:
333 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 333 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
334 _("Stream error: %s\n"), 334 _("Stream error: %s\n"),
335 pa_strerror (pa_context_errno (pa_stream_get_context (s)))); 335 pa_strerror (pa_context_errno (pa_stream_get_context (s))));
336 quit (1); 336 quit (1);
@@ -357,9 +357,9 @@ context_state_callback (pa_context * c,
357 { 357 {
358 int r; 358 int r;
359 pa_buffer_attr na; 359 pa_buffer_attr na;
360 360
361 GNUNET_assert (!stream_in); 361 GNUNET_assert (!stream_in);
362 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 362 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
363 _("Connection established.\n")); 363 _("Connection established.\n"));
364 if (! (stream_in = 364 if (! (stream_in =
365 pa_stream_new (c, "GNUNET_VoIP recorder", &sample_spec, NULL))) 365 pa_stream_new (c, "GNUNET_VoIP recorder", &sample_spec, NULL)))
@@ -374,7 +374,7 @@ context_state_callback (pa_context * c,
374 memset (&na, 0, sizeof (na)); 374 memset (&na, 0, sizeof (na));
375 na.maxlength = UINT32_MAX; 375 na.maxlength = UINT32_MAX;
376 na.fragsize = pcm_length; 376 na.fragsize = pcm_length;
377 if ((r = pa_stream_connect_record (stream_in, NULL, &na, 377 if ((r = pa_stream_connect_record (stream_in, NULL, &na,
378 PA_STREAM_ADJUST_LATENCY)) < 0) 378 PA_STREAM_ADJUST_LATENCY)) < 0)
379 { 379 {
380 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 380 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -382,12 +382,12 @@ context_state_callback (pa_context * c,
382 pa_strerror (pa_context_errno (c))); 382 pa_strerror (pa_context_errno (c)));
383 goto fail; 383 goto fail;
384 } 384 }
385 385
386 break; 386 break;
387 } 387 }
388 case PA_CONTEXT_TERMINATED: 388 case PA_CONTEXT_TERMINATED:
389 quit (0); 389 quit (0);
390 break; 390 break;
391 case PA_CONTEXT_FAILED: 391 case PA_CONTEXT_FAILED:
392 default: 392 default:
393 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 393 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -413,13 +413,13 @@ pa_init ()
413 413
414 if (!pa_sample_spec_valid (&sample_spec)) 414 if (!pa_sample_spec_valid (&sample_spec))
415 { 415 {
416 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 416 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
417 _("Wrong Spec\n")); 417 _("Wrong Spec\n"));
418 } 418 }
419 /* set up main record loop */ 419 /* set up main record loop */
420 if (!(m = pa_mainloop_new ())) 420 if (!(m = pa_mainloop_new ()))
421 { 421 {
422 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 422 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
423 _("pa_mainloop_new() failed.\n")); 423 _("pa_mainloop_new() failed.\n"));
424 } 424 }
425 mainloop_api = pa_mainloop_get_api (m); 425 mainloop_api = pa_mainloop_get_api (m);
@@ -434,9 +434,9 @@ pa_init ()
434 434
435 if (!(context = pa_context_new (mainloop_api, "GNUNET VoIP"))) 435 if (!(context = pa_context_new (mainloop_api, "GNUNET VoIP")))
436 { 436 {
437 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 437 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
438 _("pa_context_new() failed.\n")); 438 _("pa_context_new() failed.\n"));
439 } 439 }
440 pa_context_set_state_callback (context, &context_state_callback, NULL); 440 pa_context_set_state_callback (context, &context_state_callback, NULL);
441 if (pa_context_connect (context, NULL, 0, NULL) < 0) 441 if (pa_context_connect (context, NULL, 0, NULL) < 0)
442 { 442 {
@@ -446,7 +446,7 @@ pa_init ()
446 } 446 }
447 if (pa_mainloop_run (m, &i) < 0) 447 if (pa_mainloop_run (m, &i) < 0)
448 { 448 {
449 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 449 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
450 _("pa_mainloop_run() failed.\n")); 450 _("pa_mainloop_run() failed.\n"));
451 } 451 }
452} 452}
@@ -466,7 +466,7 @@ opus_init ()
466 pcm_buffer = pa_xmalloc (pcm_length); 466 pcm_buffer = pa_xmalloc (pcm_length);
467 opus_data = GNUNET_malloc (max_payload_bytes); 467 opus_data = GNUNET_malloc (max_payload_bytes);
468 enc = opus_encoder_create (SAMPLING_RATE, 468 enc = opus_encoder_create (SAMPLING_RATE,
469 channels, 469 channels,
470 OPUS_APPLICATION_VOIP, 470 OPUS_APPLICATION_VOIP,
471 &err); 471 &err);
472 opus_encoder_ctl (enc, 472 opus_encoder_ctl (enc,
diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c
index 85bbc0481..d19be5318 100644
--- a/src/conversation/gnunet-service-conversation.c
+++ b/src/conversation/gnunet-service-conversation.c
@@ -1,17 +1,17 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2013 Christian Grothoff (and other contributing authors) 3 (C) 2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version. 8 option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
@@ -105,7 +105,7 @@ struct Line
105 * Handle for the reliable tunnel (contol data) 105 * Handle for the reliable tunnel (contol data)
106 */ 106 */
107 struct GNUNET_MESH_Tunnel *tunnel_reliable; 107 struct GNUNET_MESH_Tunnel *tunnel_reliable;
108 108
109 /** 109 /**
110 * Handle for unreliable tunnel (audio data) 110 * Handle for unreliable tunnel (audio data)
111 */ 111 */
@@ -153,7 +153,7 @@ struct Line
153 153
154 /** 154 /**
155 * Current status of this line. 155 * Current status of this line.
156 */ 156 */
157 enum LineStatus status; 157 enum LineStatus status;
158 158
159}; 159};
@@ -374,7 +374,7 @@ mq_done_finish_caller_shutdown (void *cls)
374 case LS_CALLER_SHUTDOWN: 374 case LS_CALLER_SHUTDOWN:
375 destroy_line_mesh_tunnels (line); 375 destroy_line_mesh_tunnels (line);
376 break; 376 break;
377 } 377 }
378} 378}
379 379
380 380
@@ -536,7 +536,7 @@ transmit_line_audio (void *cls,
536{ 536{
537 struct Line *line = cls; 537 struct Line *line = cls;
538 struct MeshAudioMessage *mam = buf; 538 struct MeshAudioMessage *mam = buf;
539 539
540 line->unreliable_mth = NULL; 540 line->unreliable_mth = NULL;
541 if ( (NULL == buf) || 541 if ( (NULL == buf) ||
542 (size < sizeof (struct MeshAudioMessage) + line->audio_size) ) 542 (size < sizeof (struct MeshAudioMessage) + line->audio_size) )
@@ -553,7 +553,7 @@ transmit_line_audio (void *cls,
553 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 553 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
554 "Sending %u bytes of audio data via mesh\n", 554 "Sending %u bytes of audio data via mesh\n",
555 line->audio_size); 555 line->audio_size);
556 return sizeof (struct MeshAudioMessage) + line->audio_size; 556 return sizeof (struct MeshAudioMessage) + line->audio_size;
557} 557}
558 558
559 559
@@ -610,7 +610,7 @@ handle_client_audio_message (void *cls,
610 { 610 {
611 GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK, 611 GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK,
612 _("Mesh audio channel not ready; audio data dropped\n")); 612 _("Mesh audio channel not ready; audio data dropped\n"));
613 GNUNET_SERVER_receive_done (client, GNUNET_OK); 613 GNUNET_SERVER_receive_done (client, GNUNET_OK);
614 return; 614 return;
615 } 615 }
616 if (NULL != line->unreliable_mth) 616 if (NULL != line->unreliable_mth)
@@ -632,7 +632,7 @@ handle_client_audio_message (void *cls,
632 line->unreliable_mth = GNUNET_MESH_notify_transmit_ready (line->tunnel_unreliable, 632 line->unreliable_mth = GNUNET_MESH_notify_transmit_ready (line->tunnel_unreliable,
633 GNUNET_NO, 633 GNUNET_NO,
634 GNUNET_TIME_UNIT_FOREVER_REL, 634 GNUNET_TIME_UNIT_FOREVER_REL,
635 sizeof (struct MeshAudioMessage) 635 sizeof (struct MeshAudioMessage)
636 + line->audio_size, 636 + line->audio_size,
637 &transmit_line_audio, 637 &transmit_line_audio,
638 line); 638 line);
@@ -641,7 +641,7 @@ handle_client_audio_message (void *cls,
641 641
642 642
643/** 643/**
644 * We are done signalling shutdown to the other peer. 644 * We are done signalling shutdown to the other peer.
645 * Destroy the tunnel. 645 * Destroy the tunnel.
646 * 646 *
647 * @param cls the `struct GNUNET_MESH_tunnel` to destroy 647 * @param cls the `struct GNUNET_MESH_tunnel` to destroy
@@ -650,7 +650,7 @@ static void
650mq_done_destroy_tunnel (void *cls) 650mq_done_destroy_tunnel (void *cls)
651{ 651{
652 struct GNUNET_MESH_Tunnel *tunnel = cls; 652 struct GNUNET_MESH_Tunnel *tunnel = cls;
653 653
654 GNUNET_MESH_tunnel_destroy (tunnel); 654 GNUNET_MESH_tunnel_destroy (tunnel);
655} 655}
656 656
@@ -675,7 +675,7 @@ handle_mesh_ring_message (void *cls,
675 struct GNUNET_MQ_Envelope *e; 675 struct GNUNET_MQ_Envelope *e;
676 struct MeshPhoneBusyMessage *busy; 676 struct MeshPhoneBusyMessage *busy;
677 struct ClientPhoneRingMessage cring; 677 struct ClientPhoneRingMessage cring;
678 678
679 msg = (const struct MeshPhoneRingMessage *) message; 679 msg = (const struct MeshPhoneRingMessage *) message;
680 if ( (msg->purpose.size != htonl (sizeof (struct GNUNET_PeerIdentity) * 2 + 680 if ( (msg->purpose.size != htonl (sizeof (struct GNUNET_PeerIdentity) * 2 +
681 sizeof (struct GNUNET_TIME_AbsoluteNBO) + 681 sizeof (struct GNUNET_TIME_AbsoluteNBO) +
@@ -690,11 +690,11 @@ handle_mesh_ring_message (void *cls,
690 GNUNET_break_op (0); 690 GNUNET_break_op (0);
691 return GNUNET_SYSERR; 691 return GNUNET_SYSERR;
692 } 692 }
693 for (line = lines_head; NULL != line; line = line->next) 693 for (line = lines_head; NULL != line; line = line->next)
694 if ( (line->local_line == ntohl (msg->remote_line)) && 694 if ( (line->local_line == ntohl (msg->remote_line)) &&
695 (LS_CALLEE_LISTEN == line->status) ) 695 (LS_CALLEE_LISTEN == line->status) )
696 break; 696 break;
697 if (NULL == line) 697 if (NULL == line)
698 { 698 {
699 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 699 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
700 _("No available phone for incoming call on line %u, sending BUSY signal\n"), 700 _("No available phone for incoming call on line %u, sending BUSY signal\n"),
@@ -748,7 +748,7 @@ handle_mesh_hangup_message (void *cls,
748 size_t len = ntohs (message->size) - sizeof (struct MeshPhoneHangupMessage); 748 size_t len = ntohs (message->size) - sizeof (struct MeshPhoneHangupMessage);
749 char buf[len + sizeof (struct ClientPhoneHangupMessage)]; 749 char buf[len + sizeof (struct ClientPhoneHangupMessage)];
750 struct ClientPhoneHangupMessage *hup; 750 struct ClientPhoneHangupMessage *hup;
751 751
752 msg = (const struct MeshPhoneHangupMessage *) message; 752 msg = (const struct MeshPhoneHangupMessage *) message;
753 len = ntohs (msg->header.size) - sizeof (struct MeshPhoneHangupMessage); 753 len = ntohs (msg->header.size) - sizeof (struct MeshPhoneHangupMessage);
754 reason = (const char *) &msg[1]; 754 reason = (const char *) &msg[1];
@@ -831,7 +831,7 @@ handle_mesh_pickup_message (void *cls,
831 size_t len = ntohs (message->size) - sizeof (struct MeshPhonePickupMessage); 831 size_t len = ntohs (message->size) - sizeof (struct MeshPhonePickupMessage);
832 char buf[len + sizeof (struct ClientPhonePickupMessage)]; 832 char buf[len + sizeof (struct ClientPhonePickupMessage)];
833 struct ClientPhonePickupMessage *pick; 833 struct ClientPhonePickupMessage *pick;
834 834
835 msg = (const struct MeshPhonePickupMessage *) message; 835 msg = (const struct MeshPhonePickupMessage *) message;
836 len = ntohs (msg->header.size) - sizeof (struct MeshPhonePickupMessage); 836 len = ntohs (msg->header.size) - sizeof (struct MeshPhonePickupMessage);
837 metadata = (const char *) &msg[1]; 837 metadata = (const char *) &msg[1];
@@ -895,7 +895,7 @@ handle_mesh_pickup_message (void *cls,
895 if (NULL == line->tunnel_unreliable) 895 if (NULL == line->tunnel_unreliable)
896 { 896 {
897 GNUNET_break (0); 897 GNUNET_break (0);
898 } 898 }
899 return GNUNET_OK; 899 return GNUNET_OK;
900} 900}
901 901
@@ -988,7 +988,7 @@ handle_mesh_audio_message (void *cls,
988 char buf[msize + sizeof (struct ClientAudioMessage)]; 988 char buf[msize + sizeof (struct ClientAudioMessage)];
989 struct ClientAudioMessage *cam; 989 struct ClientAudioMessage *cam;
990 const union GNUNET_MESH_TunnelInfo *info; 990 const union GNUNET_MESH_TunnelInfo *info;
991 991
992 msg = (const struct MeshAudioMessage *) message; 992 msg = (const struct MeshAudioMessage *) message;
993 if (NULL == line) 993 if (NULL == line)
994 { 994 {
@@ -1014,7 +1014,7 @@ handle_mesh_audio_message (void *cls,
1014 "Received AUDIO data for non-existing line %u, dropping.\n", 1014 "Received AUDIO data for non-existing line %u, dropping.\n",
1015 ntohl (msg->remote_line)); 1015 ntohl (msg->remote_line));
1016 return GNUNET_SYSERR; 1016 return GNUNET_SYSERR;
1017 } 1017 }
1018 line->tunnel_unreliable = tunnel; 1018 line->tunnel_unreliable = tunnel;
1019 *tunnel_ctx = line; 1019 *tunnel_ctx = line;
1020 } 1020 }
@@ -1047,11 +1047,11 @@ handle_mesh_audio_message (void *cls,
1047static void * 1047static void *
1048inbound_tunnel (void *cls, 1048inbound_tunnel (void *cls,
1049 struct GNUNET_MESH_Tunnel *tunnel, 1049 struct GNUNET_MESH_Tunnel *tunnel,
1050 const struct GNUNET_PeerIdentity *initiator, 1050 const struct GNUNET_PeerIdentity *initiator,
1051 uint32_t port) 1051 uint32_t port)
1052{ 1052{
1053 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1053 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1054 _("Received incoming tunnel on port %u\n"), 1054 _("Received incoming tunnel on port %u\n"),
1055 (unsigned int) port); 1055 (unsigned int) port);
1056 return NULL; 1056 return NULL;
1057} 1057}
@@ -1131,7 +1131,7 @@ inbound_end (void *cls,
1131 * @param client identification of the client 1131 * @param client identification of the client
1132 */ 1132 */
1133static void 1133static void
1134handle_client_disconnect (void *cls, 1134handle_client_disconnect (void *cls,
1135 struct GNUNET_SERVER_Client *client) 1135 struct GNUNET_SERVER_Client *client)
1136{ 1136{
1137 struct Line *line; 1137 struct Line *line;
@@ -1155,7 +1155,7 @@ handle_client_disconnect (void *cls,
1155 1155
1156/** 1156/**
1157 * Shutdown nicely 1157 * Shutdown nicely
1158 * 1158 *
1159 * @param cls closure, NULL 1159 * @param cls closure, NULL
1160 * @param tc the task context 1160 * @param tc the task context
1161 */ 1161 */
@@ -1184,7 +1184,7 @@ do_shutdown (void *cls,
1184 * @param c configuration 1184 * @param c configuration
1185 */ 1185 */
1186static void 1186static void
1187run (void *cls, 1187run (void *cls,
1188 struct GNUNET_SERVER_Handle *server, 1188 struct GNUNET_SERVER_Handle *server,
1189 const struct GNUNET_CONFIGURATION_Handle *c) 1189 const struct GNUNET_CONFIGURATION_Handle *c)
1190{ 1190{
@@ -1210,23 +1210,23 @@ run (void *cls,
1210 {&handle_mesh_ring_message, 1210 {&handle_mesh_ring_message,
1211 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING, 1211 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING,
1212 sizeof (struct MeshPhoneRingMessage)}, 1212 sizeof (struct MeshPhoneRingMessage)},
1213 {&handle_mesh_hangup_message, 1213 {&handle_mesh_hangup_message,
1214 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP, 1214 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP,
1215 0}, 1215 0},
1216 {&handle_mesh_pickup_message, 1216 {&handle_mesh_pickup_message,
1217 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP, 1217 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP,
1218 0}, 1218 0},
1219 {&handle_mesh_busy_message, 1219 {&handle_mesh_busy_message,
1220 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_BUSY, 1220 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_BUSY,
1221 sizeof (struct MeshPhoneBusyMessage)}, 1221 sizeof (struct MeshPhoneBusyMessage)},
1222 {&handle_mesh_audio_message, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO, 1222 {&handle_mesh_audio_message, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO,
1223 0}, 1223 0},
1224 {NULL, 0, 0} 1224 {NULL, 0, 0}
1225 }; 1225 };
1226 static uint32_t ports[] = { 1226 static uint32_t ports[] = {
1227 GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL, 1227 GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL,
1228 GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO, 1228 GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO,
1229 0 1229 0
1230 }; 1230 };
1231 1231
1232 cfg = c; 1232 cfg = c;
@@ -1236,8 +1236,8 @@ run (void *cls,
1236 mesh = GNUNET_MESH_connect (cfg, 1236 mesh = GNUNET_MESH_connect (cfg,
1237 NULL, 1237 NULL,
1238 &inbound_tunnel, 1238 &inbound_tunnel,
1239 &inbound_end, 1239 &inbound_end,
1240 mesh_handlers, 1240 mesh_handlers,
1241 ports); 1241 ports);
1242 1242
1243 if (NULL == mesh) 1243 if (NULL == mesh)
@@ -1249,7 +1249,7 @@ run (void *cls,
1249 nc = GNUNET_SERVER_notification_context_create (server, 16); 1249 nc = GNUNET_SERVER_notification_context_create (server, 16);
1250 GNUNET_SERVER_add_handlers (server, server_handlers); 1250 GNUNET_SERVER_add_handlers (server, server_handlers);
1251 GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL); 1251 GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL);
1252 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 1252 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
1253 &do_shutdown, 1253 &do_shutdown,
1254 NULL); 1254 NULL);
1255} 1255}
@@ -1263,12 +1263,12 @@ run (void *cls,
1263 * @return 0 ok, 1 on error 1263 * @return 0 ok, 1 on error
1264 */ 1264 */
1265int 1265int
1266main (int argc, 1266main (int argc,
1267 char *const *argv) 1267 char *const *argv)
1268{ 1268{
1269 return (GNUNET_OK == 1269 return (GNUNET_OK ==
1270 GNUNET_SERVICE_run (argc, argv, 1270 GNUNET_SERVICE_run (argc, argv,
1271 "conversation", 1271 "conversation",
1272 GNUNET_SERVICE_OPTION_NONE, 1272 GNUNET_SERVICE_OPTION_NONE,
1273 &run, NULL)) ? 0 : 1; 1273 &run, NULL)) ? 0 : 1;
1274} 1274}
diff --git a/src/conversation/microphone.c b/src/conversation/microphone.c
index 2c399c74d..bc6044120 100644
--- a/src/conversation/microphone.c
+++ b/src/conversation/microphone.c
@@ -1,17 +1,17 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2013 Christian Grothoff (and other contributing authors) 3 (C) 2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version. 8 option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
@@ -101,8 +101,8 @@ enable (void *cls,
101 GNUNET_MICROPHONE_RecordedDataCallback rdc, 101 GNUNET_MICROPHONE_RecordedDataCallback rdc,
102 void *rdc_cls) 102 void *rdc_cls)
103{ 103{
104 struct Microphone *mic = cls; 104 struct Microphone *mic = cls;
105 static char * const record_helper_argv[] = 105 static char * const record_helper_argv[] =
106 { 106 {
107 "gnunet-helper-audio-record", 107 "gnunet-helper-audio-record",
108 NULL 108 NULL
@@ -113,14 +113,14 @@ enable (void *cls,
113 mic->record_helper = GNUNET_HELPER_start (GNUNET_NO, 113 mic->record_helper = GNUNET_HELPER_start (GNUNET_NO,
114 "gnunet-helper-audio-record", 114 "gnunet-helper-audio-record",
115 record_helper_argv, 115 record_helper_argv,
116 &process_record_messages, 116 &process_record_messages,
117 NULL, mic); 117 NULL, mic);
118 if (NULL == mic->record_helper) 118 if (NULL == mic->record_helper)
119 { 119 {
120 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 120 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
121 _("Could not start record audio helper\n")); 121 _("Could not start record audio helper\n"));
122 return GNUNET_SYSERR; 122 return GNUNET_SYSERR;
123 } 123 }
124 return GNUNET_OK; 124 return GNUNET_OK;
125} 125}
126 126
diff --git a/src/conversation/speaker.c b/src/conversation/speaker.c
index d67346f1f..0f8661834 100644
--- a/src/conversation/speaker.c
+++ b/src/conversation/speaker.c
@@ -1,17 +1,17 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2013 Christian Grothoff (and other contributing authors) 3 (C) 2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version. 8 option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
@@ -57,17 +57,17 @@ struct Speaker
57static int 57static int
58enable (void *cls) 58enable (void *cls)
59{ 59{
60 struct Speaker *spe = cls; 60 struct Speaker *spe = cls;
61 static char *playback_helper_argv[] = 61 static char *playback_helper_argv[] =
62 { 62 {
63 "gnunet-helper-audio-playback", 63 "gnunet-helper-audio-playback",
64 NULL 64 NULL
65 }; 65 };
66 66
67 spe->playback_helper = GNUNET_HELPER_start (GNUNET_NO, 67 spe->playback_helper = GNUNET_HELPER_start (GNUNET_NO,
68 "gnunet-helper-audio-playback", 68 "gnunet-helper-audio-playback",
69 playback_helper_argv, 69 playback_helper_argv,
70 NULL, 70 NULL,
71 NULL, spe); 71 NULL, spe);
72 if (NULL == spe->playback_helper) 72 if (NULL == spe->playback_helper)
73 { 73 {
@@ -143,8 +143,8 @@ play (void *cls,
143 am->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO); 143 am->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO);
144 memcpy (&am[1], data, data_size); 144 memcpy (&am[1], data, data_size);
145 (void) GNUNET_HELPER_send (spe->playback_helper, 145 (void) GNUNET_HELPER_send (spe->playback_helper,
146 &am->header, 146 &am->header,
147 GNUNET_NO, 147 GNUNET_NO,
148 NULL, NULL); 148 NULL, NULL);
149} 149}
150 150
diff --git a/src/conversation/test_conversation_api.c b/src/conversation/test_conversation_api.c
index af2ff75e4..d18616721 100644
--- a/src/conversation/test_conversation_api.c
+++ b/src/conversation/test_conversation_api.c
@@ -76,7 +76,7 @@ check ()
76int 76int
77main (int argc, char *argv[]) 77main (int argc, char *argv[])
78{ 78{
79 GNUNET_log_setup ("test_conversation_api", 79 GNUNET_log_setup ("test_conversation_api",
80 "WARNING", 80 "WARNING",
81 NULL); 81 NULL);
82 return check (); 82 return check ();
diff --git a/src/core/core_api.c b/src/core/core_api.c
index 8b9389bdf..7aa3e0519 100644
--- a/src/core/core_api.c
+++ b/src/core/core_api.c
@@ -357,7 +357,7 @@ reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
357 * @return #GNUNET_YES (continue) 357 * @return #GNUNET_YES (continue)
358 */ 358 */
359static int 359static int
360disconnect_and_free_peer_entry (void *cls, 360disconnect_and_free_peer_entry (void *cls,
361 const struct GNUNET_PeerIdentity *key, 361 const struct GNUNET_PeerIdentity *key,
362 void *value) 362 void *value)
363{ 363{
@@ -572,7 +572,7 @@ transmission_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
572 * @param cls closure with the 'struct GNUNET_CORE_Handle' 572 * @param cls closure with the 'struct GNUNET_CORE_Handle'
573 * @param size number of bytes available in @a buf 573 * @param size number of bytes available in @a buf
574 * @param buf where the callee should write the message 574 * @param buf where the callee should write the message
575 * @return number of bytes written to buf 575 * @return number of bytes written to buf
576 */ 576 */
577static size_t 577static size_t
578transmit_message (void *cls, size_t size, void *buf) 578transmit_message (void *cls, size_t size, void *buf)
@@ -649,7 +649,7 @@ transmit_message (void *cls, size_t size, void *buf)
649 ret = 649 ret =
650 th->get_message (th->get_message_cls, 650 th->get_message (th->get_message_cls,
651 size - sizeof (struct SendMessage), &sm[1]); 651 size - sizeof (struct SendMessage), &sm[1]);
652 652
653 LOG (GNUNET_ERROR_TYPE_DEBUG, 653 LOG (GNUNET_ERROR_TYPE_DEBUG,
654 "Transmitting SEND request to `%s' yielded %u bytes.\n", 654 "Transmitting SEND request to `%s' yielded %u bytes.\n",
655 GNUNET_i2s (&pr->peer), ret); 655 GNUNET_i2s (&pr->peer), ret);
@@ -1093,7 +1093,7 @@ reconnect (struct GNUNET_CORE_Handle *h)
1093 else 1093 else
1094 opt |= GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND; 1094 opt |= GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND;
1095 } 1095 }
1096 LOG (GNUNET_ERROR_TYPE_INFO, 1096 LOG (GNUNET_ERROR_TYPE_INFO,
1097 "(Re)connecting to CORE service, monitoring messages of type %u\n", 1097 "(Re)connecting to CORE service, monitoring messages of type %u\n",
1098 opt); 1098 opt);
1099 1099
diff --git a/src/core/gnunet-core.c b/src/core/gnunet-core.c
index cfdae33bf..4dbe49c50 100644
--- a/src/core/gnunet-core.c
+++ b/src/core/gnunet-core.c
@@ -72,7 +72,7 @@ shutdown_task (void *cls,
72 * @param peer peer identity this notification is about 72 * @param peer peer identity this notification is about
73 */ 73 */
74static void 74static void
75connected_peer_callback (void *cls, 75connected_peer_callback (void *cls,
76 const struct GNUNET_PeerIdentity *peer) 76 const struct GNUNET_PeerIdentity *peer)
77{ 77{
78 if (NULL == peer) 78 if (NULL == peer)
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c
index 5665fc82a..ada9b7bd9 100644
--- a/src/core/gnunet-service-core.c
+++ b/src/core/gnunet-service-core.c
@@ -58,7 +58,7 @@ static struct GNUNET_SERVER_Handle *GSC_server;
58/** 58/**
59 * Last task run during shutdown. Disconnects us from 59 * Last task run during shutdown. Disconnects us from
60 * the transport. 60 * the transport.
61 * 61 *
62 * @param cls NULL, unused 62 * @param cls NULL, unused
63 * @param tc scheduler context, unused 63 * @param tc scheduler context, unused
64 */ 64 */
@@ -114,7 +114,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
114 pk = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile); 114 pk = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile);
115 GNUNET_free (keyfile); 115 GNUNET_free (keyfile);
116 GNUNET_assert (NULL != pk); 116 GNUNET_assert (NULL != pk);
117 if ((GNUNET_OK != GSC_KX_init (pk)) || 117 if ((GNUNET_OK != GSC_KX_init (pk)) ||
118 (GNUNET_OK != GSC_NEIGHBOURS_init ())) 118 (GNUNET_OK != GSC_NEIGHBOURS_init ()))
119 { 119 {
120 GNUNET_SCHEDULER_shutdown (); 120 GNUNET_SCHEDULER_shutdown ();
diff --git a/src/core/gnunet-service-core_clients.c b/src/core/gnunet-service-core_clients.c
index bcbb56ef3..55ebb9132 100644
--- a/src/core/gnunet-service-core_clients.c
+++ b/src/core/gnunet-service-core_clients.c
@@ -517,7 +517,7 @@ client_tokenizer_callback (void *cls, void *client,
517 GNUNET_snprintf (buf, sizeof (buf), 517 GNUNET_snprintf (buf, sizeof (buf),
518 gettext_noop ("# bytes of messages of type %u received"), 518 gettext_noop ("# bytes of messages of type %u received"),
519 (unsigned int) ntohs (message->type)); 519 (unsigned int) ntohs (message->type));
520 GNUNET_STATISTICS_update (GSC_stats, buf, ntohs (message->size), GNUNET_NO); 520 GNUNET_STATISTICS_update (GSC_stats, buf, ntohs (message->size), GNUNET_NO);
521 if (0 == 521 if (0 ==
522 memcmp (&car->target, &GSC_my_identity, 522 memcmp (&car->target, &GSC_my_identity,
523 sizeof (struct GNUNET_PeerIdentity))) 523 sizeof (struct GNUNET_PeerIdentity)))
@@ -536,7 +536,7 @@ client_tokenizer_callback (void *cls, void *client,
536 GNUNET_CORE_OPTION_SEND_FULL_INBOUND); 536 GNUNET_CORE_OPTION_SEND_FULL_INBOUND);
537 GSC_CLIENTS_deliver_message (&GSC_my_identity, message, 537 GSC_CLIENTS_deliver_message (&GSC_my_identity, message,
538 sizeof (struct GNUNET_MessageHeader), 538 sizeof (struct GNUNET_MessageHeader),
539 GNUNET_CORE_OPTION_SEND_HDR_INBOUND); 539 GNUNET_CORE_OPTION_SEND_HDR_INBOUND);
540 } 540 }
541 else 541 else
542 { 542 {
@@ -548,7 +548,7 @@ client_tokenizer_callback (void *cls, void *client,
548 GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND); 548 GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND);
549 GSC_CLIENTS_deliver_message (&car->target, message, 549 GSC_CLIENTS_deliver_message (&car->target, message,
550 sizeof (struct GNUNET_MessageHeader), 550 sizeof (struct GNUNET_MessageHeader),
551 GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND); 551 GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND);
552 GSC_SESSIONS_transmit (car, message, tc->cork); 552 GSC_SESSIONS_transmit (car, message, tc->cork);
553 } 553 }
554 return GNUNET_OK; 554 return GNUNET_OK;
@@ -564,7 +564,7 @@ client_tokenizer_callback (void *cls, void *client,
564 * @return #GNUNET_YES (continue iteration) 564 * @return #GNUNET_YES (continue iteration)
565 */ 565 */
566static int 566static int
567destroy_active_client_request (void *cls, 567destroy_active_client_request (void *cls,
568 const struct GNUNET_PeerIdentity *key, 568 const struct GNUNET_PeerIdentity *key,
569 void *value) 569 void *value)
570{ 570{
@@ -765,7 +765,7 @@ GSC_CLIENTS_notify_clients_about_neighbour (const struct GNUNET_PeerIdentity
765 struct GSC_Client *c; 765 struct GSC_Client *c;
766 766
767 for (c = client_head; c != NULL; c = c->next) 767 for (c = client_head; c != NULL; c = c->next)
768 GSC_CLIENTS_notify_client_about_neighbour (c, neighbour, 768 GSC_CLIENTS_notify_client_about_neighbour (c, neighbour,
769 tmap_old, tmap_new); 769 tmap_old, tmap_new);
770} 770}
771 771
@@ -784,7 +784,7 @@ GSC_CLIENTS_notify_clients_about_neighbour (const struct GNUNET_PeerIdentity
784void 784void
785GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender, 785GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender,
786 const struct GNUNET_MessageHeader *msg, 786 const struct GNUNET_MessageHeader *msg,
787 uint16_t msize, 787 uint16_t msize,
788 uint32_t options) 788 uint32_t options)
789{ 789{
790 size_t size = msize + sizeof (struct NotifyTrafficMessage); 790 size_t size = msize + sizeof (struct NotifyTrafficMessage);
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c
index bf3c5cdaf..a74b3ae74 100644
--- a/src/core/gnunet-service-core_kx.c
+++ b/src/core/gnunet-service-core_kx.c
@@ -101,7 +101,7 @@ struct EphemeralKeyMessage
101 * At what time was this key created (beginning of validity). 101 * At what time was this key created (beginning of validity).
102 */ 102 */
103 struct GNUNET_TIME_AbsoluteNBO creation_time; 103 struct GNUNET_TIME_AbsoluteNBO creation_time;
104 104
105 /** 105 /**
106 * When does the given ephemeral key expire (end of validity). 106 * When does the given ephemeral key expire (end of validity).
107 */ 107 */
@@ -111,7 +111,7 @@ struct EphemeralKeyMessage
111 * Ephemeral public ECC key (always for NIST P-521) encoded in a format suitable 111 * Ephemeral public ECC key (always for NIST P-521) encoded in a format suitable
112 * for network transmission as created using 'gcry_sexp_sprint'. 112 * for network transmission as created using 'gcry_sexp_sprint'.
113 */ 113 */
114 struct GNUNET_CRYPTO_EccPublicEncryptKey ephemeral_key; 114 struct GNUNET_CRYPTO_EccPublicEncryptKey ephemeral_key;
115 115
116 /** 116 /**
117 * Public key of the signing peer (persistent version, not the ephemeral public key). 117 * Public key of the signing peer (persistent version, not the ephemeral public key).
@@ -407,7 +407,7 @@ static struct GSC_KeyExchangeInfo *kx_tail;
407/** 407/**
408 * Task scheduled for periodic re-generation (and thus rekeying) of our 408 * Task scheduled for periodic re-generation (and thus rekeying) of our
409 * ephemeral key. 409 * ephemeral key.
410 */ 410 */
411static GNUNET_SCHEDULER_TaskIdentifier rekey_task; 411static GNUNET_SCHEDULER_TaskIdentifier rekey_task;
412 412
413 413
@@ -424,10 +424,10 @@ derive_auth_key (struct GNUNET_CRYPTO_AuthKey *akey,
424{ 424{
425 static const char ctx[] = "authentication key"; 425 static const char ctx[] = "authentication key";
426 426
427 GNUNET_CRYPTO_hmac_derive_key (akey, skey, 427 GNUNET_CRYPTO_hmac_derive_key (akey, skey,
428 &seed, sizeof (seed), 428 &seed, sizeof (seed),
429 skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), 429 skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey),
430 ctx, sizeof (ctx), 430 ctx, sizeof (ctx),
431 NULL); 431 NULL);
432} 432}
433 433
@@ -473,8 +473,8 @@ derive_pong_iv (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
473 GNUNET_CRYPTO_symmetric_derive_iv (iv, skey, &seed, sizeof (seed), 473 GNUNET_CRYPTO_symmetric_derive_iv (iv, skey, &seed, sizeof (seed),
474 identity, 474 identity,
475 sizeof (struct GNUNET_PeerIdentity), 475 sizeof (struct GNUNET_PeerIdentity),
476 &challenge, sizeof (challenge), 476 &challenge, sizeof (challenge),
477 ctx, sizeof (ctx), 477 ctx, sizeof (ctx),
478 NULL); 478 NULL);
479} 479}
480 480
@@ -485,7 +485,7 @@ derive_pong_iv (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
485 * @param sender peer identity of the sender 485 * @param sender peer identity of the sender
486 * @param receiver peer identity of the sender 486 * @param receiver peer identity of the sender
487 * @param key_material high entropy key material to use 487 * @param key_material high entropy key material to use
488 * @param skey set to derived session key 488 * @param skey set to derived session key
489 */ 489 */
490static void 490static void
491derive_aes_key (const struct GNUNET_PeerIdentity *sender, 491derive_aes_key (const struct GNUNET_PeerIdentity *sender,
@@ -661,7 +661,7 @@ GSC_KX_start (const struct GNUNET_PeerIdentity *pid)
661 struct GNUNET_HashCode h1; 661 struct GNUNET_HashCode h1;
662 struct GNUNET_HashCode h2; 662 struct GNUNET_HashCode h2;
663 663
664 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 664 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
665 "Initiating key exchange with `%s'\n", 665 "Initiating key exchange with `%s'\n",
666 GNUNET_i2s (pid)); 666 GNUNET_i2s (pid));
667 GNUNET_STATISTICS_update (GSC_stats, 667 GNUNET_STATISTICS_update (GSC_stats,
@@ -675,12 +675,12 @@ GSC_KX_start (const struct GNUNET_PeerIdentity *pid)
675 kx); 675 kx);
676 GNUNET_CRYPTO_hash (pid, sizeof (struct GNUNET_PeerIdentity), &h1); 676 GNUNET_CRYPTO_hash (pid, sizeof (struct GNUNET_PeerIdentity), &h1);
677 GNUNET_CRYPTO_hash (&GSC_my_identity, sizeof (struct GNUNET_PeerIdentity), &h2); 677 GNUNET_CRYPTO_hash (&GSC_my_identity, sizeof (struct GNUNET_PeerIdentity), &h2);
678 678
679 if (0 < GNUNET_CRYPTO_hash_cmp (&h1, 679 if (0 < GNUNET_CRYPTO_hash_cmp (&h1,
680 &h2)) 680 &h2))
681 { 681 {
682 /* peer with "lower" identity starts KX, otherwise we typically end up 682 /* peer with "lower" identity starts KX, otherwise we typically end up
683 with both peers starting the exchange and transmit the 'set key' 683 with both peers starting the exchange and transmit the 'set key'
684 message twice */ 684 message twice */
685 kx->status = KX_STATE_KEY_SENT; 685 kx->status = KX_STATE_KEY_SENT;
686 send_key (kx); 686 send_key (kx);
@@ -744,10 +744,10 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx,
744 struct GNUNET_TIME_Absolute start_t; 744 struct GNUNET_TIME_Absolute start_t;
745 struct GNUNET_TIME_Absolute end_t; 745 struct GNUNET_TIME_Absolute end_t;
746 struct GNUNET_TIME_Absolute now; 746 struct GNUNET_TIME_Absolute now;
747 enum KxStateMachine sender_status; 747 enum KxStateMachine sender_status;
748 uint16_t size; 748 uint16_t size;
749 struct GNUNET_HashCode key_material; 749 struct GNUNET_HashCode key_material;
750 750
751 size = ntohs (msg->size); 751 size = ntohs (msg->size);
752 if (sizeof (struct EphemeralKeyMessage) != size) 752 if (sizeof (struct EphemeralKeyMessage) != size)
753 { 753 {
@@ -758,7 +758,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx,
758 end_t = GNUNET_TIME_absolute_ntoh (m->expiration_time); 758 end_t = GNUNET_TIME_absolute_ntoh (m->expiration_time);
759 if ( ( (KX_STATE_KEY_RECEIVED == kx->status) || 759 if ( ( (KX_STATE_KEY_RECEIVED == kx->status) ||
760 (KX_STATE_UP == kx->status) || 760 (KX_STATE_UP == kx->status) ||
761 (KX_STATE_REKEY_SENT == kx->status) ) && 761 (KX_STATE_REKEY_SENT == kx->status) ) &&
762 (end_t.abs_value_us <= kx->foreign_key_expires.abs_value_us) ) 762 (end_t.abs_value_us <= kx->foreign_key_expires.abs_value_us) )
763 { 763 {
764 GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# old ephemeral keys ignored"), 764 GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# old ephemeral keys ignored"),
@@ -777,7 +777,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx,
777 memcmp (&m->origin_identity, 777 memcmp (&m->origin_identity,
778 &kx->peer.public_key, 778 &kx->peer.public_key,
779 sizeof (struct GNUNET_PeerIdentity))) 779 sizeof (struct GNUNET_PeerIdentity)))
780 { 780 {
781 GNUNET_break_op (0); 781 GNUNET_break_op (0);
782 return; 782 return;
783 } 783 }
@@ -810,7 +810,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx,
810 } 810 }
811 if (GNUNET_OK != 811 if (GNUNET_OK !=
812 GNUNET_CRYPTO_ecc_ecdh (my_ephemeral_key, 812 GNUNET_CRYPTO_ecc_ecdh (my_ephemeral_key,
813 &m->ephemeral_key, 813 &m->ephemeral_key,
814 &key_material)) 814 &key_material))
815 { 815 {
816 GNUNET_break (0); 816 GNUNET_break (0);
@@ -834,7 +834,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx,
834 setup_fresh_ping (kx); 834 setup_fresh_ping (kx);
835 835
836 /* check if we still need to send the sender our key */ 836 /* check if we still need to send the sender our key */
837 sender_status = (enum KxStateMachine) ntohl (m->sender_status); 837 sender_status = (enum KxStateMachine) ntohl (m->sender_status);
838 switch (sender_status) 838 switch (sender_status)
839 { 839 {
840 case KX_STATE_DOWN: 840 case KX_STATE_DOWN:
@@ -844,7 +844,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx,
844 /* fine, need to send our key after updating our status, see below */ 844 /* fine, need to send our key after updating our status, see below */
845 break; 845 break;
846 case KX_STATE_KEY_RECEIVED: 846 case KX_STATE_KEY_RECEIVED:
847 case KX_STATE_UP: 847 case KX_STATE_UP:
848 case KX_STATE_REKEY_SENT: 848 case KX_STATE_REKEY_SENT:
849 /* other peer already got our key */ 849 /* other peer already got our key */
850 break; 850 break;
@@ -875,7 +875,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx,
875 send_key (kx); 875 send_key (kx);
876 send_ping (kx); 876 send_ping (kx);
877 break; 877 break;
878 case KX_STATE_UP: 878 case KX_STATE_UP:
879 kx->status = KX_STATE_REKEY_SENT; 879 kx->status = KX_STATE_REKEY_SENT;
880 if (KX_STATE_KEY_SENT == sender_status) 880 if (KX_STATE_KEY_SENT == sender_status)
881 send_key (kx); 881 send_key (kx);
@@ -922,7 +922,7 @@ GSC_KX_handle_ping (struct GSC_KeyExchangeInfo *kx,
922 GNUNET_STATISTICS_update (GSC_stats, 922 GNUNET_STATISTICS_update (GSC_stats,
923 gettext_noop ("# PING messages received"), 1, 923 gettext_noop ("# PING messages received"), 1,
924 GNUNET_NO); 924 GNUNET_NO);
925 if ( (kx->status != KX_STATE_KEY_RECEIVED) && 925 if ( (kx->status != KX_STATE_KEY_RECEIVED) &&
926 (kx->status != KX_STATE_UP) && 926 (kx->status != KX_STATE_UP) &&
927 (kx->status != KX_STATE_REKEY_SENT)) 927 (kx->status != KX_STATE_REKEY_SENT))
928 { 928 {
@@ -1128,7 +1128,7 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx,
1128 { 1128 {
1129 GNUNET_SCHEDULER_cancel (kx->retry_set_key_task); 1129 GNUNET_SCHEDULER_cancel (kx->retry_set_key_task);
1130 kx->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK; 1130 kx->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK;
1131 } 1131 }
1132 switch (kx->status) 1132 switch (kx->status)
1133 { 1133 {
1134 case KX_STATE_DOWN: 1134 case KX_STATE_DOWN:
@@ -1184,11 +1184,11 @@ send_key (struct GSC_KeyExchangeInfo *kx)
1184 kx->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK; 1184 kx->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK;
1185 } 1185 }
1186 /* always update sender status in SET KEY message */ 1186 /* always update sender status in SET KEY message */
1187 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1187 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1188 "Sending key to `%s' (my status: %d)\n", 1188 "Sending key to `%s' (my status: %d)\n",
1189 GNUNET_i2s (&kx->peer), 1189 GNUNET_i2s (&kx->peer),
1190 kx->status); 1190 kx->status);
1191 current_ekm.sender_status = htonl ((int32_t) (kx->status)); 1191 current_ekm.sender_status = htonl ((int32_t) (kx->status));
1192 GSC_NEIGHBOURS_transmit (&kx->peer, &current_ekm.header, 1192 GSC_NEIGHBOURS_transmit (&kx->peer, &current_ekm.header,
1193 kx->set_key_retry_frequency); 1193 kx->set_key_retry_frequency);
1194 kx->retry_set_key_task = 1194 kx->retry_set_key_task =
@@ -1236,8 +1236,8 @@ GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx,
1236 used - ENCRYPTED_HEADER_SIZE)); 1236 used - ENCRYPTED_HEADER_SIZE));
1237 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypted %u bytes for %s\n", 1237 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypted %u bytes for %s\n",
1238 used - ENCRYPTED_HEADER_SIZE, GNUNET_i2s (&kx->peer)); 1238 used - ENCRYPTED_HEADER_SIZE, GNUNET_i2s (&kx->peer));
1239 derive_auth_key (&auth_key, 1239 derive_auth_key (&auth_key,
1240 &kx->encrypt_key, 1240 &kx->encrypt_key,
1241 ph->iv_seed); 1241 ph->iv_seed);
1242 GNUNET_CRYPTO_hmac (&auth_key, &em->sequence_number, 1242 GNUNET_CRYPTO_hmac (&auth_key, &em->sequence_number,
1243 used - ENCRYPTED_HEADER_SIZE, &em->hmac); 1243 used - ENCRYPTED_HEADER_SIZE, &em->hmac);
@@ -1327,8 +1327,8 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx,
1327 if (0 != memcmp (&ph, &m->hmac, sizeof (struct GNUNET_HashCode))) 1327 if (0 != memcmp (&ph, &m->hmac, sizeof (struct GNUNET_HashCode)))
1328 { 1328 {
1329 /* checksum failed */ 1329 /* checksum failed */
1330 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1330 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1331 "Failed checksum validation for a message from `%s'\n", 1331 "Failed checksum validation for a message from `%s'\n",
1332 GNUNET_i2s (&kx->peer)); 1332 GNUNET_i2s (&kx->peer));
1333 return; 1333 return;
1334 } 1334 }
@@ -1542,7 +1542,7 @@ GSC_KX_init (struct GNUNET_CRYPTO_EccPrivateKey *pk)
1542{ 1542{
1543 GNUNET_assert (NULL != pk); 1543 GNUNET_assert (NULL != pk);
1544 my_private_key = pk; 1544 my_private_key = pk;
1545 GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, 1545 GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key,
1546 &GSC_my_identity.public_key); 1546 &GSC_my_identity.public_key);
1547 if (GNUNET_YES == 1547 if (GNUNET_YES ==
1548 GNUNET_CONFIGURATION_get_value_yesno (GSC_cfg, 1548 GNUNET_CONFIGURATION_get_value_yesno (GSC_cfg,
diff --git a/src/core/gnunet-service-core_neighbours.c b/src/core/gnunet-service-core_neighbours.c
index d82d119d7..6eff065d9 100644
--- a/src/core/gnunet-service-core_neighbours.c
+++ b/src/core/gnunet-service-core_neighbours.c
@@ -479,8 +479,8 @@ GSC_NEIGHBOURS_init ()
479 * @return GNUNET_OK (continue to iterate) 479 * @return GNUNET_OK (continue to iterate)
480 */ 480 */
481static int 481static int
482free_neighbour_helper (void *cls, 482free_neighbour_helper (void *cls,
483 const struct GNUNET_PeerIdentity * key, 483 const struct GNUNET_PeerIdentity * key,
484 void *value) 484 void *value)
485{ 485{
486 struct Neighbour *n = value; 486 struct Neighbour *n = value;
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c
index 6c66086bd..a8d3d3609 100644
--- a/src/core/gnunet-service-core_sessions.c
+++ b/src/core/gnunet-service-core_sessions.c
@@ -199,7 +199,7 @@ GSC_SESSIONS_end (const struct GNUNET_PeerIdentity *pid)
199 GNUNET_free (sme); 199 GNUNET_free (sme);
200 } 200 }
201 GNUNET_SCHEDULER_cancel (session->typemap_task); 201 GNUNET_SCHEDULER_cancel (session->typemap_task);
202 GSC_CLIENTS_notify_clients_about_neighbour (&session->peer, 202 GSC_CLIENTS_notify_clients_about_neighbour (&session->peer,
203 session->tmap, NULL); 203 session->tmap, NULL);
204 GNUNET_assert (GNUNET_YES == 204 GNUNET_assert (GNUNET_YES ==
205 GNUNET_CONTAINER_multipeermap_remove (sessions, 205 GNUNET_CONTAINER_multipeermap_remove (sessions,
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c
index 0ec3112a1..12745c984 100644
--- a/src/core/test_core_api.c
+++ b/src/core/test_core_api.c
@@ -263,7 +263,7 @@ connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
263 263
264 264
265static void 265static void
266init_notify (void *cls, 266init_notify (void *cls,
267 const struct GNUNET_PeerIdentity *my_identity) 267 const struct GNUNET_PeerIdentity *my_identity)
268{ 268{
269 struct PeerContext *p = cls; 269 struct PeerContext *p = cls;
@@ -299,8 +299,8 @@ setup_peer (struct PeerContext *p, const char *cfgname)
299 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); 299 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
300 p->cfg = GNUNET_CONFIGURATION_create (); 300 p->cfg = GNUNET_CONFIGURATION_create ();
301 p->arm_proc = 301 p->arm_proc =
302 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 302 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
303 NULL, NULL, 303 NULL, NULL,
304 binary, 304 binary,
305 "gnunet-service-arm", 305 "gnunet-service-arm",
306 "-c", cfgname, NULL); 306 "-c", cfgname, NULL);
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c
index 14e1e4db3..ddc3c585e 100644
--- a/src/core/test_core_api_reliability.c
+++ b/src/core/test_core_api_reliability.c
@@ -356,7 +356,7 @@ static struct GNUNET_CORE_MessageHandler handlers[] = {
356 356
357 357
358static void 358static void
359init_notify (void *cls, 359init_notify (void *cls,
360 const struct GNUNET_PeerIdentity *my_identity) 360 const struct GNUNET_PeerIdentity *my_identity)
361{ 361{
362 struct PeerContext *p = cls; 362 struct PeerContext *p = cls;
diff --git a/src/core/test_core_api_send_to_self.c b/src/core/test_core_api_send_to_self.c
index 4e2ee3fe4..913ae3848 100644
--- a/src/core/test_core_api_send_to_self.c
+++ b/src/core/test_core_api_send_to_self.c
@@ -103,7 +103,7 @@ send_message (void *cls, size_t size, void *buf)
103 103
104 104
105static void 105static void
106init (void *cls, 106init (void *cls,
107 const struct GNUNET_PeerIdentity *my_identity) 107 const struct GNUNET_PeerIdentity *my_identity)
108{ 108{
109 if (NULL == my_identity) 109 if (NULL == my_identity)
@@ -152,7 +152,7 @@ run (void *cls,
152 }; 152 };
153 core = 153 core =
154 GNUNET_CORE_connect (cfg, NULL, &init, &connect_cb, NULL, NULL, 154 GNUNET_CORE_connect (cfg, NULL, &init, &connect_cb, NULL, NULL,
155 0, NULL, 0, handlers); 155 0, NULL, 0, handlers);
156 die_task = 156 die_task =
157 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 157 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
158 (GNUNET_TIME_UNIT_SECONDS, 300), &cleanup, 158 (GNUNET_TIME_UNIT_SECONDS, 300), &cleanup,
diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c
index dfcc40e87..0389a908e 100644
--- a/src/core/test_core_api_start_only.c
+++ b/src/core/test_core_api_start_only.c
@@ -103,7 +103,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
103 103
104 104
105static void 105static void
106init_notify (void *cls, 106init_notify (void *cls,
107 const struct GNUNET_PeerIdentity *my_identity) 107 const struct GNUNET_PeerIdentity *my_identity)
108{ 108{
109 struct PeerContext *p = cls; 109 struct PeerContext *p = cls;
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index 94adc804b..7c1b198c9 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -498,7 +498,7 @@ static struct GNUNET_CORE_MessageHandler handlers[] = {
498 498
499 499
500static void 500static void
501init_notify (void *cls, 501init_notify (void *cls,
502 const struct GNUNET_PeerIdentity *my_identity) 502 const struct GNUNET_PeerIdentity *my_identity)
503{ 503{
504 struct PeerContext *p = cls; 504 struct PeerContext *p = cls;
diff --git a/src/datacache/datacache.c b/src/datacache/datacache.c
index 848979979..e6b49fd75 100644
--- a/src/datacache/datacache.c
+++ b/src/datacache/datacache.c
@@ -154,7 +154,7 @@ GNUNET_DATACACHE_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
154 bf_size = quota / 32; /* 8 bit per entry, 1 bit per 32 kb in DB */ 154 bf_size = quota / 32; /* 8 bit per entry, 1 bit per 32 kb in DB */
155 155
156 ret = GNUNET_malloc (sizeof (struct GNUNET_DATACACHE_Handle)); 156 ret = GNUNET_malloc (sizeof (struct GNUNET_DATACACHE_Handle));
157 157
158 if (GNUNET_YES != 158 if (GNUNET_YES !=
159 GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "DISABLE_BF")) 159 GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "DISABLE_BF"))
160 { 160 {
@@ -166,12 +166,12 @@ GNUNET_DATACACHE_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
166 if (NULL != ret->bloom_name) 166 if (NULL != ret->bloom_name)
167 { 167 {
168 ret->filter = GNUNET_CONTAINER_bloomfilter_load (ret->bloom_name, quota / 1024, /* 8 bit per entry in DB, expect 1k entries */ 168 ret->filter = GNUNET_CONTAINER_bloomfilter_load (ret->bloom_name, quota / 1024, /* 8 bit per entry in DB, expect 1k entries */
169 5); 169 5);
170 } 170 }
171 if (NULL == ret->filter) 171 if (NULL == ret->filter)
172 { 172 {
173 ret->filter = GNUNET_CONTAINER_bloomfilter_init (NULL, bf_size, 5); /* approx. 3% false positives at max use */ 173 ret->filter = GNUNET_CONTAINER_bloomfilter_init (NULL, bf_size, 5); /* approx. 3% false positives at max use */
174 } 174 }
175 } 175 }
176 ret->stats = GNUNET_STATISTICS_create ("datacache", cfg); 176 ret->stats = GNUNET_STATISTICS_create ("datacache", cfg);
177 ret->section = GNUNET_strdup (section); 177 ret->section = GNUNET_strdup (section);
@@ -247,8 +247,8 @@ GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h,
247{ 247{
248 ssize_t used; 248 ssize_t used;
249 249
250 used = h->api->put (h->api->cls, key, 250 used = h->api->put (h->api->cls, key,
251 size, data, 251 size, data,
252 type, discard_time, 252 type, discard_time,
253 path_info_len, path_info); 253 path_info_len, path_info);
254 if (-1 == used) 254 if (-1 == used)
diff --git a/src/datacache/perf_datacache.c b/src/datacache/perf_datacache.c
index 027999d22..e422f91ca 100644
--- a/src/datacache/perf_datacache.c
+++ b/src/datacache/perf_datacache.c
@@ -44,7 +44,7 @@ static const char *plugin_name;
44 44
45 45
46static int 46static int
47checkIt (void *cls, 47checkIt (void *cls,
48 const struct GNUNET_HashCode * key, size_t size, const char *data, 48 const struct GNUNET_HashCode * key, size_t size, const char *data,
49 enum GNUNET_BLOCK_Type type, 49 enum GNUNET_BLOCK_Type type,
50 struct GNUNET_TIME_Absolute exp, 50 struct GNUNET_TIME_Absolute exp,
diff --git a/src/datacache/plugin_datacache_heap.c b/src/datacache/plugin_datacache_heap.c
index aee6cd5b8..e930705f2 100644
--- a/src/datacache/plugin_datacache_heap.c
+++ b/src/datacache/plugin_datacache_heap.c
@@ -95,7 +95,7 @@ struct Value
95 * Type of the block. 95 * Type of the block.
96 */ 96 */
97 enum GNUNET_BLOCK_Type type; 97 enum GNUNET_BLOCK_Type type;
98 98
99}; 99};
100 100
101 101
@@ -110,7 +110,7 @@ struct PutContext
110 /** 110 /**
111 * Expiration time for the new value. 111 * Expiration time for the new value.
112 */ 112 */
113 struct GNUNET_TIME_Absolute discard_time; 113 struct GNUNET_TIME_Absolute discard_time;
114 114
115 /** 115 /**
116 * Data for the new value. 116 * Data for the new value.
@@ -155,7 +155,7 @@ struct PutContext
155 * 155 *
156 * @param cls the 'struct PutContext' 156 * @param cls the 'struct PutContext'
157 * @param key the key for the value(s) 157 * @param key the key for the value(s)
158 * @param value an existing value 158 * @param value an existing value
159 * @return GNUNET_YES if not found (to continue to iterate) 159 * @return GNUNET_YES if not found (to continue to iterate)
160 */ 160 */
161static int 161static int
@@ -170,16 +170,16 @@ put_cb (void *cls,
170 (val->type == put_ctx->type) && 170 (val->type == put_ctx->type) &&
171 (0 == memcmp (&val[1], put_ctx->data, put_ctx->size)) ) 171 (0 == memcmp (&val[1], put_ctx->data, put_ctx->size)) )
172 { 172 {
173 put_ctx->found = GNUNET_YES; 173 put_ctx->found = GNUNET_YES;
174 val->discard_time = GNUNET_TIME_absolute_max (val->discard_time, 174 val->discard_time = GNUNET_TIME_absolute_max (val->discard_time,
175 put_ctx->discard_time); 175 put_ctx->discard_time);
176 /* replace old path with new path */ 176 /* replace old path with new path */
177 GNUNET_array_grow (val->path_info, 177 GNUNET_array_grow (val->path_info,
178 val->path_info_len, 178 val->path_info_len,
179 put_ctx->path_info_len); 179 put_ctx->path_info_len);
180 memcpy (val->path_info, 180 memcpy (val->path_info,
181 put_ctx->path_info, 181 put_ctx->path_info,
182 put_ctx->path_info_len * sizeof (struct GNUNET_PeerIdentity)); 182 put_ctx->path_info_len * sizeof (struct GNUNET_PeerIdentity));
183 GNUNET_CONTAINER_heap_update_cost (put_ctx->heap, 183 GNUNET_CONTAINER_heap_update_cost (put_ctx->heap,
184 val->hn, 184 val->hn,
185 val->discard_time.abs_value_us); 185 val->discard_time.abs_value_us);
@@ -289,7 +289,7 @@ struct GetContext
289 * 289 *
290 * @param cls the 'struct GetContext' 290 * @param cls the 'struct GetContext'
291 * @param key the key for the value(s) 291 * @param key the key for the value(s)
292 * @param value an existing value 292 * @param value an existing value
293 * @return GNUNET_YES to continue to iterate 293 * @return GNUNET_YES to continue to iterate
294 */ 294 */
295static int 295static int
@@ -341,7 +341,7 @@ heap_plugin_get (void *cls, const struct GNUNET_HashCode * key,
341 341
342 get_ctx.type = type; 342 get_ctx.type = type;
343 get_ctx.iter = iter; 343 get_ctx.iter = iter;
344 get_ctx.iter_cls = iter_cls; 344 get_ctx.iter_cls = iter_cls;
345 get_ctx.cnt = 0; 345 get_ctx.cnt = 0;
346 GNUNET_CONTAINER_multihashmap_get_multiple (plugin->map, 346 GNUNET_CONTAINER_multihashmap_get_multiple (plugin->map,
347 key, 347 key,
@@ -363,7 +363,7 @@ heap_plugin_del (void *cls)
363{ 363{
364 struct Plugin *plugin = cls; 364 struct Plugin *plugin = cls;
365 struct Value *val; 365 struct Value *val;
366 366
367 val = GNUNET_CONTAINER_heap_remove_root (plugin->heap); 367 val = GNUNET_CONTAINER_heap_remove_root (plugin->heap);
368 if (NULL == val) 368 if (NULL == val)
369 return GNUNET_SYSERR; 369 return GNUNET_SYSERR;
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c
index c8d66ead1..6d7e28021 100644
--- a/src/datacache/plugin_datacache_postgres.c
+++ b/src/datacache/plugin_datacache_postgres.c
@@ -78,14 +78,14 @@ init_connection (struct Plugin *plugin)
78 " value BYTEA NOT NULL DEFAULT ''," 78 " value BYTEA NOT NULL DEFAULT '',"
79 " path BYTEA DEFAULT '')" 79 " path BYTEA DEFAULT '')"
80 "WITH OIDS"); 80 "WITH OIDS");
81 if ( (ret == NULL) || 81 if ( (ret == NULL) ||
82 ((PQresultStatus (ret) != PGRES_COMMAND_OK) && 82 ((PQresultStatus (ret) != PGRES_COMMAND_OK) &&
83 (0 != strcmp ("42P07", /* duplicate table */ 83 (0 != strcmp ("42P07", /* duplicate table */
84 PQresultErrorField 84 PQresultErrorField
85 (ret, 85 (ret,
86 PG_DIAG_SQLSTATE))))) 86 PG_DIAG_SQLSTATE)))))
87 { 87 {
88 (void) GNUNET_POSTGRES_check_result (plugin->dbh, ret, 88 (void) GNUNET_POSTGRES_check_result (plugin->dbh, ret,
89 PGRES_COMMAND_OK, "CREATE TABLE", 89 PGRES_COMMAND_OK, "CREATE TABLE",
90 "gn090dc"); 90 "gn090dc");
91 PQfinish (plugin->dbh); 91 PQfinish (plugin->dbh);
@@ -198,7 +198,7 @@ postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size,
198 PQexecPrepared (plugin->dbh, "put", 5, paramValues, paramLengths, 198 PQexecPrepared (plugin->dbh, "put", 5, paramValues, paramLengths,
199 paramFormats, 1); 199 paramFormats, 1);
200 if (GNUNET_OK != 200 if (GNUNET_OK !=
201 GNUNET_POSTGRES_check_result (plugin->dbh, ret, 201 GNUNET_POSTGRES_check_result (plugin->dbh, ret,
202 PGRES_COMMAND_OK, "PQexecPrepared", "put")) 202 PGRES_COMMAND_OK, "PQexecPrepared", "put"))
203 return -1; 203 return -1;
204 PQclear (ret); 204 PQclear (ret);
@@ -258,7 +258,7 @@ postgres_plugin_get (void *cls, const struct GNUNET_HashCode * key,
258 if (0 == (cnt = PQntuples (res))) 258 if (0 == (cnt = PQntuples (res)))
259 { 259 {
260 /* no result */ 260 /* no result */
261 LOG (GNUNET_ERROR_TYPE_DEBUG, 261 LOG (GNUNET_ERROR_TYPE_DEBUG,
262 "Ending iteration (no more results)\n"); 262 "Ending iteration (no more results)\n");
263 PQclear (res); 263 PQclear (res);
264 return 0; 264 return 0;
@@ -289,7 +289,7 @@ postgres_plugin_get (void *cls, const struct GNUNET_HashCode * key,
289 } 289 }
290 path_len %= sizeof (struct GNUNET_PeerIdentity); 290 path_len %= sizeof (struct GNUNET_PeerIdentity);
291 path = (const struct GNUNET_PeerIdentity *) PQgetvalue (res, i, 3); 291 path = (const struct GNUNET_PeerIdentity *) PQgetvalue (res, i, 3);
292 LOG (GNUNET_ERROR_TYPE_DEBUG, 292 LOG (GNUNET_ERROR_TYPE_DEBUG,
293 "Found result of size %u bytes and type %u in database\n", 293 "Found result of size %u bytes and type %u in database\n",
294 (unsigned int) size, (unsigned int) type); 294 (unsigned int) size, (unsigned int) type);
295 if (GNUNET_SYSERR == 295 if (GNUNET_SYSERR ==
@@ -299,7 +299,7 @@ postgres_plugin_get (void *cls, const struct GNUNET_HashCode * key,
299 path_len, 299 path_len,
300 path)) 300 path))
301 { 301 {
302 LOG (GNUNET_ERROR_TYPE_DEBUG, 302 LOG (GNUNET_ERROR_TYPE_DEBUG,
303 "Ending iteration (client error)\n"); 303 "Ending iteration (client error)\n");
304 PQclear (res); 304 PQclear (res);
305 return cnt; 305 return cnt;
@@ -330,14 +330,14 @@ postgres_plugin_del (void *cls)
330 if (GNUNET_OK != 330 if (GNUNET_OK !=
331 GNUNET_POSTGRES_check_result (plugin->dbh, res, PGRES_TUPLES_OK, "PQexecPrepared", "getm")) 331 GNUNET_POSTGRES_check_result (plugin->dbh, res, PGRES_TUPLES_OK, "PQexecPrepared", "getm"))
332 { 332 {
333 LOG (GNUNET_ERROR_TYPE_DEBUG, 333 LOG (GNUNET_ERROR_TYPE_DEBUG,
334 "Ending iteration (postgres error)\n"); 334 "Ending iteration (postgres error)\n");
335 return 0; 335 return 0;
336 } 336 }
337 if (0 == PQntuples (res)) 337 if (0 == PQntuples (res))
338 { 338 {
339 /* no result */ 339 /* no result */
340 LOG (GNUNET_ERROR_TYPE_DEBUG, 340 LOG (GNUNET_ERROR_TYPE_DEBUG,
341 "Ending iteration (no more results)\n"); 341 "Ending iteration (no more results)\n");
342 PQclear (res); 342 PQclear (res);
343 return GNUNET_SYSERR; 343 return GNUNET_SYSERR;
@@ -388,7 +388,7 @@ libgnunet_plugin_datacache_postgres_init (void *cls)
388 api->get = &postgres_plugin_get; 388 api->get = &postgres_plugin_get;
389 api->put = &postgres_plugin_put; 389 api->put = &postgres_plugin_put;
390 api->del = &postgres_plugin_del; 390 api->del = &postgres_plugin_del;
391 LOG (GNUNET_ERROR_TYPE_INFO, 391 LOG (GNUNET_ERROR_TYPE_INFO,
392 _("Postgres datacache running\n")); 392 _("Postgres datacache running\n"));
393 return api; 393 return api;
394} 394}
diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c
index 34aa61363..1901bdedd 100644
--- a/src/datacache/plugin_datacache_sqlite.c
+++ b/src/datacache/plugin_datacache_sqlite.c
@@ -96,13 +96,13 @@ sq_prepare (sqlite3 * dbh, const char *zSql, /* SQL statement, UTF-8 encoded
96 * @param type type of the value 96 * @param type type of the value
97 * @param discard_time when to discard the value in any case 97 * @param discard_time when to discard the value in any case
98 * @param path_info_len number of entries in 'path_info' 98 * @param path_info_len number of entries in 'path_info'
99 * @param path_info array of peers that have processed the request 99 * @param path_info array of peers that have processed the request
100 * @return 0 if duplicate, -1 on error, number of bytes used otherwise 100 * @return 0 if duplicate, -1 on error, number of bytes used otherwise
101 */ 101 */
102static ssize_t 102static ssize_t
103sqlite_plugin_put (void *cls, 103sqlite_plugin_put (void *cls,
104 const struct GNUNET_HashCode *key, 104 const struct GNUNET_HashCode *key,
105 size_t size, const char *data, 105 size_t size, const char *data,
106 enum GNUNET_BLOCK_Type type, 106 enum GNUNET_BLOCK_Type type,
107 struct GNUNET_TIME_Absolute discard_time, 107 struct GNUNET_TIME_Absolute discard_time,
108 unsigned int path_info_len, 108 unsigned int path_info_len,
@@ -135,11 +135,11 @@ sqlite_plugin_put (void *cls,
135 key, sizeof (struct GNUNET_HashCode), 135 key, sizeof (struct GNUNET_HashCode),
136 SQLITE_TRANSIENT)) || 136 SQLITE_TRANSIENT)) ||
137 (SQLITE_OK != sqlite3_bind_blob (stmt, 4, 137 (SQLITE_OK != sqlite3_bind_blob (stmt, 4,
138 data, size, 138 data, size,
139 SQLITE_TRANSIENT)) || 139 SQLITE_TRANSIENT)) ||
140 (SQLITE_OK != sqlite3_bind_blob (stmt, 5, 140 (SQLITE_OK != sqlite3_bind_blob (stmt, 5,
141 path_info, 141 path_info,
142 path_info_len * sizeof (struct GNUNET_PeerIdentity), 142 path_info_len * sizeof (struct GNUNET_PeerIdentity),
143 SQLITE_TRANSIENT))) 143 SQLITE_TRANSIENT)))
144 { 144 {
145 LOG_SQLITE (plugin->dbh, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 145 LOG_SQLITE (plugin->dbh, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c
index 071ae721f..d0b7e5457 100644
--- a/src/datacache/test_datacache.c
+++ b/src/datacache/test_datacache.c
@@ -38,8 +38,8 @@ static const char *plugin_name;
38 38
39 39
40static int 40static int
41checkIt (void *cls, 41checkIt (void *cls,
42 const struct GNUNET_HashCode *key, 42 const struct GNUNET_HashCode *key,
43 size_t size, const char *data, 43 size_t size, const char *data,
44 enum GNUNET_BLOCK_Type type, 44 enum GNUNET_BLOCK_Type type,
45 struct GNUNET_TIME_Absolute exp, 45 struct GNUNET_TIME_Absolute exp,
@@ -75,7 +75,7 @@ run (void *cls, char *const *args, const char *cfgfile,
75 if (h == NULL) 75 if (h == NULL)
76 { 76 {
77 FPRINTF (stderr, 77 FPRINTF (stderr,
78 "%s", 78 "%s",
79 "Failed to initialize datacache. Database likely not setup, skipping test.\n"); 79 "Failed to initialize datacache. Database likely not setup, skipping test.\n");
80 return; 80 return;
81 } 81 }
@@ -87,7 +87,7 @@ run (void *cls, char *const *args, const char *cfgfile,
87 GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n); 87 GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n);
88 ASSERT (GNUNET_OK == 88 ASSERT (GNUNET_OK ==
89 GNUNET_DATACACHE_put (h, &k, sizeof (struct GNUNET_HashCode), 89 GNUNET_DATACACHE_put (h, &k, sizeof (struct GNUNET_HashCode),
90 (const char *) &n, 1 + i % 16, exp, 90 (const char *) &n, 1 + i % 16, exp,
91 0, NULL)); 91 0, NULL));
92 k = n; 92 k = n;
93 } 93 }
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c
index 2fb250b96..461440c85 100644
--- a/src/datastore/datastore_api.c
+++ b/src/datastore/datastore_api.c
@@ -475,7 +475,7 @@ make_queue_entry (struct GNUNET_DATASTORE_Handle *h, size_t msize,
475 GNUNET_assert (pos->response_proc != NULL); 475 GNUNET_assert (pos->response_proc != NULL);
476 /* move 'pos' element to head so that it will be 476 /* move 'pos' element to head so that it will be
477 * killed on 'NULL' call below */ 477 * killed on 'NULL' call below */
478 LOG (GNUNET_ERROR_TYPE_DEBUG, "Dropping request from datastore queue\n"); 478 LOG (GNUNET_ERROR_TYPE_DEBUG, "Dropping request from datastore queue\n");
479 GNUNET_CONTAINER_DLL_remove (h->queue_head, h->queue_tail, pos); 479 GNUNET_CONTAINER_DLL_remove (h->queue_head, h->queue_tail, pos);
480 GNUNET_CONTAINER_DLL_insert (h->queue_head, h->queue_tail, pos); 480 GNUNET_CONTAINER_DLL_insert (h->queue_head, h->queue_tail, pos);
481 GNUNET_STATISTICS_update (h->stats, 481 GNUNET_STATISTICS_update (h->stats,
@@ -691,7 +691,7 @@ process_queue (struct GNUNET_DATASTORE_Handle *h)
691 * @param emsg error message 691 * @param emsg error message
692 */ 692 */
693static void 693static void
694drop_status_cont (void *cls, int32_t result, 694drop_status_cont (void *cls, int32_t result,
695 struct GNUNET_TIME_Absolute min_expiration, 695 struct GNUNET_TIME_Absolute min_expiration,
696 const char *emsg) 696 const char *emsg)
697{ 697{
@@ -800,7 +800,7 @@ process_status_message (void *cls, const struct GNUNET_MessageHeader *msg)
800 h->retry_time = GNUNET_TIME_UNIT_ZERO; 800 h->retry_time = GNUNET_TIME_UNIT_ZERO;
801 process_queue (h); 801 process_queue (h);
802 if (rc.cont != NULL) 802 if (rc.cont != NULL)
803 rc.cont (rc.cont_cls, status, 803 rc.cont (rc.cont_cls, status,
804 GNUNET_TIME_absolute_ntoh (sm->min_expiration), 804 GNUNET_TIME_absolute_ntoh (sm->min_expiration),
805 emsg); 805 emsg);
806} 806}
@@ -1039,7 +1039,7 @@ GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, uint64_t uid,
1039 cont = &drop_status_cont; 1039 cont = &drop_status_cont;
1040 LOG (GNUNET_ERROR_TYPE_DEBUG, 1040 LOG (GNUNET_ERROR_TYPE_DEBUG,
1041 "Asked to update entry %llu raising priority by %u and expiration to %s\n", 1041 "Asked to update entry %llu raising priority by %u and expiration to %s\n",
1042 uid, 1042 uid,
1043 (unsigned int) priority, 1043 (unsigned int) priority,
1044 GNUNET_STRINGS_absolute_time_to_string (expiration)); 1044 GNUNET_STRINGS_absolute_time_to_string (expiration));
1045 qc.sc.cont = cont; 1045 qc.sc.cont = cont;
diff --git a/src/datastore/gnunet-datastore.c b/src/datastore/gnunet-datastore.c
index 4388818d7..9daad04c7 100644
--- a/src/datastore/gnunet-datastore.c
+++ b/src/datastore/gnunet-datastore.c
@@ -84,7 +84,7 @@ do_shutdown (void *cls,
84/** 84/**
85 * Perform next GET operation. 85 * Perform next GET operation.
86 */ 86 */
87static void 87static void
88do_get (void); 88do_get (void);
89 89
90 90
@@ -101,7 +101,7 @@ do_get (void);
101 * space for 0-priority content 101 * space for 0-priority content
102 * @param msg NULL on success, otherwise an error message 102 * @param msg NULL on success, otherwise an error message
103 */ 103 */
104static void 104static void
105do_finish (void *cls, 105do_finish (void *cls,
106 int32_t success, 106 int32_t success,
107 struct GNUNET_TIME_Absolute min_expiration, 107 struct GNUNET_TIME_Absolute min_expiration,
@@ -135,7 +135,7 @@ do_finish (void *cls,
135 * @param uid unique identifier for the datum; 135 * @param uid unique identifier for the datum;
136 * maybe 0 if no unique identifier is available 136 * maybe 0 if no unique identifier is available
137 */ 137 */
138static void 138static void
139do_put (void *cls, 139do_put (void *cls,
140 const struct GNUNET_HashCode *key, 140 const struct GNUNET_HashCode *key,
141 size_t size, const void *data, 141 size_t size, const void *data,
@@ -156,8 +156,8 @@ do_put (void *cls,
156 first_uid = uid; 156 first_uid = uid;
157 qe = GNUNET_DATASTORE_put (db_dst, 0, 157 qe = GNUNET_DATASTORE_put (db_dst, 0,
158 key, size, data, type, 158 key, size, data, type,
159 priority, anonymity, 159 priority, anonymity,
160 0 /* FIXME: replication is lost... */, 160 0 /* FIXME: replication is lost... */,
161 expiration, 161 expiration,
162 0, 1, GNUNET_TIME_UNIT_FOREVER_REL, 162 0, 1, GNUNET_TIME_UNIT_FOREVER_REL,
163 &do_finish, NULL); 163 &do_finish, NULL);
@@ -167,7 +167,7 @@ do_put (void *cls,
167/** 167/**
168 * Perform next GET operation. 168 * Perform next GET operation.
169 */ 169 */
170static void 170static void
171do_get () 171do_get ()
172{ 172{
173 qe = GNUNET_DATASTORE_get_key (db_src, 173 qe = GNUNET_DATASTORE_get_key (db_src,
@@ -185,7 +185,7 @@ do_get ()
185 * 185 *
186 * @param cls closure 186 * @param cls closure
187 * @param args remaining command-line arguments 187 * @param args remaining command-line arguments
188 * @param cfgfile name of the configuration file used 188 * @param cfgfile name of the configuration file used
189 * @param cfg configuration -- for destination datastore 189 * @param cfg configuration -- for destination datastore
190 */ 190 */
191static void 191static void
@@ -196,7 +196,7 @@ run (void *cls, char *const *args, const char *cfgfile,
196 return; /* nothing to be done */ 196 return; /* nothing to be done */
197 if (0 == strcmp (cfgfile, alternative_cfg)) 197 if (0 == strcmp (cfgfile, alternative_cfg))
198 { 198 {
199 fprintf (stderr, 199 fprintf (stderr,
200 _("Cannot use the same configuration for source and destination\n")); 200 _("Cannot use the same configuration for source and destination\n"));
201 ret = 1; 201 ret = 1;
202 return; 202 return;
@@ -253,7 +253,7 @@ main (int argc, char *const *argv)
253 if (GNUNET_OK != 253 if (GNUNET_OK !=
254 GNUNET_PROGRAM_run (argc, argv, "gnunet-datastore", 254 GNUNET_PROGRAM_run (argc, argv, "gnunet-datastore",
255 gettext_noop ("Manipulate GNUnet datastore"), 255 gettext_noop ("Manipulate GNUnet datastore"),
256 options, &run, NULL)) 256 options, &run, NULL))
257 ret = 1; 257 ret = 1;
258 GNUNET_free ((void*) argv); 258 GNUNET_free ((void*) argv);
259 return ret; 259 return ret;
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c
index e605da8fc..7c4c47e90 100644
--- a/src/datastore/gnunet-service-datastore.c
+++ b/src/datastore/gnunet-service-datastore.c
@@ -409,7 +409,7 @@ quota_processor (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
409 "Deleting %llu bytes of low-priority (%u) content `%s' of type %u at %s prior to expiration (still trying to free another %llu bytes)\n", 409 "Deleting %llu bytes of low-priority (%u) content `%s' of type %u at %s prior to expiration (still trying to free another %llu bytes)\n",
410 (unsigned long long) (size + GNUNET_DATASTORE_ENTRY_OVERHEAD), 410 (unsigned long long) (size + GNUNET_DATASTORE_ENTRY_OVERHEAD),
411 (unsigned int) priority, 411 (unsigned int) priority,
412 GNUNET_h2s (key), type, 412 GNUNET_h2s (key), type,
413 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (expiration), 413 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (expiration),
414 GNUNET_YES), 414 GNUNET_YES),
415 *need); 415 *need);
@@ -1473,7 +1473,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1473 sizeof (struct GNUNET_MessageHeader)}, 1473 sizeof (struct GNUNET_MessageHeader)},
1474 {NULL, NULL, 0, 0} 1474 {NULL, NULL, 0, 0}
1475 }; 1475 };
1476 char *fn; 1476 char *fn;
1477 char *pfn; 1477 char *pfn;
1478 unsigned int bf_size; 1478 unsigned int bf_size;
1479 int refresh_bf; 1479 int refresh_bf;
@@ -1504,7 +1504,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1504 cache_size = quota / 8; /* Or should we make this an option? */ 1504 cache_size = quota / 8; /* Or should we make this an option? */
1505 GNUNET_STATISTICS_set (stats, gettext_noop ("# cache size"), cache_size, 1505 GNUNET_STATISTICS_set (stats, gettext_noop ("# cache size"), cache_size,
1506 GNUNET_NO); 1506 GNUNET_NO);
1507 if (quota / (32 * 1024LL) > (1 << 31)) 1507 if (quota / (32 * 1024LL) > (1 << 31))
1508 bf_size = (1 << 31); /* absolute limit: ~2 GB, beyond that BF just won't help anyway */ 1508 bf_size = (1 << 31); /* absolute limit: ~2 GB, beyond that BF just won't help anyway */
1509 else 1509 else
1510 bf_size = quota / (32 * 1024LL); /* 8 bit per entry, 1 bit per 32 kb in DB */ 1510 bf_size = quota / (32 * 1024LL); /* 8 bit per entry, 1 bit per 32 kb in DB */
@@ -1610,7 +1610,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1610 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1610 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1611 _("Rebuilding bloomfilter. Please be patient.\n")); 1611 _("Rebuilding bloomfilter. Please be patient.\n"));
1612 if (NULL != plugin->api->get_keys) 1612 if (NULL != plugin->api->get_keys)
1613 plugin->api->get_keys (plugin->api->cls, &add_key_to_bloomfilter, filter); 1613 plugin->api->get_keys (plugin->api->cls, &add_key_to_bloomfilter, filter);
1614 else 1614 else
1615 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1615 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1616 _("Plugin does not support get_keys function. Please fix!\n")); 1616 _("Plugin does not support get_keys function. Please fix!\n"));
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c
index 83be3ad5f..c51502cc6 100644
--- a/src/datastore/perf_datastore_api.c
+++ b/src/datastore/perf_datastore_api.c
@@ -294,7 +294,7 @@ run_tests (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, c
294 294
295 295
296static void 296static void
297run (void *cls, 297run (void *cls,
298 const struct GNUNET_CONFIGURATION_Handle *cfg, 298 const struct GNUNET_CONFIGURATION_Handle *cfg,
299 struct GNUNET_TESTING_Peer *peer) 299 struct GNUNET_TESTING_Peer *peer)
300{ 300{
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c
index 657acc66b..908a7ee55 100644
--- a/src/datastore/perf_plugin_datastore.c
+++ b/src/datastore/perf_plugin_datastore.c
@@ -163,10 +163,10 @@ iterate_zeros (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
163 memcpy (&i, &cdata[4], sizeof (i)); 163 memcpy (&i, &cdata[4], sizeof (i));
164 hits[i / 8] |= (1 << (i % 8)); 164 hits[i / 8] |= (1 << (i % 8));
165 165
166 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 166 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
167 "Found result %d type=%u, priority=%u, size=%u, expire=%s\n", 167 "Found result %d type=%u, priority=%u, size=%u, expire=%s\n",
168 i, 168 i,
169 type, priority, size, 169 type, priority, size,
170 GNUNET_STRINGS_absolute_time_to_string (expiration)); 170 GNUNET_STRINGS_absolute_time_to_string (expiration));
171 crc->cnt++; 171 crc->cnt++;
172 if (crc->cnt == PUT_10 / 4 - 1) 172 if (crc->cnt == PUT_10 / 4 - 1)
@@ -349,7 +349,7 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
349 GNUNET_break (0); 349 GNUNET_break (0);
350 crc->phase = RP_ERROR; 350 crc->phase = RP_ERROR;
351 } 351 }
352 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 352 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
353 "In phase %d, iteration %u\n", crc->phase, crc->cnt); 353 "In phase %d, iteration %u\n", crc->phase, crc->cnt);
354 switch (crc->phase) 354 switch (crc->phase)
355 { 355 {
diff --git a/src/datastore/plugin_datastore_heap.c b/src/datastore/plugin_datastore_heap.c
index 79dcb9043..1f756a95c 100644
--- a/src/datastore/plugin_datastore_heap.c
+++ b/src/datastore/plugin_datastore_heap.c
@@ -33,7 +33,7 @@
33 33
34/** 34/**
35 * A value that we are storing. 35 * A value that we are storing.
36 */ 36 */
37struct Value 37struct Value
38{ 38{
39 39
@@ -67,11 +67,11 @@ struct Value
67 * only used if anonymity is zero. 67 * only used if anonymity is zero.
68 */ 68 */
69 unsigned int zero_anon_offset; 69 unsigned int zero_anon_offset;
70 70
71 /** 71 /**
72 * Number of bytes in 'data'. 72 * Number of bytes in 'data'.
73 */ 73 */
74 uint32_t size; 74 uint32_t size;
75 75
76 /** 76 /**
77 * Priority of the value. 77 * Priority of the value.
@@ -82,7 +82,7 @@ struct Value
82 * Anonymity level for the value. 82 * Anonymity level for the value.
83 */ 83 */
84 uint32_t anonymity; 84 uint32_t anonymity;
85 85
86 /** 86 /**
87 * Replication level for the value. 87 * Replication level for the value.
88 */ 88 */
@@ -209,10 +209,10 @@ heap_plugin_estimate_size (void *cls)
209 * @return GNUNET_OK on success 209 * @return GNUNET_OK on success
210 */ 210 */
211static int 211static int
212heap_plugin_put (void *cls, 212heap_plugin_put (void *cls,
213 const struct GNUNET_HashCode * key, 213 const struct GNUNET_HashCode * key,
214 uint32_t size, 214 uint32_t size,
215 const void *data, 215 const void *data,
216 enum GNUNET_BLOCK_Type type, 216 enum GNUNET_BLOCK_Type type,
217 uint32_t priority, uint32_t anonymity, 217 uint32_t priority, uint32_t anonymity,
218 uint32_t replication, 218 uint32_t replication,
@@ -328,7 +328,7 @@ struct GetContext
328 * The plugin. 328 * The plugin.
329 */ 329 */
330 struct Plugin *plugin; 330 struct Plugin *plugin;
331 331
332 /** 332 /**
333 * Requested value hash. 333 * Requested value hash.
334 */ 334 */
@@ -343,7 +343,7 @@ struct GetContext
343 * Function to call with the result. 343 * Function to call with the result.
344 */ 344 */
345 PluginDatumProcessor proc; 345 PluginDatumProcessor proc;
346 346
347 /** 347 /**
348 * Closure for 'proc'. 348 * Closure for 'proc'.
349 */ 349 */
@@ -358,7 +358,7 @@ struct GetContext
358 * @param value the value to check against the query 358 * @param value the value to check against the query
359 * @return GNUNET_YES if the value matches 359 * @return GNUNET_YES if the value matches
360 */ 360 */
361static int 361static int
362match (const struct GetContext *gc, 362match (const struct GetContext *gc,
363 struct Value *value) 363 struct Value *value)
364{ 364{
@@ -421,7 +421,7 @@ get_iterator (void *cls,
421 if (0 != gc->offset--) 421 if (0 != gc->offset--)
422 return GNUNET_OK; 422 return GNUNET_OK;
423 if (GNUNET_NO == 423 if (GNUNET_NO ==
424 gc->proc (gc->proc_cls, 424 gc->proc (gc->proc_cls,
425 key, 425 key,
426 value->size, 426 value->size,
427 &value[1], 427 &value[1],
@@ -476,7 +476,7 @@ heap_plugin_get_key (void *cls, uint64_t offset,
476 &gc); 476 &gc);
477 if (0 == gc.offset) 477 if (0 == gc.offset)
478 { 478 {
479 proc (proc_cls, 479 proc (proc_cls,
480 NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); 480 NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
481 return; 481 return;
482 } 482 }
@@ -489,11 +489,11 @@ heap_plugin_get_key (void *cls, uint64_t offset,
489 { 489 {
490 GNUNET_CONTAINER_multihashmap_get_multiple (plugin->keyvalue, 490 GNUNET_CONTAINER_multihashmap_get_multiple (plugin->keyvalue,
491 key, 491 key,
492 &count_iterator, 492 &count_iterator,
493 &gc); 493 &gc);
494 if (0 == gc.offset) 494 if (0 == gc.offset)
495 { 495 {
496 proc (proc_cls, 496 proc (proc_cls,
497 NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); 497 NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
498 return; 498 return;
499 } 499 }
@@ -518,7 +518,7 @@ heap_plugin_get_key (void *cls, uint64_t offset,
518 * @param proc_cls closure for proc 518 * @param proc_cls closure for proc
519 */ 519 */
520static void 520static void
521heap_plugin_get_replication (void *cls, 521heap_plugin_get_replication (void *cls,
522 PluginDatumProcessor proc, 522 PluginDatumProcessor proc,
523 void *proc_cls) 523 void *proc_cls)
524{ 524{
@@ -528,7 +528,7 @@ heap_plugin_get_replication (void *cls,
528 value = GNUNET_CONTAINER_heap_remove_root (plugin->by_replication); 528 value = GNUNET_CONTAINER_heap_remove_root (plugin->by_replication);
529 if (NULL == value) 529 if (NULL == value)
530 { 530 {
531 proc (proc_cls, 531 proc (proc_cls,
532 NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); 532 NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
533 return; 533 return;
534 } 534 }
@@ -537,18 +537,18 @@ heap_plugin_get_replication (void *cls,
537 value->replication--; 537 value->replication--;
538 value->replication_heap = GNUNET_CONTAINER_heap_insert (plugin->by_replication, 538 value->replication_heap = GNUNET_CONTAINER_heap_insert (plugin->by_replication,
539 value, 539 value,
540 value->replication); 540 value->replication);
541 } 541 }
542 else 542 else
543 { 543 {
544 /* need a better way to pick a random item, replication level is always 0 */ 544 /* need a better way to pick a random item, replication level is always 0 */
545 value->replication_heap = GNUNET_CONTAINER_heap_insert (plugin->by_replication, 545 value->replication_heap = GNUNET_CONTAINER_heap_insert (plugin->by_replication,
546 value, 546 value,
547 value->replication); 547 value->replication);
548 value = GNUNET_CONTAINER_heap_walk_get_next (plugin->by_replication); 548 value = GNUNET_CONTAINER_heap_walk_get_next (plugin->by_replication);
549 } 549 }
550 if (GNUNET_NO == 550 if (GNUNET_NO ==
551 proc (proc_cls, 551 proc (proc_cls,
552 &value->key, 552 &value->key,
553 value->size, 553 value->size,
554 &value[1], 554 &value[1],
@@ -579,12 +579,12 @@ heap_plugin_get_expiration (void *cls, PluginDatumProcessor proc,
579 value = GNUNET_CONTAINER_heap_peek (plugin->by_expiration); 579 value = GNUNET_CONTAINER_heap_peek (plugin->by_expiration);
580 if (NULL == value) 580 if (NULL == value)
581 { 581 {
582 proc (proc_cls, 582 proc (proc_cls,
583 NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); 583 NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
584 return; 584 return;
585 } 585 }
586 if (GNUNET_NO == 586 if (GNUNET_NO ==
587 proc (proc_cls, 587 proc (proc_cls,
588 &value->key, 588 &value->key,
589 value->size, 589 value->size,
590 &value[1], 590 &value[1],
@@ -618,8 +618,8 @@ heap_plugin_get_expiration (void *cls, PluginDatumProcessor proc,
618 * @return GNUNET_OK on success 618 * @return GNUNET_OK on success
619 */ 619 */
620static int 620static int
621heap_plugin_update (void *cls, 621heap_plugin_update (void *cls,
622 uint64_t uid, 622 uint64_t uid,
623 int delta, 623 int delta,
624 struct GNUNET_TIME_Absolute expire, char **msg) 624 struct GNUNET_TIME_Absolute expire, char **msg)
625{ 625{
@@ -675,10 +675,10 @@ heap_plugin_get_zero_anonymity (void *cls, uint64_t offset,
675 } 675 }
676 if (0 == count) 676 if (0 == count)
677 { 677 {
678 proc (proc_cls, 678 proc (proc_cls,
679 NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); 679 NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
680 return; 680 return;
681 } 681 }
682 offset = offset % count; 682 offset = offset % count;
683 for (zabt = plugin->zero_head; NULL != zabt; zabt = zabt->next) 683 for (zabt = plugin->zero_head; NULL != zabt; zabt = zabt->next)
684 { 684 {
@@ -695,7 +695,7 @@ heap_plugin_get_zero_anonymity (void *cls, uint64_t offset,
695 GNUNET_assert (NULL != zabt); 695 GNUNET_assert (NULL != zabt);
696 value = zabt->array[offset]; 696 value = zabt->array[offset];
697 if (GNUNET_NO == 697 if (GNUNET_NO ==
698 proc (proc_cls, 698 proc (proc_cls,
699 &value->key, 699 &value->key,
700 value->size, 700 value->size,
701 &value[1], 701 &value[1],
@@ -749,8 +749,8 @@ return_value (void *cls,
749 void *val) 749 void *val)
750{ 750{
751 struct GetAllContext *gac = cls; 751 struct GetAllContext *gac = cls;
752 752
753 gac->proc (gac->proc_cls, 753 gac->proc (gac->proc_cls,
754 key, 754 key,
755 1); 755 1);
756 return GNUNET_OK; 756 return GNUNET_OK;
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c
index 40f25deee..923660dc2 100644
--- a/src/datastore/plugin_datastore_mysql.c
+++ b/src/datastore/plugin_datastore_mysql.c
@@ -363,7 +363,7 @@ mysql_plugin_update (void *cls, uint64_t uid, int delta,
363 363
364 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 364 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
365 "Updating value %llu adding %d to priority and maxing exp at %s\n", 365 "Updating value %llu adding %d to priority and maxing exp at %s\n",
366 vkey, delta, 366 vkey, delta,
367 GNUNET_STRINGS_absolute_time_to_string (expire)); 367 GNUNET_STRINGS_absolute_time_to_string (expire));
368 ret = 368 ret =
369 GNUNET_MYSQL_statement_run_prepared (plugin->mc, plugin->update_entry, NULL, 369 GNUNET_MYSQL_statement_run_prepared (plugin->mc, plugin->update_entry, NULL,
@@ -454,7 +454,7 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt
454 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 454 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
455 "Found %u-byte value under key `%s' with prio %u, anon %u, expire %s selecting from gn090 table\n", 455 "Found %u-byte value under key `%s' with prio %u, anon %u, expire %s selecting from gn090 table\n",
456 (unsigned int) size, GNUNET_h2s (&key), 456 (unsigned int) size, GNUNET_h2s (&key),
457 priority, anonymity, 457 priority, anonymity,
458 GNUNET_STRINGS_absolute_time_to_string (expiration)); 458 GNUNET_STRINGS_absolute_time_to_string (expiration));
459 GNUNET_assert (size < MAX_DATUM_SIZE); 459 GNUNET_assert (size < MAX_DATUM_SIZE);
460 ret = 460 ret =
@@ -769,7 +769,7 @@ mysql_plugin_get_keys (void *cls,
769 struct GNUNET_HashCode key; 769 struct GNUNET_HashCode key;
770 MYSQL_BIND cbind[1]; 770 MYSQL_BIND cbind[1];
771 unsigned long length; 771 unsigned long length;
772 772
773 statement = GNUNET_MYSQL_statement_get_stmt (plugin->mc, 773 statement = GNUNET_MYSQL_statement_get_stmt (plugin->mc,
774 plugin->get_all_keys); 774 plugin->get_all_keys);
775 if (statement == NULL) 775 if (statement == NULL)
@@ -812,14 +812,14 @@ mysql_plugin_get_keys (void *cls,
812 while (0 == (ret = mysql_stmt_fetch (statement))) 812 while (0 == (ret = mysql_stmt_fetch (statement)))
813 { 813 {
814 if (sizeof (struct GNUNET_HashCode) == length) 814 if (sizeof (struct GNUNET_HashCode) == length)
815 proc (proc_cls, &key, 1); 815 proc (proc_cls, &key, 1);
816 } 816 }
817 if (ret != MYSQL_NO_DATA) 817 if (ret != MYSQL_NO_DATA)
818 { 818 {
819 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 819 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
820 _("`%s' failed at %s:%d with error: %s\n"), 820 _("`%s' failed at %s:%d with error: %s\n"),
821 "mysql_stmt_fetch", __FILE__, __LINE__, 821 "mysql_stmt_fetch", __FILE__, __LINE__,
822 mysql_stmt_error (statement)); 822 mysql_stmt_error (statement));
823 GNUNET_MYSQL_statements_invalidate (plugin->mc); 823 GNUNET_MYSQL_statements_invalidate (plugin->mc);
824 return; 824 return;
825 } 825 }
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c
index 98109d4da..6a96ad5d3 100644
--- a/src/datastore/plugin_datastore_postgres.c
+++ b/src/datastore/plugin_datastore_postgres.c
@@ -257,7 +257,7 @@ postgres_plugin_estimate_size (void *cls)
257/** 257/**
258 * Store an item in the datastore. 258 * Store an item in the datastore.
259 * 259 *
260 * @param cls closure with the 'struct Plugin' 260 * @param cls closure with the 'struct Plugin'
261 * @param key key for the item 261 * @param key key for the item
262 * @param size number of bytes in data 262 * @param size number of bytes in data
263 * @param data content stored 263 * @param data content stored
@@ -335,7 +335,7 @@ postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t siz
335 */ 335 */
336static void 336static void
337process_result (struct Plugin *plugin, PluginDatumProcessor proc, 337process_result (struct Plugin *plugin, PluginDatumProcessor proc,
338 void *proc_cls, PGresult * res, 338 void *proc_cls, PGresult * res,
339 const char *filename, int line) 339 const char *filename, int line)
340{ 340{
341 int iret; 341 int iret;
@@ -802,7 +802,7 @@ postgres_plugin_get_keys (void *cls,
802 if (sizeof (struct GNUNET_HashCode) != PQgetlength (res, i, 0)) 802 if (sizeof (struct GNUNET_HashCode) != PQgetlength (res, i, 0))
803 { 803 {
804 memcpy (&key, PQgetvalue (res, i, 0), sizeof (struct GNUNET_HashCode)); 804 memcpy (&key, PQgetvalue (res, i, 0), sizeof (struct GNUNET_HashCode));
805 proc (proc_cls, &key, 1); 805 proc (proc_cls, &key, 1);
806 } 806 }
807 } 807 }
808 PQclear (res); 808 PQclear (res);
@@ -819,7 +819,7 @@ static void
819postgres_plugin_drop (void *cls) 819postgres_plugin_drop (void *cls)
820{ 820{
821 struct Plugin *plugin = cls; 821 struct Plugin *plugin = cls;
822 822
823 if (GNUNET_OK != GNUNET_POSTGRES_exec (plugin->dbh, "DROP TABLE gn090")) 823 if (GNUNET_OK != GNUNET_POSTGRES_exec (plugin->dbh, "DROP TABLE gn090"))
824 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "postgres", _("Failed to drop table from database.\n")); 824 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "postgres", _("Failed to drop table from database.\n"));
825} 825}
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c
index a88dd0c20..03939cee3 100644
--- a/src/datastore/test_datastore_api.c
+++ b/src/datastore/test_datastore_api.c
@@ -191,7 +191,7 @@ check_value (void *cls, const struct GNUNET_HashCode * key, size_t size,
191 return; 191 return;
192 } 192 }
193#if 0 193#if 0
194 FPRINTF (stderr, 194 FPRINTF (stderr,
195 "Check value got `%s' of size %u, type %d, expire %s\n", 195 "Check value got `%s' of size %u, type %d, expire %s\n",
196 GNUNET_h2s (key), (unsigned int) size, type, 196 GNUNET_h2s (key), (unsigned int) size, type,
197 GNUNET_STRINGS_absolute_time_to_string (expiration)); 197 GNUNET_STRINGS_absolute_time_to_string (expiration));
@@ -464,7 +464,7 @@ run_tests (void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiratio
464 464
465 465
466static void 466static void
467run (void *cls, 467run (void *cls,
468 const struct GNUNET_CONFIGURATION_Handle *cfg, 468 const struct GNUNET_CONFIGURATION_Handle *cfg,
469 struct GNUNET_TESTING_Peer *peer) 469 struct GNUNET_TESTING_Peer *peer)
470{ 470{
diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c
index 8baeeede8..7f330031a 100644
--- a/src/datastore/test_datastore_api_management.c
+++ b/src/datastore/test_datastore_api_management.c
@@ -258,7 +258,7 @@ run_tests (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, c
258 258
259 259
260static void 260static void
261run (void *cls, 261run (void *cls,
262 const struct GNUNET_CONFIGURATION_Handle *cfg, 262 const struct GNUNET_CONFIGURATION_Handle *cfg,
263 struct GNUNET_TESTING_Peer *peer) 263 struct GNUNET_TESTING_Peer *peer)
264{ 264{
diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c
index 3efd7b4ce..844d32a7b 100644
--- a/src/datastore/test_plugin_datastore.c
+++ b/src/datastore/test_plugin_datastore.c
@@ -226,7 +226,7 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
226 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test aborted.\n"); 226 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test aborted.\n");
227 crc->phase = RP_ERROR; 227 crc->phase = RP_ERROR;
228 } 228 }
229 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 229 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
230 "In phase %d, iteration %u\n", crc->phase, crc->cnt); 230 "In phase %d, iteration %u\n", crc->phase, crc->cnt);
231 switch (crc->phase) 231 switch (crc->phase)
232 { 232 {
diff --git a/src/dht/dht.h b/src/dht/dht.h
index a2c83e5ec..86fbc16bb 100644
--- a/src/dht/dht.h
+++ b/src/dht/dht.h
@@ -281,7 +281,7 @@ struct GNUNET_DHT_MonitorPutMessage
281 * Hop count so far. 281 * Hop count so far.
282 */ 282 */
283 uint32_t hop_count GNUNET_PACKED; 283 uint32_t hop_count GNUNET_PACKED;
284 284
285 /** 285 /**
286 * Replication level for this message 286 * Replication level for this message
287 */ 287 */
@@ -377,7 +377,7 @@ struct GNUNET_DHT_MonitorGetMessage
377 * Hop count 377 * Hop count
378 */ 378 */
379 uint32_t hop_count GNUNET_PACKED; 379 uint32_t hop_count GNUNET_PACKED;
380 380
381 /** 381 /**
382 * Replication level for this message 382 * Replication level for this message
383 */ 383 */
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c
index 3a6fcdc53..7b83c14c3 100644
--- a/src/dht/dht_api.c
+++ b/src/dht/dht_api.c
@@ -115,7 +115,7 @@ struct GNUNET_DHT_PutHandle
115 GNUNET_DHT_PutContinuation cont; 115 GNUNET_DHT_PutContinuation cont;
116 116
117 /** 117 /**
118 * Pending message associated with this PUT operation, 118 * Pending message associated with this PUT operation,
119 * NULL after the message has been transmitted to the service. 119 * NULL after the message has been transmitted to the service.
120 */ 120 */
121 struct PendingMessage *pending; 121 struct PendingMessage *pending;
@@ -181,7 +181,7 @@ struct GNUNET_DHT_GetHandle
181 /** 181 /**
182 * Key that this get request is for 182 * Key that this get request is for
183 */ 183 */
184 struct GNUNET_HashCode key; 184 struct GNUNET_HashCode key;
185 185
186 /** 186 /**
187 * Unique identifier for this request (for key collisions). 187 * Unique identifier for this request (for key collisions).
@@ -201,7 +201,7 @@ struct GNUNET_DHT_GetHandle
201 unsigned int seen_results_end; 201 unsigned int seen_results_end;
202 202
203 /** 203 /**
204 * Offset into the 'seen_results' array marking the 204 * Offset into the 'seen_results' array marking the
205 * position up to where we've send the hash codes to 205 * position up to where we've send the hash codes to
206 * the DHT for blocking (needed as we might not be 206 * the DHT for blocking (needed as we might not be
207 * able to send all hash codes at once). 207 * able to send all hash codes at once).
@@ -226,7 +226,7 @@ struct GNUNET_DHT_MonitorHandle
226 * DLL. 226 * DLL.
227 */ 227 */
228 struct GNUNET_DHT_MonitorHandle *prev; 228 struct GNUNET_DHT_MonitorHandle *prev;
229 229
230 /** 230 /**
231 * Main handle to this DHT api. 231 * Main handle to this DHT api.
232 */ 232 */
@@ -261,7 +261,7 @@ struct GNUNET_DHT_MonitorHandle
261 * Closure for cb. 261 * Closure for cb.
262 */ 262 */
263 void *cb_cls; 263 void *cb_cls;
264 264
265}; 265};
266 266
267 267
@@ -297,7 +297,7 @@ struct GNUNET_DHT_Handle
297 struct PendingMessage *pending_tail; 297 struct PendingMessage *pending_tail;
298 298
299 /** 299 /**
300 * Head of linked list of messages we would like to monitor. 300 * Head of linked list of messages we would like to monitor.
301 */ 301 */
302 struct GNUNET_DHT_MonitorHandle *monitor_head; 302 struct GNUNET_DHT_MonitorHandle *monitor_head;
303 303
@@ -353,7 +353,7 @@ struct GNUNET_DHT_Handle
353 * @param msg the incoming message 353 * @param msg the incoming message
354 */ 354 */
355static void 355static void
356service_message_handler (void *cls, 356service_message_handler (void *cls,
357 const struct GNUNET_MessageHeader *msg); 357 const struct GNUNET_MessageHeader *msg);
358 358
359 359
@@ -401,7 +401,7 @@ queue_filter_messages (struct GNUNET_DHT_GetHandle *get_handle)
401 if (delta > max) 401 if (delta > max)
402 delta = max; 402 delta = max;
403 msize = sizeof (struct GNUNET_DHT_ClientGetResultSeenMessage) + delta * sizeof (struct GNUNET_HashCode); 403 msize = sizeof (struct GNUNET_DHT_ClientGetResultSeenMessage) + delta * sizeof (struct GNUNET_HashCode);
404 404
405 pm = GNUNET_malloc (sizeof (struct PendingMessage) + msize); 405 pm = GNUNET_malloc (sizeof (struct PendingMessage) + msize);
406 msg = (struct GNUNET_DHT_ClientGetResultSeenMessage *) &pm[1]; 406 msg = (struct GNUNET_DHT_ClientGetResultSeenMessage *) &pm[1];
407 pm->msg = &msg->header; 407 pm->msg = &msg->header;
@@ -419,7 +419,7 @@ queue_filter_messages (struct GNUNET_DHT_GetHandle *get_handle)
419 get_handle->seen_results_transmission_offset += delta; 419 get_handle->seen_results_transmission_offset += delta;
420 GNUNET_CONTAINER_DLL_insert_tail (get_handle->dht_handle->pending_head, 420 GNUNET_CONTAINER_DLL_insert_tail (get_handle->dht_handle->pending_head,
421 get_handle->dht_handle->pending_tail, 421 get_handle->dht_handle->pending_tail,
422 pm); 422 pm);
423 } 423 }
424} 424}
425 425
@@ -434,8 +434,8 @@ queue_filter_messages (struct GNUNET_DHT_GetHandle *get_handle)
434 * @return #GNUNET_YES (always) 434 * @return #GNUNET_YES (always)
435 */ 435 */
436static int 436static int
437add_request_to_pending (void *cls, 437add_request_to_pending (void *cls,
438 const struct GNUNET_HashCode *key, 438 const struct GNUNET_HashCode *key,
439 void *value) 439 void *value)
440{ 440{
441 struct GNUNET_DHT_Handle *handle = cls; 441 struct GNUNET_DHT_Handle *handle = cls;
@@ -472,7 +472,7 @@ process_pending_messages (struct GNUNET_DHT_Handle *handle);
472 * @param tc scheduler context 472 * @param tc scheduler context
473 */ 473 */
474static void 474static void
475try_reconnect (void *cls, 475try_reconnect (void *cls,
476 const struct GNUNET_SCHEDULER_TaskContext *tc) 476 const struct GNUNET_SCHEDULER_TaskContext *tc)
477{ 477{
478 struct GNUNET_DHT_Handle *handle = cls; 478 struct GNUNET_DHT_Handle *handle = cls;
@@ -542,8 +542,8 @@ do_disconnect (struct GNUNET_DHT_Handle *handle)
542 * @return number of bytes written to @a buf 542 * @return number of bytes written to @a buf
543 */ 543 */
544static size_t 544static size_t
545transmit_pending (void *cls, 545transmit_pending (void *cls,
546 size_t size, 546 size_t size,
547 void *buf); 547 void *buf);
548 548
549 549
@@ -591,8 +591,8 @@ process_pending_messages (struct GNUNET_DHT_Handle *handle)
591 * @return number of bytes written to @a buf 591 * @return number of bytes written to @a buf
592 */ 592 */
593static size_t 593static size_t
594transmit_pending (void *cls, 594transmit_pending (void *cls,
595 size_t size, 595 size_t size,
596 void *buf) 596 void *buf)
597{ 597{
598 struct GNUNET_DHT_Handle *handle = cls; 598 struct GNUNET_DHT_Handle *handle = cls;
@@ -601,7 +601,7 @@ transmit_pending (void *cls,
601 601
602 handle->th = NULL; 602 handle->th = NULL;
603 if (NULL == buf) 603 if (NULL == buf)
604 { 604 {
605 LOG (GNUNET_ERROR_TYPE_DEBUG, 605 LOG (GNUNET_ERROR_TYPE_DEBUG,
606 "Transmission to DHT service failed! Reconnecting!\n"); 606 "Transmission to DHT service failed! Reconnecting!\n");
607 do_disconnect (handle); 607 do_disconnect (handle);
@@ -653,8 +653,8 @@ transmit_pending (void *cls,
653 * #GNUNET_NO if the reply is malformed or we found a matching request 653 * #GNUNET_NO if the reply is malformed or we found a matching request
654 */ 654 */
655static int 655static int
656process_reply (void *cls, 656process_reply (void *cls,
657 const struct GNUNET_HashCode *key, 657 const struct GNUNET_HashCode *key,
658 void *value) 658 void *value)
659{ 659{
660 const struct GNUNET_DHT_ClientResultMessage *dht_msg = cls; 660 const struct GNUNET_DHT_ClientResultMessage *dht_msg = cls;
@@ -700,14 +700,14 @@ process_reply (void *cls,
700 data = &get_path[get_path_length]; 700 data = &get_path[get_path_length];
701 /* remember that we've seen this result */ 701 /* remember that we've seen this result */
702 GNUNET_CRYPTO_hash (data, data_length, &hc); 702 GNUNET_CRYPTO_hash (data, data_length, &hc);
703 if (get_handle->seen_results_size == get_handle->seen_results_end) 703 if (get_handle->seen_results_size == get_handle->seen_results_end)
704 GNUNET_array_grow (get_handle->seen_results, 704 GNUNET_array_grow (get_handle->seen_results,
705 get_handle->seen_results_size, 705 get_handle->seen_results_size,
706 get_handle->seen_results_size * 2 + 1); 706 get_handle->seen_results_size * 2 + 1);
707 GNUNET_assert (get_handle->seen_results_end == get_handle->seen_results_transmission_offset); 707 GNUNET_assert (get_handle->seen_results_end == get_handle->seen_results_transmission_offset);
708 get_handle->seen_results[get_handle->seen_results_end++] = hc; 708 get_handle->seen_results[get_handle->seen_results_end++] = hc;
709 /* no need to block it explicitly, service already knows about it! */ 709 /* no need to block it explicitly, service already knows about it! */
710 get_handle->seen_results_transmission_offset++; 710 get_handle->seen_results_transmission_offset++;
711 get_handle->iter (get_handle->iter_cls, 711 get_handle->iter (get_handle->iter_cls,
712 GNUNET_TIME_absolute_ntoh (dht_msg->expiration), key, 712 GNUNET_TIME_absolute_ntoh (dht_msg->expiration), key,
713 get_path, get_path_length, put_path, put_path_length, 713 get_path, get_path_length, put_path, put_path_length,
@@ -746,7 +746,7 @@ process_monitor_get_message (struct GNUNET_DHT_Handle *handle,
746 ntohl (msg->desired_replication_level), 746 ntohl (msg->desired_replication_level),
747 ntohl (msg->get_path_length), 747 ntohl (msg->get_path_length),
748 (struct GNUNET_PeerIdentity *) &msg[1], 748 (struct GNUNET_PeerIdentity *) &msg[1],
749 &msg->key); 749 &msg->key);
750 } 750 }
751 return GNUNET_OK; 751 return GNUNET_OK;
752} 752}
@@ -879,7 +879,7 @@ process_put_confirmation_message (struct GNUNET_DHT_Handle *handle,
879 cont = ph->cont; 879 cont = ph->cont;
880 cont_cls = ph->cont_cls; 880 cont_cls = ph->cont_cls;
881 GNUNET_DHT_put_cancel (ph); 881 GNUNET_DHT_put_cancel (ph);
882 if (NULL != cont) 882 if (NULL != cont)
883 cont (cont_cls, GNUNET_OK); 883 cont (cont_cls, GNUNET_OK);
884 return GNUNET_OK; 884 return GNUNET_OK;
885} 885}
@@ -1132,11 +1132,11 @@ mark_put_message_gone (void *cls,
1132 * @param cont_cls closure for @a cont 1132 * @param cont_cls closure for @a cont
1133 */ 1133 */
1134struct GNUNET_DHT_PutHandle * 1134struct GNUNET_DHT_PutHandle *
1135GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, 1135GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle,
1136 const struct GNUNET_HashCode * key, 1136 const struct GNUNET_HashCode * key,
1137 uint32_t desired_replication_level, 1137 uint32_t desired_replication_level,
1138 enum GNUNET_DHT_RouteOption options, 1138 enum GNUNET_DHT_RouteOption options,
1139 enum GNUNET_BLOCK_Type type, size_t size, 1139 enum GNUNET_BLOCK_Type type, size_t size,
1140 const void *data, 1140 const void *data,
1141 struct GNUNET_TIME_Absolute exp, 1141 struct GNUNET_TIME_Absolute exp,
1142 struct GNUNET_TIME_Relative timeout, 1142 struct GNUNET_TIME_Relative timeout,
@@ -1194,7 +1194,7 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle,
1194 * go out over the network (we can't stop that); However, if the PUT 1194 * go out over the network (we can't stop that); However, if the PUT
1195 * has not yet been sent to the service, cancelling the PUT will stop 1195 * has not yet been sent to the service, cancelling the PUT will stop
1196 * this from happening (but there is no way for the user of this API 1196 * this from happening (but there is no way for the user of this API
1197 * to tell if that is the case). The only use for this API is to 1197 * to tell if that is the case). The only use for this API is to
1198 * prevent a later call to 'cont' from #GNUNET_DHT_put (i.e. because 1198 * prevent a later call to 'cont' from #GNUNET_DHT_put (i.e. because
1199 * the system is shutting down). 1199 * the system is shutting down).
1200 * 1200 *
@@ -1310,7 +1310,7 @@ GNUNET_DHT_get_filter_known_results (struct GNUNET_DHT_GetHandle *get_handle,
1310 unsigned int needed; 1310 unsigned int needed;
1311 1311
1312 needed = get_handle->seen_results_end + num_results; 1312 needed = get_handle->seen_results_end + num_results;
1313 if (needed > get_handle->seen_results_size) 1313 if (needed > get_handle->seen_results_size)
1314 GNUNET_array_grow (get_handle->seen_results, 1314 GNUNET_array_grow (get_handle->seen_results,
1315 get_handle->seen_results_size, 1315 get_handle->seen_results_size,
1316 needed); 1316 needed);
@@ -1483,7 +1483,7 @@ GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *handle)
1483 pending); 1483 pending);
1484 pending->in_pending_queue = GNUNET_YES; 1484 pending->in_pending_queue = GNUNET_YES;
1485 process_pending_messages (handle->dht_handle); 1485 process_pending_messages (handle->dht_handle);
1486 1486
1487 GNUNET_free_non_null (handle->key); 1487 GNUNET_free_non_null (handle->key);
1488 GNUNET_free (handle); 1488 GNUNET_free (handle);
1489} 1489}
diff --git a/src/dht/dht_test_lib.c b/src/dht/dht_test_lib.c
index de41b2ecc..9864da949 100644
--- a/src/dht/dht_test_lib.c
+++ b/src/dht/dht_test_lib.c
@@ -49,7 +49,7 @@ struct GNUNET_DHT_TEST_Context
49 * Main function of the test to run once all DHTs are available. 49 * Main function of the test to run once all DHTs are available.
50 */ 50 */
51 GNUNET_DHT_TEST_AppMain app_main; 51 GNUNET_DHT_TEST_AppMain app_main;
52 52
53 /** 53 /**
54 * Closure for 'app_main'. 54 * Closure for 'app_main'.
55 */ 55 */
@@ -73,7 +73,7 @@ struct GNUNET_DHT_TEST_Context
73 * from GNUNET_TESTBED_service_connect() 73 * from GNUNET_TESTBED_service_connect()
74 * @return service handle to return in 'op_result', NULL on error 74 * @return service handle to return in 'op_result', NULL on error
75 */ 75 */
76static void * 76static void *
77dht_connect_adapter (void *cls, 77dht_connect_adapter (void *cls,
78 const struct GNUNET_CONFIGURATION_Handle *cfg) 78 const struct GNUNET_CONFIGURATION_Handle *cfg)
79{ 79{
@@ -88,7 +88,7 @@ dht_connect_adapter (void *cls,
88 * @param cls closure 88 * @param cls closure
89 * @param op_result service handle returned from the connect adapter 89 * @param op_result service handle returned from the connect adapter
90 */ 90 */
91static void 91static void
92dht_disconnect_adapter (void *cls, 92dht_disconnect_adapter (void *cls,
93 void *op_result) 93 void *op_result)
94{ 94{
@@ -107,7 +107,7 @@ dht_disconnect_adapter (void *cls,
107 * @param emsg error message in case the operation has failed; will be NULL if 107 * @param emsg error message in case the operation has failed; will be NULL if
108 * operation has executed successfully. 108 * operation has executed successfully.
109 */ 109 */
110static void 110static void
111dht_connect_cb (void *cls, 111dht_connect_cb (void *cls,
112 struct GNUNET_TESTBED_Operation *op, 112 struct GNUNET_TESTBED_Operation *op,
113 void *ca_result, 113 void *ca_result,
@@ -115,7 +115,7 @@ dht_connect_cb (void *cls,
115{ 115{
116 struct GNUNET_DHT_TEST_Context *ctx = cls; 116 struct GNUNET_DHT_TEST_Context *ctx = cls;
117 unsigned int i; 117 unsigned int i;
118 118
119 if (NULL != emsg) 119 if (NULL != emsg)
120 { 120 {
121 fprintf (stderr, "Failed to connect to DHT service: %s\n", 121 fprintf (stderr, "Failed to connect to DHT service: %s\n",
@@ -134,7 +134,7 @@ dht_connect_cb (void *cls,
134 ctx, 134 ctx,
135 ctx->num_peers, 135 ctx->num_peers,
136 ctx->peers, 136 ctx->peers,
137 ctx->dhts); 137 ctx->dhts);
138} 138}
139 139
140 140
@@ -192,7 +192,7 @@ dht_test_run (void *cls,
192 * @param tmain main function to run once the testbed is ready 192 * @param tmain main function to run once the testbed is ready
193 * @param tmain_cls closure for 'tmain' 193 * @param tmain_cls closure for 'tmain'
194 */ 194 */
195void 195void
196GNUNET_DHT_TEST_run (const char *testname, 196GNUNET_DHT_TEST_run (const char *testname,
197 const char *cfgname, 197 const char *cfgname,
198 unsigned int num_peers, 198 unsigned int num_peers,
@@ -200,7 +200,7 @@ GNUNET_DHT_TEST_run (const char *testname,
200 void *tmain_cls) 200 void *tmain_cls)
201{ 201{
202 struct GNUNET_DHT_TEST_Context *ctx; 202 struct GNUNET_DHT_TEST_Context *ctx;
203 203
204 ctx = GNUNET_malloc (sizeof (struct GNUNET_DHT_TEST_Context)); 204 ctx = GNUNET_malloc (sizeof (struct GNUNET_DHT_TEST_Context));
205 ctx->num_peers = num_peers; 205 ctx->num_peers = num_peers;
206 ctx->ops = GNUNET_malloc (num_peers * sizeof (struct GNUNET_TESTBED_Operation *)); 206 ctx->ops = GNUNET_malloc (num_peers * sizeof (struct GNUNET_TESTBED_Operation *));
diff --git a/src/dht/dht_test_lib.h b/src/dht/dht_test_lib.h
index 061794af4..bfa9c1d85 100644
--- a/src/dht/dht_test_lib.h
+++ b/src/dht/dht_test_lib.h
@@ -68,7 +68,7 @@ typedef void (*GNUNET_DHT_TEST_AppMain) (void *cls,
68 * @param tmain main function to run once the testbed is ready 68 * @param tmain main function to run once the testbed is ready
69 * @param tmain_cls closure for 'tmain' 69 * @param tmain_cls closure for 'tmain'
70 */ 70 */
71void 71void
72GNUNET_DHT_TEST_run (const char *testname, 72GNUNET_DHT_TEST_run (const char *testname,
73 const char *cfgname, 73 const char *cfgname,
74 unsigned int num_peers, 74 unsigned int num_peers,
diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c
index 345a58a13..e7e809323 100644
--- a/src/dht/gnunet-dht-get.c
+++ b/src/dht/gnunet-dht-get.c
@@ -128,8 +128,8 @@ get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
128 unsigned int put_path_length, enum GNUNET_BLOCK_Type type, 128 unsigned int put_path_length, enum GNUNET_BLOCK_Type type,
129 size_t size, const void *data) 129 size_t size, const void *data)
130{ 130{
131 FPRINTF (stdout, 131 FPRINTF (stdout,
132 _("Result %d, type %d:\n%.*s\n"), 132 _("Result %d, type %d:\n%.*s\n"),
133 result_count, type, 133 result_count, type,
134 (unsigned int) size, (char *) data); 134 (unsigned int) size, (char *) data);
135 result_count++; 135 result_count++;
diff --git a/src/dht/gnunet-dht-monitor.c b/src/dht/gnunet-dht-monitor.c
index b03c7c7c0..6ec29030d 100644
--- a/src/dht/gnunet-dht-monitor.c
+++ b/src/dht/gnunet-dht-monitor.c
@@ -152,7 +152,7 @@ get_resp_callback (void *cls,
152 const void *data, 152 const void *data,
153 size_t size) 153 size_t size)
154{ 154{
155 FPRINTF (stdout, 155 FPRINTF (stdout,
156 "RESPONSE #%u: type %d, key `%s', data `%.*s'\n", 156 "RESPONSE #%u: type %d, key `%s', data `%.*s'\n",
157 result_count, 157 result_count,
158 (int) type, 158 (int) type,
@@ -191,7 +191,7 @@ put_callback (void *cls,
191 const void *data, 191 const void *data,
192 size_t size) 192 size_t size)
193{ 193{
194 FPRINTF (stdout, 194 FPRINTF (stdout,
195 "PUT %u: type %d, key `%s', data `%.*s'\n", 195 "PUT %u: type %d, key `%s', data `%.*s'\n",
196 result_count, 196 result_count,
197 (int) type, 197 (int) type,
@@ -221,14 +221,14 @@ run (void *cls, char *const *args, const char *cfgfile,
221 221
222 if (NULL == (dht_handle = GNUNET_DHT_connect (cfg, 1))) 222 if (NULL == (dht_handle = GNUNET_DHT_connect (cfg, 1)))
223 { 223 {
224 FPRINTF (stderr, "%s", 224 FPRINTF (stderr, "%s",
225 _("Failed to connect to DHT service!\n")); 225 _("Failed to connect to DHT service!\n"));
226 ret = 1; 226 ret = 1;
227 return; 227 return;
228 } 228 }
229 if (GNUNET_BLOCK_TYPE_ANY == block_type) /* Type of data not set */ 229 if (GNUNET_BLOCK_TYPE_ANY == block_type) /* Type of data not set */
230 block_type = GNUNET_BLOCK_TYPE_TEST; 230 block_type = GNUNET_BLOCK_TYPE_TEST;
231 if (NULL != query_key) 231 if (NULL != query_key)
232 { 232 {
233 key = &hc; 233 key = &hc;
234 if (GNUNET_OK != 234 if (GNUNET_OK !=
@@ -240,8 +240,8 @@ run (void *cls, char *const *args, const char *cfgfile,
240 key = NULL; 240 key = NULL;
241 } 241 }
242 if (verbose) 242 if (verbose)
243 FPRINTF (stderr, 243 FPRINTF (stderr,
244 "Monitoring for %s\n", 244 "Monitoring for %s\n",
245 GNUNET_STRINGS_relative_time_to_string (timeout_request, GNUNET_NO)); 245 GNUNET_STRINGS_relative_time_to_string (timeout_request, GNUNET_NO));
246 GNUNET_SCHEDULER_add_delayed (timeout_request, &cleanup_task, NULL); 246 GNUNET_SCHEDULER_add_delayed (timeout_request, &cleanup_task, NULL);
247 monitor_handle = GNUNET_DHT_monitor_start (dht_handle, 247 monitor_handle = GNUNET_DHT_monitor_start (dht_handle,
diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c
index 20fbba789..f91311cf3 100644
--- a/src/dht/gnunet-service-dht_clients.c
+++ b/src/dht/gnunet-service-dht_clients.c
@@ -199,7 +199,7 @@ struct ClientMonitorRecord
199 * Previous element in DLL. 199 * Previous element in DLL.
200 */ 200 */
201 struct ClientMonitorRecord *prev; 201 struct ClientMonitorRecord *prev;
202 202
203 /** 203 /**
204 * Type of blocks that are of interest 204 * Type of blocks that are of interest
205 */ 205 */
@@ -367,7 +367,7 @@ handle_client_disconnect (void *cls,
367 struct ClientMonitorRecord *monitor; 367 struct ClientMonitorRecord *monitor;
368 368
369 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 369 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
370 "Local client %p disconnects\n", 370 "Local client %p disconnects\n",
371 client); 371 client);
372 pos = find_active_client (client); 372 pos = find_active_client (client);
373 GNUNET_CONTAINER_DLL_remove (client_head, client_tail, pos); 373 GNUNET_CONTAINER_DLL_remove (client_head, client_tail, pos);
@@ -384,7 +384,7 @@ handle_client_disconnect (void *cls,
384 if (monitor->client == pos) 384 if (monitor->client == pos)
385 { 385 {
386 struct ClientMonitorRecord *next; 386 struct ClientMonitorRecord *next;
387 387
388 GNUNET_free_non_null (monitor->key); 388 GNUNET_free_non_null (monitor->key);
389 next = monitor->next; 389 next = monitor->next;
390 GNUNET_CONTAINER_DLL_remove (monitor_head, monitor_tail, monitor); 390 GNUNET_CONTAINER_DLL_remove (monitor_head, monitor_tail, monitor);
@@ -550,7 +550,7 @@ handle_dht_local_put (void *cls, struct GNUNET_SERVER_Client *client,
550 &dht_msg[1], 550 &dht_msg[1],
551 size - sizeof (struct GNUNET_DHT_ClientPutMessage)); 551 size - sizeof (struct GNUNET_DHT_ClientPutMessage));
552 GNUNET_CONTAINER_bloomfilter_free (peer_bf); 552 GNUNET_CONTAINER_bloomfilter_free (peer_bf);
553 pm = GNUNET_malloc (sizeof (struct PendingMessage) + 553 pm = GNUNET_malloc (sizeof (struct PendingMessage) +
554 sizeof (struct GNUNET_DHT_ClientPutConfirmationMessage)); 554 sizeof (struct GNUNET_DHT_ClientPutConfirmationMessage));
555 conf = (struct GNUNET_DHT_ClientPutConfirmationMessage *) &pm[1]; 555 conf = (struct GNUNET_DHT_ClientPutConfirmationMessage *) &pm[1];
556 conf->header.size = htons (sizeof (struct GNUNET_DHT_ClientPutConfirmationMessage)); 556 conf->header.size = htons (sizeof (struct GNUNET_DHT_ClientPutConfirmationMessage));
@@ -884,7 +884,7 @@ handle_dht_local_monitor_stop (void *cls, struct GNUNET_SERVER_Client *client,
884 } 884 }
885 r = r->next; 885 r = r->next;
886 } 886 }
887 887
888 GNUNET_SERVER_receive_done (client, GNUNET_OK); 888 GNUNET_SERVER_receive_done (client, GNUNET_OK);
889} 889}
890 890
@@ -1226,7 +1226,7 @@ void
1226GDS_CLIENTS_process_get (uint32_t options, 1226GDS_CLIENTS_process_get (uint32_t options,
1227 enum GNUNET_BLOCK_Type type, 1227 enum GNUNET_BLOCK_Type type,
1228 uint32_t hop_count, 1228 uint32_t hop_count,
1229 uint32_t desired_replication_level, 1229 uint32_t desired_replication_level,
1230 unsigned int path_length, 1230 unsigned int path_length,
1231 const struct GNUNET_PeerIdentity *path, 1231 const struct GNUNET_PeerIdentity *path,
1232 const struct GNUNET_HashCode * key) 1232 const struct GNUNET_HashCode * key)
@@ -1386,7 +1386,7 @@ void
1386GDS_CLIENTS_process_put (uint32_t options, 1386GDS_CLIENTS_process_put (uint32_t options,
1387 enum GNUNET_BLOCK_Type type, 1387 enum GNUNET_BLOCK_Type type,
1388 uint32_t hop_count, 1388 uint32_t hop_count,
1389 uint32_t desired_replication_level, 1389 uint32_t desired_replication_level,
1390 unsigned int path_length, 1390 unsigned int path_length,
1391 const struct GNUNET_PeerIdentity *path, 1391 const struct GNUNET_PeerIdentity *path,
1392 struct GNUNET_TIME_Absolute exp, 1392 struct GNUNET_TIME_Absolute exp,
diff --git a/src/dht/gnunet-service-dht_clients.h b/src/dht/gnunet-service-dht_clients.h
index f6d4253d5..44491377e 100644
--- a/src/dht/gnunet-service-dht_clients.h
+++ b/src/dht/gnunet-service-dht_clients.h
@@ -72,7 +72,7 @@ void
72GDS_CLIENTS_process_get (uint32_t options, 72GDS_CLIENTS_process_get (uint32_t options,
73 enum GNUNET_BLOCK_Type type, 73 enum GNUNET_BLOCK_Type type,
74 uint32_t hop_count, 74 uint32_t hop_count,
75 uint32_t desired_replication_level, 75 uint32_t desired_replication_level,
76 unsigned int path_length, 76 unsigned int path_length,
77 const struct GNUNET_PeerIdentity *path, 77 const struct GNUNET_PeerIdentity *path,
78 const struct GNUNET_HashCode * key); 78 const struct GNUNET_HashCode * key);
@@ -121,7 +121,7 @@ void
121GDS_CLIENTS_process_put (uint32_t options, 121GDS_CLIENTS_process_put (uint32_t options,
122 enum GNUNET_BLOCK_Type type, 122 enum GNUNET_BLOCK_Type type,
123 uint32_t hop_count, 123 uint32_t hop_count,
124 uint32_t desired_replication_level, 124 uint32_t desired_replication_level,
125 unsigned int path_length, 125 unsigned int path_length,
126 const struct GNUNET_PeerIdentity *path, 126 const struct GNUNET_PeerIdentity *path,
127 struct GNUNET_TIME_Absolute exp, 127 struct GNUNET_TIME_Absolute exp,
diff --git a/src/dht/gnunet-service-dht_datacache.c b/src/dht/gnunet-service-dht_datacache.c
index 6f25a90d7..0e6daa120 100644
--- a/src/dht/gnunet-service-dht_datacache.c
+++ b/src/dht/gnunet-service-dht_datacache.c
@@ -137,7 +137,7 @@ struct GetRequestContext
137 * to stop iteration. 137 * to stop iteration.
138 */ 138 */
139static int 139static int
140datacache_get_iterator (void *cls, 140datacache_get_iterator (void *cls,
141 const struct GNUNET_HashCode * key, size_t size, 141 const struct GNUNET_HashCode * key, size_t size,
142 const char *data, enum GNUNET_BLOCK_Type type, 142 const char *data, enum GNUNET_BLOCK_Type type,
143 struct GNUNET_TIME_Absolute exp, 143 struct GNUNET_TIME_Absolute exp,
@@ -239,7 +239,7 @@ GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key,
239 ctx.xquery_size = xquery_size; 239 ctx.xquery_size = xquery_size;
240 ctx.reply_bf = reply_bf; 240 ctx.reply_bf = reply_bf;
241 ctx.reply_bf_mutator = reply_bf_mutator; 241 ctx.reply_bf_mutator = reply_bf_mutator;
242 r = GNUNET_DATACACHE_get (datacache, key, type, &datacache_get_iterator, 242 r = GNUNET_DATACACHE_get (datacache, key, type, &datacache_get_iterator,
243 &ctx); 243 &ctx);
244 LOG (GNUNET_ERROR_TYPE_DEBUG, 244 LOG (GNUNET_ERROR_TYPE_DEBUG,
245 "DATACACHE GET for key %s completed (%d). %u results found.\n", 245 "DATACACHE GET for key %s completed (%d). %u results found.\n",
diff --git a/src/dht/gnunet-service-dht_hello.c b/src/dht/gnunet-service-dht_hello.c
index d3415d11d..bc964b91f 100644
--- a/src/dht/gnunet-service-dht_hello.c
+++ b/src/dht/gnunet-service-dht_hello.c
@@ -107,8 +107,8 @@ GDS_HELLO_init ()
107 * Free memory occopied by the HELLO. 107 * Free memory occopied by the HELLO.
108 */ 108 */
109static int 109static int
110free_hello (void *cls, 110free_hello (void *cls,
111 const struct GNUNET_PeerIdentity *key, 111 const struct GNUNET_PeerIdentity *key,
112 void *hello) 112 void *hello)
113{ 113{
114 GNUNET_free (hello); 114 GNUNET_free (hello);
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index 908575735..889ef25ba 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -313,7 +313,7 @@ struct PeerInfo
313 struct PeerInfo *prev; 313 struct PeerInfo *prev;
314 314
315 /** 315 /**
316 * Count of outstanding messages for peer. 316 * Count of outstanding messages for peer.
317 */ 317 */
318 unsigned int pending_count; 318 unsigned int pending_count;
319 319
@@ -553,8 +553,8 @@ struct BloomConstructorContext
553 * @return #GNUNET_YES (we should continue to iterate) 553 * @return #GNUNET_YES (we should continue to iterate)
554 */ 554 */
555static int 555static int
556add_known_to_bloom (void *cls, 556add_known_to_bloom (void *cls,
557 const struct GNUNET_PeerIdentity *key, 557 const struct GNUNET_PeerIdentity *key,
558 void *value) 558 void *value)
559{ 559{
560 struct BloomConstructorContext *ctx = cls; 560 struct BloomConstructorContext *ctx = cls;
@@ -649,7 +649,7 @@ handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
649 /* Check for connect to self message */ 649 /* Check for connect to self message */
650 if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity))) 650 if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity)))
651 return; 651 return;
652 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 652 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
653 "Connected to %s\n", 653 "Connected to %s\n",
654 GNUNET_i2s (peer)); 654 GNUNET_i2s (peer));
655 if (GNUNET_YES == 655 if (GNUNET_YES ==
@@ -714,7 +714,7 @@ handle_core_disconnect (void *cls,
714 /* Check for disconnect from self message */ 714 /* Check for disconnect from self message */
715 if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity))) 715 if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity)))
716 return; 716 return;
717 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 717 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
718 "Disconnected %s\n", 718 "Disconnected %s\n",
719 GNUNET_i2s (peer)); 719 GNUNET_i2s (peer));
720 to_remove = 720 to_remove =
@@ -919,14 +919,14 @@ get_forward_count (uint32_t hop_count, uint32_t target_replication)
919 * Differences in the lower bits must count stronger than differences 919 * Differences in the lower bits must count stronger than differences
920 * in the higher bits. 920 * in the higher bits.
921 * 921 *
922 * @param target 922 * @param target
923 * @param have 923 * @param have
924 * @return 0 if have==target, otherwise a number 924 * @return 0 if have==target, otherwise a number
925 * that is larger as the distance between 925 * that is larger as the distance between
926 * the two hash codes increases 926 * the two hash codes increases
927 */ 927 */
928static unsigned int 928static unsigned int
929get_distance (const struct GNUNET_HashCode *target, 929get_distance (const struct GNUNET_HashCode *target,
930 const struct GNUNET_HashCode *have) 930 const struct GNUNET_HashCode *have)
931{ 931{
932 unsigned int bucket; 932 unsigned int bucket;
@@ -1197,7 +1197,7 @@ get_target_peers (const struct GNUNET_HashCode *key,
1197 struct GNUNET_HashCode nhash; 1197 struct GNUNET_HashCode nhash;
1198 1198
1199 GNUNET_assert (NULL != bloom); 1199 GNUNET_assert (NULL != bloom);
1200 ret = get_forward_count (hop_count, target_replication); 1200 ret = get_forward_count (hop_count, target_replication);
1201 if (0 == ret) 1201 if (0 == ret)
1202 { 1202 {
1203 *targets = NULL; 1203 *targets = NULL;
@@ -1231,7 +1231,7 @@ get_target_peers (const struct GNUNET_HashCode *key,
1231 *targets = rtargets; 1231 *targets = rtargets;
1232 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1232 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1233 "Forwarding query `%s' to %u peers (goal was %u peers)\n", 1233 "Forwarding query `%s' to %u peers (goal was %u peers)\n",
1234 GNUNET_h2s (key), 1234 GNUNET_h2s (key),
1235 off, 1235 off,
1236 ret); 1236 ret);
1237 return off; 1237 return off;
@@ -1601,7 +1601,7 @@ core_init (void *cls,
1601 * #GNUNET_SYSERR to close it (signal serious error) 1601 * #GNUNET_SYSERR to close it (signal serious error)
1602 */ 1602 */
1603static int 1603static int
1604handle_dht_p2p_put (void *cls, 1604handle_dht_p2p_put (void *cls,
1605 const struct GNUNET_PeerIdentity *peer, 1605 const struct GNUNET_PeerIdentity *peer,
1606 const struct GNUNET_MessageHeader *message) 1606 const struct GNUNET_MessageHeader *message)
1607{ 1607{
@@ -1654,7 +1654,7 @@ handle_dht_p2p_put (void *cls,
1654 1654
1655 tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); 1655 tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
1656 LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, 1656 LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG,
1657 "XDHT PUT %s: %s->%s (%u, %u=>%u)\n", 1657 "XDHT PUT %s: %s->%s (%u, %u=>%u)\n",
1658 GNUNET_h2s (&put->key), GNUNET_i2s (peer), tmp, 1658 GNUNET_h2s (&put->key), GNUNET_i2s (peer), tmp,
1659 ntohl(put->hop_count), 1659 ntohl(put->hop_count),
1660 GNUNET_CRYPTO_hash_matching_bits (&phash, &put->key), 1660 GNUNET_CRYPTO_hash_matching_bits (&phash, &put->key),
@@ -1913,7 +1913,7 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer,
1913 1913
1914 tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); 1914 tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
1915 LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, 1915 LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG,
1916 "XDHT GET %s: %s->%s (%u, %u=>%u) xq: %.*s\n", 1916 "XDHT GET %s: %s->%s (%u, %u=>%u) xq: %.*s\n",
1917 GNUNET_h2s (&get->key), GNUNET_i2s (peer), tmp, 1917 GNUNET_h2s (&get->key), GNUNET_i2s (peer), tmp,
1918 ntohl(get->hop_count), 1918 ntohl(get->hop_count),
1919 GNUNET_CRYPTO_hash_matching_bits (&phash, &get->key), 1919 GNUNET_CRYPTO_hash_matching_bits (&phash, &get->key),
@@ -2059,7 +2059,7 @@ handle_dht_p2p_result (void *cls, const struct GNUNET_PeerIdentity *peer,
2059 char *tmp; 2059 char *tmp;
2060 2060
2061 tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); 2061 tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
2062 LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, "XDHT RESULT %s: %s->%s (%u)\n", 2062 LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, "XDHT RESULT %s: %s->%s (%u)\n",
2063 GNUNET_h2s (&prm->key), GNUNET_i2s (peer), tmp, 2063 GNUNET_h2s (&prm->key), GNUNET_i2s (peer), tmp,
2064 get_path_length + 1); 2064 get_path_length + 1);
2065 GNUNET_free (tmp); 2065 GNUNET_free (tmp);
@@ -2132,10 +2132,10 @@ handle_dht_p2p_result (void *cls, const struct GNUNET_PeerIdentity *peer,
2132 struct GNUNET_PeerIdentity xput_path[get_path_length + 1 + put_path_length]; 2132 struct GNUNET_PeerIdentity xput_path[get_path_length + 1 + put_path_length];
2133 2133
2134 memcpy (xput_path, put_path, put_path_length * sizeof (struct GNUNET_PeerIdentity)); 2134 memcpy (xput_path, put_path, put_path_length * sizeof (struct GNUNET_PeerIdentity));
2135 memcpy (&xput_path[put_path_length], 2135 memcpy (&xput_path[put_path_length],
2136 xget_path, 2136 xget_path,
2137 get_path_length * sizeof (struct GNUNET_PeerIdentity)); 2137 get_path_length * sizeof (struct GNUNET_PeerIdentity));
2138 2138
2139 GDS_DATACACHE_handle_put (GNUNET_TIME_absolute_ntoh (prm->expiration_time), 2139 GDS_DATACACHE_handle_put (GNUNET_TIME_absolute_ntoh (prm->expiration_time),
2140 &prm->key, 2140 &prm->key,
2141 get_path_length + put_path_length, xput_path, 2141 get_path_length + put_path_length, xput_path,
@@ -2214,7 +2214,7 @@ GDS_NEIGHBOURS_done ()
2214 2214
2215/** 2215/**
2216 * Get the ID of the local node. 2216 * Get the ID of the local node.
2217 * 2217 *
2218 * @return identity of the local node 2218 * @return identity of the local node
2219 */ 2219 */
2220struct GNUNET_PeerIdentity * 2220struct GNUNET_PeerIdentity *
diff --git a/src/dht/gnunet-service-dht_neighbours.h b/src/dht/gnunet-service-dht_neighbours.h
index b3b33e318..225c4aae0 100644
--- a/src/dht/gnunet-service-dht_neighbours.h
+++ b/src/dht/gnunet-service-dht_neighbours.h
@@ -137,7 +137,7 @@ GDS_NEIGHBOURS_done (void);
137 137
138/** 138/**
139 * Get the ID of the local node. 139 * Get the ID of the local node.
140 * 140 *
141 * @return identity of the local node 141 * @return identity of the local node
142 */ 142 */
143struct GNUNET_PeerIdentity * 143struct GNUNET_PeerIdentity *
diff --git a/src/dht/gnunet-service-dht_routing.c b/src/dht/gnunet-service-dht_routing.c
index d7e6505b0..e2995bd49 100644
--- a/src/dht/gnunet-service-dht_routing.c
+++ b/src/dht/gnunet-service-dht_routing.c
@@ -321,8 +321,8 @@ expire_oldest_entry ()
321 GNUNET_CONTAINER_heap_remove_node (recent_req->heap_node); 321 GNUNET_CONTAINER_heap_remove_node (recent_req->heap_node);
322 GNUNET_CONTAINER_bloomfilter_free (recent_req->reply_bf); 322 GNUNET_CONTAINER_bloomfilter_free (recent_req->reply_bf);
323 GNUNET_assert (GNUNET_YES == 323 GNUNET_assert (GNUNET_YES ==
324 GNUNET_CONTAINER_multihashmap_remove (recent_map, 324 GNUNET_CONTAINER_multihashmap_remove (recent_map,
325 &recent_req->key, 325 &recent_req->key,
326 recent_req)); 326 recent_req));
327 GNUNET_free (recent_req); 327 GNUNET_free (recent_req);
328} 328}
diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c
index b1c39e893..2295866d3 100644
--- a/src/dht/test_dht_api.c
+++ b/src/dht/test_dht_api.c
@@ -172,7 +172,7 @@ test_get (void *cls, int success)
172 retry_context.next_timeout = BASE_TIMEOUT; 172 retry_context.next_timeout = BASE_TIMEOUT;
173 173
174 get_handle = 174 get_handle =
175 GNUNET_DHT_get_start (dht_handle, 175 GNUNET_DHT_get_start (dht_handle,
176 GNUNET_BLOCK_TYPE_TEST, &hash, 1, 176 GNUNET_BLOCK_TYPE_TEST, &hash, 1,
177 GNUNET_DHT_RO_NONE, NULL, 0, &test_get_iterator, 177 GNUNET_DHT_RO_NONE, NULL, 0, &test_get_iterator,
178 NULL); 178 NULL);
diff --git a/src/dht/test_dht_monitor.c b/src/dht/test_dht_monitor.c
index 74024edf2..303fe8f87 100644
--- a/src/dht/test_dht_monitor.c
+++ b/src/dht/test_dht_monitor.c
@@ -42,7 +42,7 @@
42/** 42/**
43 * Information we keep for each GET operation. 43 * Information we keep for each GET operation.
44 */ 44 */
45struct GetOperation 45struct GetOperation
46{ 46{
47 /** 47 /**
48 * DLL. 48 * DLL.
@@ -79,7 +79,7 @@ static struct GetOperation *get_tail;
79 79
80/** 80/**
81 * Array of the testbed's peers. 81 * Array of the testbed's peers.
82 */ 82 */
83static struct GNUNET_TESTBED_Peer **my_peers; 83static struct GNUNET_TESTBED_Peer **my_peers;
84 84
85/** 85/**
@@ -109,9 +109,9 @@ static unsigned int monitor_counter;
109 * 109 *
110 * @param cls the 'struct GNUNET_DHT_TestContext' 110 * @param cls the 'struct GNUNET_DHT_TestContext'
111 * @param tc scheduler context 111 * @param tc scheduler context
112 */ 112 */
113static void 113static void
114shutdown_task (void *cls, 114shutdown_task (void *cls,
115 const struct GNUNET_SCHEDULER_TaskContext *tc) 115 const struct GNUNET_SCHEDULER_TaskContext *tc)
116{ 116{
117 struct GNUNET_DHT_TEST_Context *ctx = cls; 117 struct GNUNET_DHT_TEST_Context *ctx = cls;
@@ -177,7 +177,7 @@ dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp,
177 GNUNET_break (0); 177 GNUNET_break (0);
178 return; 178 return;
179 } 179 }
180 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 180 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
181 "Get successful\n"); 181 "Get successful\n");
182 GNUNET_DHT_get_stop (get_op->get); 182 GNUNET_DHT_get_stop (get_op->get);
183 GNUNET_CONTAINER_DLL_remove (get_head, 183 GNUNET_CONTAINER_DLL_remove (get_head,
@@ -195,7 +195,7 @@ dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp,
195 195
196/** 196/**
197 * Task to put the id of each peer into the DHT. 197 * Task to put the id of each peer into the DHT.
198 * 198 *
199 * @param cls array with NUM_PEERS DHT handles 199 * @param cls array with NUM_PEERS DHT handles
200 * @param tc Task context 200 * @param tc Task context
201 */ 201 */
@@ -208,7 +208,7 @@ do_puts (void *cls,
208 struct GNUNET_HashCode value; 208 struct GNUNET_HashCode value;
209 unsigned int i; 209 unsigned int i;
210 210
211 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 211 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
212 "Putting values into DHT\n"); 212 "Putting values into DHT\n");
213 for (i = 0; i < NUM_PEERS; i++) 213 for (i = 0; i < NUM_PEERS; i++)
214 { 214 {
@@ -217,13 +217,13 @@ do_puts (void *cls,
217 GNUNET_DHT_put (hs[i], &key, 10U, 217 GNUNET_DHT_put (hs[i], &key, 10U,
218 GNUNET_DHT_RO_RECORD_ROUTE | 218 GNUNET_DHT_RO_RECORD_ROUTE |
219 GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, 219 GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE,
220 GNUNET_BLOCK_TYPE_TEST, 220 GNUNET_BLOCK_TYPE_TEST,
221 sizeof (value), &value, 221 sizeof (value), &value,
222 GNUNET_TIME_UNIT_FOREVER_ABS, 222 GNUNET_TIME_UNIT_FOREVER_ABS,
223 GNUNET_TIME_UNIT_FOREVER_REL, 223 GNUNET_TIME_UNIT_FOREVER_REL,
224 NULL, NULL); 224 NULL, NULL);
225 } 225 }
226 put_task = GNUNET_SCHEDULER_add_delayed (PUT_FREQUENCY, 226 put_task = GNUNET_SCHEDULER_add_delayed (PUT_FREQUENCY,
227 &do_puts, hs); 227 &do_puts, hs);
228} 228}
229 229
@@ -296,7 +296,7 @@ monitor_put_cb (void *cls,
296 i = (unsigned int) (long) cls; 296 i = (unsigned int) (long) cls;
297 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 297 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
298 "%u got a PUT message for key %s with %u bytes\n", 298 "%u got a PUT message for key %s with %u bytes\n",
299 i, 299 i,
300 GNUNET_h2s (key), size); 300 GNUNET_h2s (key), size);
301 monitor_counter++; 301 monitor_counter++;
302} 302}
@@ -334,7 +334,7 @@ monitor_res_cb (void *cls,
334 i = (unsigned int) (long) cls; 334 i = (unsigned int) (long) cls;
335 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 335 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
336 "%u got a REPLY message for key %s with %u bytes\n", 336 "%u got a REPLY message for key %s with %u bytes\n",
337 i, 337 i,
338 GNUNET_h2s (key), size); 338 GNUNET_h2s (key), size);
339 monitor_counter++; 339 monitor_counter++;
340} 340}
@@ -372,7 +372,7 @@ run (void *cls,
372 &monitor_res_cb, 372 &monitor_res_cb,
373 &monitor_put_cb, 373 &monitor_put_cb,
374 (void *)(long)i); 374 (void *)(long)i);
375 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 375 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
376 "Peers setup, starting test\n"); 376 "Peers setup, starting test\n");
377 put_task = GNUNET_SCHEDULER_add_now (&do_puts, dhts); 377 put_task = GNUNET_SCHEDULER_add_now (&do_puts, dhts);
378 for (i=0;i<num_peers;i++) 378 for (i=0;i<num_peers;i++)
@@ -384,7 +384,7 @@ run (void *cls,
384 GNUNET_CONTAINER_DLL_insert (get_head, 384 GNUNET_CONTAINER_DLL_insert (get_head,
385 get_tail, 385 get_tail,
386 get_op); 386 get_op);
387 get_op->get = GNUNET_DHT_get_start (dhts[j], 387 get_op->get = GNUNET_DHT_get_start (dhts[j],
388 GNUNET_BLOCK_TYPE_TEST, /* type */ 388 GNUNET_BLOCK_TYPE_TEST, /* type */
389 &key, /*key to search */ 389 &key, /*key to search */
390 4U, /* replication level */ 390 4U, /* replication level */
@@ -394,7 +394,7 @@ run (void *cls,
394 &dht_get_handler, get_op); 394 &dht_get_handler, get_op);
395 } 395 }
396 } 396 }
397 timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 397 timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
398 &shutdown_task, ctx); 398 &shutdown_task, ctx);
399} 399}
400 400
diff --git a/src/dht/test_dht_topo.c b/src/dht/test_dht_topo.c
index 1ab580d5b..1fd61129b 100644
--- a/src/dht/test_dht_topo.c
+++ b/src/dht/test_dht_topo.c
@@ -43,7 +43,7 @@
43/** 43/**
44 * Information we keep for each GET operation. 44 * Information we keep for each GET operation.
45 */ 45 */
46struct GetOperation 46struct GetOperation
47{ 47{
48 /** 48 /**
49 * DLL. 49 * DLL.
@@ -90,7 +90,7 @@ static struct GetOperation *get_tail;
90 90
91/** 91/**
92 * Array of the testbed's peers. 92 * Array of the testbed's peers.
93 */ 93 */
94static struct GNUNET_TESTBED_Peer **my_peers; 94static struct GNUNET_TESTBED_Peer **my_peers;
95 95
96/** 96/**
@@ -173,10 +173,10 @@ stats_finished (void *cls,
173 return; 173 return;
174 } 174 }
175 for (i = 0; NULL != stats[i].name; i++) 175 for (i = 0; NULL != stats[i].name; i++)
176 FPRINTF (stderr, 176 FPRINTF (stderr,
177 "%6s/%60s = %12llu\n", 177 "%6s/%60s = %12llu\n",
178 stats[i].subsystem, 178 stats[i].subsystem,
179 stats[i].name, 179 stats[i].name,
180 stats[i].total); 180 stats[i].total);
181 GNUNET_SCHEDULER_cancel (put_task); 181 GNUNET_SCHEDULER_cancel (put_task);
182 GNUNET_DHT_TEST_cleanup (ctx); 182 GNUNET_DHT_TEST_cleanup (ctx);
@@ -194,7 +194,7 @@ stats_finished (void *cls,
194 * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not 194 * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
195 * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration 195 * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
196 */ 196 */
197static int 197static int
198handle_stats (void *cls, 198handle_stats (void *cls,
199 const struct GNUNET_TESTBED_Peer *peer, 199 const struct GNUNET_TESTBED_Peer *peer,
200 const char *subsystem, 200 const char *subsystem,
@@ -221,9 +221,9 @@ handle_stats (void *cls,
221 * 221 *
222 * @param cls the 'struct GNUNET_DHT_TestContext' 222 * @param cls the 'struct GNUNET_DHT_TestContext'
223 * @param tc scheduler context 223 * @param tc scheduler context
224 */ 224 */
225static void 225static void
226shutdown_task (void *cls, 226shutdown_task (void *cls,
227 const struct GNUNET_SCHEDULER_TaskContext *tc) 227 const struct GNUNET_SCHEDULER_TaskContext *tc)
228{ 228{
229 struct GNUNET_DHT_TEST_Context *ctx = cls; 229 struct GNUNET_DHT_TEST_Context *ctx = cls;
@@ -285,7 +285,7 @@ dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp,
285 GNUNET_break (0); 285 GNUNET_break (0);
286 return; 286 return;
287 } 287 }
288 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 288 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
289 "Get successful\n"); 289 "Get successful\n");
290#if 0 290#if 0
291 { 291 {
@@ -318,7 +318,7 @@ dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp,
318 318
319/** 319/**
320 * Task to put the id of each peer into the DHT. 320 * Task to put the id of each peer into the DHT.
321 * 321 *
322 * @param cls array with NUM_PEERS DHT handles 322 * @param cls array with NUM_PEERS DHT handles
323 * @param tc Task context 323 * @param tc Task context
324 */ 324 */
@@ -331,7 +331,7 @@ do_puts (void *cls,
331 struct GNUNET_HashCode value; 331 struct GNUNET_HashCode value;
332 unsigned int i; 332 unsigned int i;
333 333
334 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 334 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
335 "Putting values into DHT\n"); 335 "Putting values into DHT\n");
336 for (i = 0; i < NUM_PEERS; i++) 336 for (i = 0; i < NUM_PEERS; i++)
337 { 337 {
@@ -340,13 +340,13 @@ do_puts (void *cls,
340 GNUNET_DHT_put (hs[i], &key, 10U, 340 GNUNET_DHT_put (hs[i], &key, 10U,
341 GNUNET_DHT_RO_RECORD_ROUTE | 341 GNUNET_DHT_RO_RECORD_ROUTE |
342 GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, 342 GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE,
343 GNUNET_BLOCK_TYPE_TEST, 343 GNUNET_BLOCK_TYPE_TEST,
344 sizeof (value), &value, 344 sizeof (value), &value,
345 GNUNET_TIME_UNIT_FOREVER_ABS, 345 GNUNET_TIME_UNIT_FOREVER_ABS,
346 GNUNET_TIME_UNIT_FOREVER_REL, 346 GNUNET_TIME_UNIT_FOREVER_REL,
347 NULL, NULL); 347 NULL, NULL);
348 } 348 }
349 put_task = GNUNET_SCHEDULER_add_delayed (PUT_FREQUENCY, 349 put_task = GNUNET_SCHEDULER_add_delayed (PUT_FREQUENCY,
350 &do_puts, hs); 350 &do_puts, hs);
351} 351}
352 352
@@ -374,7 +374,7 @@ run (void *cls,
374 374
375 GNUNET_assert (NUM_PEERS == num_peers); 375 GNUNET_assert (NUM_PEERS == num_peers);
376 my_peers = peers; 376 my_peers = peers;
377 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 377 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
378 "Peers setup, starting test\n"); 378 "Peers setup, starting test\n");
379 put_task = GNUNET_SCHEDULER_add_now (&do_puts, dhts); 379 put_task = GNUNET_SCHEDULER_add_now (&do_puts, dhts);
380 for (i=0;i<num_peers;i++) 380 for (i=0;i<num_peers;i++)
@@ -386,7 +386,7 @@ run (void *cls,
386 GNUNET_CONTAINER_DLL_insert (get_head, 386 GNUNET_CONTAINER_DLL_insert (get_head,
387 get_tail, 387 get_tail,
388 get_op); 388 get_op);
389 get_op->get = GNUNET_DHT_get_start (dhts[j], 389 get_op->get = GNUNET_DHT_get_start (dhts[j],
390 GNUNET_BLOCK_TYPE_TEST, /* type */ 390 GNUNET_BLOCK_TYPE_TEST, /* type */
391 &key, /*key to search */ 391 &key, /*key to search */
392 4U, /* replication level */ 392 4U, /* replication level */
@@ -396,7 +396,7 @@ run (void *cls,
396 &dht_get_handler, get_op); 396 &dht_get_handler, get_op);
397 } 397 }
398 } 398 }
399 timeout_task = GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, 399 timeout_task = GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT,
400 &shutdown_task, ctx); 400 &shutdown_task, ctx);
401} 401}
402 402
@@ -409,7 +409,7 @@ main (int xargc, char *xargv[])
409{ 409{
410 const char *cfg_filename; 410 const char *cfg_filename;
411 const char *test_name; 411 const char *test_name;
412 412
413 if (NULL != strstr (xargv[0], "test_dht_2dtorus")) 413 if (NULL != strstr (xargv[0], "test_dht_2dtorus"))
414 { 414 {
415 cfg_filename = "test_dht_2dtorus.conf"; 415 cfg_filename = "test_dht_2dtorus.conf";
@@ -418,19 +418,19 @@ main (int xargc, char *xargv[])
418 } 418 }
419 else if (NULL != strstr (xargv[0], "test_dht_line")) 419 else if (NULL != strstr (xargv[0], "test_dht_line"))
420 { 420 {
421 cfg_filename = "test_dht_line.conf"; 421 cfg_filename = "test_dht_line.conf";
422 test_name = "test-dht-line"; 422 test_name = "test-dht-line";
423 NUM_PEERS = 5; 423 NUM_PEERS = 5;
424 } 424 }
425 else if (NULL != strstr (xargv[0], "test_dht_twopeer")) 425 else if (NULL != strstr (xargv[0], "test_dht_twopeer"))
426 { 426 {
427 cfg_filename = "test_dht_line.conf"; 427 cfg_filename = "test_dht_line.conf";
428 test_name = "test-dht-twopeer"; 428 test_name = "test-dht-twopeer";
429 NUM_PEERS = 2; 429 NUM_PEERS = 2;
430 } 430 }
431 else if (NULL != strstr (xargv[0], "test_dht_multipeer")) 431 else if (NULL != strstr (xargv[0], "test_dht_multipeer"))
432 { 432 {
433 cfg_filename = "test_dht_multipeer.conf"; 433 cfg_filename = "test_dht_multipeer.conf";
434 test_name = "test-dht-multipeer"; 434 test_name = "test-dht-multipeer";
435 NUM_PEERS = 10; 435 NUM_PEERS = 10;
436 } 436 }
diff --git a/src/dns/dns.h b/src/dns/dns.h
index 7ee49a9c8..4c41335a3 100644
--- a/src/dns/dns.h
+++ b/src/dns/dns.h
@@ -60,7 +60,7 @@ struct GNUNET_DNS_Request
60 * Always zero. 60 * Always zero.
61 */ 61 */
62 uint32_t reserved GNUNET_PACKED; 62 uint32_t reserved GNUNET_PACKED;
63 63
64 /** 64 /**
65 * Unique request ID. 65 * Unique request ID.
66 */ 66 */
@@ -85,7 +85,7 @@ struct GNUNET_DNS_Response
85 * Zero to drop, 1 for no change (no payload), 2 for update (message has payload). 85 * Zero to drop, 1 for no change (no payload), 2 for update (message has payload).
86 */ 86 */
87 uint32_t drop_flag GNUNET_PACKED; 87 uint32_t drop_flag GNUNET_PACKED;
88 88
89 /** 89 /**
90 * Unique request ID. 90 * Unique request ID.
91 */ 91 */
diff --git a/src/dns/dns_api.c b/src/dns/dns_api.c
index f48457a01..9a8e1ca2d 100644
--- a/src/dns/dns_api.c
+++ b/src/dns/dns_api.c
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file dns/dns_api.c 22 * @file dns/dns_api.c
23 * @brief API to access the DNS service. 23 * @brief API to access the DNS service.
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
@@ -100,7 +100,7 @@ struct GNUNET_DNS_Handle
100 * Function to call to get replies. 100 * Function to call to get replies.
101 */ 101 */
102 GNUNET_DNS_RequestHandler rh; 102 GNUNET_DNS_RequestHandler rh;
103 103
104 /** 104 /**
105 * Closure for 'rh'. 105 * Closure for 'rh'.
106 */ 106 */
@@ -125,7 +125,7 @@ struct GNUNET_DNS_Handle
125 * Re-connect counter, to make sure we did not reconnect in the meantime. 125 * Re-connect counter, to make sure we did not reconnect in the meantime.
126 */ 126 */
127 uint32_t generation; 127 uint32_t generation;
128 128
129 /** 129 /**
130 * Flags for events we care about. 130 * Flags for events we care about.
131 */ 131 */
@@ -253,7 +253,7 @@ request_handler (void *cls,
253 req = (const struct GNUNET_DNS_Request *) msg; 253 req = (const struct GNUNET_DNS_Request *) msg;
254 GNUNET_break (ntohl (req->reserved) == 0); 254 GNUNET_break (ntohl (req->reserved) == 0);
255 payload_length = ntohs (req->header.size) - sizeof (struct GNUNET_DNS_Request); 255 payload_length = ntohs (req->header.size) - sizeof (struct GNUNET_DNS_Request);
256 GNUNET_CLIENT_receive (dh->dns_connection, 256 GNUNET_CLIENT_receive (dh->dns_connection,
257 &request_handler, dh, 257 &request_handler, dh,
258 GNUNET_TIME_UNIT_FOREVER_REL); 258 GNUNET_TIME_UNIT_FOREVER_REL);
259 259
@@ -261,7 +261,7 @@ request_handler (void *cls,
261 rh = GNUNET_malloc (sizeof (struct GNUNET_DNS_RequestHandle)); 261 rh = GNUNET_malloc (sizeof (struct GNUNET_DNS_RequestHandle));
262 rh->dh =dh; 262 rh->dh =dh;
263 rh->request_id = req->request_id; 263 rh->request_id = req->request_id;
264 rh->generation = dh->generation; 264 rh->generation = dh->generation;
265 dh->pending_requests++; 265 dh->pending_requests++;
266 dh->rh (dh->rh_cls, 266 dh->rh (dh->rh_cls,
267 rh, 267 rh,
@@ -285,7 +285,7 @@ send_response (void *cls, size_t size, void *buf)
285 struct GNUNET_DNS_Handle *dh = cls; 285 struct GNUNET_DNS_Handle *dh = cls;
286 struct ReplyQueueEntry *qe; 286 struct ReplyQueueEntry *qe;
287 size_t len; 287 size_t len;
288 288
289 dh->dns_transmit_handle = NULL; 289 dh->dns_transmit_handle = NULL;
290 if (NULL == buf) 290 if (NULL == buf)
291 { 291 {
@@ -300,12 +300,12 @@ send_response (void *cls, size_t size, void *buf)
300 return 0; 300 return 0;
301 len = ntohs (qe->msg->size); 301 len = ntohs (qe->msg->size);
302 if (len > size) 302 if (len > size)
303 { 303 {
304 dh->dns_transmit_handle = 304 dh->dns_transmit_handle =
305 GNUNET_CLIENT_notify_transmit_ready (dh->dns_connection, 305 GNUNET_CLIENT_notify_transmit_ready (dh->dns_connection,
306 len, 306 len,
307 GNUNET_TIME_UNIT_FOREVER_REL, 307 GNUNET_TIME_UNIT_FOREVER_REL,
308 GNUNET_NO, 308 GNUNET_NO,
309 &send_response, dh); 309 &send_response, dh);
310 return 0; 310 return 0;
311 } 311 }
@@ -317,7 +317,7 @@ send_response (void *cls, size_t size, void *buf)
317 if (GNUNET_NO == dh->in_receive) 317 if (GNUNET_NO == dh->in_receive)
318 { 318 {
319 dh->in_receive = GNUNET_YES; 319 dh->in_receive = GNUNET_YES;
320 GNUNET_CLIENT_receive (dh->dns_connection, 320 GNUNET_CLIENT_receive (dh->dns_connection,
321 &request_handler, dh, 321 &request_handler, dh,
322 GNUNET_TIME_UNIT_FOREVER_REL); 322 GNUNET_TIME_UNIT_FOREVER_REL);
323 } 323 }
@@ -327,11 +327,11 @@ send_response (void *cls, size_t size, void *buf)
327 GNUNET_CLIENT_notify_transmit_ready (dh->dns_connection, 327 GNUNET_CLIENT_notify_transmit_ready (dh->dns_connection,
328 ntohs (qe->msg->size), 328 ntohs (qe->msg->size),
329 GNUNET_TIME_UNIT_FOREVER_REL, 329 GNUNET_TIME_UNIT_FOREVER_REL,
330 GNUNET_NO, 330 GNUNET_NO,
331 &send_response, dh); 331 &send_response, dh);
332 } 332 }
333 return len; 333 return len;
334} 334}
335 335
336 336
337/** 337/**
@@ -344,7 +344,7 @@ static void
344queue_reply (struct GNUNET_DNS_Handle *dh, 344queue_reply (struct GNUNET_DNS_Handle *dh,
345 struct ReplyQueueEntry *qe) 345 struct ReplyQueueEntry *qe)
346{ 346{
347 if (NULL == dh->dns_connection) 347 if (NULL == dh->dns_connection)
348 { 348 {
349 GNUNET_free (qe); 349 GNUNET_free (qe);
350 return; 350 return;
@@ -354,12 +354,12 @@ queue_reply (struct GNUNET_DNS_Handle *dh,
354 qe); 354 qe);
355 if (NULL != dh->dns_transmit_handle) 355 if (NULL != dh->dns_transmit_handle)
356 return; 356 return;
357 /* trigger sending */ 357 /* trigger sending */
358 dh->dns_transmit_handle = 358 dh->dns_transmit_handle =
359 GNUNET_CLIENT_notify_transmit_ready (dh->dns_connection, 359 GNUNET_CLIENT_notify_transmit_ready (dh->dns_connection,
360 ntohs (dh->rq_head->msg->size), 360 ntohs (dh->rq_head->msg->size),
361 GNUNET_TIME_UNIT_FOREVER_REL, 361 GNUNET_TIME_UNIT_FOREVER_REL,
362 GNUNET_NO, 362 GNUNET_NO,
363 &send_response, dh); 363 &send_response, dh);
364} 364}
365 365
@@ -440,7 +440,7 @@ GNUNET_DNS_request_drop (struct GNUNET_DNS_RequestHandle *rh)
440 * @param reply reply data 440 * @param reply reply data
441 */ 441 */
442void 442void
443GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh, 443GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh,
444 uint16_t reply_length, 444 uint16_t reply_length,
445 const char *reply) 445 const char *reply)
446{ 446{
@@ -480,7 +480,7 @@ GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh,
480 * @param flags when to call rh 480 * @param flags when to call rh
481 * @param rh function to call with DNS requests 481 * @param rh function to call with DNS requests
482 * @param rh_cls closure to pass to rh 482 * @param rh_cls closure to pass to rh
483 * @return DNS handle 483 * @return DNS handle
484 */ 484 */
485struct GNUNET_DNS_Handle * 485struct GNUNET_DNS_Handle *
486GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, 486GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -489,7 +489,7 @@ GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
489 void *rh_cls) 489 void *rh_cls)
490{ 490{
491 struct GNUNET_DNS_Handle *dh; 491 struct GNUNET_DNS_Handle *dh;
492 492
493 dh = GNUNET_malloc (sizeof (struct GNUNET_DNS_Handle)); 493 dh = GNUNET_malloc (sizeof (struct GNUNET_DNS_Handle));
494 dh->cfg = cfg; 494 dh->cfg = cfg;
495 dh->flags = flags; 495 dh->flags = flags;
diff --git a/src/dns/dnsparser.c b/src/dns/dnsparser.c
index 369f90215..d10da1ca9 100644
--- a/src/dns/dnsparser.c
+++ b/src/dns/dnsparser.c
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file dns/dnsparser.c 22 * @file dns/dnsparser.c
23 * @brief helper library to parse DNS packets. 23 * @brief helper library to parse DNS packets.
24 * @author Philipp Toelke 24 * @author Philipp Toelke
25 * @author Christian Grothoff 25 * @author Christian Grothoff
26 */ 26 */
@@ -47,10 +47,10 @@ GNUNET_DNSPARSER_check_label (const char *label)
47{ 47{
48 char *output; 48 char *output;
49 size_t slen; 49 size_t slen;
50 50
51 if (NULL != strchr (label, '.')) 51 if (NULL != strchr (label, '.'))
52 return GNUNET_SYSERR; /* not a label! Did you mean GNUNET_DNSPARSER_check_name? */ 52 return GNUNET_SYSERR; /* not a label! Did you mean GNUNET_DNSPARSER_check_name? */
53 if (IDNA_SUCCESS != 53 if (IDNA_SUCCESS !=
54 idna_to_ascii_8z (label, &output, IDNA_ALLOW_UNASSIGNED)) 54 idna_to_ascii_8z (label, &output, IDNA_ALLOW_UNASSIGNED))
55 return GNUNET_SYSERR; 55 return GNUNET_SYSERR;
56 slen = strlen (output); 56 slen = strlen (output);
@@ -78,7 +78,7 @@ GNUNET_DNSPARSER_check_name (const char *name)
78 char *output; 78 char *output;
79 size_t slen; 79 size_t slen;
80 char *tok; 80 char *tok;
81 81
82 ldup = GNUNET_strdup (name); 82 ldup = GNUNET_strdup (name);
83 for (tok = strtok (ldup, "."); NULL != tok; tok = strtok (NULL, ".")) 83 for (tok = strtok (ldup, "."); NULL != tok; tok = strtok (NULL, "."))
84 if (GNUNET_OK != 84 if (GNUNET_OK !=
@@ -88,7 +88,7 @@ GNUNET_DNSPARSER_check_name (const char *name)
88 return GNUNET_SYSERR; 88 return GNUNET_SYSERR;
89 } 89 }
90 GNUNET_free (ldup); 90 GNUNET_free (ldup);
91 if (IDNA_SUCCESS != 91 if (IDNA_SUCCESS !=
92 idna_to_ascii_8z (name, &output, IDNA_ALLOW_UNASSIGNED)) 92 idna_to_ascii_8z (name, &output, IDNA_ALLOW_UNASSIGNED))
93 return GNUNET_SYSERR; 93 return GNUNET_SYSERR;
94 slen = strlen (output); 94 slen = strlen (output);
@@ -113,7 +113,7 @@ GNUNET_DNSPARSER_free_soa (struct GNUNET_DNSPARSER_SoaRecord *soa)
113 return; 113 return;
114 GNUNET_free_non_null (soa->mname); 114 GNUNET_free_non_null (soa->mname);
115 GNUNET_free_non_null (soa->rname); 115 GNUNET_free_non_null (soa->rname);
116 GNUNET_free (soa); 116 GNUNET_free (soa);
117} 117}
118 118
119 119
@@ -131,7 +131,7 @@ GNUNET_DNSPARSER_free_srv (struct GNUNET_DNSPARSER_SrvRecord *srv)
131 GNUNET_free_non_null (srv->domain_name); 131 GNUNET_free_non_null (srv->domain_name);
132 GNUNET_free_non_null (srv->proto); 132 GNUNET_free_non_null (srv->proto);
133 GNUNET_free_non_null (srv->service); 133 GNUNET_free_non_null (srv->service);
134 GNUNET_free (srv); 134 GNUNET_free (srv);
135} 135}
136 136
137 137
@@ -146,13 +146,13 @@ GNUNET_DNSPARSER_free_mx (struct GNUNET_DNSPARSER_MxRecord *mx)
146 if (NULL == mx) 146 if (NULL == mx)
147 return; 147 return;
148 GNUNET_free_non_null (mx->mxhost); 148 GNUNET_free_non_null (mx->mxhost);
149 GNUNET_free (mx); 149 GNUNET_free (mx);
150} 150}
151 151
152 152
153/** 153/**
154 * Free the given DNS record. 154 * Free the given DNS record.
155 * 155 *
156 * @param r record to free 156 * @param r record to free
157 */ 157 */
158void 158void
@@ -206,7 +206,7 @@ parse_name (const char *udp_payload,
206 size_t xoff; 206 size_t xoff;
207 char *utf8; 207 char *utf8;
208 Idna_rc rc; 208 Idna_rc rc;
209 209
210 ret = GNUNET_strdup (""); 210 ret = GNUNET_strdup ("");
211 while (1) 211 while (1)
212 { 212 {
@@ -301,7 +301,7 @@ parse_name (const char *udp_payload,
301 *off += 2; 301 *off += 2;
302 /* pointers always terminate names */ 302 /* pointers always terminate names */
303 break; 303 break;
304 } 304 }
305 else 305 else
306 { 306 {
307 /* neither pointer nor inline string, not supported... */ 307 /* neither pointer nor inline string, not supported... */
@@ -312,7 +312,7 @@ parse_name (const char *udp_payload,
312 if (0 < strlen(ret)) 312 if (0 < strlen(ret))
313 ret[strlen(ret)-1] = '\0'; /* eat tailing '.' */ 313 ret[strlen(ret)-1] = '\0'; /* eat tailing '.' */
314 return ret; 314 return ret;
315 error: 315 error:
316 GNUNET_break_op (0); 316 GNUNET_break_op (0);
317 GNUNET_free (ret); 317 GNUNET_free (ret);
318 return NULL; 318 return NULL;
@@ -356,7 +356,7 @@ GNUNET_DNSPARSER_parse_query (const char *udp_payload,
356 char *name; 356 char *name;
357 struct GNUNET_TUN_DnsQueryLine ql; 357 struct GNUNET_TUN_DnsQueryLine ql;
358 358
359 name = GNUNET_DNSPARSER_parse_name (udp_payload, 359 name = GNUNET_DNSPARSER_parse_name (udp_payload,
360 udp_payload_length, 360 udp_payload_length,
361 off); 361 off);
362 if (NULL == name) 362 if (NULL == name)
@@ -414,7 +414,7 @@ GNUNET_DNSPARSER_parse_soa (const char *udp_payload,
414 return NULL; 414 return NULL;
415 } 415 }
416 memcpy (&soa_bin, 416 memcpy (&soa_bin,
417 &udp_payload[*off], 417 &udp_payload[*off],
418 sizeof (struct GNUNET_TUN_DnsSoaRecord)); 418 sizeof (struct GNUNET_TUN_DnsSoaRecord));
419 soa->serial = ntohl (soa_bin.serial); 419 soa->serial = ntohl (soa_bin.serial);
420 soa->refresh = ntohl (soa_bin.refresh); 420 soa->refresh = ntohl (soa_bin.refresh);
@@ -450,7 +450,7 @@ GNUNET_DNSPARSER_parse_mx (const char *udp_payload,
450 GNUNET_break_op (0); 450 GNUNET_break_op (0);
451 return NULL; 451 return NULL;
452 } 452 }
453 memcpy (&mxpref, &udp_payload[*off], sizeof (uint16_t)); 453 memcpy (&mxpref, &udp_payload[*off], sizeof (uint16_t));
454 (*off) += sizeof (uint16_t); 454 (*off) += sizeof (uint16_t);
455 mx = GNUNET_new (struct GNUNET_DNSPARSER_MxRecord); 455 mx = GNUNET_new (struct GNUNET_DNSPARSER_MxRecord);
456 mx->preference = ntohs (mxpref); 456 mx->preference = ntohs (mxpref);
@@ -498,8 +498,8 @@ GNUNET_DNSPARSER_parse_srv (const char *r_name,
498 if (*off + sizeof (struct GNUNET_TUN_DnsSrvRecord) > udp_payload_length) 498 if (*off + sizeof (struct GNUNET_TUN_DnsSrvRecord) > udp_payload_length)
499 return NULL; 499 return NULL;
500 memcpy (&srv_bin, 500 memcpy (&srv_bin,
501 &udp_payload[*off], 501 &udp_payload[*off],
502 sizeof (struct GNUNET_TUN_DnsSrvRecord)); 502 sizeof (struct GNUNET_TUN_DnsSrvRecord));
503 (*off) += sizeof (struct GNUNET_TUN_DnsSrvRecord); 503 (*off) += sizeof (struct GNUNET_TUN_DnsSrvRecord);
504 srv = GNUNET_new (struct GNUNET_DNSPARSER_SrvRecord); 504 srv = GNUNET_new (struct GNUNET_DNSPARSER_SrvRecord);
505 srv->priority = ntohs (srv_bin.prio); 505 srv->priority = ntohs (srv_bin.prio);
@@ -565,7 +565,7 @@ GNUNET_DNSPARSER_parse_record (const char *udp_payload,
565 size_t old_off; 565 size_t old_off;
566 uint16_t data_len; 566 uint16_t data_len;
567 567
568 name = GNUNET_DNSPARSER_parse_name (udp_payload, 568 name = GNUNET_DNSPARSER_parse_name (udp_payload,
569 udp_payload_length, 569 udp_payload_length,
570 off); 570 off);
571 if (NULL == name) 571 if (NULL == name)
@@ -599,7 +599,7 @@ GNUNET_DNSPARSER_parse_record (const char *udp_payload,
599 case GNUNET_DNSPARSER_TYPE_PTR: 599 case GNUNET_DNSPARSER_TYPE_PTR:
600 r->data.hostname = GNUNET_DNSPARSER_parse_name (udp_payload, 600 r->data.hostname = GNUNET_DNSPARSER_parse_name (udp_payload,
601 udp_payload_length, 601 udp_payload_length,
602 off); 602 off);
603 if ( (NULL == r->data.hostname) || 603 if ( (NULL == r->data.hostname) ||
604 (old_off + data_len != *off) ) 604 (old_off + data_len != *off) )
605 return GNUNET_SYSERR; 605 return GNUNET_SYSERR;
@@ -645,7 +645,7 @@ GNUNET_DNSPARSER_parse_record (const char *udp_payload,
645 break; 645 break;
646 } 646 }
647 (*off) += data_len; 647 (*off) += data_len;
648 return GNUNET_OK; 648 return GNUNET_OK;
649} 649}
650 650
651 651
@@ -654,7 +654,7 @@ GNUNET_DNSPARSER_parse_record (const char *udp_payload,
654 * processing and manipulation. 654 * processing and manipulation.
655 * 655 *
656 * @param udp_payload wire-format of the DNS packet 656 * @param udp_payload wire-format of the DNS packet
657 * @param udp_payload_length number of bytes in @a udp_payload 657 * @param udp_payload_length number of bytes in @a udp_payload
658 * @return NULL on error, otherwise the parsed packet 658 * @return NULL on error, otherwise the parsed packet
659 */ 659 */
660struct GNUNET_DNSPARSER_Packet * 660struct GNUNET_DNSPARSER_Packet *
@@ -664,7 +664,7 @@ GNUNET_DNSPARSER_parse (const char *udp_payload,
664 struct GNUNET_DNSPARSER_Packet *p; 664 struct GNUNET_DNSPARSER_Packet *p;
665 const struct GNUNET_TUN_DnsHeader *dns; 665 const struct GNUNET_TUN_DnsHeader *dns;
666 size_t off; 666 size_t off;
667 unsigned int n; 667 unsigned int n;
668 unsigned int i; 668 unsigned int i;
669 669
670 if (udp_payload_length < sizeof (struct GNUNET_TUN_DnsHeader)) 670 if (udp_payload_length < sizeof (struct GNUNET_TUN_DnsHeader))
@@ -711,7 +711,7 @@ GNUNET_DNSPARSER_parse (const char *udp_payload,
711 udp_payload_length, 711 udp_payload_length,
712 &off, 712 &off,
713 &p->authority_records[i])) 713 &p->authority_records[i]))
714 goto error; 714 goto error;
715 } 715 }
716 n = ntohs (dns->additional_rcount); 716 n = ntohs (dns->additional_rcount);
717 if (n > 0) 717 if (n > 0)
@@ -724,7 +724,7 @@ GNUNET_DNSPARSER_parse (const char *udp_payload,
724 udp_payload_length, 724 udp_payload_length,
725 &off, 725 &off,
726 &p->additional_records[i])) 726 &p->additional_records[i]))
727 goto error; 727 goto error;
728 } 728 }
729 return p; 729 return p;
730 error: 730 error:
@@ -793,7 +793,7 @@ GNUNET_DNSPARSER_builder_add_name (char *dst,
793 if (NULL == name) 793 if (NULL == name)
794 return GNUNET_SYSERR; 794 return GNUNET_SYSERR;
795 795
796 if (IDNA_SUCCESS != 796 if (IDNA_SUCCESS !=
797 (rc = idna_to_ascii_8z (name, &idna_start, IDNA_ALLOW_UNASSIGNED))) 797 (rc = idna_to_ascii_8z (name, &idna_start, IDNA_ALLOW_UNASSIGNED)))
798 { 798 {
799 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 799 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -815,7 +815,7 @@ GNUNET_DNSPARSER_builder_add_name (char *dst,
815 else 815 else
816 len = dot - idna_name; 816 len = dot - idna_name;
817 if ( (len >= 64) || (0 == len) ) 817 if ( (len >= 64) || (0 == len) )
818 goto fail; /* segment too long or empty */ 818 goto fail; /* segment too long or empty */
819 dst[pos++] = (char) (uint8_t) len; 819 dst[pos++] = (char) (uint8_t) len;
820 memcpy (&dst[pos], idna_name, len); 820 memcpy (&dst[pos], idna_name, len);
821 pos += len; 821 pos += len;
@@ -836,7 +836,7 @@ GNUNET_DNSPARSER_builder_add_name (char *dst,
836#else 836#else
837 free (idna_start); 837 free (idna_start);
838#endif 838#endif
839 return GNUNET_NO; 839 return GNUNET_NO;
840} 840}
841 841
842 842
@@ -1004,7 +1004,7 @@ add_record (char *dst,
1004 size_t pos; 1004 size_t pos;
1005 struct GNUNET_TUN_DnsRecordLine rl; 1005 struct GNUNET_TUN_DnsRecordLine rl;
1006 char *name; 1006 char *name;
1007 1007
1008 start = *off; 1008 start = *off;
1009 /* for SRV records, we can create the name from the details 1009 /* for SRV records, we can create the name from the details
1010 of the record if needed */ 1010 of the record if needed */
@@ -1025,9 +1025,9 @@ add_record (char *dst,
1025 1025
1026 pos = *off + sizeof (struct GNUNET_TUN_DnsRecordLine); 1026 pos = *off + sizeof (struct GNUNET_TUN_DnsRecordLine);
1027 switch (record->type) 1027 switch (record->type)
1028 { 1028 {
1029 case GNUNET_DNSPARSER_TYPE_MX: 1029 case GNUNET_DNSPARSER_TYPE_MX:
1030 ret = GNUNET_DNSPARSER_builder_add_mx (dst, dst_len, &pos, record->data.mx); 1030 ret = GNUNET_DNSPARSER_builder_add_mx (dst, dst_len, &pos, record->data.mx);
1031 break; 1031 break;
1032 case GNUNET_DNSPARSER_TYPE_SOA: 1032 case GNUNET_DNSPARSER_TYPE_SOA:
1033 ret = GNUNET_DNSPARSER_builder_add_soa (dst, dst_len, &pos, record->data.soa); 1033 ret = GNUNET_DNSPARSER_builder_add_soa (dst, dst_len, &pos, record->data.soa);
@@ -1069,14 +1069,14 @@ add_record (char *dst,
1069 rl.data_len = htons ((uint16_t) (pos - (*off + sizeof (struct GNUNET_TUN_DnsRecordLine)))); 1069 rl.data_len = htons ((uint16_t) (pos - (*off + sizeof (struct GNUNET_TUN_DnsRecordLine))));
1070 memcpy (&dst[*off], &rl, sizeof (struct GNUNET_TUN_DnsRecordLine)); 1070 memcpy (&dst[*off], &rl, sizeof (struct GNUNET_TUN_DnsRecordLine));
1071 *off = pos; 1071 *off = pos;
1072 return GNUNET_OK; 1072 return GNUNET_OK;
1073} 1073}
1074 1074
1075 1075
1076/** 1076/**
1077 * Given a DNS packet @a p, generate the corresponding UDP payload. 1077 * Given a DNS packet @a p, generate the corresponding UDP payload.
1078 * Note that we do not attempt to pack the strings with pointers 1078 * Note that we do not attempt to pack the strings with pointers
1079 * as this would complicate the code and this is about being 1079 * as this would complicate the code and this is about being
1080 * simple and secure, not fast, fancy and broken like bind. 1080 * simple and secure, not fast, fancy and broken like bind.
1081 * 1081 *
1082 * @param p packet to pack 1082 * @param p packet to pack
@@ -1092,14 +1092,14 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
1092 uint16_t max, 1092 uint16_t max,
1093 char **buf, 1093 char **buf,
1094 size_t *buf_length) 1094 size_t *buf_length)
1095{ 1095{
1096 struct GNUNET_TUN_DnsHeader dns; 1096 struct GNUNET_TUN_DnsHeader dns;
1097 size_t off; 1097 size_t off;
1098 char tmp[max]; 1098 char tmp[max];
1099 unsigned int i; 1099 unsigned int i;
1100 int ret; 1100 int ret;
1101 int trc; 1101 int trc;
1102 1102
1103 if ( (p->num_queries > UINT16_MAX) || 1103 if ( (p->num_queries > UINT16_MAX) ||
1104 (p->num_answers > UINT16_MAX) || 1104 (p->num_answers > UINT16_MAX) ||
1105 (p->num_authority_records > UINT16_MAX) || 1105 (p->num_authority_records > UINT16_MAX) ||
@@ -1116,55 +1116,55 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
1116 trc = GNUNET_NO; 1116 trc = GNUNET_NO;
1117 for (i=0;i<p->num_queries;i++) 1117 for (i=0;i<p->num_queries;i++)
1118 { 1118 {
1119 ret = GNUNET_DNSPARSER_builder_add_query (tmp, sizeof (tmp), &off, &p->queries[i]); 1119 ret = GNUNET_DNSPARSER_builder_add_query (tmp, sizeof (tmp), &off, &p->queries[i]);
1120 if (GNUNET_SYSERR == ret) 1120 if (GNUNET_SYSERR == ret)
1121 return GNUNET_SYSERR; 1121 return GNUNET_SYSERR;
1122 if (GNUNET_NO == ret) 1122 if (GNUNET_NO == ret)
1123 { 1123 {
1124 dns.query_count = htons ((uint16_t) (i-1)); 1124 dns.query_count = htons ((uint16_t) (i-1));
1125 trc = GNUNET_YES; 1125 trc = GNUNET_YES;
1126 break; 1126 break;
1127 } 1127 }
1128 } 1128 }
1129 for (i=0;i<p->num_answers;i++) 1129 for (i=0;i<p->num_answers;i++)
1130 { 1130 {
1131 ret = add_record (tmp, sizeof (tmp), &off, &p->answers[i]); 1131 ret = add_record (tmp, sizeof (tmp), &off, &p->answers[i]);
1132 if (GNUNET_SYSERR == ret) 1132 if (GNUNET_SYSERR == ret)
1133 return GNUNET_SYSERR; 1133 return GNUNET_SYSERR;
1134 if (GNUNET_NO == ret) 1134 if (GNUNET_NO == ret)
1135 { 1135 {
1136 dns.answer_rcount = htons ((uint16_t) (i-1)); 1136 dns.answer_rcount = htons ((uint16_t) (i-1));
1137 trc = GNUNET_YES; 1137 trc = GNUNET_YES;
1138 break; 1138 break;
1139 } 1139 }
1140 } 1140 }
1141 for (i=0;i<p->num_authority_records;i++) 1141 for (i=0;i<p->num_authority_records;i++)
1142 { 1142 {
1143 ret = add_record (tmp, sizeof (tmp), &off, &p->authority_records[i]); 1143 ret = add_record (tmp, sizeof (tmp), &off, &p->authority_records[i]);
1144 if (GNUNET_SYSERR == ret) 1144 if (GNUNET_SYSERR == ret)
1145 return GNUNET_SYSERR; 1145 return GNUNET_SYSERR;
1146 if (GNUNET_NO == ret) 1146 if (GNUNET_NO == ret)
1147 { 1147 {
1148 dns.authority_rcount = htons ((uint16_t) (i-1)); 1148 dns.authority_rcount = htons ((uint16_t) (i-1));
1149 trc = GNUNET_YES; 1149 trc = GNUNET_YES;
1150 break; 1150 break;
1151 } 1151 }
1152 } 1152 }
1153 for (i=0;i<p->num_additional_records;i++) 1153 for (i=0;i<p->num_additional_records;i++)
1154 { 1154 {
1155 ret = add_record (tmp, sizeof (tmp), &off, &p->additional_records[i]); 1155 ret = add_record (tmp, sizeof (tmp), &off, &p->additional_records[i]);
1156 if (GNUNET_SYSERR == ret) 1156 if (GNUNET_SYSERR == ret)
1157 return GNUNET_SYSERR; 1157 return GNUNET_SYSERR;
1158 if (GNUNET_NO == ret) 1158 if (GNUNET_NO == ret)
1159 { 1159 {
1160 dns.additional_rcount = htons (i-1); 1160 dns.additional_rcount = htons (i-1);
1161 trc = GNUNET_YES; 1161 trc = GNUNET_YES;
1162 break; 1162 break;
1163 } 1163 }
1164 } 1164 }
1165 1165
1166 if (GNUNET_YES == trc) 1166 if (GNUNET_YES == trc)
1167 dns.flags.message_truncated = 1; 1167 dns.flags.message_truncated = 1;
1168 memcpy (tmp, &dns, sizeof (struct GNUNET_TUN_DnsHeader)); 1168 memcpy (tmp, &dns, sizeof (struct GNUNET_TUN_DnsHeader));
1169 1169
1170 *buf = GNUNET_malloc (off); 1170 *buf = GNUNET_malloc (off);
diff --git a/src/dns/dnsstub.c b/src/dns/dnsstub.c
index 0e130a77f..bd85bf896 100644
--- a/src/dns/dnsstub.c
+++ b/src/dns/dnsstub.c
@@ -43,7 +43,7 @@
43 */ 43 */
44struct GNUNET_DNSSTUB_RequestSocket 44struct GNUNET_DNSSTUB_RequestSocket
45{ 45{
46 46
47 /** 47 /**
48 * UDP socket we use for this request for IPv4 48 * UDP socket we use for this request for IPv4
49 */ 49 */
@@ -89,12 +89,12 @@ struct GNUNET_DNSSTUB_RequestSocket
89 89
90/** 90/**
91 * Handle to the stub resolver. 91 * Handle to the stub resolver.
92 */ 92 */
93struct GNUNET_DNSSTUB_Context 93struct GNUNET_DNSSTUB_Context
94{ 94{
95 95
96 /** 96 /**
97 * Array of all open sockets for DNS requests. 97 * Array of all open sockets for DNS requests.
98 */ 98 */
99 struct GNUNET_DNSSTUB_RequestSocket sockets[DNS_SOCKET_MAX]; 99 struct GNUNET_DNSSTUB_RequestSocket sockets[DNS_SOCKET_MAX];
100 100
@@ -138,7 +138,7 @@ cleanup_rs (struct GNUNET_DNSSTUB_RequestSocket *rs)
138 * 138 *
139 * @param af AF_INET or AF_INET6 139 * @param af AF_INET or AF_INET6
140 * @return GNUNET_OK on success 140 * @return GNUNET_OK on success
141 */ 141 */
142static struct GNUNET_NETWORK_Handle * 142static struct GNUNET_NETWORK_Handle *
143open_socket (int af) 143open_socket (int af)
144{ 144{
@@ -168,11 +168,11 @@ open_socket (int af)
168 } 168 }
169 sa->sa_family = af; 169 sa->sa_family = af;
170 if (GNUNET_OK != GNUNET_NETWORK_socket_bind (ret, 170 if (GNUNET_OK != GNUNET_NETWORK_socket_bind (ret,
171 sa, 171 sa,
172 alen, 172 alen,
173 0)) 173 0))
174 { 174 {
175 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 175 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
176 _("Could not bind to any port: %s\n"), 176 _("Could not bind to any port: %s\n"),
177 STRERROR (errno)); 177 STRERROR (errno));
178 GNUNET_NETWORK_socket_close (ret); 178 GNUNET_NETWORK_socket_close (ret);
@@ -195,7 +195,7 @@ read_response (void *cls,
195 195
196/** 196/**
197 * Get a socket of the specified address family to send out a 197 * Get a socket of the specified address family to send out a
198 * UDP DNS request to the Internet. 198 * UDP DNS request to the Internet.
199 * 199 *
200 * @param ctx the DNSSTUB context 200 * @param ctx the DNSSTUB context
201 * @param af desired address family 201 * @param af desired address family
@@ -208,7 +208,7 @@ get_request_socket (struct GNUNET_DNSSTUB_Context *ctx,
208 struct GNUNET_DNSSTUB_RequestSocket *rs; 208 struct GNUNET_DNSSTUB_RequestSocket *rs;
209 struct GNUNET_NETWORK_FDSet *rset; 209 struct GNUNET_NETWORK_FDSet *rset;
210 210
211 rs = &ctx->sockets[GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, 211 rs = &ctx->sockets[GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE,
212 DNS_SOCKET_MAX)]; 212 DNS_SOCKET_MAX)];
213 rs->timeout = GNUNET_TIME_relative_to_absolute (REQUEST_TIMEOUT); 213 rs->timeout = GNUNET_TIME_relative_to_absolute (REQUEST_TIMEOUT);
214 switch (af) 214 switch (af)
@@ -223,7 +223,7 @@ get_request_socket (struct GNUNET_DNSSTUB_Context *ctx,
223 break; 223 break;
224 default: 224 default:
225 return NULL; 225 return NULL;
226 } 226 }
227 if (GNUNET_SCHEDULER_NO_TASK != rs->read_task) 227 if (GNUNET_SCHEDULER_NO_TASK != rs->read_task)
228 { 228 {
229 GNUNET_SCHEDULER_cancel (rs->read_task); 229 GNUNET_SCHEDULER_cancel (rs->read_task);
@@ -286,7 +286,7 @@ GNUNET_DNSSTUB_resolve (struct GNUNET_DNSSTUB_Context *ctx,
286 rs->addrlen = sa_len; 286 rs->addrlen = sa_len;
287 rs->rc = rc; 287 rs->rc = rc;
288 rs->rc_cls = rc_cls; 288 rs->rc_cls = rc_cls;
289 if (GNUNET_SYSERR == 289 if (GNUNET_SYSERR ==
290 GNUNET_NETWORK_socket_sendto (ret, 290 GNUNET_NETWORK_socket_sendto (ret,
291 request, 291 request,
292 request_len, 292 request_len,
@@ -351,7 +351,7 @@ GNUNET_DNSSTUB_resolve2 (struct GNUNET_DNSSTUB_Context *ctx,
351#endif 351#endif
352 sa = (struct sockaddr *) &v6; 352 sa = (struct sockaddr *) &v6;
353 af = AF_INET6; 353 af = AF_INET6;
354 } 354 }
355 else 355 else
356 { 356 {
357 GNUNET_break (0); 357 GNUNET_break (0);
@@ -384,7 +384,7 @@ GNUNET_DNSSTUB_resolve2 (struct GNUNET_DNSSTUB_Context *ctx,
384 _("Failed to send DNS request to %s\n"), 384 _("Failed to send DNS request to %s\n"),
385 GNUNET_a2s (sa, salen)); 385 GNUNET_a2s (sa, salen));
386 rs->timeout = GNUNET_TIME_relative_to_absolute (REQUEST_TIMEOUT); 386 rs->timeout = GNUNET_TIME_relative_to_absolute (REQUEST_TIMEOUT);
387 387
388 return rs; 388 return rs;
389 389
390} 390}
@@ -420,13 +420,13 @@ do_dns_read (struct GNUNET_DNSSTUB_RequestSocket *rs,
420#endif 420#endif
421 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 421 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
422 "Receiving %d byte DNS reply\n", 422 "Receiving %d byte DNS reply\n",
423 len); 423 len);
424 { 424 {
425 unsigned char buf[len] GNUNET_ALIGN; 425 unsigned char buf[len] GNUNET_ALIGN;
426 426
427 addrlen = sizeof (addr); 427 addrlen = sizeof (addr);
428 memset (&addr, 0, sizeof (addr)); 428 memset (&addr, 0, sizeof (addr));
429 r = GNUNET_NETWORK_socket_recvfrom (dnsout, 429 r = GNUNET_NETWORK_socket_recvfrom (dnsout,
430 buf, sizeof (buf), 430 buf, sizeof (buf),
431 (struct sockaddr*) &addr, &addrlen); 431 (struct sockaddr*) &addr, &addrlen);
432 if (-1 == r) 432 if (-1 == r)
@@ -437,7 +437,7 @@ do_dns_read (struct GNUNET_DNSSTUB_RequestSocket *rs,
437 } 437 }
438 if (sizeof (struct GNUNET_TUN_DnsHeader) > r) 438 if (sizeof (struct GNUNET_TUN_DnsHeader) > r)
439 { 439 {
440 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 440 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
441 _("Received DNS response that is too small (%u bytes)"), 441 _("Received DNS response that is too small (%u bytes)"),
442 r); 442 r);
443 return GNUNET_NO; 443 return GNUNET_NO;
@@ -446,11 +446,11 @@ do_dns_read (struct GNUNET_DNSSTUB_RequestSocket *rs,
446 if ( (addrlen != rs->addrlen) || 446 if ( (addrlen != rs->addrlen) ||
447 (0 != memcmp (&rs->addr, 447 (0 != memcmp (&rs->addr,
448 &addr, 448 &addr,
449 addrlen)) || 449 addrlen)) ||
450 (0 == GNUNET_TIME_absolute_get_remaining (rs->timeout).rel_value_us) ) 450 (0 == GNUNET_TIME_absolute_get_remaining (rs->timeout).rel_value_us) )
451 { 451 {
452 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 452 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
453 "Request timeout or invalid sender address; ignoring reply\n"); 453 "Request timeout or invalid sender address; ignoring reply\n");
454 return GNUNET_NO; 454 return GNUNET_NO;
455 } 455 }
456 if (NULL != rs->rc) 456 if (NULL != rs->rc)
@@ -458,7 +458,7 @@ do_dns_read (struct GNUNET_DNSSTUB_RequestSocket *rs,
458 rs, 458 rs,
459 dns, 459 dns,
460 r); 460 r);
461 } 461 }
462 return GNUNET_OK; 462 return GNUNET_OK;
463} 463}
464 464
@@ -530,7 +530,7 @@ struct GNUNET_DNSSTUB_Context *
530GNUNET_DNSSTUB_start (const char *dns_ip) 530GNUNET_DNSSTUB_start (const char *dns_ip)
531{ 531{
532 struct GNUNET_DNSSTUB_Context *ctx; 532 struct GNUNET_DNSSTUB_Context *ctx;
533 533
534 ctx = GNUNET_malloc (sizeof (struct GNUNET_DNSSTUB_Context)); 534 ctx = GNUNET_malloc (sizeof (struct GNUNET_DNSSTUB_Context));
535 if (NULL != dns_ip) 535 if (NULL != dns_ip)
536 ctx->dns_exit = GNUNET_strdup (dns_ip); 536 ctx->dns_exit = GNUNET_strdup (dns_ip);
diff --git a/src/dns/gnunet-dns-monitor.c b/src/dns/gnunet-dns-monitor.c
index 4c92009eb..48dd7a12d 100644
--- a/src/dns/gnunet-dns-monitor.c
+++ b/src/dns/gnunet-dns-monitor.c
@@ -130,7 +130,7 @@ display_record (const struct GNUNET_DNSPARSER_Record *record)
130 const char *format; 130 const char *format;
131 char buf[INET6_ADDRSTRLEN]; 131 char buf[INET6_ADDRSTRLEN];
132 char *tmp; 132 char *tmp;
133 133
134 tmp = NULL; 134 tmp = NULL;
135 switch (record->type) 135 switch (record->type)
136 { 136 {
@@ -164,7 +164,7 @@ display_record (const struct GNUNET_DNSPARSER_Record *record)
164 (unsigned int) record->data.soa->refresh, 164 (unsigned int) record->data.soa->refresh,
165 (unsigned int) record->data.soa->retry, 165 (unsigned int) record->data.soa->retry,
166 (unsigned int) record->data.soa->expire, 166 (unsigned int) record->data.soa->expire,
167 (unsigned int) record->data.soa->minimum_ttl); 167 (unsigned int) record->data.soa->minimum_ttl);
168 format = tmp; 168 format = tmp;
169 } 169 }
170 break; 170 break;
@@ -242,7 +242,7 @@ display_record (const struct GNUNET_DNSPARSER_Record *record)
242 * @param request_length number of bytes in request 242 * @param request_length number of bytes in request
243 * @param request udp payload of the DNS request 243 * @param request udp payload of the DNS request
244 */ 244 */
245static void 245static void
246display_request (void *cls, 246display_request (void *cls,
247 struct GNUNET_DNS_RequestHandle *rh, 247 struct GNUNET_DNS_RequestHandle *rh,
248 size_t request_length, 248 size_t request_length,
@@ -284,13 +284,13 @@ display_request (void *cls,
284 p->flags.authenticated_data ? "AD " : "", 284 p->flags.authenticated_data ? "AD " : "",
285 p->flags.recursion_available ? "RA " : "", 285 p->flags.recursion_available ? "RA " : "",
286 return_codes[p->flags.return_code & 15], 286 return_codes[p->flags.return_code & 15],
287 op_codes[p->flags.opcode & 15]); 287 op_codes[p->flags.opcode & 15]);
288 if (p->num_queries > 0) 288 if (p->num_queries > 0)
289 fprintf (stdout, 289 fprintf (stdout,
290 "\tQueries:\n"); 290 "\tQueries:\n");
291 for (i=0;i<p->num_queries;i++) 291 for (i=0;i<p->num_queries;i++)
292 display_query (&p->queries[i]); 292 display_query (&p->queries[i]);
293 293
294 if (p->num_answers > 0) 294 if (p->num_answers > 0)
295 fprintf (stdout, 295 fprintf (stdout,
296 "\tAnswers:\n"); 296 "\tAnswers:\n");
@@ -338,7 +338,7 @@ run (void *cls, char *const *args, const char *cfgfile,
338 if (outbound_only) 338 if (outbound_only)
339 flags |= GNUNET_DNS_FLAG_RESPONSE_MONITOR; 339 flags |= GNUNET_DNS_FLAG_RESPONSE_MONITOR;
340 handle = 340 handle =
341 GNUNET_DNS_connect (cfg, 341 GNUNET_DNS_connect (cfg,
342 flags, 342 flags,
343 &display_request, 343 &display_request,
344 NULL); 344 NULL);
diff --git a/src/dns/gnunet-dns-redirector.c b/src/dns/gnunet-dns-redirector.c
index 3df2ac21a..4d1a452a5 100644
--- a/src/dns/gnunet-dns-redirector.c
+++ b/src/dns/gnunet-dns-redirector.c
@@ -67,13 +67,13 @@ modify_record (const struct GNUNET_DNSPARSER_Record *record)
67 67
68 switch (record->type) 68 switch (record->type)
69 { 69 {
70 case GNUNET_DNSPARSER_TYPE_A: 70 case GNUNET_DNSPARSER_TYPE_A:
71 if (record->data.raw.data_len != sizeof (struct in_addr)) 71 if (record->data.raw.data_len != sizeof (struct in_addr))
72 return; 72 return;
73 if (NULL != n4) 73 if (NULL != n4)
74 { 74 {
75 if (verbosity > 1) 75 if (verbosity > 1)
76 fprintf (stderr, 76 fprintf (stderr,
77 "Changing A record from `%s' to `%s'\n", 77 "Changing A record from `%s' to `%s'\n",
78 inet_ntop (AF_INET, record->data.raw.data, buf, sizeof (buf)), 78 inet_ntop (AF_INET, record->data.raw.data, buf, sizeof (buf)),
79 n4); 79 n4);
@@ -86,7 +86,7 @@ modify_record (const struct GNUNET_DNSPARSER_Record *record)
86 if (NULL != n6) 86 if (NULL != n6)
87 { 87 {
88 if (verbosity > 1) 88 if (verbosity > 1)
89 fprintf (stderr, 89 fprintf (stderr,
90 "Changing AAAA record from `%s' to `%s'\n", 90 "Changing AAAA record from `%s' to `%s'\n",
91 inet_ntop (AF_INET6, record->data.raw.data, buf, sizeof (buf)), 91 inet_ntop (AF_INET6, record->data.raw.data, buf, sizeof (buf)),
92 n6); 92 n6);
@@ -129,7 +129,7 @@ modify_record (const struct GNUNET_DNSPARSER_Record *record)
129 * @param request_length number of bytes in request 129 * @param request_length number of bytes in request
130 * @param request udp payload of the DNS request 130 * @param request udp payload of the DNS request
131 */ 131 */
132static void 132static void
133modify_request (void *cls, 133modify_request (void *cls,
134 struct GNUNET_DNS_RequestHandle *rh, 134 struct GNUNET_DNS_RequestHandle *rh,
135 size_t request_length, 135 size_t request_length,
@@ -156,7 +156,7 @@ modify_request (void *cls,
156 if (GNUNET_OK != ret) 156 if (GNUNET_OK != ret)
157 { 157 {
158 if (GNUNET_NO == ret) 158 if (GNUNET_NO == ret)
159 fprintf (stderr, 159 fprintf (stderr,
160 "Modified DNS response did not fit, keeping old response\n"); 160 "Modified DNS response did not fit, keeping old response\n");
161 else 161 else
162 GNUNET_break (0); /* our modifications should have been sane! */ 162 GNUNET_break (0); /* our modifications should have been sane! */
@@ -169,7 +169,7 @@ modify_request (void *cls,
169 "Injecting modified DNS response\n"); 169 "Injecting modified DNS response\n");
170 GNUNET_DNS_request_answer (rh, len, buf); 170 GNUNET_DNS_request_answer (rh, len, buf);
171 } 171 }
172 GNUNET_free_non_null (buf); 172 GNUNET_free_non_null (buf);
173} 173}
174 174
175 175
@@ -219,7 +219,7 @@ run (void *cls, char *const *args, const char *cfgfile,
219 } 219 }
220 220
221 handle = 221 handle =
222 GNUNET_DNS_connect (cfg, 222 GNUNET_DNS_connect (cfg,
223 GNUNET_DNS_FLAG_POST_RESOLUTION, 223 GNUNET_DNS_FLAG_POST_RESOLUTION,
224 &modify_request, 224 &modify_request,
225 NULL); 225 NULL);
diff --git a/src/dns/gnunet-helper-dns.c b/src/dns/gnunet-helper-dns.c
index bc83da027..8ff6413f8 100644
--- a/src/dns/gnunet-helper-dns.c
+++ b/src/dns/gnunet-helper-dns.c
@@ -23,7 +23,7 @@
23 * @brief helper to install firewall rules to hijack all DNS traffic 23 * @brief helper to install firewall rules to hijack all DNS traffic
24 * and send it to our virtual interface (except for DNS traffic 24 * and send it to our virtual interface (except for DNS traffic
25 * that originates on the specified port). We then 25 * that originates on the specified port). We then
26 * allow interacting with our virtual interface via stdin/stdout. 26 * allow interacting with our virtual interface via stdin/stdout.
27 * @author Philipp Tölke 27 * @author Philipp Tölke
28 * @author Christian Grothoff 28 * @author Christian Grothoff
29 * 29 *
@@ -55,13 +55,13 @@
55 * Naturally, neither of these problems can be helped as this is the 55 * Naturally, neither of these problems can be helped as this is the
56 * fundamental purpose of the binary. Certifying that this code is 56 * fundamental purpose of the binary. Certifying that this code is
57 * "safe" thus only means that it doesn't allow anything else (such 57 * "safe" thus only means that it doesn't allow anything else (such
58 * as local priv. escalation, etc.). 58 * as local priv. escalation, etc.).
59 * 59 *
60 * The following list of people have reviewed this code and considered 60 * The following list of people have reviewed this code and considered
61 * it safe (within specifications) since the last modification (if you 61 * it safe (within specifications) since the last modification (if you
62 * reviewed it, please have your name added to the list): 62 * reviewed it, please have your name added to the list):
63 * 63 *
64 * - Christian Grothoff 64 * - Christian Grothoff
65 */ 65 */
66#include "platform.h" 66#include "platform.h"
67 67
@@ -174,7 +174,7 @@ open_dev_null (int target_fd,
174 if (fd == target_fd) 174 if (fd == target_fd)
175 return; 175 return;
176 if (-1 == dup2 (fd, target_fd)) 176 if (-1 == dup2 (fd, target_fd))
177 { 177 {
178 (void) close (fd); 178 (void) close (fd);
179 abort (); 179 abort ();
180 } 180 }
@@ -184,13 +184,13 @@ open_dev_null (int target_fd,
184 184
185/** 185/**
186 * Run the given command and wait for it to complete. 186 * Run the given command and wait for it to complete.
187 * 187 *
188 * @param file name of the binary to run 188 * @param file name of the binary to run
189 * @param cmd command line arguments (as given to 'execv') 189 * @param cmd command line arguments (as given to 'execv')
190 * @return 0 on success, 1 on any error 190 * @return 0 on success, 1 on any error
191 */ 191 */
192static int 192static int
193fork_and_exec (const char *file, 193fork_and_exec (const char *file,
194 char *const cmd[]) 194 char *const cmd[])
195{ 195{
196 int status; 196 int status;
@@ -200,8 +200,8 @@ fork_and_exec (const char *file,
200 pid = fork (); 200 pid = fork ();
201 if (-1 == pid) 201 if (-1 == pid)
202 { 202 {
203 fprintf (stderr, 203 fprintf (stderr,
204 "fork failed: %s\n", 204 "fork failed: %s\n",
205 strerror (errno)); 205 strerror (errno));
206 return 1; 206 return 1;
207 } 207 }
@@ -210,25 +210,25 @@ fork_and_exec (const char *file,
210 /* we are the child process */ 210 /* we are the child process */
211 /* close stdin/stdout to not cause interference 211 /* close stdin/stdout to not cause interference
212 with the helper's main protocol! */ 212 with the helper's main protocol! */
213 (void) close (0); 213 (void) close (0);
214 open_dev_null (0, O_RDONLY); 214 open_dev_null (0, O_RDONLY);
215 (void) close (1); 215 (void) close (1);
216 open_dev_null (1, O_WRONLY); 216 open_dev_null (1, O_WRONLY);
217 (void) execv (file, cmd); 217 (void) execv (file, cmd);
218 /* can only get here on error */ 218 /* can only get here on error */
219 fprintf (stderr, 219 fprintf (stderr,
220 "exec `%s' failed: %s\n", 220 "exec `%s' failed: %s\n",
221 file, 221 file,
222 strerror (errno)); 222 strerror (errno));
223 _exit (1); 223 _exit (1);
224 } 224 }
225 /* keep running waitpid as long as the only error we get is 'EINTR' */ 225 /* keep running waitpid as long as the only error we get is 'EINTR' */
226 while ( (-1 == (ret = waitpid (pid, &status, 0))) && 226 while ( (-1 == (ret = waitpid (pid, &status, 0))) &&
227 (errno == EINTR) ); 227 (errno == EINTR) );
228 if (-1 == ret) 228 if (-1 == ret)
229 { 229 {
230 fprintf (stderr, 230 fprintf (stderr,
231 "waitpid failed: %s\n", 231 "waitpid failed: %s\n",
232 strerror (errno)); 232 strerror (errno));
233 return 1; 233 return 1;
234 } 234 }
@@ -312,8 +312,8 @@ set_address6 (const char *dev, const char *address, unsigned long prefix_len)
312 sa6.sin6_family = AF_INET6; 312 sa6.sin6_family = AF_INET6;
313 if (1 != inet_pton (AF_INET6, address, sa6.sin6_addr.s6_addr)) 313 if (1 != inet_pton (AF_INET6, address, sa6.sin6_addr.s6_addr))
314 { 314 {
315 fprintf (stderr, 315 fprintf (stderr,
316 "Failed to parse IPv6 address `%s': %s\n", 316 "Failed to parse IPv6 address `%s': %s\n",
317 address, 317 address,
318 strerror (errno)); 318 strerror (errno));
319 exit (1); 319 exit (1);
@@ -321,11 +321,11 @@ set_address6 (const char *dev, const char *address, unsigned long prefix_len)
321 321
322 if (-1 == (fd = socket (PF_INET6, SOCK_DGRAM, 0))) 322 if (-1 == (fd = socket (PF_INET6, SOCK_DGRAM, 0)))
323 { 323 {
324 fprintf (stderr, 324 fprintf (stderr,
325 "Error creating IPv6 socket: %s (ignored)\n", 325 "Error creating IPv6 socket: %s (ignored)\n",
326 strerror (errno)); 326 strerror (errno));
327 /* ignore error, maybe only IPv4 works on this system! */ 327 /* ignore error, maybe only IPv4 works on this system! */
328 return; 328 return;
329 } 329 }
330 330
331 memset (&ifr, 0, sizeof (struct ifreq)); 331 memset (&ifr, 0, sizeof (struct ifreq));
@@ -410,8 +410,8 @@ set_address4 (const char *dev, const char *address, const char *mask)
410 */ 410 */
411 if (1 != inet_pton (AF_INET, address, &addr->sin_addr.s_addr)) 411 if (1 != inet_pton (AF_INET, address, &addr->sin_addr.s_addr))
412 { 412 {
413 fprintf (stderr, 413 fprintf (stderr,
414 "Failed to parse IPv4 address `%s': %s\n", 414 "Failed to parse IPv4 address `%s': %s\n",
415 address, 415 address,
416 strerror (errno)); 416 strerror (errno));
417 exit (1); 417 exit (1);
@@ -420,7 +420,7 @@ set_address4 (const char *dev, const char *address, const char *mask)
420 if (-1 == (fd = socket (PF_INET, SOCK_DGRAM, 0))) 420 if (-1 == (fd = socket (PF_INET, SOCK_DGRAM, 0)))
421 { 421 {
422 fprintf (stderr, 422 fprintf (stderr,
423 "Error creating IPv4 socket: %s\n", 423 "Error creating IPv4 socket: %s\n",
424 strerror (errno)); 424 strerror (errno));
425 exit (1); 425 exit (1);
426 } 426 }
@@ -619,7 +619,7 @@ run (int fd_tun)
619 return; 619 return;
620 } 620 }
621 buftun_size -= written; 621 buftun_size -= written;
622 buftun_read += written; 622 buftun_read += written;
623 } 623 }
624 624
625 if (FD_ISSET (0, &fds_r)) 625 if (FD_ISSET (0, &fds_r))
@@ -749,7 +749,7 @@ main (int argc, char *const*argv)
749 return 254; 749 return 254;
750 } 750 }
751#else 751#else
752 if (0 != seteuid (0)) 752 if (0 != seteuid (0))
753 { 753 {
754 fprintf (stderr, "Failed to seteuid back to root: %s\n", strerror (errno)); 754 fprintf (stderr, "Failed to seteuid back to root: %s\n", strerror (errno));
755 return 254; 755 return 254;
@@ -763,7 +763,7 @@ main (int argc, char *const*argv)
763 sbin_iptables = "/usr/sbin/iptables"; 763 sbin_iptables = "/usr/sbin/iptables";
764 else 764 else
765 { 765 {
766 fprintf (stderr, 766 fprintf (stderr,
767 "Fatal: executable iptables not found in approved directories: %s\n", 767 "Fatal: executable iptables not found in approved directories: %s\n",
768 strerror (errno)); 768 strerror (errno));
769 return 3; 769 return 3;
@@ -805,7 +805,7 @@ main (int argc, char *const*argv)
805 /* setup pipe to shutdown nicely on SIGINT */ 805 /* setup pipe to shutdown nicely on SIGINT */
806 if (0 != pipe (cpipe)) 806 if (0 != pipe (cpipe))
807 { 807 {
808 fprintf (stderr, 808 fprintf (stderr,
809 "Fatal: could not setup control pipe: %s\n", 809 "Fatal: could not setup control pipe: %s\n",
810 strerror (errno)); 810 strerror (errno));
811 return 6; 811 return 6;
@@ -839,14 +839,14 @@ main (int argc, char *const*argv)
839 } 839 }
840 if ( (SIG_ERR == signal (SIGTERM, &signal_handler)) || 840 if ( (SIG_ERR == signal (SIGTERM, &signal_handler)) ||
841 (SIG_ERR == signal (SIGINT, &signal_handler)) || 841 (SIG_ERR == signal (SIGINT, &signal_handler)) ||
842 (SIG_ERR == signal (SIGHUP, &signal_handler)) ) 842 (SIG_ERR == signal (SIGHUP, &signal_handler)) )
843 { 843 {
844 fprintf (stderr, 844 fprintf (stderr,
845 "Fatal: could not initialize signal handler: %s\n", 845 "Fatal: could not initialize signal handler: %s\n",
846 strerror (errno)); 846 strerror (errno));
847 (void) close (cpipe[0]); 847 (void) close (cpipe[0]);
848 (void) close (cpipe[1]); 848 (void) close (cpipe[1]);
849 return 7; 849 return 7;
850 } 850 }
851 851
852 852
@@ -868,8 +868,8 @@ main (int argc, char *const*argv)
868 return 5; 868 return 5;
869 } 869 }
870 } 870 }
871 871
872 872
873 /* now open virtual interface (first part that requires root) */ 873 /* now open virtual interface (first part that requires root) */
874 if (-1 == (fd_tun = init_tun (dev))) 874 if (-1 == (fd_tun = init_tun (dev)))
875 { 875 {
@@ -907,14 +907,14 @@ main (int argc, char *const*argv)
907 set_address4 (dev, address, mask); 907 set_address4 (dev, address, mask);
908 } 908 }
909 909
910 910
911 /* update routing tables -- next part why we need SUID! */ 911 /* update routing tables -- next part why we need SUID! */
912 /* Forward everything from our EGID (which should only be held 912 /* Forward everything from our EGID (which should only be held
913 by the 'gnunet-service-dns') and with destination 913 by the 'gnunet-service-dns') and with destination
914 to port 53 on UDP, without hijacking */ 914 to port 53 on UDP, without hijacking */
915 r = 8; /* failed to fully setup routing table */ 915 r = 8; /* failed to fully setup routing table */
916 { 916 {
917 char *const mangle_args[] = 917 char *const mangle_args[] =
918 { 918 {
919 "iptables", "-m", "owner", "-t", "mangle", "-I", "OUTPUT", "1", "-p", 919 "iptables", "-m", "owner", "-t", "mangle", "-I", "OUTPUT", "1", "-p",
920 "udp", "--gid-owner", mygid, "--dport", DNS_PORT, "-j", 920 "udp", "--gid-owner", mygid, "--dport", DNS_PORT, "-j",
@@ -922,7 +922,7 @@ main (int argc, char *const*argv)
922 }; 922 };
923 if (0 != fork_and_exec (sbin_iptables, mangle_args)) 923 if (0 != fork_and_exec (sbin_iptables, mangle_args))
924 goto cleanup_rest; 924 goto cleanup_rest;
925 } 925 }
926 /* Mark all of the other DNS traffic using our mark DNS_MARK */ 926 /* Mark all of the other DNS traffic using our mark DNS_MARK */
927 { 927 {
928 char *const mark_args[] = 928 char *const mark_args[] =
@@ -965,7 +965,7 @@ main (int argc, char *const*argv)
965 } 965 }
966#else 966#else
967 /* Note: no 'setuid' here as we must keep our saved UID as root */ 967 /* Note: no 'setuid' here as we must keep our saved UID as root */
968 if (0 != seteuid (uid)) 968 if (0 != seteuid (uid))
969 { 969 {
970 fprintf (stderr, "Failed to seteuid: %s\n", strerror (errno)); 970 fprintf (stderr, "Failed to seteuid: %s\n", strerror (errno));
971 r = 24; 971 r = 24;
@@ -977,7 +977,7 @@ main (int argc, char *const*argv)
977 977
978 /* now forward until we hit a problem */ 978 /* now forward until we hit a problem */
979 run (fd_tun); 979 run (fd_tun);
980 980
981 /* now need to regain privs so we can remove the firewall rules we added! */ 981 /* now need to regain privs so we can remove the firewall rules we added! */
982#ifdef HAVE_SETRESUID 982#ifdef HAVE_SETRESUID
983 if (0 != setresuid (uid, 0, 0)) 983 if (0 != setresuid (uid, 0, 0))
@@ -987,19 +987,19 @@ main (int argc, char *const*argv)
987 goto cleanup_route_4; 987 goto cleanup_route_4;
988 } 988 }
989#else 989#else
990 if (0 != seteuid (0)) 990 if (0 != seteuid (0))
991 { 991 {
992 fprintf (stderr, "Failed to seteuid back to root: %s\n", strerror (errno)); 992 fprintf (stderr, "Failed to seteuid back to root: %s\n", strerror (errno));
993 r = 40; 993 r = 40;
994 goto cleanup_route_4; 994 goto cleanup_route_4;
995 } 995 }
996#endif 996#endif
997 997
998 /* update routing tables again -- this is why we could not fully drop privs */ 998 /* update routing tables again -- this is why we could not fully drop privs */
999 /* now undo updating of routing tables; normal exit or clean-up-on-error case */ 999 /* now undo updating of routing tables; normal exit or clean-up-on-error case */
1000 cleanup_route_4: 1000 cleanup_route_4:
1001 { 1001 {
1002 char *const route_clean_args[] = 1002 char *const route_clean_args[] =
1003 { 1003 {
1004 "ip", "route", "del", "default", "dev", dev, 1004 "ip", "route", "del", "default", "dev", dev,
1005 "table", DNS_TABLE, NULL 1005 "table", DNS_TABLE, NULL
diff --git a/src/dns/gnunet-service-dns.c b/src/dns/gnunet-service-dns.c
index ac410d3ed..53c19d01c 100644
--- a/src/dns/gnunet-service-dns.c
+++ b/src/dns/gnunet-service-dns.c
@@ -34,7 +34,7 @@
34 * each request will be given one of 128 random source ports, and the 34 * each request will be given one of 128 random source ports, and the
35 * 128 random source ports will also change "often" (less often if the 35 * 128 random source ports will also change "often" (less often if the
36 * system is very busy, each time if we are mostly idle). At the same 36 * system is very busy, each time if we are mostly idle). At the same
37 * time, the system will never use more than 256 UDP sockets. 37 * time, the system will never use more than 256 UDP sockets.
38 */ 38 */
39#include "platform.h" 39#include "platform.h"
40#include "gnunet_util_lib.h" 40#include "gnunet_util_lib.h"
@@ -88,7 +88,7 @@ enum RequestPhase
88 * Global Internet query is now pending. 88 * Global Internet query is now pending.
89 */ 89 */
90 RP_INTERNET_DNS, 90 RP_INTERNET_DNS,
91 91
92 /** 92 /**
93 * Client (or global DNS request) has resulted in a response. 93 * Client (or global DNS request) has resulted in a response.
94 * Forward to all POST-RESOLUTION clients. If client list is empty, 94 * Forward to all POST-RESOLUTION clients. If client list is empty,
@@ -111,22 +111,22 @@ enum RequestPhase
111 111
112/** 112/**
113 * Entry we keep for each client. 113 * Entry we keep for each client.
114 */ 114 */
115struct ClientRecord 115struct ClientRecord
116{ 116{
117 /** 117 /**
118 * Kept in doubly-linked list. 118 * Kept in doubly-linked list.
119 */ 119 */
120 struct ClientRecord *next; 120 struct ClientRecord *next;
121 121
122 /** 122 /**
123 * Kept in doubly-linked list. 123 * Kept in doubly-linked list.
124 */ 124 */
125 struct ClientRecord *prev; 125 struct ClientRecord *prev;
126 126
127 /** 127 /**
128 * Handle to the client. 128 * Handle to the client.
129 */ 129 */
130 struct GNUNET_SERVER_Client *client; 130 struct GNUNET_SERVER_Client *client;
131 131
132 /** 132 /**
@@ -139,7 +139,7 @@ struct ClientRecord
139 139
140/** 140/**
141 * Entry we keep for each active request. 141 * Entry we keep for each active request.
142 */ 142 */
143struct RequestRecord 143struct RequestRecord
144{ 144{
145 145
@@ -180,7 +180,7 @@ struct RequestRecord
180 180
181 /** 181 /**
182 * Number of bytes in payload. 182 * Number of bytes in payload.
183 */ 183 */
184 size_t payload_length; 184 size_t payload_length;
185 185
186 /** 186 /**
@@ -317,7 +317,7 @@ request_done (struct RequestRecord *rr)
317 317
318 GNUNET_array_grow (rr->client_wait_list, 318 GNUNET_array_grow (rr->client_wait_list,
319 rr->client_wait_list_length, 319 rr->client_wait_list_length,
320 0); 320 0);
321 if (RP_RESPONSE_MONITOR != rr->phase) 321 if (RP_RESPONSE_MONITOR != rr->phase)
322 { 322 {
323 /* no response, drop */ 323 /* no response, drop */
@@ -330,7 +330,7 @@ request_done (struct RequestRecord *rr)
330 330
331 LOG (GNUNET_ERROR_TYPE_DEBUG, 331 LOG (GNUNET_ERROR_TYPE_DEBUG,
332 "Transmitting response for request %llu\n", 332 "Transmitting response for request %llu\n",
333 (unsigned long long) rr->request_id); 333 (unsigned long long) rr->request_id);
334 /* send response via hijacker */ 334 /* send response via hijacker */
335 reply_len = sizeof (struct GNUNET_MessageHeader); 335 reply_len = sizeof (struct GNUNET_MessageHeader);
336 reply_len += sizeof (struct GNUNET_TUN_Layer2PacketHeader); 336 reply_len += sizeof (struct GNUNET_TUN_Layer2PacketHeader);
@@ -345,7 +345,7 @@ request_done (struct RequestRecord *rr)
345 default: 345 default:
346 GNUNET_break (0); 346 GNUNET_break (0);
347 cleanup_rr (rr); 347 cleanup_rr (rr);
348 return; 348 return;
349 } 349 }
350 reply_len += sizeof (struct GNUNET_TUN_UdpHeader); 350 reply_len += sizeof (struct GNUNET_TUN_UdpHeader);
351 reply_len += rr->payload_length; 351 reply_len += rr->payload_length;
@@ -354,7 +354,7 @@ request_done (struct RequestRecord *rr)
354 /* response too big, drop */ 354 /* response too big, drop */
355 GNUNET_break (0); /* how can this be? */ 355 GNUNET_break (0); /* how can this be? */
356 cleanup_rr(rr); 356 cleanup_rr(rr);
357 return; 357 return;
358 } 358 }
359 { 359 {
360 char buf[reply_len] GNUNET_ALIGN; 360 char buf[reply_len] GNUNET_ALIGN;
@@ -374,7 +374,7 @@ request_done (struct RequestRecord *rr)
374 374
375 tun.flags = htons (0); 375 tun.flags = htons (0);
376 if (rr->src_addr.ss_family == AF_INET) 376 if (rr->src_addr.ss_family == AF_INET)
377 tun.proto = htons (ETH_P_IPV4); 377 tun.proto = htons (ETH_P_IPV4);
378 else 378 else
379 tun.proto = htons (ETH_P_IPV6); 379 tun.proto = htons (ETH_P_IPV6);
380 memcpy (&buf[off], &tun, sizeof (struct GNUNET_TUN_Layer2PacketHeader)); 380 memcpy (&buf[off], &tun, sizeof (struct GNUNET_TUN_Layer2PacketHeader));
@@ -483,14 +483,14 @@ send_request_to_client (struct RequestRecord *rr,
483 } 483 }
484 LOG (GNUNET_ERROR_TYPE_DEBUG, 484 LOG (GNUNET_ERROR_TYPE_DEBUG,
485 "Sending information about request %llu to local client\n", 485 "Sending information about request %llu to local client\n",
486 (unsigned long long) rr->request_id); 486 (unsigned long long) rr->request_id);
487 req = (struct GNUNET_DNS_Request*) buf; 487 req = (struct GNUNET_DNS_Request*) buf;
488 req->header.type = htons (GNUNET_MESSAGE_TYPE_DNS_CLIENT_REQUEST); 488 req->header.type = htons (GNUNET_MESSAGE_TYPE_DNS_CLIENT_REQUEST);
489 req->header.size = htons (sizeof (buf)); 489 req->header.size = htons (sizeof (buf));
490 req->reserved = htonl (0); 490 req->reserved = htonl (0);
491 req->request_id = rr->request_id; 491 req->request_id = rr->request_id;
492 memcpy (&req[1], rr->payload, rr->payload_length); 492 memcpy (&req[1], rr->payload, rr->payload_length);
493 GNUNET_SERVER_notification_context_unicast (nc, 493 GNUNET_SERVER_notification_context_unicast (nc,
494 client, 494 client,
495 &req->header, 495 &req->header,
496 GNUNET_NO); 496 GNUNET_NO);
@@ -541,8 +541,8 @@ next_phase (struct RequestRecord *rr)
541 nz = (int) j; 541 nz = (int) j;
542 break; 542 break;
543 } 543 }
544 } 544 }
545 if (-1 != nz) 545 if (-1 != nz)
546 { 546 {
547 send_request_to_client (rr, rr->client_wait_list[nz]->client); 547 send_request_to_client (rr, rr->client_wait_list[nz]->client);
548 return; 548 return;
@@ -551,7 +551,7 @@ next_phase (struct RequestRecord *rr)
551 LOG (GNUNET_ERROR_TYPE_DEBUG, 551 LOG (GNUNET_ERROR_TYPE_DEBUG,
552 "Request %llu now in phase %d\n", 552 "Request %llu now in phase %d\n",
553 rr->request_id, 553 rr->request_id,
554 rr->phase); 554 rr->phase);
555 switch (rr->phase) 555 switch (rr->phase)
556 { 556 {
557 case RP_INIT: 557 case RP_INIT:
@@ -647,7 +647,7 @@ next_phase (struct RequestRecord *rr)
647 * 647 *
648 * @param cls unused 648 * @param cls unused
649 * @param client handle of client that disconnected 649 * @param client handle of client that disconnected
650 */ 650 */
651static void 651static void
652client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) 652client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
653{ 653{
@@ -674,7 +674,7 @@ client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
674 if (rr->client_wait_list[j] == cr) 674 if (rr->client_wait_list[j] == cr)
675 { 675 {
676 rr->client_wait_list[j] = NULL; 676 rr->client_wait_list[j] = NULL;
677 next_phase (rr); 677 next_phase (rr);
678 } 678 }
679 } 679 }
680 } 680 }
@@ -714,8 +714,8 @@ process_dns_result (void *cls,
714 gettext_noop ("# External DNS response discarded (no matching request)"), 714 gettext_noop ("# External DNS response discarded (no matching request)"),
715 1, GNUNET_NO); 715 1, GNUNET_NO);
716 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 716 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
717 "Received DNS reply that does not match any pending request. Dropping.\n"); 717 "Received DNS reply that does not match any pending request. Dropping.\n");
718 return; 718 return;
719 } 719 }
720 LOG (GNUNET_ERROR_TYPE_DEBUG, 720 LOG (GNUNET_ERROR_TYPE_DEBUG,
721 "Got a response from the stub resolver for DNS request %llu intercepted locally!\n", 721 "Got a response from the stub resolver for DNS request %llu intercepted locally!\n",
@@ -736,7 +736,7 @@ process_dns_result (void *cls,
736 * @param message the init message (unused) 736 * @param message the init message (unused)
737 */ 737 */
738static void 738static void
739handle_client_init (void *cls GNUNET_UNUSED, 739handle_client_init (void *cls GNUNET_UNUSED,
740 struct GNUNET_SERVER_Client *client, 740 struct GNUNET_SERVER_Client *client,
741 const struct GNUNET_MessageHeader *message) 741 const struct GNUNET_MessageHeader *message)
742{ 742{
@@ -745,7 +745,7 @@ handle_client_init (void *cls GNUNET_UNUSED,
745 745
746 cr = GNUNET_malloc (sizeof (struct ClientRecord)); 746 cr = GNUNET_malloc (sizeof (struct ClientRecord));
747 cr->client = client; 747 cr->client = client;
748 cr->flags = (enum GNUNET_DNS_Flags) ntohl (reg->flags); 748 cr->flags = (enum GNUNET_DNS_Flags) ntohl (reg->flags);
749 GNUNET_SERVER_client_keep (client); 749 GNUNET_SERVER_client_keep (client);
750 GNUNET_CONTAINER_DLL_insert (clients_head, 750 GNUNET_CONTAINER_DLL_insert (clients_head,
751 clients_tail, 751 clients_tail,
@@ -763,7 +763,7 @@ handle_client_init (void *cls GNUNET_UNUSED,
763 * @param message the response 763 * @param message the response
764 */ 764 */
765static void 765static void
766handle_client_response (void *cls GNUNET_UNUSED, 766handle_client_response (void *cls GNUNET_UNUSED,
767 struct GNUNET_SERVER_Client *client, 767 struct GNUNET_SERVER_Client *client,
768 const struct GNUNET_MessageHeader *message) 768 const struct GNUNET_MessageHeader *message)
769{ 769{
@@ -816,7 +816,7 @@ handle_client_response (void *cls GNUNET_UNUSED,
816 { 816 {
817 GNUNET_break (0); 817 GNUNET_break (0);
818 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 818 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
819 next_phase (rr); 819 next_phase (rr);
820 return; 820 return;
821 } 821 }
822 GNUNET_free_non_null (rr->payload); 822 GNUNET_free_non_null (rr->payload);
@@ -844,9 +844,9 @@ handle_client_response (void *cls GNUNET_UNUSED,
844 } 844 }
845 break; 845 break;
846 } 846 }
847 next_phase (rr); 847 next_phase (rr);
848 GNUNET_SERVER_receive_done (client, GNUNET_OK); 848 GNUNET_SERVER_receive_done (client, GNUNET_OK);
849 return; 849 return;
850 } 850 }
851 /* odd, client was not on our list for the request, that ought 851 /* odd, client was not on our list for the request, that ought
852 to be an error */ 852 to be an error */
@@ -936,7 +936,7 @@ process_helper_messages (void *cls GNUNET_UNUSED, void *client,
936 } 936 }
937 if ( (msize <= sizeof (struct GNUNET_TUN_UdpHeader) + sizeof (struct GNUNET_TUN_DnsHeader)) || 937 if ( (msize <= sizeof (struct GNUNET_TUN_UdpHeader) + sizeof (struct GNUNET_TUN_DnsHeader)) ||
938 (DNS_PORT != ntohs (udp->destination_port)) ) 938 (DNS_PORT != ntohs (udp->destination_port)) )
939 { 939 {
940 /* non-DNS packet received on TUN, ignore */ 940 /* non-DNS packet received on TUN, ignore */
941 GNUNET_STATISTICS_update (stats, 941 GNUNET_STATISTICS_update (stats,
942 gettext_noop ("# Non-DNS UDP packet received via TUN interface"), 942 gettext_noop ("# Non-DNS UDP packet received via TUN interface"),
@@ -1025,7 +1025,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1025{ 1025{
1026 static const struct GNUNET_SERVER_MessageHandler handlers[] = { 1026 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
1027 /* callback, cls, type, size */ 1027 /* callback, cls, type, size */
1028 {&handle_client_init, NULL, GNUNET_MESSAGE_TYPE_DNS_CLIENT_INIT, 1028 {&handle_client_init, NULL, GNUNET_MESSAGE_TYPE_DNS_CLIENT_INIT,
1029 sizeof (struct GNUNET_DNS_Register)}, 1029 sizeof (struct GNUNET_DNS_Register)},
1030 {&handle_client_response, NULL, GNUNET_MESSAGE_TYPE_DNS_CLIENT_RESPONSE, 0}, 1030 {&handle_client_response, NULL, GNUNET_MESSAGE_TYPE_DNS_CLIENT_RESPONSE, 0},
1031 {NULL, NULL, 0, 0} 1031 {NULL, NULL, 0, 0}
@@ -1059,7 +1059,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1059 cls); 1059 cls);
1060 dns_exit = NULL; 1060 dns_exit = NULL;
1061 if ( ( (GNUNET_OK != 1061 if ( ( (GNUNET_OK !=
1062 GNUNET_CONFIGURATION_get_value_string (cfg, "dns", 1062 GNUNET_CONFIGURATION_get_value_string (cfg, "dns",
1063 "DNS_EXIT", 1063 "DNS_EXIT",
1064 &dns_exit)) || 1064 &dns_exit)) ||
1065 ( (1 != inet_pton (AF_INET, dns_exit, &dns_exit4)) && 1065 ( (1 != inet_pton (AF_INET, dns_exit, &dns_exit4)) &&
@@ -1157,7 +1157,7 @@ main (int argc, char *const *argv)
1157 strerror (errno)); 1157 strerror (errno));
1158 } 1158 }
1159 else if (sgid != rgid) 1159 else if (sgid != rgid)
1160 { 1160 {
1161 if (-1 == setregid (sgid, sgid)) 1161 if (-1 == setregid (sgid, sgid))
1162 fprintf (stderr, "setregid failed: %s\n", strerror (errno)); 1162 fprintf (stderr, "setregid failed: %s\n", strerror (errno));
1163 } 1163 }
diff --git a/src/dns/plugin_block_dns.c b/src/dns/plugin_block_dns.c
index de9185a5a..a8846944e 100644
--- a/src/dns/plugin_block_dns.c
+++ b/src/dns/plugin_block_dns.c
@@ -85,14 +85,14 @@ block_plugin_dns_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
85 GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh 85 GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh
86 (ad->expiration_time)).rel_value_us) 86 (ad->expiration_time)).rel_value_us)
87 { 87 {
88 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 88 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
89 "DNS advertisement has expired\n"); 89 "DNS advertisement has expired\n");
90 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 90 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
91 } 91 }
92 if (GNUNET_OK != 92 if (GNUNET_OK !=
93 GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_DNS_RECORD, 93 GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_DNS_RECORD,
94 &ad->purpose, 94 &ad->purpose,
95 &ad->signature, 95 &ad->signature,
96 &ad->peer.public_key)) 96 &ad->peer.public_key))
97 { 97 {
98 GNUNET_break_op (0); 98 GNUNET_break_op (0);
@@ -117,9 +117,9 @@ block_plugin_dns_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
117 * (or if extracting a key from a block of this type does not work) 117 * (or if extracting a key from a block of this type does not work)
118 */ 118 */
119static int 119static int
120block_plugin_dns_get_key (void *cls, 120block_plugin_dns_get_key (void *cls,
121 enum GNUNET_BLOCK_Type type, 121 enum GNUNET_BLOCK_Type type,
122 const void *block, 122 const void *block,
123 size_t block_size, 123 size_t block_size,
124 struct GNUNET_HashCode *key) 124 struct GNUNET_HashCode *key)
125{ 125{
diff --git a/src/dv/dv.h b/src/dv/dv.h
index c0247218e..c0a4828a2 100644
--- a/src/dv/dv.h
+++ b/src/dv/dv.h
@@ -142,7 +142,7 @@ struct GNUNET_DV_AckMessage
142 /** 142 /**
143 * Type: GNUNET_MESSAGE_TYPE_DV_SEND_ACK or 143 * Type: GNUNET_MESSAGE_TYPE_DV_SEND_ACK or
144 * GNUNET_MESSAGE_TYPE_DV_SEND_NACK. 144 * GNUNET_MESSAGE_TYPE_DV_SEND_NACK.
145 */ 145 */
146 struct GNUNET_MessageHeader header; 146 struct GNUNET_MessageHeader header;
147 147
148 /** 148 /**
@@ -166,7 +166,7 @@ struct GNUNET_DV_DistanceUpdateMessage
166{ 166{
167 /** 167 /**
168 * Type: GNUNET_MESSAGE_TYPE_DV_DISTANCE_CHANGED. 168 * Type: GNUNET_MESSAGE_TYPE_DV_DISTANCE_CHANGED.
169 */ 169 */
170 struct GNUNET_MessageHeader header; 170 struct GNUNET_MessageHeader header;
171 171
172 /** 172 /**
diff --git a/src/dv/dv_api.c b/src/dv/dv_api.c
index 1bbb789f9..412ab47ad 100644
--- a/src/dv/dv_api.c
+++ b/src/dv/dv_api.c
@@ -63,7 +63,7 @@ struct GNUNET_DV_TransmitHandle
63 * Closure for 'cb'. 63 * Closure for 'cb'.
64 */ 64 */
65 void *cb_cls; 65 void *cb_cls;
66 66
67 /** 67 /**
68 * The actual message (allocated at the end of this struct). 68 * The actual message (allocated at the end of this struct).
69 */ 69 */
@@ -78,7 +78,7 @@ struct GNUNET_DV_TransmitHandle
78 * UID of our message, if any. 78 * UID of our message, if any.
79 */ 79 */
80 uint32_t uid; 80 uint32_t uid;
81 81
82}; 82};
83 83
84 84
@@ -107,7 +107,7 @@ struct GNUNET_DV_ServiceHandle
107 * Closure for the callbacks. 107 * Closure for the callbacks.
108 */ 108 */
109 void *cls; 109 void *cls;
110 110
111 /** 111 /**
112 * Function to call on connect events. 112 * Function to call on connect events.
113 */ 113 */
@@ -221,12 +221,12 @@ start_transmit (struct GNUNET_DV_ServiceHandle *sh)
221 if (NULL != sh->th) 221 if (NULL != sh->th)
222 return; 222 return;
223 if (NULL == sh->th_head) 223 if (NULL == sh->th_head)
224 return; 224 return;
225 sh->th = 225 sh->th =
226 GNUNET_CLIENT_notify_transmit_ready (sh->client, 226 GNUNET_CLIENT_notify_transmit_ready (sh->client,
227 ntohs (sh->th_head->msg->size), 227 ntohs (sh->th_head->msg->size),
228 GNUNET_TIME_UNIT_FOREVER_REL, 228 GNUNET_TIME_UNIT_FOREVER_REL,
229 GNUNET_NO, 229 GNUNET_NO,
230 &transmit_pending, sh); 230 &transmit_pending, sh);
231} 231}
232 232
@@ -291,7 +291,7 @@ process_ack (void *cls,
291 * @param msg the message that was received 291 * @param msg the message that was received
292 */ 292 */
293static void 293static void
294handle_message_receipt (void *cls, 294handle_message_receipt (void *cls,
295 const struct GNUNET_MessageHeader *msg) 295 const struct GNUNET_MessageHeader *msg)
296{ 296{
297 struct GNUNET_DV_ServiceHandle *sh = cls; 297 struct GNUNET_DV_ServiceHandle *sh = cls;
@@ -302,7 +302,7 @@ handle_message_receipt (void *cls,
302 const struct GNUNET_MessageHeader *payload; 302 const struct GNUNET_MessageHeader *payload;
303 const struct GNUNET_DV_AckMessage *ack; 303 const struct GNUNET_DV_AckMessage *ack;
304 struct AckContext ctx; 304 struct AckContext ctx;
305 305
306 if (NULL == msg) 306 if (NULL == msg)
307 { 307 {
308 /* Connection closed */ 308 /* Connection closed */
@@ -389,7 +389,7 @@ handle_message_receipt (void *cls,
389 reconnect (sh); 389 reconnect (sh);
390 break; 390 break;
391 } 391 }
392 GNUNET_CLIENT_receive (sh->client, 392 GNUNET_CLIENT_receive (sh->client,
393 &handle_message_receipt, sh, 393 &handle_message_receipt, sh,
394 GNUNET_TIME_UNIT_FOREVER_REL); 394 GNUNET_TIME_UNIT_FOREVER_REL);
395} 395}
@@ -402,7 +402,7 @@ handle_message_receipt (void *cls,
402 * @param size number of bytes available in buf 402 * @param size number of bytes available in buf
403 * @param buf where to copy the message 403 * @param buf where to copy the message
404 * @return number of bytes written to buf 404 * @return number of bytes written to buf
405 */ 405 */
406static size_t 406static size_t
407transmit_start (void *cls, 407transmit_start (void *cls,
408 size_t size, 408 size_t size,
@@ -464,7 +464,7 @@ cleanup_send_cb (void *cls,
464 */ 464 */
465static void 465static void
466reconnect (struct GNUNET_DV_ServiceHandle *sh) 466reconnect (struct GNUNET_DV_ServiceHandle *sh)
467{ 467{
468 if (NULL != sh->th) 468 if (NULL != sh->th)
469 { 469 {
470 GNUNET_CLIENT_notify_transmit_ready_cancel (sh->th); 470 GNUNET_CLIENT_notify_transmit_ready_cancel (sh->th);
@@ -538,7 +538,7 @@ void
538GNUNET_DV_service_disconnect (struct GNUNET_DV_ServiceHandle *sh) 538GNUNET_DV_service_disconnect (struct GNUNET_DV_ServiceHandle *sh)
539{ 539{
540 struct GNUNET_DV_TransmitHandle *pos; 540 struct GNUNET_DV_TransmitHandle *pos;
541 541
542 if (NULL == sh) 542 if (NULL == sh)
543 return; 543 return;
544 if (NULL != sh->th) 544 if (NULL != sh->th)
@@ -553,7 +553,7 @@ GNUNET_DV_service_disconnect (struct GNUNET_DV_ServiceHandle *sh)
553 pos); 553 pos);
554 GNUNET_free (pos); 554 GNUNET_free (pos);
555 } 555 }
556 if (NULL != sh->client) 556 if (NULL != sh->client)
557 { 557 {
558 GNUNET_CLIENT_disconnect (sh->client); 558 GNUNET_CLIENT_disconnect (sh->client);
559 sh->client = NULL; 559 sh->client = NULL;
@@ -607,7 +607,7 @@ GNUNET_DV_send (struct GNUNET_DV_ServiceHandle *sh,
607 th->msg = (const struct GNUNET_MessageHeader *) &th[1]; 607 th->msg = (const struct GNUNET_MessageHeader *) &th[1];
608 sm = (struct GNUNET_DV_SendMessage *) &th[1]; 608 sm = (struct GNUNET_DV_SendMessage *) &th[1];
609 sm->header.type = htons (GNUNET_MESSAGE_TYPE_DV_SEND); 609 sm->header.type = htons (GNUNET_MESSAGE_TYPE_DV_SEND);
610 sm->header.size = htons (sizeof (struct GNUNET_DV_SendMessage) + 610 sm->header.size = htons (sizeof (struct GNUNET_DV_SendMessage) +
611 ntohs (msg->size)); 611 ntohs (msg->size));
612 if (0 == sh->uid_gen) 612 if (0 == sh->uid_gen)
613 sh->uid_gen = 1; 613 sh->uid_gen = 1;
diff --git a/src/dv/gnunet-dv.c b/src/dv/gnunet-dv.c
index 77324978e..43af3458e 100644
--- a/src/dv/gnunet-dv.c
+++ b/src/dv/gnunet-dv.c
@@ -44,7 +44,7 @@ static int verbose;
44 * @param peer newly connected peer 44 * @param peer newly connected peer
45 * @param distance distance to the peer 45 * @param distance distance to the peer
46 */ 46 */
47static void 47static void
48connect_cb (void *cls, 48connect_cb (void *cls,
49 const struct GNUNET_PeerIdentity *peer, 49 const struct GNUNET_PeerIdentity *peer,
50 uint32_t distance) 50 uint32_t distance)
@@ -62,7 +62,7 @@ connect_cb (void *cls,
62 * @param peer connected peer 62 * @param peer connected peer
63 * @param distance new distance to the peer 63 * @param distance new distance to the peer
64 */ 64 */
65static void 65static void
66change_cb (void *cls, 66change_cb (void *cls,
67 const struct GNUNET_PeerIdentity *peer, 67 const struct GNUNET_PeerIdentity *peer,
68 uint32_t distance) 68 uint32_t distance)
@@ -79,7 +79,7 @@ change_cb (void *cls,
79 * @param cls closure 79 * @param cls closure
80 * @param peer peer that disconnected 80 * @param peer peer that disconnected
81 */ 81 */
82static void 82static void
83disconnect_cb (void *cls, 83disconnect_cb (void *cls,
84 const struct GNUNET_PeerIdentity *peer) 84 const struct GNUNET_PeerIdentity *peer)
85{ 85{
@@ -96,7 +96,7 @@ disconnect_cb (void *cls,
96 * @param distance how far did the message travel 96 * @param distance how far did the message travel
97 * @param msg actual message payload 97 * @param msg actual message payload
98 */ 98 */
99static void 99static void
100message_cb (void *cls, 100message_cb (void *cls,
101 const struct GNUNET_PeerIdentity *sender, 101 const struct GNUNET_PeerIdentity *sender,
102 uint32_t distance, 102 uint32_t distance,
@@ -171,7 +171,7 @@ main (int argc, char *const *argv)
171 return 2; 171 return 2;
172 172
173 res = GNUNET_PROGRAM_run (argc, argv, "gnunet-dv", 173 res = GNUNET_PROGRAM_run (argc, argv, "gnunet-dv",
174 gettext_noop ("Print information about DV state"), 174 gettext_noop ("Print information about DV state"),
175 options, &run, 175 options, &run,
176 NULL); 176 NULL);
177 GNUNET_free ((void *) argv); 177 GNUNET_free ((void *) argv);
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c
index 19303ed83..cd4517164 100644
--- a/src/dv/gnunet-service-dv.c
+++ b/src/dv/gnunet-service-dv.c
@@ -92,7 +92,7 @@ struct Target
92 92
93/** 93/**
94 * Message exchanged between DV services (via core), requesting a 94 * Message exchanged between DV services (via core), requesting a
95 * message to be routed. 95 * message to be routed.
96 */ 96 */
97struct RouteMessage 97struct RouteMessage
98{ 98{
@@ -176,7 +176,7 @@ struct DirectNeighbor
176 * with other applications. 176 * with other applications.
177 */ 177 */
178 struct GNUNET_HashCode real_session_id; 178 struct GNUNET_HashCode real_session_id;
179 179
180 /** 180 /**
181 * Head of linked list of messages to send to this peer. 181 * Head of linked list of messages to send to this peer.
182 */ 182 */
@@ -197,7 +197,7 @@ struct DirectNeighbor
197 * Keys are peer identities, values are 'struct Target' entries. 197 * Keys are peer identities, values are 'struct Target' entries.
198 * Note that the distances in the targets are from the point-of-view 198 * Note that the distances in the targets are from the point-of-view
199 * of the peer, not from us! 199 * of the peer, not from us!
200 */ 200 */
201 struct GNUNET_CONTAINER_MultiPeerMap *neighbor_table; 201 struct GNUNET_CONTAINER_MultiPeerMap *neighbor_table;
202 202
203 /** 203 /**
@@ -206,7 +206,7 @@ struct DirectNeighbor
206 * Keys are peer identities, values are 'struct Target' entries. 206 * Keys are peer identities, values are 'struct Target' entries.
207 * Note that the distances in the targets are from the point-of-view 207 * Note that the distances in the targets are from the point-of-view
208 * of the peer, not from us! 208 * of the peer, not from us!
209 */ 209 */
210 struct GNUNET_CONTAINER_MultiPeerMap *neighbor_table_consensus; 210 struct GNUNET_CONTAINER_MultiPeerMap *neighbor_table_consensus;
211 211
212 /** 212 /**
@@ -318,13 +318,13 @@ struct ConsensusSet
318 318
319/** 319/**
320 * Peermap of all of our neighbors; processing these usually requires 320 * Peermap of all of our neighbors; processing these usually requires
321 * first checking to see if the peer is core-connected and if the 321 * first checking to see if the peer is core-connected and if the
322 * distance is 1, in which case they are direct neighbors. 322 * distance is 1, in which case they are direct neighbors.
323 */ 323 */
324static struct GNUNET_CONTAINER_MultiPeerMap *direct_neighbors; 324static struct GNUNET_CONTAINER_MultiPeerMap *direct_neighbors;
325 325
326/** 326/**
327 * Hashmap with all routes that we currently support; contains 327 * Hashmap with all routes that we currently support; contains
328 * routing information for all peers from distance 2 328 * routing information for all peers from distance 2
329 * up to distance DEFAULT_FISHEYE_DEPTH. 329 * up to distance DEFAULT_FISHEYE_DEPTH.
330 */ 330 */
@@ -367,7 +367,7 @@ static struct GNUNET_STATISTICS_Handle *stats;
367 * Handle to ATS service. 367 * Handle to ATS service.
368 */ 368 */
369static struct GNUNET_ATS_PerformanceHandle *ats; 369static struct GNUNET_ATS_PerformanceHandle *ats;
370 370
371 371
372/** 372/**
373 * Start creating a new DV set union by initiating the connection. 373 * Start creating a new DV set union by initiating the connection.
@@ -375,7 +375,7 @@ static struct GNUNET_ATS_PerformanceHandle *ats;
375 * @param cls the 'struct DirectNeighbor' of the peer we're building 375 * @param cls the 'struct DirectNeighbor' of the peer we're building
376 * a routing consensus with 376 * a routing consensus with
377 * @param tc scheduler context 377 * @param tc scheduler context
378 */ 378 */
379static void 379static void
380initiate_set_union (void *cls, 380initiate_set_union (void *cls,
381 const struct GNUNET_SCHEDULER_TaskContext *tc); 381 const struct GNUNET_SCHEDULER_TaskContext *tc);
@@ -396,7 +396,7 @@ initiate_set_union (void *cls,
396 * necessary to specify the set we want to do the operation with, 396 * necessary to specify the set we want to do the operation with,
397 * whith sometimes can be derived from the context message. 397 * whith sometimes can be derived from the context message.
398 * Also necessary to specify the timeout. 398 * Also necessary to specify the timeout.
399 */ 399 */
400static void 400static void
401listen_set_union (void *cls, 401listen_set_union (void *cls,
402 const struct GNUNET_PeerIdentity *other_peer, 402 const struct GNUNET_PeerIdentity *other_peer,
@@ -412,7 +412,7 @@ listen_set_union (void *cls,
412 * @param distance distance to the original sender of the message 412 * @param distance distance to the original sender of the message
413 */ 413 */
414static void 414static void
415send_data_to_plugin (const struct GNUNET_MessageHeader *message, 415send_data_to_plugin (const struct GNUNET_MessageHeader *message,
416 const struct GNUNET_PeerIdentity *origin, 416 const struct GNUNET_PeerIdentity *origin,
417 uint32_t distance) 417 uint32_t distance)
418{ 418{
@@ -422,10 +422,10 @@ send_data_to_plugin (const struct GNUNET_MessageHeader *message,
422 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 422 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
423 "Delivering message from peer `%s'\n", 423 "Delivering message from peer `%s'\n",
424 GNUNET_i2s (origin)); 424 GNUNET_i2s (origin));
425 size = sizeof (struct GNUNET_DV_ReceivedMessage) + 425 size = sizeof (struct GNUNET_DV_ReceivedMessage) +
426 ntohs (message->size); 426 ntohs (message->size);
427 if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 427 if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
428 { 428 {
429 GNUNET_break (0); /* too big */ 429 GNUNET_break (0); /* too big */
430 return; 430 return;
431 } 431 }
@@ -435,7 +435,7 @@ send_data_to_plugin (const struct GNUNET_MessageHeader *message,
435 received_msg->distance = htonl (distance); 435 received_msg->distance = htonl (distance);
436 received_msg->sender = *origin; 436 received_msg->sender = *origin;
437 memcpy (&received_msg[1], message, ntohs (message->size)); 437 memcpy (&received_msg[1], message, ntohs (message->size));
438 GNUNET_SERVER_notification_context_broadcast (nc, 438 GNUNET_SERVER_notification_context_broadcast (nc,
439 &received_msg->header, 439 &received_msg->header,
440 GNUNET_YES); 440 GNUNET_YES);
441 GNUNET_free (received_msg); 441 GNUNET_free (received_msg);
@@ -450,7 +450,7 @@ send_data_to_plugin (const struct GNUNET_MessageHeader *message,
450static void 450static void
451send_control_to_plugin (const struct GNUNET_MessageHeader *message) 451send_control_to_plugin (const struct GNUNET_MessageHeader *message)
452{ 452{
453 GNUNET_SERVER_notification_context_broadcast (nc, 453 GNUNET_SERVER_notification_context_broadcast (nc,
454 message, 454 message,
455 GNUNET_NO); 455 GNUNET_NO);
456} 456}
@@ -464,7 +464,7 @@ send_control_to_plugin (const struct GNUNET_MessageHeader *message)
464 * @param nack GNUNET_NO to send ACK, GNUNET_YES to send NACK 464 * @param nack GNUNET_NO to send ACK, GNUNET_YES to send NACK
465 */ 465 */
466static void 466static void
467send_ack_to_plugin (const struct GNUNET_PeerIdentity *target, 467send_ack_to_plugin (const struct GNUNET_PeerIdentity *target,
468 uint32_t uid, 468 uint32_t uid,
469 int nack) 469 int nack)
470{ 470{
@@ -474,7 +474,7 @@ send_ack_to_plugin (const struct GNUNET_PeerIdentity *target,
474 "Delivering ACK for message to peer `%s'\n", 474 "Delivering ACK for message to peer `%s'\n",
475 GNUNET_i2s (target)); 475 GNUNET_i2s (target));
476 ack_msg.header.size = htons (sizeof (ack_msg)); 476 ack_msg.header.size = htons (sizeof (ack_msg));
477 ack_msg.header.type = htons ((GNUNET_YES == nack) 477 ack_msg.header.type = htons ((GNUNET_YES == nack)
478 ? GNUNET_MESSAGE_TYPE_DV_SEND_NACK 478 ? GNUNET_MESSAGE_TYPE_DV_SEND_NACK
479 : GNUNET_MESSAGE_TYPE_DV_SEND_ACK); 479 : GNUNET_MESSAGE_TYPE_DV_SEND_ACK);
480 ack_msg.uid = htonl (uid); 480 ack_msg.uid = htonl (uid);
@@ -490,7 +490,7 @@ send_ack_to_plugin (const struct GNUNET_PeerIdentity *target,
490 * @param distance new distance to the peer 490 * @param distance new distance to the peer
491 */ 491 */
492static void 492static void
493send_distance_change_to_plugin (const struct GNUNET_PeerIdentity *peer, 493send_distance_change_to_plugin (const struct GNUNET_PeerIdentity *peer,
494 uint32_t distance) 494 uint32_t distance)
495{ 495{
496 struct GNUNET_DV_DistanceUpdateMessage du_msg; 496 struct GNUNET_DV_DistanceUpdateMessage du_msg;
@@ -513,7 +513,7 @@ send_distance_change_to_plugin (const struct GNUNET_PeerIdentity *peer,
513 * @param distance distance to the target 513 * @param distance distance to the target
514 */ 514 */
515static void 515static void
516send_connect_to_plugin (const struct GNUNET_PeerIdentity *target, 516send_connect_to_plugin (const struct GNUNET_PeerIdentity *target,
517 uint32_t distance) 517 uint32_t distance)
518{ 518{
519 struct GNUNET_DV_ConnectMessage cm; 519 struct GNUNET_DV_ConnectMessage cm;
@@ -585,7 +585,7 @@ core_transmit_notify (void *cls, size_t size, void *buf)
585 dn->pm_tail, 585 dn->pm_tail,
586 pending); 586 pending);
587 memcpy (&cbuf[off], pending->msg, msize); 587 memcpy (&cbuf[off], pending->msg, msize);
588 if (0 != pending->uid) 588 if (0 != pending->uid)
589 send_ack_to_plugin (&pending->ultimate_target, 589 send_ack_to_plugin (&pending->ultimate_target,
590 pending->uid, 590 pending->uid,
591 GNUNET_NO); 591 GNUNET_NO);
@@ -599,7 +599,7 @@ core_transmit_notify (void *cls, size_t size, void *buf)
599 0 /* priority */, 599 0 /* priority */,
600 GNUNET_TIME_UNIT_FOREVER_REL, 600 GNUNET_TIME_UNIT_FOREVER_REL,
601 &dn->peer, 601 &dn->peer,
602 msize, 602 msize,
603 &core_transmit_notify, dn); 603 &core_transmit_notify, dn);
604 return off; 604 return off;
605} 605}
@@ -662,7 +662,7 @@ forward_payload (struct DirectNeighbor *target,
662 0 /* priority */, 662 0 /* priority */,
663 GNUNET_TIME_UNIT_FOREVER_REL, 663 GNUNET_TIME_UNIT_FOREVER_REL,
664 &target->peer, 664 &target->peer,
665 msize, 665 msize,
666 &core_transmit_notify, target); 666 &core_transmit_notify, target);
667} 667}
668 668
@@ -738,7 +738,7 @@ move_route (struct Route *route,
738 release_route (route); 738 release_route (route);
739 i = get_consensus_slot (new_distance); 739 i = get_consensus_slot (new_distance);
740 route->set_offset = i; 740 route->set_offset = i;
741 consensi[new_distance].targets[i] = route; 741 consensi[new_distance].targets[i] = route;
742 route->target.distance = htonl (new_distance); 742 route->target.distance = htonl (new_distance);
743} 743}
744 744
@@ -785,13 +785,13 @@ build_set (void *cls)
785 while ( (DEFAULT_FISHEYE_DEPTH - 1 > neighbor->consensus_insertion_distance) && 785 while ( (DEFAULT_FISHEYE_DEPTH - 1 > neighbor->consensus_insertion_distance) &&
786 (consensi[neighbor->consensus_insertion_distance].array_length < neighbor->consensus_insertion_offset) && 786 (consensi[neighbor->consensus_insertion_distance].array_length < neighbor->consensus_insertion_offset) &&
787 (NULL == consensi[neighbor->consensus_insertion_distance].targets[neighbor->consensus_insertion_offset]) ) 787 (NULL == consensi[neighbor->consensus_insertion_distance].targets[neighbor->consensus_insertion_offset]) )
788 neighbor->consensus_insertion_offset++; 788 neighbor->consensus_insertion_offset++;
789 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 789 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
790 "Adding element to SET\n"); 790 "Adding element to SET\n");
791 GNUNET_SET_add_element (neighbor->my_set, 791 GNUNET_SET_add_element (neighbor->my_set,
792 &element, 792 &element,
793 &build_set, neighbor); 793 &build_set, neighbor);
794 794
795} 795}
796 796
797 797
@@ -814,9 +814,9 @@ handle_direct_connect (struct DirectNeighbor *neighbor)
814 GNUNET_STATISTICS_update (stats, 814 GNUNET_STATISTICS_update (stats,
815 "# peers connected (1-hop)", 815 "# peers connected (1-hop)",
816 1, GNUNET_NO); 816 1, GNUNET_NO);
817 route = GNUNET_CONTAINER_multipeermap_get (all_routes, 817 route = GNUNET_CONTAINER_multipeermap_get (all_routes,
818 &neighbor->peer); 818 &neighbor->peer);
819 if (NULL != route) 819 if (NULL != route)
820 { 820 {
821 send_disconnect_to_plugin (&neighbor->peer); 821 send_disconnect_to_plugin (&neighbor->peer);
822 release_route (route); 822 release_route (route);
@@ -839,7 +839,7 @@ handle_direct_connect (struct DirectNeighbor *neighbor)
839 sizeof (struct GNUNET_PeerIdentity))) 839 sizeof (struct GNUNET_PeerIdentity)))
840 { 840 {
841 neighbor->initiate_task = GNUNET_SCHEDULER_add_now (&initiate_set_union, 841 neighbor->initiate_task = GNUNET_SCHEDULER_add_now (&initiate_set_union,
842 neighbor); 842 neighbor);
843 } 843 }
844 else 844 else
845 { 845 {
@@ -861,16 +861,16 @@ handle_direct_connect (struct DirectNeighbor *neighbor)
861 * @param peer peer identity this notification is about 861 * @param peer peer identity this notification is about
862 */ 862 */
863static void 863static void
864handle_core_connect (void *cls, 864handle_core_connect (void *cls,
865 const struct GNUNET_PeerIdentity *peer) 865 const struct GNUNET_PeerIdentity *peer)
866{ 866{
867 struct DirectNeighbor *neighbor; 867 struct DirectNeighbor *neighbor;
868 868
869 /* Check for connect to self message */ 869 /* Check for connect to self message */
870 if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity))) 870 if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity)))
871 return; 871 return;
872 /* check if entry exists */ 872 /* check if entry exists */
873 neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors, 873 neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors,
874 peer); 874 peer);
875 if (NULL != neighbor) 875 if (NULL != neighbor)
876 { 876 {
@@ -929,14 +929,14 @@ free_targets (void *cls,
929 * @return GNUNET_YES to continue iteration, GNUNET_NO to stop 929 * @return GNUNET_YES to continue iteration, GNUNET_NO to stop
930 */ 930 */
931static int 931static int
932check_possible_route (void *cls, 932check_possible_route (void *cls,
933 const struct GNUNET_PeerIdentity *key, 933 const struct GNUNET_PeerIdentity *key,
934 void *value) 934 void *value)
935{ 935{
936 struct DirectNeighbor *neighbor = cls; 936 struct DirectNeighbor *neighbor = cls;
937 struct Target *target = value; 937 struct Target *target = value;
938 struct Route *route; 938 struct Route *route;
939 939
940 route = GNUNET_CONTAINER_multipeermap_get (all_routes, 940 route = GNUNET_CONTAINER_multipeermap_get (all_routes,
941 key); 941 key);
942 if (NULL != route) 942 if (NULL != route)
@@ -975,15 +975,15 @@ check_possible_route (void *cls,
975 * @return GNUNET_YES to continue iteration 975 * @return GNUNET_YES to continue iteration
976 */ 976 */
977static int 977static int
978refresh_routes (void *cls, 978refresh_routes (void *cls,
979 const struct GNUNET_PeerIdentity *key, 979 const struct GNUNET_PeerIdentity *key,
980 void *value) 980 void *value)
981{ 981{
982 struct DirectNeighbor *neighbor = value; 982 struct DirectNeighbor *neighbor = value;
983 983
984 if ( (GNUNET_YES != neighbor->connected) || 984 if ( (GNUNET_YES != neighbor->connected) ||
985 (DIRECT_NEIGHBOR_COST != neighbor->distance) ) 985 (DIRECT_NEIGHBOR_COST != neighbor->distance) )
986 return GNUNET_YES; 986 return GNUNET_YES;
987 if (NULL != neighbor->neighbor_table) 987 if (NULL != neighbor->neighbor_table)
988 GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table, 988 GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table,
989 &check_possible_route, 989 &check_possible_route,
@@ -1024,8 +1024,8 @@ get_atsi_distance (const struct GNUNET_ATS_Information *atsi,
1024 * @return GNUNET_YES to continue iteration, GNUNET_NO to stop 1024 * @return GNUNET_YES to continue iteration, GNUNET_NO to stop
1025 */ 1025 */
1026static int 1026static int
1027cull_routes (void *cls, 1027cull_routes (void *cls,
1028 const struct GNUNET_PeerIdentity *key, 1028 const struct GNUNET_PeerIdentity *key,
1029 void *value) 1029 void *value)
1030{ 1030{
1031 struct DirectNeighbor *neighbor = cls; 1031 struct DirectNeighbor *neighbor = cls;
@@ -1047,7 +1047,7 @@ cull_routes (void *cls,
1047 * disrupted. Remove all routes via that peer and 1047 * disrupted. Remove all routes via that peer and
1048 * stop the consensus with it. 1048 * stop the consensus with it.
1049 * 1049 *
1050 * @param neighbor peer that was disconnected (or at least is no 1050 * @param neighbor peer that was disconnected (or at least is no
1051 * longer at distance 1) 1051 * longer at distance 1)
1052 */ 1052 */
1053static void 1053static void
@@ -1118,7 +1118,7 @@ handle_ats_update (void *cls,
1118 int active, 1118 int active,
1119 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 1119 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
1120 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 1120 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
1121 const struct GNUNET_ATS_Information *ats, 1121 const struct GNUNET_ATS_Information *ats,
1122 uint32_t ats_count) 1122 uint32_t ats_count)
1123{ 1123{
1124 struct DirectNeighbor *neighbor; 1124 struct DirectNeighbor *neighbor;
@@ -1126,25 +1126,25 @@ handle_ats_update (void *cls,
1126 1126
1127 if (GNUNET_NO == active) 1127 if (GNUNET_NO == active)
1128 return; 1128 return;
1129 distance = get_atsi_distance (ats, ats_count); 1129 distance = get_atsi_distance (ats, ats_count);
1130 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1130 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1131 "ATS says distance to %s is %u\n", 1131 "ATS says distance to %s is %u\n",
1132 GNUNET_i2s (&address->peer), 1132 GNUNET_i2s (&address->peer),
1133 (unsigned int) distance); 1133 (unsigned int) distance);
1134 /* check if entry exists */ 1134 /* check if entry exists */
1135 neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors, 1135 neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors,
1136 &address->peer); 1136 &address->peer);
1137 if (NULL != neighbor) 1137 if (NULL != neighbor)
1138 { 1138 {
1139 if ( (DIRECT_NEIGHBOR_COST == neighbor->distance) && 1139 if ( (DIRECT_NEIGHBOR_COST == neighbor->distance) &&
1140 (DIRECT_NEIGHBOR_COST == distance) ) 1140 (DIRECT_NEIGHBOR_COST == distance) )
1141 return; /* no change */ 1141 return; /* no change */
1142 if (DIRECT_NEIGHBOR_COST == neighbor->distance) 1142 if (DIRECT_NEIGHBOR_COST == neighbor->distance)
1143 { 1143 {
1144 neighbor->distance = distance; 1144 neighbor->distance = distance;
1145 GNUNET_STATISTICS_update (stats, 1145 GNUNET_STATISTICS_update (stats,
1146 "# peers connected (1-hop)", 1146 "# peers connected (1-hop)",
1147 -1, GNUNET_NO); 1147 -1, GNUNET_NO);
1148 handle_direct_disconnect (neighbor); 1148 handle_direct_disconnect (neighbor);
1149 GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors, 1149 GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors,
1150 &refresh_routes, 1150 &refresh_routes,
@@ -1153,7 +1153,7 @@ handle_ats_update (void *cls,
1153 } 1153 }
1154 neighbor->distance = distance; 1154 neighbor->distance = distance;
1155 if (DIRECT_NEIGHBOR_COST != neighbor->distance) 1155 if (DIRECT_NEIGHBOR_COST != neighbor->distance)
1156 return; 1156 return;
1157 if (GNUNET_YES != neighbor->connected) 1157 if (GNUNET_YES != neighbor->connected)
1158 return; 1158 return;
1159 handle_direct_connect (neighbor); 1159 handle_direct_connect (neighbor);
@@ -1167,7 +1167,7 @@ handle_ats_update (void *cls,
1167 neighbor, 1167 neighbor,
1168 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 1168 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
1169 neighbor->connected = GNUNET_NO; /* not yet */ 1169 neighbor->connected = GNUNET_NO; /* not yet */
1170 neighbor->distance = distance; 1170 neighbor->distance = distance;
1171} 1171}
1172 1172
1173 1173
@@ -1357,7 +1357,7 @@ handle_set_union_result (void *cls,
1357 /* check if we got an alternative for the removed routes */ 1357 /* check if we got an alternative for the removed routes */
1358 GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors, 1358 GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors,
1359 &refresh_routes, 1359 &refresh_routes,
1360 NULL); 1360 NULL);
1361 } 1361 }
1362 /* add targets that appeared (and check for improved routes) */ 1362 /* add targets that appeared (and check for improved routes) */
1363 GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table_consensus, 1363 GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table_consensus,
@@ -1406,7 +1406,7 @@ handle_set_union_result (void *cls,
1406 * necessary to specify the set we want to do the operation with, 1406 * necessary to specify the set we want to do the operation with,
1407 * whith sometimes can be derived from the context message. 1407 * whith sometimes can be derived from the context message.
1408 * Also necessary to specify the timeout. 1408 * Also necessary to specify the timeout.
1409 */ 1409 */
1410static void 1410static void
1411listen_set_union (void *cls, 1411listen_set_union (void *cls,
1412 const struct GNUNET_PeerIdentity *other_peer, 1412 const struct GNUNET_PeerIdentity *other_peer,
@@ -1446,7 +1446,7 @@ listen_set_union (void *cls,
1446 * @param cls the 'struct DirectNeighbor' of the peer we're building 1446 * @param cls the 'struct DirectNeighbor' of the peer we're building
1447 * a routing consensus with 1447 * a routing consensus with
1448 * @param tc scheduler context 1448 * @param tc scheduler context
1449 */ 1449 */
1450static void 1450static void
1451initiate_set_union (void *cls, 1451initiate_set_union (void *cls,
1452 const struct GNUNET_SCHEDULER_TaskContext *tc) 1452 const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -1550,7 +1550,7 @@ handle_dv_route_message (void *cls, const struct GNUNET_PeerIdentity *peer,
1550 &rm->target, 1550 &rm->target,
1551 &rm->sender, 1551 &rm->sender,
1552 payload); 1552 payload);
1553 return GNUNET_OK; 1553 return GNUNET_OK;
1554} 1554}
1555 1555
1556 1556
@@ -1627,12 +1627,12 @@ cleanup_neighbor (struct DirectNeighbor *neighbor)
1627 neighbor->pm_queue_size--; 1627 neighbor->pm_queue_size--;
1628 GNUNET_CONTAINER_DLL_remove (neighbor->pm_head, 1628 GNUNET_CONTAINER_DLL_remove (neighbor->pm_head,
1629 neighbor->pm_tail, 1629 neighbor->pm_tail,
1630 pending); 1630 pending);
1631 GNUNET_free (pending); 1631 GNUNET_free (pending);
1632 } 1632 }
1633 handle_direct_disconnect (neighbor); 1633 handle_direct_disconnect (neighbor);
1634 GNUNET_assert (GNUNET_YES == 1634 GNUNET_assert (GNUNET_YES ==
1635 GNUNET_CONTAINER_multipeermap_remove (direct_neighbors, 1635 GNUNET_CONTAINER_multipeermap_remove (direct_neighbors,
1636 &neighbor->peer, 1636 &neighbor->peer,
1637 neighbor)); 1637 neighbor));
1638 GNUNET_free (neighbor); 1638 GNUNET_free (neighbor);
@@ -1669,7 +1669,7 @@ handle_core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
1669 { 1669 {
1670 GNUNET_STATISTICS_update (stats, 1670 GNUNET_STATISTICS_update (stats,
1671 "# peers connected (1-hop)", 1671 "# peers connected (1-hop)",
1672 -1, GNUNET_NO); 1672 -1, GNUNET_NO);
1673 } 1673 }
1674 cleanup_neighbor (neighbor); 1674 cleanup_neighbor (neighbor);
1675 GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors, 1675 GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors,
@@ -1770,13 +1770,13 @@ add_route (void *cls,
1770 struct GNUNET_SERVER_Client *client = cls; 1770 struct GNUNET_SERVER_Client *client = cls;
1771 struct Route *route = value; 1771 struct Route *route = value;
1772 struct GNUNET_DV_ConnectMessage cm; 1772 struct GNUNET_DV_ConnectMessage cm;
1773 1773
1774 cm.header.size = htons (sizeof (cm)); 1774 cm.header.size = htons (sizeof (cm));
1775 cm.header.type = htons (GNUNET_MESSAGE_TYPE_DV_CONNECT); 1775 cm.header.type = htons (GNUNET_MESSAGE_TYPE_DV_CONNECT);
1776 cm.distance = htonl (route->target.distance); 1776 cm.distance = htonl (route->target.distance);
1777 cm.peer = route->target.peer; 1777 cm.peer = route->target.peer;
1778 1778
1779 GNUNET_SERVER_notification_context_unicast (nc, 1779 GNUNET_SERVER_notification_context_unicast (nc,
1780 client, 1780 client,
1781 &cm.header, 1781 &cm.header,
1782 GNUNET_NO); 1782 GNUNET_NO);
@@ -1796,7 +1796,7 @@ static void
1796handle_start (void *cls, struct GNUNET_SERVER_Client *client, 1796handle_start (void *cls, struct GNUNET_SERVER_Client *client,
1797 const struct GNUNET_MessageHeader *message) 1797 const struct GNUNET_MessageHeader *message)
1798{ 1798{
1799 GNUNET_SERVER_notification_context_add (nc, client); 1799 GNUNET_SERVER_notification_context_add (nc, client);
1800 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1800 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1801 GNUNET_CONTAINER_multipeermap_iterate (all_routes, 1801 GNUNET_CONTAINER_multipeermap_iterate (all_routes,
1802 &add_route, 1802 &add_route,
@@ -1837,11 +1837,11 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1837 {NULL, 0, 0} 1837 {NULL, 0, 0}
1838 }; 1838 };
1839 static struct GNUNET_SERVER_MessageHandler plugin_handlers[] = { 1839 static struct GNUNET_SERVER_MessageHandler plugin_handlers[] = {
1840 {&handle_start, NULL, 1840 {&handle_start, NULL,
1841 GNUNET_MESSAGE_TYPE_DV_START, 1841 GNUNET_MESSAGE_TYPE_DV_START,
1842 sizeof (struct GNUNET_MessageHeader) }, 1842 sizeof (struct GNUNET_MessageHeader) },
1843 { &handle_dv_send_message, NULL, 1843 { &handle_dv_send_message, NULL,
1844 GNUNET_MESSAGE_TYPE_DV_SEND, 1844 GNUNET_MESSAGE_TYPE_DV_SEND,
1845 0}, 1845 0},
1846 {NULL, NULL, 0, 0} 1846 {NULL, NULL, 0, 0}
1847 }; 1847 };
@@ -1850,11 +1850,11 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1850 direct_neighbors = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); 1850 direct_neighbors = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
1851 all_routes = GNUNET_CONTAINER_multipeermap_create (65536, GNUNET_NO); 1851 all_routes = GNUNET_CONTAINER_multipeermap_create (65536, GNUNET_NO);
1852 core_api = GNUNET_CORE_connect (cfg, NULL, 1852 core_api = GNUNET_CORE_connect (cfg, NULL,
1853 &core_init, 1853 &core_init,
1854 &handle_core_connect, 1854 &handle_core_connect,
1855 &handle_core_disconnect, 1855 &handle_core_disconnect,
1856 NULL, GNUNET_NO, 1856 NULL, GNUNET_NO,
1857 NULL, GNUNET_NO, 1857 NULL, GNUNET_NO,
1858 core_handlers); 1858 core_handlers);
1859 1859
1860 if (NULL == core_api) 1860 if (NULL == core_api)
diff --git a/src/dv/plugin_transport_dv.c b/src/dv/plugin_transport_dv.c
index 76c823b17..2acc3da3f 100644
--- a/src/dv/plugin_transport_dv.c
+++ b/src/dv/plugin_transport_dv.c
@@ -160,7 +160,7 @@ struct Plugin
160 /** 160 /**
161 * Tokenizer for boxed messages. 161 * Tokenizer for boxed messages.
162 */ 162 */
163 struct GNUNET_SERVER_MessageStreamTokenizer *mst; 163 struct GNUNET_SERVER_MessageStreamTokenizer *mst;
164 164
165}; 165};
166 166
@@ -202,11 +202,11 @@ unbox_cb (void *cls,
202 struct Plugin *plugin = cls; 202 struct Plugin *plugin = cls;
203 struct Session *session = client; 203 struct Session *session = client;
204 struct GNUNET_ATS_Information ats; 204 struct GNUNET_ATS_Information ats;
205 205
206 ats.type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); 206 ats.type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
207 ats.value = htonl (session->distance); 207 ats.value = htonl (session->distance);
208 session->active = GNUNET_YES; 208 session->active = GNUNET_YES;
209 plugin->env->receive (plugin->env->cls, 209 plugin->env->receive (plugin->env->cls,
210 &session->sender, 210 &session->sender,
211 message, 211 message,
212 session, "", 0); 212 session, "", 0);
@@ -222,7 +222,7 @@ unbox_cb (void *cls,
222 * @param cls closure with the plugin 222 * @param cls closure with the plugin
223 * @param sender sender of the message 223 * @param sender sender of the message
224 * @param distance how far did the message travel 224 * @param distance how far did the message travel
225 * @param msg actual message payload 225 * @param msg actual message payload
226 */ 226 */
227static void 227static void
228handle_dv_message_received (void *cls, 228handle_dv_message_received (void *cls,
@@ -236,7 +236,7 @@ handle_dv_message_received (void *cls,
236 236
237 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, 237 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
238 sender); 238 sender);
239 if (NULL == session) 239 if (NULL == session)
240 { 240 {
241 GNUNET_break (0); 241 GNUNET_break (0);
242 return; 242 return;
@@ -244,7 +244,7 @@ handle_dv_message_received (void *cls,
244 if (GNUNET_MESSAGE_TYPE_DV_BOX == ntohs (msg->type)) 244 if (GNUNET_MESSAGE_TYPE_DV_BOX == ntohs (msg->type))
245 { 245 {
246 /* need to unbox using MST */ 246 /* need to unbox using MST */
247 GNUNET_SERVER_mst_receive (plugin->mst, 247 GNUNET_SERVER_mst_receive (plugin->mst,
248 session, 248 session,
249 (const char *) &msg[1], 249 (const char *) &msg[1],
250 ntohs (msg->size) - sizeof (struct GNUNET_MessageHeader), 250 ntohs (msg->size) - sizeof (struct GNUNET_MessageHeader),
@@ -270,7 +270,7 @@ handle_dv_message_received (void *cls,
270 * @param peer newly connected peer 270 * @param peer newly connected peer
271 * @param distance distance to the peer 271 * @param distance distance to the peer
272 */ 272 */
273static void 273static void
274handle_dv_connect (void *cls, 274handle_dv_connect (void *cls,
275 const struct GNUNET_PeerIdentity *peer, 275 const struct GNUNET_PeerIdentity *peer,
276 uint32_t distance) 276 uint32_t distance)
@@ -280,13 +280,13 @@ handle_dv_connect (void *cls,
280 280
281 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, 281 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
282 peer); 282 peer);
283 if (NULL != session) 283 if (NULL != session)
284 { 284 {
285 GNUNET_break (0); 285 GNUNET_break (0);
286 session->distance = distance; 286 session->distance = distance;
287 if (GNUNET_YES == session->active) 287 if (GNUNET_YES == session->active)
288 notify_distance_change (session); 288 notify_distance_change (session);
289 return; /* nothing to do */ 289 return; /* nothing to do */
290 } 290 }
291 session = GNUNET_new (struct Session); 291 session = GNUNET_new (struct Session);
292 session->sender = *peer; 292 session->sender = *peer;
@@ -306,7 +306,7 @@ handle_dv_connect (void *cls,
306 * @param peer connected peer 306 * @param peer connected peer
307 * @param distance new distance to the peer 307 * @param distance new distance to the peer
308 */ 308 */
309static void 309static void
310handle_dv_distance_changed (void *cls, 310handle_dv_distance_changed (void *cls,
311 const struct GNUNET_PeerIdentity *peer, 311 const struct GNUNET_PeerIdentity *peer,
312 uint32_t distance) 312 uint32_t distance)
@@ -316,7 +316,7 @@ handle_dv_distance_changed (void *cls,
316 316
317 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, 317 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
318 peer); 318 peer);
319 if (NULL == session) 319 if (NULL == session)
320 { 320 {
321 GNUNET_break (0); 321 GNUNET_break (0);
322 handle_dv_connect (plugin, peer, distance); 322 handle_dv_connect (plugin, peer, distance);
@@ -370,7 +370,7 @@ free_session (struct Session *session)
370 * @param cls closure with 'struct Plugin' 370 * @param cls closure with 'struct Plugin'
371 * @param peer peer that disconnected 371 * @param peer peer that disconnected
372 */ 372 */
373static void 373static void
374handle_dv_disconnect (void *cls, 374handle_dv_disconnect (void *cls,
375 const struct GNUNET_PeerIdentity *peer) 375 const struct GNUNET_PeerIdentity *peer)
376{ 376{
@@ -379,7 +379,7 @@ handle_dv_disconnect (void *cls,
379 379
380 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, 380 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
381 peer); 381 peer);
382 if (NULL == session) 382 if (NULL == session)
383 return; /* nothing to do */ 383 return; /* nothing to do */
384 free_session (session); 384 free_session (session);
385} 385}
@@ -431,10 +431,10 @@ send_finished (void *cls,
431 * and does NOT mean that the message was not transmitted (DV) 431 * and does NOT mean that the message was not transmitted (DV)
432 */ 432 */
433static ssize_t 433static ssize_t
434dv_plugin_send (void *cls, 434dv_plugin_send (void *cls,
435 struct Session *session, 435 struct Session *session,
436 const char *msgbuf, size_t msgbuf_size, unsigned int priority, 436 const char *msgbuf, size_t msgbuf_size, unsigned int priority,
437 struct GNUNET_TIME_Relative timeout, 437 struct GNUNET_TIME_Relative timeout,
438 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) 438 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
439{ 439{
440 struct PendingRequest *pr; 440 struct PendingRequest *pr;
@@ -486,8 +486,8 @@ dv_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
486 486
487 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, 487 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
488 target); 488 target);
489 if (NULL == session) 489 if (NULL == session)
490 return; /* nothing to do */ 490 return; /* nothing to do */
491 while (NULL != (pr = session->pr_head)) 491 while (NULL != (pr = session->pr_head))
492 { 492 {
493 GNUNET_CONTAINER_DLL_remove (session->pr_head, 493 GNUNET_CONTAINER_DLL_remove (session->pr_head,
@@ -548,7 +548,7 @@ dv_plugin_address_to_string (void *cls, const void *addr, size_t addrlen)
548 if (0 != addrlen) 548 if (0 != addrlen)
549 { 549 {
550 GNUNET_break (0); /* malformed */ 550 GNUNET_break (0); /* malformed */
551 return NULL; 551 return NULL;
552 } 552 }
553 return "dv"; 553 return "dv";
554} 554}
@@ -588,7 +588,7 @@ dv_plugin_check_address (void *cls, const void *addr, size_t addrlen)
588 * @param address the address 588 * @param address the address
589 * @return the session if the address is valid, NULL otherwise 589 * @return the session if the address is valid, NULL otherwise
590 */ 590 */
591static struct Session * 591static struct Session *
592dv_get_session (void *cls, 592dv_get_session (void *cls,
593 const struct GNUNET_HELLO_Address *address) 593 const struct GNUNET_HELLO_Address *address)
594{ 594{
@@ -618,7 +618,7 @@ dv_get_session (void *cls,
618 * @param added length of created address 618 * @param added length of created address
619 * @return GNUNET_OK on success, GNUNET_SYSERR on failure 619 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
620 */ 620 */
621static int 621static int
622dv_plugin_string_to_address (void *cls, 622dv_plugin_string_to_address (void *cls,
623 const char *addr, 623 const char *addr,
624 uint16_t addrlen, 624 uint16_t addrlen,
@@ -646,7 +646,7 @@ dv_plugin_string_to_address (void *cls,
646 * @param session the session 646 * @param session the session
647 * @return the network type 647 * @return the network type
648 */ 648 */
649static enum GNUNET_ATS_Network_Type 649static enum GNUNET_ATS_Network_Type
650dv_get_network (void *cls, 650dv_get_network (void *cls,
651 struct Session *session) 651 struct Session *session)
652{ 652{
@@ -682,7 +682,7 @@ libgnunet_plugin_transport_dv_init (void *cls)
682 if (NULL == plugin->dvh) 682 if (NULL == plugin->dvh)
683 { 683 {
684 GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions); 684 GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions);
685 GNUNET_SERVER_mst_destroy (plugin->mst); 685 GNUNET_SERVER_mst_destroy (plugin->mst);
686 GNUNET_free (plugin); 686 GNUNET_free (plugin);
687 return NULL; 687 return NULL;
688 } 688 }
@@ -737,7 +737,7 @@ libgnunet_plugin_transport_dv_done (void *cls)
737 &free_session_iterator, 737 &free_session_iterator,
738 NULL); 738 NULL);
739 GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions); 739 GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions);
740 GNUNET_SERVER_mst_destroy (plugin->mst); 740 GNUNET_SERVER_mst_destroy (plugin->mst);
741 GNUNET_free (plugin); 741 GNUNET_free (plugin);
742 GNUNET_free (api); 742 GNUNET_free (api);
743 return NULL; 743 return NULL;
diff --git a/src/dv/test_transport_blacklist.c b/src/dv/test_transport_blacklist.c
index 601544afa..e76964744 100644
--- a/src/dv/test_transport_blacklist.c
+++ b/src/dv/test_transport_blacklist.c
@@ -42,7 +42,7 @@ test_connection (void *cls,
42 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Links successful %u / %u failed\n", links_succeeded, links_failed); 42 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Links successful %u / %u failed\n", links_succeeded, links_failed);
43 if ( (4 == num_peers) && (0 == links_failed) ) 43 if ( (4 == num_peers) && (0 == links_failed) )
44 { 44 {
45 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 45 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
46 "Testbed connect peers despite blacklist!\n"); 46 "Testbed connect peers despite blacklist!\n");
47 ok = 1; 47 ok = 1;
48 } 48 }
diff --git a/src/env/env.c b/src/env/env.c
index c977572ab..33d12c01e 100644
--- a/src/env/env.c
+++ b/src/env/env.c
@@ -18,7 +18,7 @@
18 * Boston, MA 02111-1307, USA. 18 * Boston, MA 02111-1307, USA.
19 */ 19 */
20 20
21/** 21/**
22 * @file env/env.c 22 * @file env/env.c
23 * @brief Library providing operations for the @e environment of 23 * @brief Library providing operations for the @e environment of
24 * PSYC and Social messages, and for (de)serializing variable values. 24 * PSYC and Social messages, and for (de)serializing variable values.
@@ -29,7 +29,7 @@
29#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
30#include "gnunet_env_lib.h" 30#include "gnunet_env_lib.h"
31 31
32/** 32/**
33 * Environment for a message. 33 * Environment for a message.
34 * 34 *
35 * Contains modifiers. 35 * Contains modifiers.
@@ -42,9 +42,9 @@ struct GNUNET_ENV_Environment
42}; 42};
43 43
44 44
45/** 45/**
46 * Create an environment. 46 * Create an environment.
47 * 47 *
48 * @return A newly allocated environment. 48 * @return A newly allocated environment.
49 */ 49 */
50struct GNUNET_ENV_Environment * 50struct GNUNET_ENV_Environment *
@@ -54,7 +54,7 @@ GNUNET_ENV_environment_create ()
54} 54}
55 55
56 56
57/** 57/**
58 * Add a modifier to the environment. 58 * Add a modifier to the environment.
59 * 59 *
60 * @param env The environment. 60 * @param env The environment.
@@ -78,7 +78,7 @@ GNUNET_ENV_environment_add_mod (struct GNUNET_ENV_Environment *env,
78} 78}
79 79
80 80
81/** 81/**
82 * Iterate through all modifiers in the environment. 82 * Iterate through all modifiers in the environment.
83 * 83 *
84 * @param env The environment. 84 * @param env The environment.
@@ -95,7 +95,7 @@ GNUNET_ENV_environment_iterate (const struct GNUNET_ENV_Environment *env,
95} 95}
96 96
97 97
98/** 98/**
99 * Get the number of modifiers in the environment. 99 * Get the number of modifiers in the environment.
100 * 100 *
101 * @param env The environment. 101 * @param env The environment.
@@ -109,7 +109,7 @@ GNUNET_ENV_environment_get_mod_count (const struct GNUNET_ENV_Environment *env)
109} 109}
110 110
111 111
112/** 112/**
113 * Destroy an environment. 113 * Destroy an environment.
114 * 114 *
115 * @param env The environment to destroy. 115 * @param env The environment to destroy.
diff --git a/src/env/test_env.c b/src/env/test_env.c
index 11ec9662b..6f6bda338 100644
--- a/src/env/test_env.c
+++ b/src/env/test_env.c
@@ -18,7 +18,7 @@
18 * Boston, MA 02111-1307, USA. 18 * Boston, MA 02111-1307, USA.
19 */ 19 */
20 20
21/** 21/**
22 * @file env/test_env.c 22 * @file env/test_env.c
23 * @brief Tests for the environment library. 23 * @brief Tests for the environment library.
24 * @author Gabor X Toth 24 * @author Gabor X Toth
diff --git a/src/exit/exit.h b/src/exit/exit.h
index ff5e3f54c..b4cea4c23 100644
--- a/src/exit/exit.h
+++ b/src/exit/exit.h
@@ -91,7 +91,7 @@ struct GNUNET_EXIT_TcpInternetStartMessage
91 91
92 92
93/** 93/**
94 * Message send via mesh between VPN and entry and an exit daemon to 94 * Message send via mesh between VPN and entry and an exit daemon to
95 * transmit TCP data between the VPN entry and an exit session. This 95 * transmit TCP data between the VPN entry and an exit session. This
96 * format is used for both Internet-exits and service-exits and 96 * format is used for both Internet-exits and service-exits and
97 * in both directions (VPN to exit and exit to VPN). 97 * in both directions (VPN to exit and exit to VPN).
@@ -136,7 +136,7 @@ struct GNUNET_EXIT_UdpServiceMessage
136 136
137 /** 137 /**
138 * Destination port to use for the UDP request. In NBO. 138 * Destination port to use for the UDP request. In NBO.
139 */ 139 */
140 uint16_t destination_port GNUNET_PACKED; 140 uint16_t destination_port GNUNET_PACKED;
141 141
142 /** 142 /**
@@ -171,7 +171,7 @@ struct GNUNET_EXIT_UdpInternetMessage
171 171
172 /** 172 /**
173 * Destination port to use for the UDP request. In NBO. 173 * Destination port to use for the UDP request. In NBO.
174 */ 174 */
175 uint16_t destination_port GNUNET_PACKED; 175 uint16_t destination_port GNUNET_PACKED;
176 176
177 /* followed by IP address of the destination; either 177 /* followed by IP address of the destination; either
@@ -201,7 +201,7 @@ struct GNUNET_EXIT_UdpReplyMessage
201 /** 201 /**
202 * Destination port to use for the UDP reply (0 to use the same 202 * Destination port to use for the UDP reply (0 to use the same
203 * port as for the original request). In NBO. 203 * port as for the original request). In NBO.
204 */ 204 */
205 uint16_t destination_port GNUNET_PACKED; 205 uint16_t destination_port GNUNET_PACKED;
206 206
207 /* followed by UDP payload */ 207 /* followed by UDP payload */
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index a758162a7..f4d656f3c 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -31,7 +31,7 @@
31 * - which code should advertise services? the service model is right 31 * - which code should advertise services? the service model is right
32 * now a bit odd, especially as this code DOES the exit and knows 32 * now a bit odd, especially as this code DOES the exit and knows
33 * the DNS "name", but OTOH this is clearly NOT the place to advertise 33 * the DNS "name", but OTOH this is clearly NOT the place to advertise
34 * the service's existence; maybe the daemon should turn into a 34 * the service's existence; maybe the daemon should turn into a
35 * service with an API to add local-exit services dynamically? 35 * service with an API to add local-exit services dynamically?
36 */ 36 */
37#include "platform.h" 37#include "platform.h"
@@ -111,7 +111,7 @@ struct SocketAddress
111 */ 111 */
112 struct in6_addr ipv6; 112 struct in6_addr ipv6;
113 } address; 113 } address;
114 114
115 /** 115 /**
116 * IPPROTO_TCP or IPPROTO_UDP; 116 * IPPROTO_TCP or IPPROTO_UDP;
117 */ 117 */
@@ -155,7 +155,7 @@ struct LocalService
155 * IP-version, protocol, source-IP, destination-IP, source-port and 155 * IP-version, protocol, source-IP, destination-IP, source-port and
156 * destinatin-port. 156 * destinatin-port.
157 */ 157 */
158struct RedirectInformation 158struct RedirectInformation
159{ 159{
160 160
161 /** 161 /**
@@ -171,10 +171,10 @@ struct RedirectInformation
171 */ 171 */
172 struct SocketAddress local_address; 172 struct SocketAddress local_address;
173 173
174 /* 174 /*
175 Note 1: additional information might be added here in the 175 Note 1: additional information might be added here in the
176 future to support protocols that require special handling, 176 future to support protocols that require special handling,
177 such as ftp/tftp 177 such as ftp/tftp
178 178
179 Note 2: we might also sometimes not match on all components 179 Note 2: we might also sometimes not match on all components
180 of the tuple, to support protocols where things do not always 180 of the tuple, to support protocols where things do not always
@@ -235,42 +235,42 @@ struct TunnelState
235 struct GNUNET_MESH_TransmitHandle *th; 235 struct GNUNET_MESH_TransmitHandle *th;
236 236
237 /** 237 /**
238 * #GNUNET_NO if this is a tunnel for TCP/UDP, 238 * #GNUNET_NO if this is a tunnel for TCP/UDP,
239 * #GNUNET_YES if this is a tunnel for DNS, 239 * #GNUNET_YES if this is a tunnel for DNS,
240 * #GNUNET_SYSERR if the tunnel is not yet initialized. 240 * #GNUNET_SYSERR if the tunnel is not yet initialized.
241 */ 241 */
242 int is_dns; 242 int is_dns;
243 243
244 union 244 union
245 { 245 {
246 struct 246 struct
247 { 247 {
248 248
249 /** 249 /**
250 * Heap node for this state in the connections_heap. 250 * Heap node for this state in the connections_heap.
251 */ 251 */
252 struct GNUNET_CONTAINER_HeapNode *heap_node; 252 struct GNUNET_CONTAINER_HeapNode *heap_node;
253 253
254 /** 254 /**
255 * Key this state has in the connections_map. 255 * Key this state has in the connections_map.
256 */ 256 */
257 struct GNUNET_HashCode state_key; 257 struct GNUNET_HashCode state_key;
258 258
259 /** 259 /**
260 * Associated service record, or NULL for no service. 260 * Associated service record, or NULL for no service.
261 */ 261 */
262 struct LocalService *serv; 262 struct LocalService *serv;
263 263
264 /** 264 /**
265 * Head of DLL of messages for this tunnel. 265 * Head of DLL of messages for this tunnel.
266 */ 266 */
267 struct TunnelMessageQueue *head; 267 struct TunnelMessageQueue *head;
268 268
269 /** 269 /**
270 * Tail of DLL of messages for this tunnel. 270 * Tail of DLL of messages for this tunnel.
271 */ 271 */
272 struct TunnelMessageQueue *tail; 272 struct TunnelMessageQueue *tail;
273 273
274 /** 274 /**
275 * Primary redirection information for this connection. 275 * Primary redirection information for this connection.
276 */ 276 */
@@ -284,28 +284,28 @@ struct TunnelState
284 * DNS reply ready for transmission. 284 * DNS reply ready for transmission.
285 */ 285 */
286 char *reply; 286 char *reply;
287 287
288 /** 288 /**
289 * Socket we are using to transmit this request (must match if we receive 289 * Socket we are using to transmit this request (must match if we receive
290 * a response). 290 * a response).
291 */ 291 */
292 struct GNUNET_DNSSTUB_RequestSocket *rs; 292 struct GNUNET_DNSSTUB_RequestSocket *rs;
293 293
294 /** 294 /**
295 * Number of bytes in 'reply'. 295 * Number of bytes in 'reply'.
296 */ 296 */
297 size_t reply_length; 297 size_t reply_length;
298 298
299 /** 299 /**
300 * Original DNS request ID as used by the client. 300 * Original DNS request ID as used by the client.
301 */ 301 */
302 uint16_t original_id; 302 uint16_t original_id;
303 303
304 /** 304 /**
305 * DNS request ID that we used for forwarding. 305 * DNS request ID that we used for forwarding.
306 */ 306 */
307 uint16_t my_id; 307 uint16_t my_id;
308 308
309 } dns; 309 } dns;
310 310
311 } specifics; 311 } specifics;
@@ -411,7 +411,7 @@ static struct GNUNET_DNSSTUB_Context *dnsstub;
411 411
412/** 412/**
413 * Handle for ongoing DHT PUT operations to advertise exit service. 413 * Handle for ongoing DHT PUT operations to advertise exit service.
414 */ 414 */
415static struct GNUNET_DHT_PutHandle *dht_put; 415static struct GNUNET_DHT_PutHandle *dht_put;
416 416
417/** 417/**
@@ -487,7 +487,7 @@ transmit_reply_to_mesh (void *cls,
487 GNUNET_assert (ts->specifics.dns.reply != NULL); 487 GNUNET_assert (ts->specifics.dns.reply != NULL);
488 if (size == 0) 488 if (size == 0)
489 return 0; 489 return 0;
490 ret = sizeof (struct GNUNET_MessageHeader) + ts->specifics.dns.reply_length; 490 ret = sizeof (struct GNUNET_MessageHeader) + ts->specifics.dns.reply_length;
491 GNUNET_assert (ret <= size); 491 GNUNET_assert (ret <= size);
492 hdr.size = htons (ret); 492 hdr.size = htons (ret);
493 hdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET); 493 hdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET);
@@ -502,7 +502,7 @@ transmit_reply_to_mesh (void *cls,
502 off += ts->specifics.dns.reply_length - sizeof (dns); 502 off += ts->specifics.dns.reply_length - sizeof (dns);
503 GNUNET_free (ts->specifics.dns.reply); 503 GNUNET_free (ts->specifics.dns.reply);
504 ts->specifics.dns.reply = NULL; 504 ts->specifics.dns.reply = NULL;
505 ts->specifics.dns.reply_length = 0; 505 ts->specifics.dns.reply_length = 0;
506 GNUNET_assert (ret == off); 506 GNUNET_assert (ret == off);
507 return ret; 507 return ret;
508} 508}
@@ -558,7 +558,7 @@ process_dns_result (void *cls,
558 * @param tunnel connection to the other end 558 * @param tunnel connection to the other end
559 * @param tunnel_ctx pointer to our `struct TunnelState *` 559 * @param tunnel_ctx pointer to our `struct TunnelState *`
560 * @param message the actual message 560 * @param message the actual message
561 * 561 *
562 * @return #GNUNET_OK to keep the connection open, 562 * @return #GNUNET_OK to keep the connection open,
563 * #GNUNET_SYSERR to close it (signal serious error) 563 * #GNUNET_SYSERR to close it (signal serious error)
564 */ 564 */
@@ -595,7 +595,7 @@ receive_dns_request (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
595 ts->specifics.dns.original_id = dns->id; 595 ts->specifics.dns.original_id = dns->id;
596 if (tunnels[ts->specifics.dns.my_id] == ts) 596 if (tunnels[ts->specifics.dns.my_id] == ts)
597 tunnels[ts->specifics.dns.my_id] = NULL; 597 tunnels[ts->specifics.dns.my_id] = NULL;
598 ts->specifics.dns.my_id = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 598 ts->specifics.dns.my_id = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
599 UINT16_MAX + 1); 599 UINT16_MAX + 1);
600 tunnels[ts->specifics.dns.my_id] = ts; 600 tunnels[ts->specifics.dns.my_id] = ts;
601 memcpy (buf, dns, dlen); 601 memcpy (buf, dns, dlen);
@@ -619,7 +619,7 @@ receive_dns_request (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
619 * @param ri information about the connection 619 * @param ri information about the connection
620 */ 620 */
621static void 621static void
622hash_redirect_info (struct GNUNET_HashCode *hash, 622hash_redirect_info (struct GNUNET_HashCode *hash,
623 const struct RedirectInformation *ri) 623 const struct RedirectInformation *ri)
624{ 624{
625 char *off; 625 char *off;
@@ -678,7 +678,7 @@ hash_redirect_info (struct GNUNET_HashCode *hash,
678 */ 678 */
679static struct TunnelState * 679static struct TunnelState *
680get_redirect_state (int af, 680get_redirect_state (int af,
681 int protocol, 681 int protocol,
682 const void *destination_ip, 682 const void *destination_ip,
683 uint16_t destination_port, 683 uint16_t destination_port,
684 const void *local_ip, 684 const void *local_ip,
@@ -718,7 +718,7 @@ get_redirect_state (int af,
718 return NULL; 718 return NULL;
719 /* Mark this connection as freshly used */ 719 /* Mark this connection as freshly used */
720 if (NULL == state_key) 720 if (NULL == state_key)
721 GNUNET_CONTAINER_heap_update_cost (connections_heap, 721 GNUNET_CONTAINER_heap_update_cost (connections_heap,
722 state->specifics.tcp_udp.heap_node, 722 state->specifics.tcp_udp.heap_node,
723 GNUNET_TIME_absolute_get ().abs_value_us); 723 GNUNET_TIME_absolute_get ().abs_value_us);
724 return state; 724 return state;
@@ -774,7 +774,7 @@ free_service_record (void *cls,
774 * respective service entry. 774 * respective service entry.
775 * 775 *
776 * @param service_map map of services (TCP or UDP) 776 * @param service_map map of services (TCP or UDP)
777 * @param name name of the service 777 * @param name name of the service
778 * @param destination_port destination port 778 * @param destination_port destination port
779 * @param service service information record to store (service->name will be set). 779 * @param service service information record to store (service->name will be set).
780 */ 780 */
@@ -827,8 +827,8 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf)
827 return 0; 827 return 0;
828 if (0 == size) 828 if (0 == size)
829 { 829 {
830 s->th = GNUNET_MESH_notify_transmit_ready (tunnel, 830 s->th = GNUNET_MESH_notify_transmit_ready (tunnel,
831 GNUNET_NO /* corking */, 831 GNUNET_NO /* corking */,
832 GNUNET_TIME_UNIT_FOREVER_REL, 832 GNUNET_TIME_UNIT_FOREVER_REL,
833 tnq->len, 833 tnq->len,
834 &send_to_peer_notify_callback, 834 &send_to_peer_notify_callback,
@@ -838,13 +838,13 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf)
838 GNUNET_assert (size >= tnq->len); 838 GNUNET_assert (size >= tnq->len);
839 memcpy (buf, tnq->payload, tnq->len); 839 memcpy (buf, tnq->payload, tnq->len);
840 size = tnq->len; 840 size = tnq->len;
841 GNUNET_CONTAINER_DLL_remove (s->specifics.tcp_udp.head, 841 GNUNET_CONTAINER_DLL_remove (s->specifics.tcp_udp.head,
842 s->specifics.tcp_udp.tail, 842 s->specifics.tcp_udp.tail,
843 tnq); 843 tnq);
844 GNUNET_free (tnq); 844 GNUNET_free (tnq);
845 if (NULL != (tnq = s->specifics.tcp_udp.head)) 845 if (NULL != (tnq = s->specifics.tcp_udp.head))
846 s->th = GNUNET_MESH_notify_transmit_ready (tunnel, 846 s->th = GNUNET_MESH_notify_transmit_ready (tunnel,
847 GNUNET_NO /* corking */, 847 GNUNET_NO /* corking */,
848 GNUNET_TIME_UNIT_FOREVER_REL, 848 GNUNET_TIME_UNIT_FOREVER_REL,
849 tnq->len, 849 tnq->len,
850 &send_to_peer_notify_callback, 850 &send_to_peer_notify_callback,
@@ -887,16 +887,16 @@ send_packet_to_mesh_tunnel (struct TunnelState *s,
887 * @param icmp A pointer to the Packet 887 * @param icmp A pointer to the Packet
888 * @param pktlen number of bytes in 'icmp' 888 * @param pktlen number of bytes in 'icmp'
889 * @param af address family (AFINET or AF_INET6) 889 * @param af address family (AFINET or AF_INET6)
890 * @param destination_ip destination IP-address of the IP packet (should 890 * @param destination_ip destination IP-address of the IP packet (should
891 * be our local address) 891 * be our local address)
892 * @param source_ip original source IP-address of the IP packet (should 892 * @param source_ip original source IP-address of the IP packet (should
893 * be the original destination address) 893 * be the original destination address)
894 */ 894 */
895static void 895static void
896icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp, 896icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp,
897 size_t pktlen, 897 size_t pktlen,
898 int af, 898 int af,
899 const void *destination_ip, 899 const void *destination_ip,
900 const void *source_ip) 900 const void *source_ip)
901{ 901{
902 struct TunnelState *state; 902 struct TunnelState *state;
@@ -920,7 +920,7 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp,
920 sbuf, sizeof (sbuf)), 920 sbuf, sizeof (sbuf)),
921 inet_ntop (af, 921 inet_ntop (af,
922 destination_ip, 922 destination_ip,
923 dbuf, sizeof (dbuf))); 923 dbuf, sizeof (dbuf)));
924 } 924 }
925 if (pktlen < sizeof (struct GNUNET_TUN_IcmpHeader)) 925 if (pktlen < sizeof (struct GNUNET_TUN_IcmpHeader))
926 { 926 {
@@ -946,7 +946,7 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp,
946 case GNUNET_TUN_ICMPTYPE_DESTINATION_UNREACHABLE: 946 case GNUNET_TUN_ICMPTYPE_DESTINATION_UNREACHABLE:
947 case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH: 947 case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH:
948 case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED: 948 case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED:
949 if (pktlen < 949 if (pktlen <
950 sizeof (struct GNUNET_TUN_IcmpHeader) + 950 sizeof (struct GNUNET_TUN_IcmpHeader) +
951 sizeof (struct GNUNET_TUN_IPv4Header) + 8) 951 sizeof (struct GNUNET_TUN_IPv4Header) + 8)
952 { 952 {
@@ -980,7 +980,7 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp,
980 case GNUNET_TUN_ICMPTYPE6_PACKET_TOO_BIG: 980 case GNUNET_TUN_ICMPTYPE6_PACKET_TOO_BIG:
981 case GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED: 981 case GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED:
982 case GNUNET_TUN_ICMPTYPE6_PARAMETER_PROBLEM: 982 case GNUNET_TUN_ICMPTYPE6_PARAMETER_PROBLEM:
983 if (pktlen < 983 if (pktlen <
984 sizeof (struct GNUNET_TUN_IcmpHeader) + 984 sizeof (struct GNUNET_TUN_IcmpHeader) +
985 sizeof (struct GNUNET_TUN_IPv6Header) + 8) 985 sizeof (struct GNUNET_TUN_IPv6Header) + 8)
986 { 986 {
@@ -1055,7 +1055,7 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp,
1055 return; 1055 return;
1056 } 1056 }
1057 mlen = sizeof (struct GNUNET_EXIT_IcmpToVPNMessage) + pktlen - sizeof (struct GNUNET_TUN_IcmpHeader); 1057 mlen = sizeof (struct GNUNET_EXIT_IcmpToVPNMessage) + pktlen - sizeof (struct GNUNET_TUN_IcmpHeader);
1058 tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueue) + mlen); 1058 tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueue) + mlen);
1059 tnq->payload = &tnq[1]; 1059 tnq->payload = &tnq[1];
1060 tnq->len = mlen; 1060 tnq->len = mlen;
1061 i2v = (struct GNUNET_EXIT_IcmpToVPNMessage *) &tnq[1]; 1061 i2v = (struct GNUNET_EXIT_IcmpToVPNMessage *) &tnq[1];
@@ -1075,16 +1075,16 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp,
1075 * @param udp A pointer to the Packet 1075 * @param udp A pointer to the Packet
1076 * @param pktlen number of bytes in 'udp' 1076 * @param pktlen number of bytes in 'udp'
1077 * @param af address family (AFINET or AF_INET6) 1077 * @param af address family (AFINET or AF_INET6)
1078 * @param destination_ip destination IP-address of the IP packet (should 1078 * @param destination_ip destination IP-address of the IP packet (should
1079 * be our local address) 1079 * be our local address)
1080 * @param source_ip original source IP-address of the IP packet (should 1080 * @param source_ip original source IP-address of the IP packet (should
1081 * be the original destination address) 1081 * be the original destination address)
1082 */ 1082 */
1083static void 1083static void
1084udp_from_helper (const struct GNUNET_TUN_UdpHeader *udp, 1084udp_from_helper (const struct GNUNET_TUN_UdpHeader *udp,
1085 size_t pktlen, 1085 size_t pktlen,
1086 int af, 1086 int af,
1087 const void *destination_ip, 1087 const void *destination_ip,
1088 const void *source_ip) 1088 const void *source_ip)
1089{ 1089{
1090 struct TunnelState *state; 1090 struct TunnelState *state;
@@ -1131,7 +1131,7 @@ udp_from_helper (const struct GNUNET_TUN_UdpHeader *udp,
1131 return; 1131 return;
1132 } 1132 }
1133 mlen = sizeof (struct GNUNET_EXIT_UdpReplyMessage) + pktlen - sizeof (struct GNUNET_TUN_UdpHeader); 1133 mlen = sizeof (struct GNUNET_EXIT_UdpReplyMessage) + pktlen - sizeof (struct GNUNET_TUN_UdpHeader);
1134 tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueue) + mlen); 1134 tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueue) + mlen);
1135 tnq->payload = &tnq[1]; 1135 tnq->payload = &tnq[1];
1136 tnq->len = mlen; 1136 tnq->len = mlen;
1137 urm = (struct GNUNET_EXIT_UdpReplyMessage *) &tnq[1]; 1137 urm = (struct GNUNET_EXIT_UdpReplyMessage *) &tnq[1];
@@ -1152,13 +1152,13 @@ udp_from_helper (const struct GNUNET_TUN_UdpHeader *udp,
1152 * @param tcp A pointer to the Packet 1152 * @param tcp A pointer to the Packet
1153 * @param pktlen the length of the packet, including its TCP header 1153 * @param pktlen the length of the packet, including its TCP header
1154 * @param af address family (AFINET or AF_INET6) 1154 * @param af address family (AFINET or AF_INET6)
1155 * @param destination_ip destination IP-address of the IP packet (should 1155 * @param destination_ip destination IP-address of the IP packet (should
1156 * be our local address) 1156 * be our local address)
1157 * @param source_ip original source IP-address of the IP packet (should 1157 * @param source_ip original source IP-address of the IP packet (should
1158 * be the original destination address) 1158 * be the original destination address)
1159 */ 1159 */
1160static void 1160static void
1161tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp, 1161tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp,
1162 size_t pktlen, 1162 size_t pktlen,
1163 int af, 1163 int af,
1164 const void *destination_ip, 1164 const void *destination_ip,
@@ -1193,7 +1193,7 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp,
1193 return; 1193 return;
1194 } 1194 }
1195 state = get_redirect_state (af, IPPROTO_TCP, 1195 state = get_redirect_state (af, IPPROTO_TCP,
1196 source_ip, 1196 source_ip,
1197 ntohs (tcp->source_port), 1197 ntohs (tcp->source_port),
1198 destination_ip, 1198 destination_ip,
1199 ntohs (tcp->destination_port), 1199 ntohs (tcp->destination_port),
@@ -1202,12 +1202,12 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp,
1202 { 1202 {
1203 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1203 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1204 _("TCP Packet dropped, have no matching connection information\n")); 1204 _("TCP Packet dropped, have no matching connection information\n"));
1205 1205
1206 return; 1206 return;
1207 } 1207 }
1208 /* mug port numbers and crc to avoid information leakage; 1208 /* mug port numbers and crc to avoid information leakage;
1209 sender will need to lookup the correct values anyway */ 1209 sender will need to lookup the correct values anyway */
1210 memcpy (buf, tcp, pktlen); 1210 memcpy (buf, tcp, pktlen);
1211 mtcp = (struct GNUNET_TUN_TcpHeader *) buf; 1211 mtcp = (struct GNUNET_TUN_TcpHeader *) buf;
1212 mtcp->source_port = 0; 1212 mtcp->source_port = 0;
1213 mtcp->destination_port = 0; 1213 mtcp->destination_port = 0;
@@ -1228,7 +1228,7 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp,
1228 tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN); 1228 tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN);
1229 tdm->reserved = htonl (0); 1229 tdm->reserved = htonl (0);
1230 memcpy (&tdm->tcp_header, 1230 memcpy (&tdm->tcp_header,
1231 buf, 1231 buf,
1232 pktlen); 1232 pktlen);
1233 send_packet_to_mesh_tunnel (state, tnq); 1233 send_packet_to_mesh_tunnel (state, tnq);
1234} 1234}
@@ -1296,26 +1296,26 @@ message_token (void *cls GNUNET_UNUSED, void *client GNUNET_UNUSED,
1296 _("IPv4 packet options received. Ignored.\n")); 1296 _("IPv4 packet options received. Ignored.\n"));
1297 return GNUNET_OK; 1297 return GNUNET_OK;
1298 } 1298 }
1299 1299
1300 size -= sizeof (struct GNUNET_TUN_IPv4Header); 1300 size -= sizeof (struct GNUNET_TUN_IPv4Header);
1301 switch (pkt4->protocol) 1301 switch (pkt4->protocol)
1302 { 1302 {
1303 case IPPROTO_UDP: 1303 case IPPROTO_UDP:
1304 udp_from_helper ((const struct GNUNET_TUN_UdpHeader *) &pkt4[1], size, 1304 udp_from_helper ((const struct GNUNET_TUN_UdpHeader *) &pkt4[1], size,
1305 AF_INET, 1305 AF_INET,
1306 &pkt4->destination_address, 1306 &pkt4->destination_address,
1307 &pkt4->source_address); 1307 &pkt4->source_address);
1308 break; 1308 break;
1309 case IPPROTO_TCP: 1309 case IPPROTO_TCP:
1310 tcp_from_helper ((const struct GNUNET_TUN_TcpHeader *) &pkt4[1], size, 1310 tcp_from_helper ((const struct GNUNET_TUN_TcpHeader *) &pkt4[1], size,
1311 AF_INET, 1311 AF_INET,
1312 &pkt4->destination_address, 1312 &pkt4->destination_address,
1313 &pkt4->source_address); 1313 &pkt4->source_address);
1314 break; 1314 break;
1315 case IPPROTO_ICMP: 1315 case IPPROTO_ICMP:
1316 icmp_from_helper ((const struct GNUNET_TUN_IcmpHeader *) &pkt4[1], size, 1316 icmp_from_helper ((const struct GNUNET_TUN_IcmpHeader *) &pkt4[1], size,
1317 AF_INET, 1317 AF_INET,
1318 &pkt4->destination_address, 1318 &pkt4->destination_address,
1319 &pkt4->source_address); 1319 &pkt4->source_address);
1320 break; 1320 break;
1321 default: 1321 default:
@@ -1349,19 +1349,19 @@ message_token (void *cls GNUNET_UNUSED, void *client GNUNET_UNUSED,
1349 case IPPROTO_UDP: 1349 case IPPROTO_UDP:
1350 udp_from_helper ((const struct GNUNET_TUN_UdpHeader *) &pkt6[1], size, 1350 udp_from_helper ((const struct GNUNET_TUN_UdpHeader *) &pkt6[1], size,
1351 AF_INET6, 1351 AF_INET6,
1352 &pkt6->destination_address, 1352 &pkt6->destination_address,
1353 &pkt6->source_address); 1353 &pkt6->source_address);
1354 break; 1354 break;
1355 case IPPROTO_TCP: 1355 case IPPROTO_TCP:
1356 tcp_from_helper ((const struct GNUNET_TUN_TcpHeader *) &pkt6[1], size, 1356 tcp_from_helper ((const struct GNUNET_TUN_TcpHeader *) &pkt6[1], size,
1357 AF_INET6, 1357 AF_INET6,
1358 &pkt6->destination_address, 1358 &pkt6->destination_address,
1359 &pkt6->source_address); 1359 &pkt6->source_address);
1360 break; 1360 break;
1361 case IPPROTO_ICMPV6: 1361 case IPPROTO_ICMPV6:
1362 icmp_from_helper ((const struct GNUNET_TUN_IcmpHeader *) &pkt6[1], size, 1362 icmp_from_helper ((const struct GNUNET_TUN_IcmpHeader *) &pkt6[1], size,
1363 AF_INET6, 1363 AF_INET6,
1364 &pkt6->destination_address, 1364 &pkt6->destination_address,
1365 &pkt6->source_address); 1365 &pkt6->source_address);
1366 break; 1366 break;
1367 default: 1367 default:
@@ -1398,14 +1398,14 @@ setup_fresh_address (int af,
1398 local_address->af = af; 1398 local_address->af = af;
1399 local_address->proto = (uint8_t) proto; 1399 local_address->proto = (uint8_t) proto;
1400 /* default "local" port range is often 32768--61000, 1400 /* default "local" port range is often 32768--61000,
1401 so we pick a random value in that range */ 1401 so we pick a random value in that range */
1402 if ( ( (af == AF_INET) && (proto == IPPROTO_ICMP) ) || 1402 if ( ( (af == AF_INET) && (proto == IPPROTO_ICMP) ) ||
1403 ( (af == AF_INET6) && (proto == IPPROTO_ICMPV6) ) ) 1403 ( (af == AF_INET6) && (proto == IPPROTO_ICMPV6) ) )
1404 local_address->port = 0; 1404 local_address->port = 0;
1405 else 1405 else
1406 local_address->port 1406 local_address->port
1407 = (uint16_t) 32768 + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1407 = (uint16_t) 32768 + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
1408 28232); 1408 28232);
1409 switch (af) 1409 switch (af)
1410 { 1410 {
1411 case AF_INET: 1411 case AF_INET:
@@ -1422,13 +1422,13 @@ setup_fresh_address (int af,
1422 local_address->address.ipv4 = addr; 1422 local_address->address.ipv4 = addr;
1423 return; 1423 return;
1424 } 1424 }
1425 /* Given 192.168.0.1/255.255.0.0, we want a mask 1425 /* Given 192.168.0.1/255.255.0.0, we want a mask
1426 of '192.168.255.255', thus: */ 1426 of '192.168.255.255', thus: */
1427 mask.s_addr = addr.s_addr | ~mask.s_addr; 1427 mask.s_addr = addr.s_addr | ~mask.s_addr;
1428 /* Pick random IPv4 address within the subnet, except 'addr' or 'mask' itself */ 1428 /* Pick random IPv4 address within the subnet, except 'addr' or 'mask' itself */
1429 do 1429 do
1430 { 1430 {
1431 rnd.s_addr = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1431 rnd.s_addr = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
1432 UINT32_MAX); 1432 UINT32_MAX);
1433 local_address->address.ipv4.s_addr = (addr.s_addr | rnd.s_addr) & mask.s_addr; 1433 local_address->address.ipv4.s_addr = (addr.s_addr | rnd.s_addr) & mask.s_addr;
1434 } 1434 }
@@ -1442,7 +1442,7 @@ setup_fresh_address (int af,
1442 struct in6_addr mask; 1442 struct in6_addr mask;
1443 struct in6_addr rnd; 1443 struct in6_addr rnd;
1444 int i; 1444 int i;
1445 1445
1446 addr = exit_ipv6addr; 1446 addr = exit_ipv6addr;
1447 GNUNET_assert (ipv6prefix < 128); 1447 GNUNET_assert (ipv6prefix < 128);
1448 if (ipv6prefix == 127) 1448 if (ipv6prefix == 127)
@@ -1456,13 +1456,13 @@ setup_fresh_address (int af,
1456 mask = addr; 1456 mask = addr;
1457 for (i=127;i>=ipv6prefix;i--) 1457 for (i=127;i>=ipv6prefix;i--)
1458 mask.s6_addr[i / 8] |= (1 << (i % 8)); 1458 mask.s6_addr[i / 8] |= (1 << (i % 8));
1459 1459
1460 /* Pick random IPv6 address within the subnet, except 'addr' or 'mask' itself */ 1460 /* Pick random IPv6 address within the subnet, except 'addr' or 'mask' itself */
1461 do 1461 do
1462 { 1462 {
1463 for (i=0;i<16;i++) 1463 for (i=0;i<16;i++)
1464 { 1464 {
1465 rnd.s6_addr[i] = (unsigned char) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1465 rnd.s6_addr[i] = (unsigned char) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
1466 256); 1466 256);
1467 local_address->address.ipv6.s6_addr[i] 1467 local_address->address.ipv6.s6_addr[i]
1468 = (addr.s6_addr[i] | rnd.s6_addr[i]) & mask.s6_addr[i]; 1468 = (addr.s6_addr[i] | rnd.s6_addr[i]) & mask.s6_addr[i];
@@ -1478,7 +1478,7 @@ setup_fresh_address (int af,
1478 break; 1478 break;
1479 default: 1479 default:
1480 GNUNET_assert (0); 1480 GNUNET_assert (0);
1481 } 1481 }
1482} 1482}
1483 1483
1484 1484
@@ -1531,19 +1531,19 @@ setup_state_record (struct TunnelState *state)
1531 char buf[INET6_ADDRSTRLEN]; 1531 char buf[INET6_ADDRSTRLEN];
1532 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1532 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1533 "Picked local address %s:%u for new connection\n", 1533 "Picked local address %s:%u for new connection\n",
1534 inet_ntop (state->specifics.tcp_udp.ri.local_address.af, 1534 inet_ntop (state->specifics.tcp_udp.ri.local_address.af,
1535 &state->specifics.tcp_udp.ri.local_address.address, 1535 &state->specifics.tcp_udp.ri.local_address.address,
1536 buf, sizeof (buf)), 1536 buf, sizeof (buf)),
1537 (unsigned int) state->specifics.tcp_udp.ri.local_address.port); 1537 (unsigned int) state->specifics.tcp_udp.ri.local_address.port);
1538 } 1538 }
1539 state->specifics.tcp_udp.state_key = key; 1539 state->specifics.tcp_udp.state_key = key;
1540 GNUNET_assert (GNUNET_OK == 1540 GNUNET_assert (GNUNET_OK ==
1541 GNUNET_CONTAINER_multihashmap_put (connections_map, 1541 GNUNET_CONTAINER_multihashmap_put (connections_map,
1542 &key, state, 1542 &key, state,
1543 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 1543 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
1544 state->specifics.tcp_udp.heap_node = GNUNET_CONTAINER_heap_insert (connections_heap, 1544 state->specifics.tcp_udp.heap_node = GNUNET_CONTAINER_heap_insert (connections_heap,
1545 state, 1545 state,
1546 GNUNET_TIME_absolute_get ().abs_value_us); 1546 GNUNET_TIME_absolute_get ().abs_value_us);
1547 while (GNUNET_CONTAINER_heap_get_size (connections_heap) > max_connections) 1547 while (GNUNET_CONTAINER_heap_get_size (connections_heap) > max_connections)
1548 { 1548 {
1549 s = GNUNET_CONTAINER_heap_remove_root (connections_heap); 1549 s = GNUNET_CONTAINER_heap_remove_root (connections_heap);
@@ -1552,7 +1552,7 @@ setup_state_record (struct TunnelState *state)
1552 GNUNET_MESH_tunnel_destroy (s->tunnel); 1552 GNUNET_MESH_tunnel_destroy (s->tunnel);
1553 GNUNET_assert (GNUNET_OK == 1553 GNUNET_assert (GNUNET_OK ==
1554 GNUNET_CONTAINER_multihashmap_remove (connections_map, 1554 GNUNET_CONTAINER_multihashmap_remove (connections_map,
1555 &s->specifics.tcp_udp.state_key, 1555 &s->specifics.tcp_udp.state_key,
1556 s)); 1556 s));
1557 GNUNET_free (s); 1557 GNUNET_free (s);
1558 } 1558 }
@@ -1630,7 +1630,7 @@ prepare_ipv4_packet (const void *payload, size_t payload_length,
1630 case IPPROTO_TCP: 1630 case IPPROTO_TCP:
1631 { 1631 {
1632 struct GNUNET_TUN_TcpHeader *pkt4_tcp = (struct GNUNET_TUN_TcpHeader *) &pkt4[1]; 1632 struct GNUNET_TUN_TcpHeader *pkt4_tcp = (struct GNUNET_TUN_TcpHeader *) &pkt4[1];
1633 1633
1634 *pkt4_tcp = *tcp_header; 1634 *pkt4_tcp = *tcp_header;
1635 pkt4_tcp->source_port = htons (src_address->port); 1635 pkt4_tcp->source_port = htons (src_address->port);
1636 pkt4_tcp->destination_port = htons (dst_address->port); 1636 pkt4_tcp->destination_port = htons (dst_address->port);
@@ -1696,7 +1696,7 @@ prepare_ipv6_packet (const void *payload, size_t payload_length,
1696 1696
1697 GNUNET_TUN_initialize_ipv6_header (pkt6, 1697 GNUNET_TUN_initialize_ipv6_header (pkt6,
1698 protocol, 1698 protocol,
1699 len, 1699 len,
1700 &src_address->address.ipv6, 1700 &src_address->address.ipv6,
1701 &dst_address->address.ipv6); 1701 &dst_address->address.ipv6);
1702 1702
@@ -1785,7 +1785,7 @@ send_tcp_packet_via_tun (const struct SocketAddress *destination_address,
1785 char buf[len] GNUNET_ALIGN; 1785 char buf[len] GNUNET_ALIGN;
1786 struct GNUNET_MessageHeader *hdr; 1786 struct GNUNET_MessageHeader *hdr;
1787 struct GNUNET_TUN_Layer2PacketHeader *tun; 1787 struct GNUNET_TUN_Layer2PacketHeader *tun;
1788 1788
1789 hdr = (struct GNUNET_MessageHeader *) buf; 1789 hdr = (struct GNUNET_MessageHeader *) buf;
1790 hdr->type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER); 1790 hdr->type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER);
1791 hdr->size = htons (len); 1791 hdr->size = htons (len);
@@ -1800,7 +1800,7 @@ send_tcp_packet_via_tun (const struct SocketAddress *destination_address,
1800 tun->proto = htons (ETH_P_IPV4); 1800 tun->proto = htons (ETH_P_IPV4);
1801 prepare_ipv4_packet (payload, payload_length, 1801 prepare_ipv4_packet (payload, payload_length,
1802 IPPROTO_TCP, 1802 IPPROTO_TCP,
1803 tcp_header, 1803 tcp_header,
1804 source_address, 1804 source_address,
1805 destination_address, 1805 destination_address,
1806 ipv4); 1806 ipv4);
@@ -1811,9 +1811,9 @@ send_tcp_packet_via_tun (const struct SocketAddress *destination_address,
1811 struct GNUNET_TUN_IPv6Header * ipv6 = (struct GNUNET_TUN_IPv6Header*) &tun[1]; 1811 struct GNUNET_TUN_IPv6Header * ipv6 = (struct GNUNET_TUN_IPv6Header*) &tun[1];
1812 1812
1813 tun->proto = htons (ETH_P_IPV6); 1813 tun->proto = htons (ETH_P_IPV6);
1814 prepare_ipv6_packet (payload, payload_length, 1814 prepare_ipv6_packet (payload, payload_length,
1815 IPPROTO_TCP, 1815 IPPROTO_TCP,
1816 tcp_header, 1816 tcp_header,
1817 source_address, 1817 source_address,
1818 destination_address, 1818 destination_address,
1819 ipv6); 1819 ipv6);
@@ -1840,7 +1840,7 @@ send_tcp_packet_via_tun (const struct SocketAddress *destination_address,
1840 * @param tunnel connection to the other end 1840 * @param tunnel connection to the other end
1841 * @param tunnel_ctx pointer to our 'struct TunnelState *' 1841 * @param tunnel_ctx pointer to our 'struct TunnelState *'
1842 * @param message the actual message 1842 * @param message the actual message
1843 * 1843 *
1844 * @return GNUNET_OK to keep the connection open, 1844 * @return GNUNET_OK to keep the connection open,
1845 * GNUNET_SYSERR to close it (signal serious error) 1845 * GNUNET_SYSERR to close it (signal serious error)
1846 */ 1846 */
@@ -1853,7 +1853,7 @@ receive_tcp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1853 const struct GNUNET_EXIT_TcpServiceStartMessage *start; 1853 const struct GNUNET_EXIT_TcpServiceStartMessage *start;
1854 uint16_t pkt_len = ntohs (message->size); 1854 uint16_t pkt_len = ntohs (message->size);
1855 1855
1856 if (NULL == state) 1856 if (NULL == state)
1857 { 1857 {
1858 GNUNET_break_op (0); 1858 GNUNET_break_op (0);
1859 return GNUNET_SYSERR; 1859 return GNUNET_SYSERR;
@@ -1899,11 +1899,11 @@ receive_tcp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1899 "Received data from %s for forwarding to TCP service %s on port %u\n", 1899 "Received data from %s for forwarding to TCP service %s on port %u\n",
1900 GNUNET_i2s (&state->peer), 1900 GNUNET_i2s (&state->peer),
1901 GNUNET_h2s (&start->service_descriptor), 1901 GNUNET_h2s (&start->service_descriptor),
1902 (unsigned int) ntohs (start->tcp_header.destination_port)); 1902 (unsigned int) ntohs (start->tcp_header.destination_port));
1903 if (NULL == (state->specifics.tcp_udp.serv = find_service (tcp_services, &start->service_descriptor, 1903 if (NULL == (state->specifics.tcp_udp.serv = find_service (tcp_services, &start->service_descriptor,
1904 ntohs (start->tcp_header.destination_port)))) 1904 ntohs (start->tcp_header.destination_port))))
1905 { 1905 {
1906 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1906 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1907 _("No service found for %s on port %d!\n"), 1907 _("No service found for %s on port %d!\n"),
1908 "TCP", 1908 "TCP",
1909 ntohs (start->tcp_header.destination_port)); 1909 ntohs (start->tcp_header.destination_port));
@@ -1912,7 +1912,7 @@ receive_tcp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1912 1, GNUNET_NO); 1912 1, GNUNET_NO);
1913 return GNUNET_SYSERR; 1913 return GNUNET_SYSERR;
1914 } 1914 }
1915 state->specifics.tcp_udp.ri.remote_address = state->specifics.tcp_udp.serv->address; 1915 state->specifics.tcp_udp.ri.remote_address = state->specifics.tcp_udp.serv->address;
1916 setup_state_record (state); 1916 setup_state_record (state);
1917 send_tcp_packet_via_tun (&state->specifics.tcp_udp.ri.remote_address, 1917 send_tcp_packet_via_tun (&state->specifics.tcp_udp.ri.remote_address,
1918 &state->specifics.tcp_udp.ri.local_address, 1918 &state->specifics.tcp_udp.ri.local_address,
@@ -1929,7 +1929,7 @@ receive_tcp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1929 * @param tunnel connection to the other end 1929 * @param tunnel connection to the other end
1930 * @param tunnel_ctx pointer to our 'struct TunnelState *' 1930 * @param tunnel_ctx pointer to our 'struct TunnelState *'
1931 * @param message the actual message 1931 * @param message the actual message
1932 * 1932 *
1933 * @return GNUNET_OK to keep the connection open, 1933 * @return GNUNET_OK to keep the connection open,
1934 * GNUNET_SYSERR to close it (signal serious error) 1934 * GNUNET_SYSERR to close it (signal serious error)
1935 */ 1935 */
@@ -1946,7 +1946,7 @@ receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1946 const void *payload; 1946 const void *payload;
1947 int af; 1947 int af;
1948 1948
1949 if (NULL == state) 1949 if (NULL == state)
1950 { 1950 {
1951 GNUNET_break_op (0); 1951 GNUNET_break_op (0);
1952 return GNUNET_SYSERR; 1952 return GNUNET_SYSERR;
@@ -1973,7 +1973,7 @@ receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1973 return GNUNET_SYSERR; 1973 return GNUNET_SYSERR;
1974 } 1974 }
1975 start = (const struct GNUNET_EXIT_TcpInternetStartMessage*) message; 1975 start = (const struct GNUNET_EXIT_TcpInternetStartMessage*) message;
1976 pkt_len -= sizeof (struct GNUNET_EXIT_TcpInternetStartMessage); 1976 pkt_len -= sizeof (struct GNUNET_EXIT_TcpInternetStartMessage);
1977 if ( (NULL != state->specifics.tcp_udp.serv) || 1977 if ( (NULL != state->specifics.tcp_udp.serv) ||
1978 (NULL != state->specifics.tcp_udp.heap_node) ) 1978 (NULL != state->specifics.tcp_udp.heap_node) )
1979 { 1979 {
@@ -2030,10 +2030,10 @@ receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2030 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2030 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2031 "Received data from %s for starting TCP stream to %s:%u\n", 2031 "Received data from %s for starting TCP stream to %s:%u\n",
2032 GNUNET_i2s (&state->peer), 2032 GNUNET_i2s (&state->peer),
2033 inet_ntop (af, 2033 inet_ntop (af,
2034 &state->specifics.tcp_udp.ri.remote_address.address, 2034 &state->specifics.tcp_udp.ri.remote_address.address,
2035 buf, sizeof (buf)), 2035 buf, sizeof (buf)),
2036 (unsigned int) ntohs (start->tcp_header.destination_port)); 2036 (unsigned int) ntohs (start->tcp_header.destination_port));
2037 } 2037 }
2038 state->specifics.tcp_udp.ri.remote_address.proto = IPPROTO_TCP; 2038 state->specifics.tcp_udp.ri.remote_address.proto = IPPROTO_TCP;
2039 state->specifics.tcp_udp.ri.remote_address.port = ntohs (start->tcp_header.destination_port); 2039 state->specifics.tcp_udp.ri.remote_address.port = ntohs (start->tcp_header.destination_port);
@@ -2047,14 +2047,14 @@ receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2047 2047
2048 2048
2049/** 2049/**
2050 * Process a request to forward TCP data on an established 2050 * Process a request to forward TCP data on an established
2051 * connection via this peer. 2051 * connection via this peer.
2052 * 2052 *
2053 * @param cls closure, NULL 2053 * @param cls closure, NULL
2054 * @param tunnel connection to the other end 2054 * @param tunnel connection to the other end
2055 * @param tunnel_ctx pointer to our 'struct TunnelState *' 2055 * @param tunnel_ctx pointer to our 'struct TunnelState *'
2056 * @param message the actual message 2056 * @param message the actual message
2057 * 2057 *
2058 * @return GNUNET_OK to keep the connection open, 2058 * @return GNUNET_OK to keep the connection open,
2059 * GNUNET_SYSERR to close it (signal serious error) 2059 * GNUNET_SYSERR to close it (signal serious error)
2060 */ 2060 */
@@ -2089,7 +2089,7 @@ receive_tcp_data (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2089 return GNUNET_SYSERR; 2089 return GNUNET_SYSERR;
2090 } 2090 }
2091 data = (const struct GNUNET_EXIT_TcpDataMessage*) message; 2091 data = (const struct GNUNET_EXIT_TcpDataMessage*) message;
2092 pkt_len -= sizeof (struct GNUNET_EXIT_TcpDataMessage); 2092 pkt_len -= sizeof (struct GNUNET_EXIT_TcpDataMessage);
2093 if ( (NULL == state) || 2093 if ( (NULL == state) ||
2094 (NULL == state->specifics.tcp_udp.heap_node) ) 2094 (NULL == state->specifics.tcp_udp.heap_node) )
2095 { 2095 {
@@ -2112,7 +2112,7 @@ receive_tcp_data (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2112 "Received additional %u bytes of data from %s for TCP stream to %s:%u\n", 2112 "Received additional %u bytes of data from %s for TCP stream to %s:%u\n",
2113 pkt_len, 2113 pkt_len,
2114 GNUNET_i2s (&state->peer), 2114 GNUNET_i2s (&state->peer),
2115 inet_ntop (state->specifics.tcp_udp.ri.remote_address.af, 2115 inet_ntop (state->specifics.tcp_udp.ri.remote_address.af,
2116 &state->specifics.tcp_udp.ri.remote_address.address, 2116 &state->specifics.tcp_udp.ri.remote_address.address,
2117 buf, sizeof (buf)), 2117 buf, sizeof (buf)),
2118 (unsigned int) state->specifics.tcp_udp.ri.remote_address.port); 2118 (unsigned int) state->specifics.tcp_udp.ri.remote_address.port);
@@ -2174,7 +2174,7 @@ send_icmp_packet_via_tun (const struct SocketAddress *destination_address,
2174 char buf[len] GNUNET_ALIGN; 2174 char buf[len] GNUNET_ALIGN;
2175 struct GNUNET_MessageHeader *hdr; 2175 struct GNUNET_MessageHeader *hdr;
2176 struct GNUNET_TUN_Layer2PacketHeader *tun; 2176 struct GNUNET_TUN_Layer2PacketHeader *tun;
2177 2177
2178 hdr= (struct GNUNET_MessageHeader *) buf; 2178 hdr= (struct GNUNET_MessageHeader *) buf;
2179 hdr->type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER); 2179 hdr->type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER);
2180 hdr->size = htons (len); 2180 hdr->size = htons (len);
@@ -2287,7 +2287,7 @@ make_up_icmpv6_payload (struct TunnelState *state,
2287 * @param tunnel connection to the other end 2287 * @param tunnel connection to the other end
2288 * @param tunnel_ctx pointer to our 'struct TunnelState *' 2288 * @param tunnel_ctx pointer to our 'struct TunnelState *'
2289 * @param message the actual message 2289 * @param message the actual message
2290 * 2290 *
2291 * @return GNUNET_OK to keep the connection open, 2291 * @return GNUNET_OK to keep the connection open,
2292 * GNUNET_SYSERR to close it (signal serious error) 2292 * GNUNET_SYSERR to close it (signal serious error)
2293 */ 2293 */
@@ -2300,7 +2300,7 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2300 const struct GNUNET_EXIT_IcmpInternetMessage *msg; 2300 const struct GNUNET_EXIT_IcmpInternetMessage *msg;
2301 uint16_t pkt_len = ntohs (message->size); 2301 uint16_t pkt_len = ntohs (message->size);
2302 const struct in_addr *v4; 2302 const struct in_addr *v4;
2303 const struct in6_addr *v6; 2303 const struct in6_addr *v6;
2304 const void *payload; 2304 const void *payload;
2305 char buf[sizeof (struct GNUNET_TUN_IPv6Header) + 8] GNUNET_ALIGN; 2305 char buf[sizeof (struct GNUNET_TUN_IPv6Header) + 8] GNUNET_ALIGN;
2306 int af; 2306 int af;
@@ -2327,7 +2327,7 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2327 return GNUNET_SYSERR; 2327 return GNUNET_SYSERR;
2328 } 2328 }
2329 msg = (const struct GNUNET_EXIT_IcmpInternetMessage*) message; 2329 msg = (const struct GNUNET_EXIT_IcmpInternetMessage*) message;
2330 pkt_len -= sizeof (struct GNUNET_EXIT_IcmpInternetMessage); 2330 pkt_len -= sizeof (struct GNUNET_EXIT_IcmpInternetMessage);
2331 2331
2332 af = (int) ntohl (msg->af); 2332 af = (int) ntohl (msg->af);
2333 if ( (NULL != state->specifics.tcp_udp.heap_node) && 2333 if ( (NULL != state->specifics.tcp_udp.heap_node) &&
@@ -2361,7 +2361,7 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2361 state->specifics.tcp_udp.ri.remote_address.proto = IPPROTO_ICMP; 2361 state->specifics.tcp_udp.ri.remote_address.proto = IPPROTO_ICMP;
2362 setup_state_record (state); 2362 setup_state_record (state);
2363 } 2363 }
2364 /* check that ICMP type is something we want to support 2364 /* check that ICMP type is something we want to support
2365 and possibly make up payload! */ 2365 and possibly make up payload! */
2366 switch (msg->icmp_header.type) 2366 switch (msg->icmp_header.type)
2367 { 2367 {
@@ -2383,7 +2383,7 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2383 2383
2384 GNUNET_assert (8 == sizeof (struct GNUNET_TUN_UdpHeader)); 2384 GNUNET_assert (8 == sizeof (struct GNUNET_TUN_UdpHeader));
2385 pkt_len = sizeof (struct GNUNET_TUN_IPv4Header) + 8; 2385 pkt_len = sizeof (struct GNUNET_TUN_IPv4Header) + 8;
2386 make_up_icmpv4_payload (state, 2386 make_up_icmpv4_payload (state,
2387 ipp, 2387 ipp,
2388 udp); 2388 udp);
2389 payload = ipp; 2389 payload = ipp;
@@ -2394,7 +2394,7 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2394 GNUNET_STATISTICS_update (stats, 2394 GNUNET_STATISTICS_update (stats,
2395 gettext_noop ("# ICMPv4 packets dropped (type not allowed)"), 2395 gettext_noop ("# ICMPv4 packets dropped (type not allowed)"),
2396 1, GNUNET_NO); 2396 1, GNUNET_NO);
2397 return GNUNET_SYSERR; 2397 return GNUNET_SYSERR;
2398 } 2398 }
2399 /* end AF_INET */ 2399 /* end AF_INET */
2400 break; 2400 break;
@@ -2419,7 +2419,7 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2419 state->specifics.tcp_udp.ri.remote_address.proto = IPPROTO_ICMPV6; 2419 state->specifics.tcp_udp.ri.remote_address.proto = IPPROTO_ICMPV6;
2420 setup_state_record (state); 2420 setup_state_record (state);
2421 } 2421 }
2422 /* check that ICMP type is something we want to support 2422 /* check that ICMP type is something we want to support
2423 and possibly make up payload! */ 2423 and possibly make up payload! */
2424 switch (msg->icmp_header.type) 2424 switch (msg->icmp_header.type)
2425 { 2425 {
@@ -2442,7 +2442,7 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2442 2442
2443 GNUNET_assert (8 == sizeof (struct GNUNET_TUN_UdpHeader)); 2443 GNUNET_assert (8 == sizeof (struct GNUNET_TUN_UdpHeader));
2444 pkt_len = sizeof (struct GNUNET_TUN_IPv6Header) + 8; 2444 pkt_len = sizeof (struct GNUNET_TUN_IPv6Header) + 8;
2445 make_up_icmpv6_payload (state, 2445 make_up_icmpv6_payload (state,
2446 ipp, 2446 ipp,
2447 udp); 2447 udp);
2448 payload = ipp; 2448 payload = ipp;
@@ -2453,22 +2453,22 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2453 GNUNET_STATISTICS_update (stats, 2453 GNUNET_STATISTICS_update (stats,
2454 gettext_noop ("# ICMPv6 packets dropped (type not allowed)"), 2454 gettext_noop ("# ICMPv6 packets dropped (type not allowed)"),
2455 1, GNUNET_NO); 2455 1, GNUNET_NO);
2456 return GNUNET_SYSERR; 2456 return GNUNET_SYSERR;
2457 } 2457 }
2458 /* end AF_INET6 */ 2458 /* end AF_INET6 */
2459 break; 2459 break;
2460 default: 2460 default:
2461 /* bad AF */ 2461 /* bad AF */
2462 GNUNET_break_op (0); 2462 GNUNET_break_op (0);
2463 return GNUNET_SYSERR; 2463 return GNUNET_SYSERR;
2464 } 2464 }
2465 2465
2466 { 2466 {
2467 char buf[INET6_ADDRSTRLEN]; 2467 char buf[INET6_ADDRSTRLEN];
2468 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2468 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2469 "Received ICMP data from %s for forwarding to %s\n", 2469 "Received ICMP data from %s for forwarding to %s\n",
2470 GNUNET_i2s (&state->peer), 2470 GNUNET_i2s (&state->peer),
2471 inet_ntop (af, 2471 inet_ntop (af,
2472 &state->specifics.tcp_udp.ri.remote_address.address, 2472 &state->specifics.tcp_udp.ri.remote_address.address,
2473 buf, sizeof (buf))); 2473 buf, sizeof (buf)));
2474 } 2474 }
@@ -2499,7 +2499,7 @@ make_up_icmp_service_payload (struct TunnelState *state,
2499 { 2499 {
2500 struct GNUNET_TUN_IPv4Header *ipv4; 2500 struct GNUNET_TUN_IPv4Header *ipv4;
2501 struct GNUNET_TUN_UdpHeader *udp; 2501 struct GNUNET_TUN_UdpHeader *udp;
2502 2502
2503 ipv4 = (struct GNUNET_TUN_IPv4Header *)buf; 2503 ipv4 = (struct GNUNET_TUN_IPv4Header *)buf;
2504 udp = (struct GNUNET_TUN_UdpHeader *) &ipv4[1]; 2504 udp = (struct GNUNET_TUN_UdpHeader *) &ipv4[1];
2505 make_up_icmpv4_payload (state, 2505 make_up_icmpv4_payload (state,
@@ -2520,7 +2520,7 @@ make_up_icmp_service_payload (struct TunnelState *state,
2520 ipv6, 2520 ipv6,
2521 udp); 2521 udp);
2522 GNUNET_assert (8 == sizeof (struct GNUNET_TUN_UdpHeader)); 2522 GNUNET_assert (8 == sizeof (struct GNUNET_TUN_UdpHeader));
2523 return sizeof (struct GNUNET_TUN_IPv6Header) + 8; 2523 return sizeof (struct GNUNET_TUN_IPv6Header) + 8;
2524 } 2524 }
2525 break; 2525 break;
2526 default: 2526 default:
@@ -2538,7 +2538,7 @@ make_up_icmp_service_payload (struct TunnelState *state,
2538 * @param tunnel connection to the other end 2538 * @param tunnel connection to the other end
2539 * @param tunnel_ctx pointer to our 'struct TunnelState *' 2539 * @param tunnel_ctx pointer to our 'struct TunnelState *'
2540 * @param message the actual message 2540 * @param message the actual message
2541 * 2541 *
2542 * @return GNUNET_OK to keep the connection open, 2542 * @return GNUNET_OK to keep the connection open,
2543 * GNUNET_SYSERR to close it (signal serious error) 2543 * GNUNET_SYSERR to close it (signal serious error)
2544 */ 2544 */
@@ -2590,7 +2590,7 @@ receive_icmp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel
2590 } 2590 }
2591 icmp = msg->icmp_header; 2591 icmp = msg->icmp_header;
2592 payload = &msg[1]; 2592 payload = &msg[1];
2593 state->specifics.tcp_udp.ri.remote_address = state->specifics.tcp_udp.serv->address; 2593 state->specifics.tcp_udp.ri.remote_address = state->specifics.tcp_udp.serv->address;
2594 setup_state_record (state); 2594 setup_state_record (state);
2595 2595
2596 /* check that ICMP type is something we want to support, 2596 /* check that ICMP type is something we want to support,
@@ -2772,7 +2772,7 @@ send_udp_packet_via_tun (const struct SocketAddress *destination_address,
2772 char buf[len] GNUNET_ALIGN; 2772 char buf[len] GNUNET_ALIGN;
2773 struct GNUNET_MessageHeader *hdr; 2773 struct GNUNET_MessageHeader *hdr;
2774 struct GNUNET_TUN_Layer2PacketHeader *tun; 2774 struct GNUNET_TUN_Layer2PacketHeader *tun;
2775 2775
2776 hdr= (struct GNUNET_MessageHeader *) buf; 2776 hdr= (struct GNUNET_MessageHeader *) buf;
2777 hdr->type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER); 2777 hdr->type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER);
2778 hdr->size = htons (len); 2778 hdr->size = htons (len);
@@ -2798,7 +2798,7 @@ send_udp_packet_via_tun (const struct SocketAddress *destination_address,
2798 struct GNUNET_TUN_IPv6Header * ipv6 = (struct GNUNET_TUN_IPv6Header*) &tun[1]; 2798 struct GNUNET_TUN_IPv6Header * ipv6 = (struct GNUNET_TUN_IPv6Header*) &tun[1];
2799 2799
2800 tun->proto = htons (ETH_P_IPV6); 2800 tun->proto = htons (ETH_P_IPV6);
2801 prepare_ipv6_packet (payload, payload_length, 2801 prepare_ipv6_packet (payload, payload_length,
2802 IPPROTO_UDP, 2802 IPPROTO_UDP,
2803 NULL, 2803 NULL,
2804 source_address, 2804 source_address,
@@ -2826,7 +2826,7 @@ send_udp_packet_via_tun (const struct SocketAddress *destination_address,
2826 * @param tunnel connection to the other end 2826 * @param tunnel connection to the other end
2827 * @param tunnel_ctx pointer to our 'struct TunnelState *' 2827 * @param tunnel_ctx pointer to our 'struct TunnelState *'
2828 * @param message the actual message 2828 * @param message the actual message
2829 * 2829 *
2830 * @return GNUNET_OK to keep the connection open, 2830 * @return GNUNET_OK to keep the connection open,
2831 * GNUNET_SYSERR to close it (signal serious error) 2831 * GNUNET_SYSERR to close it (signal serious error)
2832 */ 2832 */
@@ -2865,7 +2865,7 @@ receive_udp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2865 return GNUNET_SYSERR; 2865 return GNUNET_SYSERR;
2866 } 2866 }
2867 msg = (const struct GNUNET_EXIT_UdpInternetMessage*) message; 2867 msg = (const struct GNUNET_EXIT_UdpInternetMessage*) message;
2868 pkt_len -= sizeof (struct GNUNET_EXIT_UdpInternetMessage); 2868 pkt_len -= sizeof (struct GNUNET_EXIT_UdpInternetMessage);
2869 af = (int) ntohl (msg->af); 2869 af = (int) ntohl (msg->af);
2870 state->specifics.tcp_udp.ri.remote_address.af = af; 2870 state->specifics.tcp_udp.ri.remote_address.af = af;
2871 switch (af) 2871 switch (af)
@@ -2911,10 +2911,10 @@ receive_udp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2911 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2911 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2912 "Received data from %s for forwarding to UDP %s:%u\n", 2912 "Received data from %s for forwarding to UDP %s:%u\n",
2913 GNUNET_i2s (&state->peer), 2913 GNUNET_i2s (&state->peer),
2914 inet_ntop (af, 2914 inet_ntop (af,
2915 &state->specifics.tcp_udp.ri.remote_address.address, 2915 &state->specifics.tcp_udp.ri.remote_address.address,
2916 buf, sizeof (buf)), 2916 buf, sizeof (buf)),
2917 (unsigned int) ntohs (msg->destination_port)); 2917 (unsigned int) ntohs (msg->destination_port));
2918 } 2918 }
2919 state->specifics.tcp_udp.ri.remote_address.proto = IPPROTO_UDP; 2919 state->specifics.tcp_udp.ri.remote_address.proto = IPPROTO_UDP;
2920 state->specifics.tcp_udp.ri.remote_address.port = msg->destination_port; 2920 state->specifics.tcp_udp.ri.remote_address.port = msg->destination_port;
@@ -2937,7 +2937,7 @@ receive_udp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2937 * @param tunnel connection to the other end 2937 * @param tunnel connection to the other end
2938 * @param tunnel_ctx pointer to our 'struct TunnelState *' 2938 * @param tunnel_ctx pointer to our 'struct TunnelState *'
2939 * @param message the actual message 2939 * @param message the actual message
2940 * 2940 *
2941 * @return GNUNET_OK to keep the connection open, 2941 * @return GNUNET_OK to keep the connection open,
2942 * GNUNET_SYSERR to close it (signal serious error) 2942 * GNUNET_SYSERR to close it (signal serious error)
2943 */ 2943 */
@@ -2978,11 +2978,11 @@ receive_udp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2978 "Received data from %s for forwarding to UDP service %s on port %u\n", 2978 "Received data from %s for forwarding to UDP service %s on port %u\n",
2979 GNUNET_i2s (&state->peer), 2979 GNUNET_i2s (&state->peer),
2980 GNUNET_h2s (&msg->service_descriptor), 2980 GNUNET_h2s (&msg->service_descriptor),
2981 (unsigned int) ntohs (msg->destination_port)); 2981 (unsigned int) ntohs (msg->destination_port));
2982 if (NULL == (state->specifics.tcp_udp.serv = find_service (udp_services, &msg->service_descriptor, 2982 if (NULL == (state->specifics.tcp_udp.serv = find_service (udp_services, &msg->service_descriptor,
2983 ntohs (msg->destination_port)))) 2983 ntohs (msg->destination_port))))
2984 { 2984 {
2985 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 2985 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
2986 _("No service found for %s on port %d!\n"), 2986 _("No service found for %s on port %d!\n"),
2987 "UDP", 2987 "UDP",
2988 ntohs (msg->destination_port)); 2988 ntohs (msg->destination_port));
@@ -2991,7 +2991,7 @@ receive_udp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2991 1, GNUNET_NO); 2991 1, GNUNET_NO);
2992 return GNUNET_SYSERR; 2992 return GNUNET_SYSERR;
2993 } 2993 }
2994 state->specifics.tcp_udp.ri.remote_address = state->specifics.tcp_udp.serv->address; 2994 state->specifics.tcp_udp.ri.remote_address = state->specifics.tcp_udp.serv->address;
2995 setup_state_record (state); 2995 setup_state_record (state);
2996 if (0 != ntohs (msg->source_port)) 2996 if (0 != ntohs (msg->source_port))
2997 state->specifics.tcp_udp.ri.local_address.port = msg->source_port; 2997 state->specifics.tcp_udp.ri.local_address.port = msg->source_port;
@@ -3057,7 +3057,7 @@ clean_tunnel (void *cls GNUNET_UNUSED, const struct GNUNET_MESH_Tunnel *tunnel,
3057 { 3057 {
3058 if (tunnels[s->specifics.dns.my_id] == s) 3058 if (tunnels[s->specifics.dns.my_id] == s)
3059 tunnels[s->specifics.dns.my_id] = NULL; 3059 tunnels[s->specifics.dns.my_id] = NULL;
3060 GNUNET_free_non_null (s->specifics.dns.reply); 3060 GNUNET_free_non_null (s->specifics.dns.reply);
3061 } 3061 }
3062 else 3062 else
3063 { 3063 {
@@ -3233,10 +3233,10 @@ add_services (int proto,
3233 } 3233 }
3234 hostport[0] = '\0'; 3234 hostport[0] = '\0';
3235 hostport++; 3235 hostport++;
3236 3236
3237 int local_port = atoi (redirect); 3237 int local_port = atoi (redirect);
3238 int remote_port = atoi (hostport); 3238 int remote_port = atoi (hostport);
3239 3239
3240 if (!((local_port > 0) && (local_port < 65536))) 3240 if (!((local_port > 0) && (local_port < 65536)))
3241 { 3241 {
3242 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3242 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -3260,7 +3260,7 @@ add_services (int proto,
3260 { 3260 {
3261 const char *ip4addr = exit_argv[5]; 3261 const char *ip4addr = exit_argv[5];
3262 3262
3263 serv->address.af = AF_INET; 3263 serv->address.af = AF_INET;
3264 GNUNET_assert (1 == inet_pton (AF_INET, ip4addr, &serv->address.address.ipv4)); 3264 GNUNET_assert (1 == inet_pton (AF_INET, ip4addr, &serv->address.address.ipv4));
3265 } 3265 }
3266 else if (0 == strcmp ("localhost6", hostname)) 3266 else if (0 == strcmp ("localhost6", hostname))
@@ -3272,10 +3272,10 @@ add_services (int proto,
3272 } 3272 }
3273 else 3273 else
3274 { 3274 {
3275 struct addrinfo *res; 3275 struct addrinfo *res;
3276 int ret; 3276 int ret;
3277 3277
3278 ret = getaddrinfo (hostname, NULL, NULL, &res); 3278 ret = getaddrinfo (hostname, NULL, NULL, &res);
3279 if ( (ret != 0) || (res == NULL) ) 3279 if ( (ret != 0) || (res == NULL) )
3280 { 3280 {
3281 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3281 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -3285,7 +3285,7 @@ add_services (int proto,
3285 GNUNET_free (serv); 3285 GNUNET_free (serv);
3286 continue; 3286 continue;
3287 } 3287 }
3288 3288
3289 serv->address.af = res->ai_family; 3289 serv->address.af = res->ai_family;
3290 switch (res->ai_family) 3290 switch (res->ai_family)
3291 { 3291 {
@@ -3388,7 +3388,7 @@ dht_put_cont (void *cls,
3388{ 3388{
3389 dht_put = NULL; 3389 dht_put = NULL;
3390 dht_task = GNUNET_SCHEDULER_add_delayed (DHT_PUT_FREQUENCY, 3390 dht_task = GNUNET_SCHEDULER_add_delayed (DHT_PUT_FREQUENCY,
3391 &do_dht_put, 3391 &do_dht_put,
3392 NULL); 3392 NULL);
3393} 3393}
3394 3394
@@ -3408,7 +3408,7 @@ do_dht_put (void *cls,
3408 3408
3409 dht_task = GNUNET_SCHEDULER_NO_TASK; 3409 dht_task = GNUNET_SCHEDULER_NO_TASK;
3410 expiration = GNUNET_TIME_absolute_ntoh (dns_advertisement.expiration_time); 3410 expiration = GNUNET_TIME_absolute_ntoh (dns_advertisement.expiration_time);
3411 if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us < 3411 if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us <
3412 GNUNET_TIME_UNIT_HOURS.rel_value_us) 3412 GNUNET_TIME_UNIT_HOURS.rel_value_us)
3413 { 3413 {
3414 /* refresh advertisement */ 3414 /* refresh advertisement */
@@ -3424,7 +3424,7 @@ do_dht_put (void *cls,
3424 1 /* replication */, 3424 1 /* replication */,
3425 GNUNET_DHT_RO_NONE, 3425 GNUNET_DHT_RO_NONE,
3426 GNUNET_BLOCK_TYPE_DNS, 3426 GNUNET_BLOCK_TYPE_DNS,
3427 sizeof (struct GNUNET_DNS_Advertisement), 3427 sizeof (struct GNUNET_DNS_Advertisement),
3428 &dns_advertisement, 3428 &dns_advertisement,
3429 expiration, 3429 expiration,
3430 GNUNET_TIME_UNIT_FOREVER_REL, 3430 GNUNET_TIME_UNIT_FOREVER_REL,
@@ -3480,9 +3480,9 @@ run (void *cls, char *const *args GNUNET_UNUSED,
3480 3480
3481 cfg = cfg_; 3481 cfg = cfg_;
3482 ipv4_exit = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "EXIT_IPV4"); 3482 ipv4_exit = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "EXIT_IPV4");
3483 ipv6_exit = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "EXIT_IPV6"); 3483 ipv6_exit = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "EXIT_IPV6");
3484 ipv4_enabled = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "ENABLE_IPV4"); 3484 ipv4_enabled = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "ENABLE_IPV4");
3485 ipv6_enabled = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "ENABLE_IPV6"); 3485 ipv6_enabled = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "ENABLE_IPV6");
3486 if ( (ipv4_exit) || (ipv6_exit) ) 3486 if ( (ipv4_exit) || (ipv6_exit) )
3487 { 3487 {
3488 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-exit"); 3488 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-exit");
@@ -3540,13 +3540,13 @@ run (void *cls, char *const *args GNUNET_UNUSED,
3540 if ( (GNUNET_YES == 3540 if ( (GNUNET_YES ==
3541 GNUNET_CONFIGURATION_get_value_yesno (cfg_, "exit", "ENABLE_DNS")) && 3541 GNUNET_CONFIGURATION_get_value_yesno (cfg_, "exit", "ENABLE_DNS")) &&
3542 ( (GNUNET_OK != 3542 ( (GNUNET_OK !=
3543 GNUNET_CONFIGURATION_get_value_string (cfg, "exit", 3543 GNUNET_CONFIGURATION_get_value_string (cfg, "exit",
3544 "DNS_RESOLVER", 3544 "DNS_RESOLVER",
3545 &dns_exit)) || 3545 &dns_exit)) ||
3546 ( (1 != inet_pton (AF_INET, dns_exit, &dns_exit4)) && 3546 ( (1 != inet_pton (AF_INET, dns_exit, &dns_exit4)) &&
3547 (1 != inet_pton (AF_INET6, dns_exit, &dns_exit6)) ) ) ) 3547 (1 != inet_pton (AF_INET6, dns_exit, &dns_exit6)) ) ) )
3548 { 3548 {
3549 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, 3549 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
3550 "dns", "DNS_RESOLVER", 3550 "dns", "DNS_RESOLVER",
3551 _("need a valid IPv4 or IPv6 address\n")); 3551 _("need a valid IPv4 or IPv6 address\n"));
3552 GNUNET_free_non_null (dns_exit); 3552 GNUNET_free_non_null (dns_exit);
@@ -3575,13 +3575,13 @@ run (void *cls, char *const *args GNUNET_UNUSED,
3575 peer_key = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg); 3575 peer_key = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg);
3576 GNUNET_CRYPTO_ecc_key_get_public_for_signature (peer_key, 3576 GNUNET_CRYPTO_ecc_key_get_public_for_signature (peer_key,
3577 &dns_advertisement.peer.public_key); 3577 &dns_advertisement.peer.public_key);
3578 dns_advertisement.purpose.size = htonl (sizeof (struct GNUNET_DNS_Advertisement) - 3578 dns_advertisement.purpose.size = htonl (sizeof (struct GNUNET_DNS_Advertisement) -
3579 sizeof (struct GNUNET_CRYPTO_EccSignature)); 3579 sizeof (struct GNUNET_CRYPTO_EccSignature));
3580 dns_advertisement.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_DNS_RECORD); 3580 dns_advertisement.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_DNS_RECORD);
3581 GNUNET_CRYPTO_hash ("dns", 3581 GNUNET_CRYPTO_hash ("dns",
3582 strlen ("dns"), 3582 strlen ("dns"),
3583 &dht_put_key); 3583 &dht_put_key);
3584 dht_task = GNUNET_SCHEDULER_add_now (&do_dht_put, 3584 dht_task = GNUNET_SCHEDULER_add_now (&do_dht_put,
3585 NULL); 3585 NULL);
3586 apptypes[app_idx] = GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER; 3586 apptypes[app_idx] = GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER;
3587 app_idx++; 3587 app_idx++;
@@ -3617,7 +3617,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
3617 { 3617 {
3618 exit_argv[2] = GNUNET_strdup ("-"); 3618 exit_argv[2] = GNUNET_strdup ("-");
3619 } 3619 }
3620 3620
3621 3621
3622 if (GNUNET_YES == ipv6_enabled) 3622 if (GNUNET_YES == ipv6_enabled)
3623 { 3623 {
@@ -3651,7 +3651,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
3651 GNUNET_SCHEDULER_shutdown (); 3651 GNUNET_SCHEDULER_shutdown ();
3652 return; 3652 return;
3653 } 3653 }
3654 } 3654 }
3655 else 3655 else
3656 { 3656 {
3657 /* IPv6 explicitly disabled */ 3657 /* IPv6 explicitly disabled */
@@ -3695,9 +3695,9 @@ run (void *cls, char *const *args GNUNET_UNUSED,
3695 3695
3696 connections_map = GNUNET_CONTAINER_multihashmap_create (65536, GNUNET_NO); 3696 connections_map = GNUNET_CONTAINER_multihashmap_create (65536, GNUNET_NO);
3697 connections_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); 3697 connections_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
3698 mesh_handle 3698 mesh_handle
3699 = GNUNET_MESH_connect (cfg, NULL, 3699 = GNUNET_MESH_connect (cfg, NULL,
3700 &new_tunnel, 3700 &new_tunnel,
3701 &clean_tunnel, handlers, 3701 &clean_tunnel, handlers,
3702 apptypes); // FIXME use ports 3702 apptypes); // FIXME use ports
3703 if (NULL == mesh_handle) 3703 if (NULL == mesh_handle)
@@ -3724,12 +3724,12 @@ run (void *cls, char *const *args GNUNET_UNUSED,
3724 (void) GNUNET_asprintf (&prefixed_regex, "%s%s%s", 3724 (void) GNUNET_asprintf (&prefixed_regex, "%s%s%s",
3725 GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, 3725 GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX,
3726 "4", regex); 3726 "4", regex);
3727 regex4 = GNUNET_REGEX_announce (cfg, 3727 regex4 = GNUNET_REGEX_announce (cfg,
3728 prefixed_regex, 3728 prefixed_regex,
3729 REGEX_REFRESH_FREQUENCY, 3729 REGEX_REFRESH_FREQUENCY,
3730 REGEX_MAX_PATH_LEN_IPV4); 3730 REGEX_MAX_PATH_LEN_IPV4);
3731 GNUNET_free (regex); 3731 GNUNET_free (regex);
3732 GNUNET_free (prefixed_regex); 3732 GNUNET_free (prefixed_regex);
3733 } 3733 }
3734 } 3734 }
3735 3735
@@ -3744,7 +3744,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
3744 regex = NULL; 3744 regex = NULL;
3745 else 3745 else
3746 regex = GNUNET_TUN_ipv6policy2regex (policy); 3746 regex = GNUNET_TUN_ipv6policy2regex (policy);
3747 GNUNET_free_non_null (policy); 3747 GNUNET_free_non_null (policy);
3748 if (NULL != regex) 3748 if (NULL != regex)
3749 { 3749 {
3750 (void) GNUNET_asprintf (&prefixed_regex, "%s%s%s", 3750 (void) GNUNET_asprintf (&prefixed_regex, "%s%s%s",
@@ -3760,7 +3760,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
3760 } 3760 }
3761 if ((ipv4_exit) || (ipv6_exit)) 3761 if ((ipv4_exit) || (ipv6_exit))
3762 helper_handle = GNUNET_HELPER_start (GNUNET_NO, 3762 helper_handle = GNUNET_HELPER_start (GNUNET_NO,
3763 "gnunet-helper-exit", 3763 "gnunet-helper-exit",
3764 exit_argv, 3764 exit_argv,
3765 &message_token, 3765 &message_token,
3766 NULL, NULL); 3766 NULL, NULL);
diff --git a/src/exit/gnunet-helper-exit-windows.c b/src/exit/gnunet-helper-exit-windows.c
index 461494480..bb6b6a8e4 100644
--- a/src/exit/gnunet-helper-exit-windows.c
+++ b/src/exit/gnunet-helper-exit-windows.c
@@ -19,8 +19,8 @@
19 */ 19 */
20/** 20/**
21 * @file exit/gnunet-helper-exit-windows.c 21 * @file exit/gnunet-helper-exit-windows.c
22 * @brief the helper for the EXIT service in win32 builds. 22 * @brief the helper for the EXIT service in win32 builds.
23 * Opens a virtual network-interface, sends data received on the if to stdout, 23 * Opens a virtual network-interface, sends data received on the if to stdout,
24 * sends data received on stdin to the interface 24 * sends data received on stdin to the interface
25 * @author Christian M. Fuchs 25 * @author Christian M. Fuchs
26 * 26 *
@@ -68,7 +68,7 @@
68#endif 68#endif
69 69
70/** 70/**
71 * Will this binary be run in permissions testing mode? 71 * Will this binary be run in permissions testing mode?
72 */ 72 */
73static boolean privilege_testing = FALSE; 73static boolean privilege_testing = FALSE;
74 74
@@ -90,7 +90,7 @@ static boolean privilege_testing = FALSE;
90#define INF_FILE64 "share/gnunet/openvpn-tap32/tapw64/OemWin2k.inf" 90#define INF_FILE64 "share/gnunet/openvpn-tap32/tapw64/OemWin2k.inf"
91 91
92/** 92/**
93 * Hardware ID used in the inf-file. 93 * Hardware ID used in the inf-file.
94 * This might change over time, as openvpn advances their driver 94 * This might change over time, as openvpn advances their driver
95 */ 95 */
96#define HARDWARE_ID "tap0901" 96#define HARDWARE_ID "tap0901"
@@ -101,7 +101,7 @@ static boolean privilege_testing = FALSE;
101#define TAP_WIN_MIN_MAJOR 9 101#define TAP_WIN_MIN_MAJOR 9
102 102
103/** 103/**
104 * Minimum minor-id of the driver version we can work with. 104 * Minimum minor-id of the driver version we can work with.
105 * v <= 7 has buggy IPv6. 105 * v <= 7 has buggy IPv6.
106 * v == 8 is broken for small IPv4 Packets 106 * v == 8 is broken for small IPv4 Packets
107 */ 107 */
@@ -109,7 +109,7 @@ static boolean privilege_testing = FALSE;
109 109
110/** 110/**
111 * Time in seconds to wait for our virtual device to go up after telling it to do so. 111 * Time in seconds to wait for our virtual device to go up after telling it to do so.
112 * 112 *
113 * openvpn doesn't specify a value, 4 seems sane for testing, even for openwrt 113 * openvpn doesn't specify a value, 4 seems sane for testing, even for openwrt
114 * (in fact, 4 was chosen by a fair dice roll...) 114 * (in fact, 4 was chosen by a fair dice roll...)
115 */ 115 */
@@ -121,7 +121,7 @@ static boolean privilege_testing = FALSE;
121#define INTERFACE_REGISTRY_LOCATION "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}" 121#define INTERFACE_REGISTRY_LOCATION "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
122 122
123/** 123/**
124 * Our local process' PID. Used for creating a sufficiently unique additional 124 * Our local process' PID. Used for creating a sufficiently unique additional
125 * hardware ID for our device. 125 * hardware ID for our device.
126 */ 126 */
127static char secondary_hwid[LINE_LEN / 2]; 127static char secondary_hwid[LINE_LEN / 2];
@@ -132,13 +132,13 @@ static char secondary_hwid[LINE_LEN / 2];
132 */ 132 */
133static char device_visible_name[256]; 133static char device_visible_name[256];
134 134
135/** 135/**
136 * This is our own local instance of a virtual network interface 136 * This is our own local instance of a virtual network interface
137 * It is (somewhat) equivalent to using tun/tap in unixoid systems 137 * It is (somewhat) equivalent to using tun/tap in unixoid systems
138 * 138 *
139 * Upon initialization, we create such an device node. 139 * Upon initialization, we create such an device node.
140 * Upon termination, we remove it again. 140 * Upon termination, we remove it again.
141 * 141 *
142 * If we crash this device might stay around. 142 * If we crash this device might stay around.
143 */ 143 */
144static HDEVINFO DeviceInfo = INVALID_HANDLE_VALUE; 144static HDEVINFO DeviceInfo = INVALID_HANDLE_VALUE;
@@ -149,7 +149,7 @@ static HDEVINFO DeviceInfo = INVALID_HANDLE_VALUE;
149static SP_DEVINFO_DATA DeviceNode; 149static SP_DEVINFO_DATA DeviceNode;
150 150
151/** 151/**
152 * GUID of our virtual device in the form of 152 * GUID of our virtual device in the form of
153 * {12345678-1234-1234-1234-123456789abc} - in hex 153 * {12345678-1234-1234-1234-123456789abc} - in hex
154 */ 154 */
155static char device_guid[256]; 155static char device_guid[256];
@@ -161,36 +161,36 @@ static char device_guid[256];
161enum IO_State 161enum IO_State
162{ 162{
163 163
164 /** 164 /**
165 * overlapped I/O is ready for work 165 * overlapped I/O is ready for work
166 */ 166 */
167 IOSTATE_READY = 0, 167 IOSTATE_READY = 0,
168 168
169 /** 169 /**
170 * overlapped I/O has been queued 170 * overlapped I/O has been queued
171 */ 171 */
172 IOSTATE_QUEUED, 172 IOSTATE_QUEUED,
173 173
174 /** 174 /**
175 * overlapped I/O has finished, but is waiting for it's write-partner 175 * overlapped I/O has finished, but is waiting for it's write-partner
176 */ 176 */
177 IOSTATE_WAITING, 177 IOSTATE_WAITING,
178 178
179 /** 179 /**
180 * there is a full buffer waiting 180 * there is a full buffer waiting
181 */ 181 */
182 IOSTATE_RESUME, 182 IOSTATE_RESUME,
183 183
184 /** 184 /**
185 * Operlapped IO states for facility objects 185 * Operlapped IO states for facility objects
186 * overlapped I/O has failed, stop processing 186 * overlapped I/O has failed, stop processing
187 */ 187 */
188 IOSTATE_FAILED 188 IOSTATE_FAILED
189 189
190}; 190};
191 191
192 192
193/** 193/**
194 * A IO Object + read/writebuffer + buffer-size for windows asynchronous IO handling 194 * A IO Object + read/writebuffer + buffer-size for windows asynchronous IO handling
195 */ 195 */
196struct io_facility 196struct io_facility
@@ -229,7 +229,7 @@ struct io_facility
229 * Amount of data actually written or read by readfile/writefile. 229 * Amount of data actually written or read by readfile/writefile.
230 */ 230 */
231 DWORD buffer_size_processed; 231 DWORD buffer_size_processed;
232 232
233 /** 233 /**
234 * How much of this buffer we have written in total 234 * How much of this buffer we have written in total
235 */ 235 */
@@ -248,32 +248,32 @@ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
248 248
249/** 249/**
250 * Determines if the host OS is win32 or win64 250 * Determines if the host OS is win32 or win64
251 * 251 *
252 * @return true if 252 * @return true if
253 */ 253 */
254BOOL 254BOOL
255is_win64 () 255is_win64 ()
256{ 256{
257#if defined(_WIN64) 257#if defined(_WIN64)
258 //this is a win64 binary, 258 //this is a win64 binary,
259 return TRUE; 259 return TRUE;
260#elif defined(_WIN32) 260#elif defined(_WIN32)
261 //this is a 32bit binary, and we need to check if we are running in WOW64 261 //this is a 32bit binary, and we need to check if we are running in WOW64
262 BOOL success = FALSE; 262 BOOL success = FALSE;
263 BOOL on_wow64 = FALSE; 263 BOOL on_wow64 = FALSE;
264 LPFN_ISWOW64PROCESS IsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress (GetModuleHandle ("kernel32"), "IsWow64Process"); 264 LPFN_ISWOW64PROCESS IsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress (GetModuleHandle ("kernel32"), "IsWow64Process");
265 265
266 if (NULL != IsWow64Process) 266 if (NULL != IsWow64Process)
267 success = IsWow64Process (GetCurrentProcess (), &on_wow64); 267 success = IsWow64Process (GetCurrentProcess (), &on_wow64);
268 268
269 return success && on_wow64; 269 return success && on_wow64;
270#endif 270#endif
271} 271}
272/** 272/**
273 * Wrapper for executing a shellcommand in windows. 273 * Wrapper for executing a shellcommand in windows.
274 * 274 *
275 * @param command - the command + parameters to execute 275 * @param command - the command + parameters to execute
276 * @return * exitcode of the program executed, 276 * @return * exitcode of the program executed,
277 * * EINVAL (cmd/file not found) 277 * * EINVAL (cmd/file not found)
278 * * EPIPE (could not read STDOUT) 278 * * EPIPE (could not read STDOUT)
279 */ 279 */
@@ -393,7 +393,7 @@ set_address4 (const char *address, const char *mask)
393 strerror (errno)); 393 strerror (errno));
394 return -1; 394 return -1;
395 } 395 }
396 // Set Device to Subnet-Mode? 396 // Set Device to Subnet-Mode?
397 // do we really need tun.c:2925 ? 397 // do we really need tun.c:2925 ?
398 398
399 /* 399 /*
@@ -445,8 +445,8 @@ remove_address4 (const char *address)
445 445
446 446
447/** 447/**
448 * Setup a new virtual interface to use for tunneling. 448 * Setup a new virtual interface to use for tunneling.
449 * 449 *
450 * @return: TRUE if setup was successful, else FALSE 450 * @return: TRUE if setup was successful, else FALSE
451 */ 451 */
452static BOOL 452static BOOL
@@ -454,7 +454,7 @@ setup_interface ()
454{ 454{
455 /* 455 /*
456 * where to find our inf-file. (+ the "full" path, after windows found") 456 * where to find our inf-file. (+ the "full" path, after windows found")
457 * 457 *
458 * We do not directly input all the props here, because openvpn will update 458 * We do not directly input all the props here, because openvpn will update
459 * these details over time. 459 * these details over time.
460 */ 460 */
@@ -465,22 +465,22 @@ setup_interface ()
465 GUID class_guid; 465 GUID class_guid;
466 int str_length = 0; 466 int str_length = 0;
467 467
468 /** 468 /**
469 * Set the device's hardware ID and add it to a list. 469 * Set the device's hardware ID and add it to a list.
470 * This information will later on identify this device in registry. 470 * This information will later on identify this device in registry.
471 */ 471 */
472 strncpy (hwidlist, HARDWARE_ID, LINE_LEN); 472 strncpy (hwidlist, HARDWARE_ID, LINE_LEN);
473 /** 473 /**
474 * this is kind of over-complicated, but allows keeps things independent of 474 * this is kind of over-complicated, but allows keeps things independent of
475 * how the openvpn-hwid is actually stored. 475 * how the openvpn-hwid is actually stored.
476 * 476 *
477 * A HWID list is double-\0 terminated and \0 separated 477 * A HWID list is double-\0 terminated and \0 separated
478 */ 478 */
479 str_length = strlen (hwidlist) + 1; 479 str_length = strlen (hwidlist) + 1;
480 strncpy (&hwidlist[str_length], secondary_hwid, LINE_LEN); 480 strncpy (&hwidlist[str_length], secondary_hwid, LINE_LEN);
481 str_length += strlen (&hwidlist[str_length]) + 1; 481 str_length += strlen (&hwidlist[str_length]) + 1;
482 482
483 /** 483 /**
484 * Locate the inf-file, we need to store it somewhere where the system can 484 * Locate the inf-file, we need to store it somewhere where the system can
485 * find it. We need to pick the correct driver for win32/win64. 485 * find it. We need to pick the correct driver for win32/win64.
486 */ 486 */
@@ -490,7 +490,7 @@ setup_interface ()
490 GetFullPathNameA (INF_FILE, MAX_PATH, inf_file_path, &temp_inf_filename); 490 GetFullPathNameA (INF_FILE, MAX_PATH, inf_file_path, &temp_inf_filename);
491 491
492 fprintf (stderr, "INFO: Located our driver's .inf file at %s\n", inf_file_path); 492 fprintf (stderr, "INFO: Located our driver's .inf file at %s\n", inf_file_path);
493 /** 493 /**
494 * Bootstrap our device info using the drivers inf-file 494 * Bootstrap our device info using the drivers inf-file
495 */ 495 */
496 if ( ! SetupDiGetINFClassA (inf_file_path, 496 if ( ! SetupDiGetINFClassA (inf_file_path,
@@ -499,9 +499,9 @@ setup_interface ()
499 NULL)) 499 NULL))
500 return FALSE; 500 return FALSE;
501 501
502 /** 502 /**
503 * Collect all the other needed information... 503 * Collect all the other needed information...
504 * let the system fill our this form 504 * let the system fill our this form
505 */ 505 */
506 DeviceInfo = SetupDiCreateDeviceInfoList (&class_guid, NULL); 506 DeviceInfo = SetupDiCreateDeviceInfoList (&class_guid, NULL);
507 if (DeviceInfo == INVALID_HANDLE_VALUE) 507 if (DeviceInfo == INVALID_HANDLE_VALUE)
@@ -546,9 +546,9 @@ setup_interface ()
546 546
547 547
548/** 548/**
549 * Remove our new virtual interface to use for tunneling. 549 * Remove our new virtual interface to use for tunneling.
550 * This function must be called AFTER setup_interface! 550 * This function must be called AFTER setup_interface!
551 * 551 *
552 * @return: TRUE if destruction was successful, else FALSE 552 * @return: TRUE if destruction was successful, else FALSE
553 */ 553 */
554static BOOL 554static BOOL
@@ -564,7 +564,7 @@ remove_interface ()
564 remove.Scope = DI_REMOVEDEVICE_GLOBAL; 564 remove.Scope = DI_REMOVEDEVICE_GLOBAL;
565 remove.ClassInstallHeader.InstallFunction = DIF_REMOVE; 565 remove.ClassInstallHeader.InstallFunction = DIF_REMOVE;
566 /* 566 /*
567 * 1. Prepare our existing device information set, and place the 567 * 1. Prepare our existing device information set, and place the
568 * uninstall related information into the structure 568 * uninstall related information into the structure
569 */ 569 */
570 if ( ! SetupDiSetClassInstallParamsA (DeviceInfo, 570 if ( ! SetupDiSetClassInstallParamsA (DeviceInfo,
@@ -581,7 +581,7 @@ remove_interface ()
581 return FALSE; 581 return FALSE;
582 582
583 SetupDiDestroyDeviceInfoList (DeviceInfo); 583 SetupDiDestroyDeviceInfoList (DeviceInfo);
584 584
585 fprintf (stderr, "DEBUG: removed interface successfully\n"); 585 fprintf (stderr, "DEBUG: removed interface successfully\n");
586 586
587 return TRUE; 587 return TRUE;
@@ -590,8 +590,8 @@ remove_interface ()
590 590
591/** 591/**
592 * Do all the lookup necessary to retrieve the inteface's actual name 592 * Do all the lookup necessary to retrieve the inteface's actual name
593 * off the registry. 593 * off the registry.
594 * 594 *
595 * @return: TRUE if we were able to lookup the interface's name, else FALSE 595 * @return: TRUE if we were able to lookup the interface's name, else FALSE
596 */ 596 */
597static BOOL 597static BOOL
@@ -615,7 +615,7 @@ resolve_interface_name ()
615 0, //must be 0 615 0, //must be 0
616 NULL)) //hMachine, we are local 616 NULL)) //hMachine, we are local
617 return FALSE; 617 return FALSE;
618 618
619 fprintf (stderr, "DEBUG: Resolving interface name for network device %s\n",pnp_instance_id); 619 fprintf (stderr, "DEBUG: Resolving interface name for network device %s\n",pnp_instance_id);
620 620
621 /* Registry is incredibly slow, retry for up to 30 seconds to allow registry to refresh */ 621 /* Registry is incredibly slow, retry for up to 30 seconds to allow registry to refresh */
@@ -633,7 +633,7 @@ resolve_interface_name ()
633 &adapter_key_handle)) 633 &adapter_key_handle))
634 return FALSE; 634 return FALSE;
635 635
636 /* Of course there is a multitude of entries here, with arbitrary names, 636 /* Of course there is a multitude of entries here, with arbitrary names,
637 * thus we need to iterate through there. 637 * thus we need to iterate through there.
638 */ 638 */
639 while (!retval) 639 while (!retval)
@@ -658,7 +658,7 @@ resolve_interface_name ()
658 NULL, 658 NULL,
659 NULL); 659 NULL);
660 660
661 /* this may fail due to one of two reasons: 661 /* this may fail due to one of two reasons:
662 * we are at the end of the list*/ 662 * we are at the end of the list*/
663 if (ERROR_NO_MORE_ITEMS == status) 663 if (ERROR_NO_MORE_ITEMS == status)
664 break; 664 break;
@@ -709,8 +709,8 @@ resolve_interface_name ()
709 if (status != ERROR_SUCCESS || data_type != REG_SZ) 709 if (status != ERROR_SUCCESS || data_type != REG_SZ)
710 goto cleanup; 710 goto cleanup;
711 711
712 /* 712 /*
713 * we have successfully found OUR instance, 713 * we have successfully found OUR instance,
714 * save the device GUID before exiting 714 * save the device GUID before exiting
715 */ 715 */
716 716
@@ -732,7 +732,7 @@ cleanup:
732 732
733/** 733/**
734 * Determines the version of the installed TAP32 driver and checks if it's sufficiently new for GNUNET 734 * Determines the version of the installed TAP32 driver and checks if it's sufficiently new for GNUNET
735 * 735 *
736 * @param handle the handle to our tap device 736 * @param handle the handle to our tap device
737 * @return TRUE if the version is sufficient, else FALSE 737 * @return TRUE if the version is sufficient, else FALSE
738 */ 738 */
@@ -758,7 +758,7 @@ check_tapw32_version (HANDLE handle)
758 TAP_WIN_MIN_MINOR); 758 TAP_WIN_MIN_MINOR);
759 return FALSE; 759 return FALSE;
760 } 760 }
761 761
762 return TRUE; 762 return TRUE;
763} 763}
764 764
@@ -824,8 +824,8 @@ init_tun ()
824 824
825/** 825/**
826 * Brings a TAP device up and sets it to connected state. 826 * Brings a TAP device up and sets it to connected state.
827 * 827 *
828 * @param handle the handle to our TAP device 828 * @param handle the handle to our TAP device
829 * @return True if the operation succeeded, else false 829 * @return True if the operation succeeded, else false
830 */ 830 */
831static BOOL 831static BOOL
@@ -851,25 +851,25 @@ tun_up (HANDLE handle)
851 851
852/** 852/**
853 * Attempts to read off an input facility (tap or named pipe) in overlapped mode. 853 * Attempts to read off an input facility (tap or named pipe) in overlapped mode.
854 * 854 *
855 * 1. 855 * 1.
856 * If the input facility is in IOSTATE_READY, it will issue a new read operation to the 856 * If the input facility is in IOSTATE_READY, it will issue a new read operation to the
857 * input handle. Then it goes into IOSTATE_QUEUED state. 857 * input handle. Then it goes into IOSTATE_QUEUED state.
858 * In case the read succeeded instantly the input facility enters 3. 858 * In case the read succeeded instantly the input facility enters 3.
859 * 859 *
860 * 2. 860 * 2.
861 * If the input facility is in IOSTATE_QUEUED state, it will check if the queued read has finished already. 861 * If the input facility is in IOSTATE_QUEUED state, it will check if the queued read has finished already.
862 * If it has finished, go to state 3. 862 * If it has finished, go to state 3.
863 * If it has failed, set IOSTATE_FAILED 863 * If it has failed, set IOSTATE_FAILED
864 * 864 *
865 * 3. 865 * 3.
866 * If the output facility is in state IOSTATE_READY, the read-buffer is copied to the output buffer. 866 * If the output facility is in state IOSTATE_READY, the read-buffer is copied to the output buffer.
867 * The input facility enters state IOSTATE_READY 867 * The input facility enters state IOSTATE_READY
868 * The output facility enters state IOSTATE_READY 868 * The output facility enters state IOSTATE_READY
869 * If the output facility is in state IOSTATE_QUEUED, the input facility enters IOSTATE_WAITING 869 * If the output facility is in state IOSTATE_QUEUED, the input facility enters IOSTATE_WAITING
870 * 870 *
871 * IOSTATE_WAITING is reset by the output facility, once it has completed. 871 * IOSTATE_WAITING is reset by the output facility, once it has completed.
872 * 872 *
873 * @param input_facility input named pipe or file to work with. 873 * @param input_facility input named pipe or file to work with.
874 * @param output_facility output pipe or file to hand over data to. 874 * @param output_facility output pipe or file to hand over data to.
875 * @return false if an event reset was impossible (OS error), else true 875 * @return false if an event reset was impossible (OS error), else true
@@ -880,11 +880,11 @@ attempt_read_tap (struct io_facility * input_facility,
880{ 880{
881 struct GNUNET_MessageHeader * hdr; 881 struct GNUNET_MessageHeader * hdr;
882 unsigned short size; 882 unsigned short size;
883 883
884 switch (input_facility->facility_state) 884 switch (input_facility->facility_state)
885 { 885 {
886 case IOSTATE_READY: 886 case IOSTATE_READY:
887 { 887 {
888 if (! ResetEvent (input_facility->overlapped.hEvent)) 888 if (! ResetEvent (input_facility->overlapped.hEvent))
889 { 889 {
890 return FALSE; 890 return FALSE;
@@ -903,9 +903,9 @@ attempt_read_tap (struct io_facility * input_facility,
903 /* reset event manually*/ 903 /* reset event manually*/
904 if (! SetEvent (input_facility->overlapped.hEvent)) 904 if (! SetEvent (input_facility->overlapped.hEvent))
905 return FALSE; 905 return FALSE;
906 906
907 fprintf (stderr, "DEBUG: tap read succeeded immediately\n"); 907 fprintf (stderr, "DEBUG: tap read succeeded immediately\n");
908 908
909 /* we successfully read something from the TAP and now need to 909 /* we successfully read something from the TAP and now need to
910 * send it our via STDOUT. Is that possible at the moment? */ 910 * send it our via STDOUT. Is that possible at the moment? */
911 if ((IOSTATE_READY == output_facility->facility_state || 911 if ((IOSTATE_READY == output_facility->facility_state ||
@@ -914,7 +914,7 @@ attempt_read_tap (struct io_facility * input_facility,
914 { /* hand over this buffers content and apply message header for gnunet */ 914 { /* hand over this buffers content and apply message header for gnunet */
915 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer; 915 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer;
916 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader); 916 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader);
917 917
918 memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader), 918 memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
919 input_facility->buffer, 919 input_facility->buffer,
920 input_facility->buffer_size); 920 input_facility->buffer_size);
@@ -961,7 +961,7 @@ attempt_read_tap (struct io_facility * input_facility,
961 return FALSE; 961 return FALSE;
962 962
963 fprintf (stderr, "DEBUG: tap read succeeded delayed\n"); 963 fprintf (stderr, "DEBUG: tap read succeeded delayed\n");
964 964
965 /* we successfully read something from the TAP and now need to 965 /* we successfully read something from the TAP and now need to
966 * send it our via STDOUT. Is that possible at the moment? */ 966 * send it our via STDOUT. Is that possible at the moment? */
967 if ((IOSTATE_READY == output_facility->facility_state || 967 if ((IOSTATE_READY == output_facility->facility_state ||
@@ -970,7 +970,7 @@ attempt_read_tap (struct io_facility * input_facility,
970 { /* hand over this buffers content and apply message header for gnunet */ 970 { /* hand over this buffers content and apply message header for gnunet */
971 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer; 971 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer;
972 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader); 972 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader);
973 973
974 memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader), 974 memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
975 input_facility->buffer, 975 input_facility->buffer,
976 input_facility->buffer_size); 976 input_facility->buffer_size);
@@ -1023,26 +1023,26 @@ attempt_read_tap (struct io_facility * input_facility,
1023 1023
1024/** 1024/**
1025 * Attempts to read off an input facility (tap or named pipe) in overlapped mode. 1025 * Attempts to read off an input facility (tap or named pipe) in overlapped mode.
1026 * 1026 *
1027 * 1. 1027 * 1.
1028 * If the input facility is in IOSTATE_READY, it will issue a new read operation to the 1028 * If the input facility is in IOSTATE_READY, it will issue a new read operation to the
1029 * input handle. Then it goes into IOSTATE_QUEUED state. 1029 * input handle. Then it goes into IOSTATE_QUEUED state.
1030 * In case the read succeeded instantly the input facility enters 3. 1030 * In case the read succeeded instantly the input facility enters 3.
1031 * 1031 *
1032 * 2. 1032 * 2.
1033 * If the input facility is in IOSTATE_QUEUED state, it will check if the queued read has finished already. 1033 * If the input facility is in IOSTATE_QUEUED state, it will check if the queued read has finished already.
1034 * If it has finished, go to state 3. 1034 * If it has finished, go to state 3.
1035 * If it has failed, set IOSTATE_FAILED 1035 * If it has failed, set IOSTATE_FAILED
1036 * 1036 *
1037 * 3. 1037 * 3.
1038 * If the facility is finished with ready 1038 * If the facility is finished with ready
1039 * The read-buffer is copied to the output buffer, except for the GNUNET_MessageHeader. 1039 * The read-buffer is copied to the output buffer, except for the GNUNET_MessageHeader.
1040 * The input facility enters state IOSTATE_READY 1040 * The input facility enters state IOSTATE_READY
1041 * The output facility enters state IOSTATE_READY 1041 * The output facility enters state IOSTATE_READY
1042 * If the output facility is in state IOSTATE_QUEUED, the input facility enters IOSTATE_WAITING 1042 * If the output facility is in state IOSTATE_QUEUED, the input facility enters IOSTATE_WAITING
1043 * 1043 *
1044 * IOSTATE_WAITING is reset by the output facility, once it has completed. 1044 * IOSTATE_WAITING is reset by the output facility, once it has completed.
1045 * 1045 *
1046 * @param input_facility input named pipe or file to work with. 1046 * @param input_facility input named pipe or file to work with.
1047 * @param output_facility output pipe or file to hand over data to. 1047 * @param output_facility output pipe or file to hand over data to.
1048 * @return false if an event reset was impossible (OS error), else true 1048 * @return false if an event reset was impossible (OS error), else true
@@ -1052,17 +1052,17 @@ attempt_read_stdin (struct io_facility * input_facility,
1052 struct io_facility * output_facility) 1052 struct io_facility * output_facility)
1053{ 1053{
1054 struct GNUNET_MessageHeader * hdr; 1054 struct GNUNET_MessageHeader * hdr;
1055 1055
1056 switch (input_facility->facility_state) 1056 switch (input_facility->facility_state)
1057 { 1057 {
1058 case IOSTATE_READY: 1058 case IOSTATE_READY:
1059 { 1059 {
1060 input_facility->buffer_size = 0; 1060 input_facility->buffer_size = 0;
1061 1061
1062partial_read_iostate_ready: 1062partial_read_iostate_ready:
1063 if (! ResetEvent (input_facility->overlapped.hEvent)) 1063 if (! ResetEvent (input_facility->overlapped.hEvent))
1064 return FALSE; 1064 return FALSE;
1065 1065
1066 /* Check how the task is handled */ 1066 /* Check how the task is handled */
1067 if (ReadFile (input_facility->handle, 1067 if (ReadFile (input_facility->handle,
1068 input_facility->buffer + input_facility->buffer_size, 1068 input_facility->buffer + input_facility->buffer_size,
@@ -1110,7 +1110,7 @@ partial_read_iostate_ready:
1110 input_facility->facility_state = IOSTATE_WAITING; 1110 input_facility->facility_state = IOSTATE_WAITING;
1111 else /* we read nothing */ 1111 else /* we read nothing */
1112 input_facility->facility_state = IOSTATE_READY; 1112 input_facility->facility_state = IOSTATE_READY;
1113 } 1113 }
1114 else /* operation was either queued or failed*/ 1114 else /* operation was either queued or failed*/
1115 { 1115 {
1116 int err = GetLastError (); 1116 int err = GetLastError ();
@@ -1138,13 +1138,13 @@ partial_read_iostate_ready:
1138 FALSE)) 1138 FALSE))
1139 {/* successful return for a queued operation */ 1139 {/* successful return for a queued operation */
1140 hdr = (struct GNUNET_MessageHeader *) input_facility->buffer; 1140 hdr = (struct GNUNET_MessageHeader *) input_facility->buffer;
1141 1141
1142 if (! ResetEvent (input_facility->overlapped.hEvent)) 1142 if (! ResetEvent (input_facility->overlapped.hEvent))
1143 return FALSE; 1143 return FALSE;
1144 1144
1145 fprintf (stderr, "DEBUG: stdin read succeeded delayed\n"); 1145 fprintf (stderr, "DEBUG: stdin read succeeded delayed\n");
1146 input_facility->buffer_size += input_facility->buffer_size_processed; 1146 input_facility->buffer_size += input_facility->buffer_size_processed;
1147 1147
1148 if ((ntohs (hdr->type) != GNUNET_MESSAGE_TYPE_VPN_HELPER) || 1148 if ((ntohs (hdr->type) != GNUNET_MESSAGE_TYPE_VPN_HELPER) ||
1149 (ntohs (hdr->size) > sizeof (input_facility->buffer))) 1149 (ntohs (hdr->size) > sizeof (input_facility->buffer)))
1150 { 1150 {
@@ -1206,7 +1206,7 @@ partial_read_iostate_ready:
1206 * Attempts to write to an output facility (tap or named pipe) in overlapped mode. 1206 * Attempts to write to an output facility (tap or named pipe) in overlapped mode.
1207 * 1207 *
1208 * TODO: high level description 1208 * TODO: high level description
1209 * 1209 *
1210 * @param output_facility output pipe or file to hand over data to. 1210 * @param output_facility output pipe or file to hand over data to.
1211 * @param input_facility input named pipe or file to work with. 1211 * @param input_facility input named pipe or file to work with.
1212 * @return false if an event reset was impossible (OS error), else true 1212 * @return false if an event reset was impossible (OS error), else true
@@ -1219,7 +1219,7 @@ attempt_write (struct io_facility * output_facility,
1219 { 1219 {
1220 case IOSTATE_READY: 1220 case IOSTATE_READY:
1221 output_facility->buffer_size_written = 0; 1221 output_facility->buffer_size_written = 0;
1222 1222
1223continue_partial_write: 1223continue_partial_write:
1224 if (! ResetEvent (output_facility->overlapped.hEvent)) 1224 if (! ResetEvent (output_facility->overlapped.hEvent))
1225 return FALSE; 1225 return FALSE;
@@ -1234,7 +1234,7 @@ continue_partial_write:
1234 1234
1235 fprintf (stderr, "DEBUG: write succeeded immediately\n"); 1235 fprintf (stderr, "DEBUG: write succeeded immediately\n");
1236 output_facility->buffer_size_written += output_facility->buffer_size_processed; 1236 output_facility->buffer_size_written += output_facility->buffer_size_processed;
1237 1237
1238 /* reset event manually*/ 1238 /* reset event manually*/
1239 if (! SetEvent (output_facility->overlapped.hEvent)) 1239 if (! SetEvent (output_facility->overlapped.hEvent))
1240 return FALSE; 1240 return FALSE;
@@ -1242,7 +1242,7 @@ continue_partial_write:
1242 /* partial write */ 1242 /* partial write */
1243 if (output_facility->buffer_size_written < output_facility->buffer_size) 1243 if (output_facility->buffer_size_written < output_facility->buffer_size)
1244 goto continue_partial_write; 1244 goto continue_partial_write;
1245 1245
1246 /* we are now waiting for our buffer to be filled*/ 1246 /* we are now waiting for our buffer to be filled*/
1247 output_facility->facility_state = IOSTATE_WAITING; 1247 output_facility->facility_state = IOSTATE_WAITING;
1248 1248
@@ -1269,7 +1269,7 @@ continue_partial_write:
1269 return TRUE; 1269 return TRUE;
1270 case IOSTATE_QUEUED: 1270 case IOSTATE_QUEUED:
1271 // there was an operation going on already, check if that has completed now. 1271 // there was an operation going on already, check if that has completed now.
1272 1272
1273 if (GetOverlappedResult (output_facility->handle, 1273 if (GetOverlappedResult (output_facility->handle,
1274 &output_facility->overlapped, 1274 &output_facility->overlapped,
1275 &output_facility->buffer_size_processed, 1275 &output_facility->buffer_size_processed,
@@ -1277,17 +1277,17 @@ continue_partial_write:
1277 {/* successful return for a queued operation */ 1277 {/* successful return for a queued operation */
1278 if (! ResetEvent (output_facility->overlapped.hEvent)) 1278 if (! ResetEvent (output_facility->overlapped.hEvent))
1279 return FALSE; 1279 return FALSE;
1280 1280
1281 fprintf (stderr, "DEBUG: write succeeded delayed\n"); 1281 fprintf (stderr, "DEBUG: write succeeded delayed\n");
1282 output_facility->buffer_size_written += output_facility->buffer_size_processed; 1282 output_facility->buffer_size_written += output_facility->buffer_size_processed;
1283 1283
1284 /* partial write */ 1284 /* partial write */
1285 if (output_facility->buffer_size_written < output_facility->buffer_size) 1285 if (output_facility->buffer_size_written < output_facility->buffer_size)
1286 goto continue_partial_write; 1286 goto continue_partial_write;
1287 1287
1288 /* we are now waiting for our buffer to be filled*/ 1288 /* we are now waiting for our buffer to be filled*/
1289 output_facility->facility_state = IOSTATE_WAITING; 1289 output_facility->facility_state = IOSTATE_WAITING;
1290 1290
1291 /* we successfully wrote something and now need to reset our reader */ 1291 /* we successfully wrote something and now need to reset our reader */
1292 if (IOSTATE_WAITING == input_facility->facility_state) 1292 if (IOSTATE_WAITING == input_facility->facility_state)
1293 input_facility->facility_state = IOSTATE_RESUME; 1293 input_facility->facility_state = IOSTATE_RESUME;
@@ -1304,7 +1304,7 @@ continue_partial_write:
1304 fprintf (stderr, "FATAL: Write to handle failed, exiting\n"); 1304 fprintf (stderr, "FATAL: Write to handle failed, exiting\n");
1305 } 1305 }
1306 } 1306 }
1307 default: 1307 default:
1308 return TRUE; 1308 return TRUE;
1309 } 1309 }
1310} 1310}
@@ -1312,7 +1312,7 @@ continue_partial_write:
1312 1312
1313/** 1313/**
1314 * Initialize a overlapped structure 1314 * Initialize a overlapped structure
1315 * 1315 *
1316 * @param elem the element to initilize 1316 * @param elem the element to initilize
1317 * @param initial_state the initial state for this instance 1317 * @param initial_state the initial state for this instance
1318 * @param signaled if the hEvent created should default to signaled or not 1318 * @param signaled if the hEvent created should default to signaled or not
@@ -1358,13 +1358,13 @@ run (HANDLE tap_handle)
1358 /* tun up: */ 1358 /* tun up: */
1359 /* we do this HERE and not beforehand (in init_tun()), in contrast to openvpn 1359 /* we do this HERE and not beforehand (in init_tun()), in contrast to openvpn
1360 * to remove the need to flush the arp cache, handle DHCP and wrong IPs. 1360 * to remove the need to flush the arp cache, handle DHCP and wrong IPs.
1361 * 1361 *
1362 * DHCP and such are all features we will never use in gnunet afaik. 1362 * DHCP and such are all features we will never use in gnunet afaik.
1363 * But for openvpn those are essential. 1363 * But for openvpn those are essential.
1364 */ 1364 */
1365 if ((privilege_testing) || (! tun_up (tap_handle) )) 1365 if ((privilege_testing) || (! tun_up (tap_handle) ))
1366 goto teardown_final; 1366 goto teardown_final;
1367 1367
1368 /* Initialize our overlapped IO structures*/ 1368 /* Initialize our overlapped IO structures*/
1369 if (! (initialize_io_facility (&tap_read, IOSTATE_READY, FALSE) 1369 if (! (initialize_io_facility (&tap_read, IOSTATE_READY, FALSE)
1370 && initialize_io_facility (&tap_write, IOSTATE_WAITING, TRUE) 1370 && initialize_io_facility (&tap_write, IOSTATE_WAITING, TRUE)
@@ -1380,12 +1380,12 @@ run (HANDLE tap_handle)
1380 /* Debug output to console STDIN/STDOUT*/ 1380 /* Debug output to console STDIN/STDOUT*/
1381 std_in.handle = parent_std_in_handle; 1381 std_in.handle = parent_std_in_handle;
1382 std_out.handle = parent_std_out_handle; 1382 std_out.handle = parent_std_out_handle;
1383 1383
1384#else 1384#else
1385 fprintf (stderr, "DEBUG: reopening stdin/out for overlapped IO\n"); 1385 fprintf (stderr, "DEBUG: reopening stdin/out for overlapped IO\n");
1386 /* 1386 /*
1387 * Find out the types of our handles. 1387 * Find out the types of our handles.
1388 * This part is a problem, because in windows we need to handle files, 1388 * This part is a problem, because in windows we need to handle files,
1389 * pipes and the console differently. 1389 * pipes and the console differently.
1390 */ 1390 */
1391 if ((FILE_TYPE_PIPE != GetFileType (parent_std_in_handle)) || 1391 if ((FILE_TYPE_PIPE != GetFileType (parent_std_in_handle)) ||
@@ -1417,9 +1417,9 @@ run (HANDLE tap_handle)
1417 goto teardown; 1417 goto teardown;
1418 } 1418 }
1419#endif 1419#endif
1420 1420
1421 fprintf (stderr, "DEBUG: mainloop has begun\n"); 1421 fprintf (stderr, "DEBUG: mainloop has begun\n");
1422 1422
1423 while (std_out.path_open || tap_write.path_open) 1423 while (std_out.path_open || tap_write.path_open)
1424 { 1424 {
1425 /* perform READ from stdin if possible */ 1425 /* perform READ from stdin if possible */
@@ -1439,15 +1439,15 @@ run (HANDLE tap_handle)
1439 break; 1439 break;
1440 } 1440 }
1441 fprintf (stderr, "DEBUG: teardown initiated\n"); 1441 fprintf (stderr, "DEBUG: teardown initiated\n");
1442 1442
1443teardown: 1443teardown:
1444 1444
1445 CancelIo (tap_handle); 1445 CancelIo (tap_handle);
1446 CancelIo (std_in.handle); 1446 CancelIo (std_in.handle);
1447 CancelIo (std_out.handle); 1447 CancelIo (std_out.handle);
1448 1448
1449teardown_final: 1449teardown_final:
1450 1450
1451 CloseHandle (tap_handle); 1451 CloseHandle (tap_handle);
1452} 1452}
1453 1453
@@ -1474,7 +1474,7 @@ main (int argc, char **argv)
1474 BOOL have_ip4 = FALSE; 1474 BOOL have_ip4 = FALSE;
1475 BOOL have_ip6 = FALSE; 1475 BOOL have_ip6 = FALSE;
1476 BOOL have_nat44 = FALSE; 1476 BOOL have_nat44 = FALSE;
1477 1477
1478 if ( (1 < argc) && (0 != strcmp (argv[1], "-d"))){ 1478 if ( (1 < argc) && (0 != strcmp (argv[1], "-d"))){
1479 privilege_testing = TRUE; 1479 privilege_testing = TRUE;
1480 fprintf (stderr, 1480 fprintf (stderr,
@@ -1483,10 +1483,10 @@ main (int argc, char **argv)
1483 argv++; 1483 argv++;
1484 argc--; 1484 argc--;
1485 } 1485 }
1486 1486
1487 if (6 != argc) 1487 if (6 != argc)
1488 { 1488 {
1489 fprintf (stderr, 1489 fprintf (stderr,
1490 "%s", 1490 "%s",
1491 "FATAL: must supply 6 arguments\nUsage:\ngnunet-helper-exit [-d] <if name prefix> <uplink-interface name> <address6 or \"-\"> <netbits6> <address4 or \"-\"> <netmask4>\n"); 1491 "FATAL: must supply 6 arguments\nUsage:\ngnunet-helper-exit [-d] <if name prefix> <uplink-interface name> <address6 or \"-\"> <netbits6> <address4 or \"-\"> <netmask4>\n");
1492 return 1; 1492 return 1;
@@ -1495,9 +1495,9 @@ main (int argc, char **argv)
1495 strncpy (hwid, argv[1], LINE_LEN); 1495 strncpy (hwid, argv[1], LINE_LEN);
1496 hwid[LINE_LEN - 1] = '\0'; 1496 hwid[LINE_LEN - 1] = '\0';
1497 1497
1498 /* 1498 /*
1499 * We use our PID for finding/resolving the control-panel name of our virtual 1499 * We use our PID for finding/resolving the control-panel name of our virtual
1500 * device. PIDs are (of course) unique at runtime, thus we can safely use it 1500 * device. PIDs are (of course) unique at runtime, thus we can safely use it
1501 * as additional hardware-id for our device. 1501 * as additional hardware-id for our device.
1502 */ 1502 */
1503 snprintf (secondary_hwid, LINE_LEN / 2, "%s-%d", 1503 snprintf (secondary_hwid, LINE_LEN / 2, "%s-%d",
@@ -1558,7 +1558,7 @@ main (int argc, char **argv)
1558 fprintf (stderr, "FATAL: Could not enable forwarding via netsh: %s\n", strerror (local_ret)); 1558 fprintf (stderr, "FATAL: Could not enable forwarding via netsh: %s\n", strerror (local_ret));
1559 goto cleanup; 1559 goto cleanup;
1560 } 1560 }
1561 /* we can keep IPv6 forwarding around, as all interfaces have 1561 /* we can keep IPv6 forwarding around, as all interfaces have
1562 * their forwarding mode reset to false at bootup. */ 1562 * their forwarding mode reset to false at bootup. */
1563 } 1563 }
1564 1564
@@ -1574,11 +1574,11 @@ main (int argc, char **argv)
1574 // setup NAPT, if possible 1574 // setup NAPT, if possible
1575 /* MS has REMOVED the routing/nat capabilities from Vista+, thus 1575 /* MS has REMOVED the routing/nat capabilities from Vista+, thus
1576 * we can not setup NAT like in XP or on the server. Actually the 1576 * we can not setup NAT like in XP or on the server. Actually the
1577 * the only feasible solution seems to be to use 1577 * the only feasible solution seems to be to use
1578 * Internet Connection Sharing, which introduces a horde of problems 1578 * Internet Connection Sharing, which introduces a horde of problems
1579 * such as sending out rogue-RAs on the external interface in an ipv6 1579 * such as sending out rogue-RAs on the external interface in an ipv6
1580 * network. 1580 * network.
1581 * Thus, below stuff ONLY works on 1581 * Thus, below stuff ONLY works on
1582 * WinXP SP3 1582 * WinXP SP3
1583 * Win Server 2003 SP1+ 1583 * Win Server 2003 SP1+
1584 * Win Server 2008 1584 * Win Server 2008
@@ -1637,7 +1637,7 @@ cleanup:
1637 if (0 != local_ret) 1637 if (0 != local_ret)
1638 fprintf(stderr, "WARNING: Could not remove IPv4-NAPT from internal interface, hopefully this will have no effect in future runs: %s\n", strerror(local_ret)); 1638 fprintf(stderr, "WARNING: Could not remove IPv4-NAPT from internal interface, hopefully this will have no effect in future runs: %s\n", strerror(local_ret));
1639 } 1639 }
1640 1640
1641 fprintf(stderr, "DEBUG: Removing IP4 address\n"); 1641 fprintf(stderr, "DEBUG: Removing IP4 address\n");
1642 remove_address4 (address); 1642 remove_address4 (address);
1643 } 1643 }
diff --git a/src/exit/gnunet-helper-exit.c b/src/exit/gnunet-helper-exit.c
index e2a0fd416..e87aac559 100644
--- a/src/exit/gnunet-helper-exit.c
+++ b/src/exit/gnunet-helper-exit.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file exit/gnunet-helper-exit.c 22 * @file exit/gnunet-helper-exit.c
23 * 23 *
24 * @brief the helper for exit nodes. Opens a virtual 24 * @brief the helper for exit nodes. Opens a virtual
25 * network-interface, sends data received on the if to stdout, sends 25 * network-interface, sends data received on the if to stdout, sends
@@ -109,7 +109,7 @@ open_dev_null (int target_fd,
109 if (fd == target_fd) 109 if (fd == target_fd)
110 return; 110 return;
111 if (-1 == dup2 (fd, target_fd)) 111 if (-1 == dup2 (fd, target_fd))
112 { 112 {
113 (void) close (fd); 113 (void) close (fd);
114 abort (); 114 abort ();
115 } 115 }
@@ -119,13 +119,13 @@ open_dev_null (int target_fd,
119 119
120/** 120/**
121 * Run the given command and wait for it to complete. 121 * Run the given command and wait for it to complete.
122 * 122 *
123 * @param file name of the binary to run 123 * @param file name of the binary to run
124 * @param cmd command line arguments (as given to 'execv') 124 * @param cmd command line arguments (as given to 'execv')
125 * @return 0 on success, 1 on any error 125 * @return 0 on success, 1 on any error
126 */ 126 */
127static int 127static int
128fork_and_exec (const char *file, 128fork_and_exec (const char *file,
129 char *const cmd[]) 129 char *const cmd[])
130{ 130{
131 int status; 131 int status;
@@ -135,8 +135,8 @@ fork_and_exec (const char *file,
135 pid = fork (); 135 pid = fork ();
136 if (-1 == pid) 136 if (-1 == pid)
137 { 137 {
138 fprintf (stderr, 138 fprintf (stderr,
139 "fork failed: %s\n", 139 "fork failed: %s\n",
140 strerror (errno)); 140 strerror (errno));
141 return 1; 141 return 1;
142 } 142 }
@@ -145,25 +145,25 @@ fork_and_exec (const char *file,
145 /* we are the child process */ 145 /* we are the child process */
146 /* close stdin/stdout to not cause interference 146 /* close stdin/stdout to not cause interference
147 with the helper's main protocol! */ 147 with the helper's main protocol! */
148 (void) close (0); 148 (void) close (0);
149 open_dev_null (0, O_RDONLY); 149 open_dev_null (0, O_RDONLY);
150 (void) close (1); 150 (void) close (1);
151 open_dev_null (1, O_WRONLY); 151 open_dev_null (1, O_WRONLY);
152 (void) execv (file, cmd); 152 (void) execv (file, cmd);
153 /* can only get here on error */ 153 /* can only get here on error */
154 fprintf (stderr, 154 fprintf (stderr,
155 "exec `%s' failed: %s\n", 155 "exec `%s' failed: %s\n",
156 file, 156 file,
157 strerror (errno)); 157 strerror (errno));
158 _exit (1); 158 _exit (1);
159 } 159 }
160 /* keep running waitpid as long as the only error we get is 'EINTR' */ 160 /* keep running waitpid as long as the only error we get is 'EINTR' */
161 while ( (-1 == (ret = waitpid (pid, &status, 0))) && 161 while ( (-1 == (ret = waitpid (pid, &status, 0))) &&
162 (errno == EINTR) ); 162 (errno == EINTR) );
163 if (-1 == ret) 163 if (-1 == ret)
164 { 164 {
165 fprintf (stderr, 165 fprintf (stderr,
166 "waitpid failed: %s\n", 166 "waitpid failed: %s\n",
167 strerror (errno)); 167 strerror (errno));
168 return 1; 168 return 1;
169 } 169 }
@@ -215,7 +215,7 @@ init_tun (char *dev)
215 215
216 if (-1 == ioctl (fd, TUNSETIFF, (void *) &ifr)) 216 if (-1 == ioctl (fd, TUNSETIFF, (void *) &ifr))
217 { 217 {
218 fprintf (stderr, 218 fprintf (stderr,
219 "Error with ioctl on `%s': %s\n", "/dev/net/tun", 219 "Error with ioctl on `%s': %s\n", "/dev/net/tun",
220 strerror (errno)); 220 strerror (errno));
221 (void) close (fd); 221 (void) close (fd);
@@ -255,7 +255,7 @@ set_address6 (const char *dev, const char *address, unsigned long prefix_len)
255 255
256 if (-1 == (fd = socket (PF_INET6, SOCK_DGRAM, 0))) 256 if (-1 == (fd = socket (PF_INET6, SOCK_DGRAM, 0)))
257 { 257 {
258 fprintf (stderr, "Error creating socket: %s\n", strerror (errno)); 258 fprintf (stderr, "Error creating socket: %s\n", strerror (errno));
259 exit (1); 259 exit (1);
260 } 260 }
261 261
@@ -669,7 +669,7 @@ main (int argc, char **argv)
669 sbin_iptables = "/usr/sbin/iptables"; 669 sbin_iptables = "/usr/sbin/iptables";
670 else 670 else
671 { 671 {
672 fprintf (stderr, 672 fprintf (stderr,
673 "Fatal: executable iptables not found in approved directories: %s\n", 673 "Fatal: executable iptables not found in approved directories: %s\n",
674 strerror (errno)); 674 strerror (errno));
675 return 1; 675 return 1;
@@ -691,7 +691,7 @@ main (int argc, char **argv)
691 691
692 if (-1 == (fd_tun = init_tun (dev))) 692 if (-1 == (fd_tun = init_tun (dev)))
693 { 693 {
694 fprintf (stderr, 694 fprintf (stderr,
695 "Fatal: could not initialize tun-interface `%s' with IPv6 %s/%s and IPv4 %s/%s\n", 695 "Fatal: could not initialize tun-interface `%s' with IPv6 %s/%s and IPv4 %s/%s\n",
696 dev, 696 dev,
697 argv[3], 697 argv[3],
@@ -706,13 +706,13 @@ main (int argc, char **argv)
706 { 706 {
707 const char *address = argv[3]; 707 const char *address = argv[3];
708 long prefix_len = atol (argv[4]); 708 long prefix_len = atol (argv[4]);
709 709
710 if ((prefix_len < 1) || (prefix_len > 127)) 710 if ((prefix_len < 1) || (prefix_len > 127))
711 { 711 {
712 fprintf (stderr, "Fatal: prefix_len out of range\n"); 712 fprintf (stderr, "Fatal: prefix_len out of range\n");
713 return 1; 713 return 1;
714 } 714 }
715 set_address6 (dev, address, prefix_len); 715 set_address6 (dev, address, prefix_len);
716 } 716 }
717 { 717 {
718 char *const sysctl_args[] = 718 char *const sysctl_args[] =
@@ -724,7 +724,7 @@ main (int argc, char **argv)
724 { 724 {
725 fprintf (stderr, 725 fprintf (stderr,
726 "Failed to enable IPv6 forwarding. Will continue anyway.\n"); 726 "Failed to enable IPv6 forwarding. Will continue anyway.\n");
727 } 727 }
728 } 728 }
729 } 729 }
730 730
@@ -733,7 +733,7 @@ main (int argc, char **argv)
733 { 733 {
734 const char *address = argv[5]; 734 const char *address = argv[5];
735 const char *mask = argv[6]; 735 const char *mask = argv[6];
736 736
737 set_address4 (dev, address, mask); 737 set_address4 (dev, address, mask);
738 } 738 }
739 { 739 {
@@ -746,7 +746,7 @@ main (int argc, char **argv)
746 { 746 {
747 fprintf (stderr, 747 fprintf (stderr,
748 "Failed to enable IPv4 forwarding. Will continue anyway.\n"); 748 "Failed to enable IPv4 forwarding. Will continue anyway.\n");
749 } 749 }
750 } 750 }
751 if (0 != strcmp (argv[2], "-")) 751 if (0 != strcmp (argv[2], "-"))
752 { 752 {
@@ -759,10 +759,10 @@ main (int argc, char **argv)
759 { 759 {
760 fprintf (stderr, 760 fprintf (stderr,
761 "Failed to enable IPv4 masquerading (NAT). Will continue anyway.\n"); 761 "Failed to enable IPv4 masquerading (NAT). Will continue anyway.\n");
762 } 762 }
763 } 763 }
764 } 764 }
765 765
766 uid_t uid = getuid (); 766 uid_t uid = getuid ();
767#ifdef HAVE_SETRESUID 767#ifdef HAVE_SETRESUID
768 if (0 != setresuid (uid, uid, uid)) 768 if (0 != setresuid (uid, uid, uid))
diff --git a/src/experimentation/gnunet-daemon-experimentation.h b/src/experimentation/gnunet-daemon-experimentation.h
index 9886f5d5d..86e41a114 100644
--- a/src/experimentation/gnunet-daemon-experimentation.h
+++ b/src/experimentation/gnunet-daemon-experimentation.h
@@ -89,54 +89,54 @@ struct Experiment
89 /* Header */ 89 /* Header */
90 /* ----------------- */ 90 /* ----------------- */
91 char *name; 91 char *name;
92 92
93 /** 93 /**
94 * Experiment issuer 94 * Experiment issuer
95 */ 95 */
96 struct GNUNET_CRYPTO_EccPublicSignKey issuer; 96 struct GNUNET_CRYPTO_EccPublicSignKey issuer;
97 97
98 /** 98 /**
99 * Experiment version as timestamp of creation 99 * Experiment version as timestamp of creation
100 */ 100 */
101 struct GNUNET_TIME_Absolute version; 101 struct GNUNET_TIME_Absolute version;
102 102
103 /** 103 /**
104 * Description 104 * Description
105 */ 105 */
106 char *description; 106 char *description;
107 107
108 /** 108 /**
109 * Required capabilities 109 * Required capabilities
110 */ 110 */
111 uint32_t required_capabilities; 111 uint32_t required_capabilities;
112 112
113 /* Experiment timing */ 113 /* Experiment timing */
114 /* ----------------- */ 114 /* ----------------- */
115 115
116 /** 116 /**
117 * When to start experiment 117 * When to start experiment
118 */ 118 */
119 struct GNUNET_TIME_Absolute start; 119 struct GNUNET_TIME_Absolute start;
120 120
121 /** 121 /**
122 * When to end experiment 122 * When to end experiment
123 */ 123 */
124 struct GNUNET_TIME_Absolute stop; 124 struct GNUNET_TIME_Absolute stop;
125 125
126 /** 126 /**
127 * How often to run experiment 127 * How often to run experiment
128 */ 128 */
129 struct GNUNET_TIME_Relative frequency; 129 struct GNUNET_TIME_Relative frequency;
130 130
131 /** 131 /**
132 * How long to run each execution 132 * How long to run each execution
133 */ 133 */
134 struct GNUNET_TIME_Relative duration; 134 struct GNUNET_TIME_Relative duration;
135 135
136 136
137 /* Experiment itself */ 137 /* Experiment itself */
138 /* ----------------- */ 138 /* ----------------- */
139 139
140 /* TBD */ 140 /* TBD */
141}; 141};
142 142
@@ -150,34 +150,34 @@ struct Node
150 * Peer id 150 * Peer id
151 */ 151 */
152 struct GNUNET_PeerIdentity id; 152 struct GNUNET_PeerIdentity id;
153 153
154 /** 154 /**
155 * Task for response timeout 155 * Task for response timeout
156 */ 156 */
157 GNUNET_SCHEDULER_TaskIdentifier timeout_task; 157 GNUNET_SCHEDULER_TaskIdentifier timeout_task;
158 158
159 /** 159 /**
160 * Core transmission handle 160 * Core transmission handle
161 */ 161 */
162 struct GNUNET_CORE_TransmitHandle *cth; 162 struct GNUNET_CORE_TransmitHandle *cth;
163 163
164 /** 164 /**
165 * Node capabilities 165 * Node capabilities
166 */ 166 */
167 uint32_t capabilities; 167 uint32_t capabilities;
168 168
169 /** 169 /**
170 * Experiment version as timestamp of creation 170 * Experiment version as timestamp of creation
171 */ 171 */
172 struct GNUNET_TIME_Absolute version; 172 struct GNUNET_TIME_Absolute version;
173 173
174 struct NodeComCtx *e_req_head; 174 struct NodeComCtx *e_req_head;
175 175
176 struct NodeComCtx *e_req_tail; 176 struct NodeComCtx *e_req_tail;
177 177
178 /** 178 /**
179 * Array of issuers accepted by this neighbor. 179 * Array of issuers accepted by this neighbor.
180 */ 180 */
181 struct GNUNET_CRYPTO_EccPublicSignKey *issuer_id; 181 struct GNUNET_CRYPTO_EccPublicSignKey *issuer_id;
182 182
183 unsigned int issuer_count; 183 unsigned int issuer_count;
@@ -198,9 +198,9 @@ GNUNET_NETWORK_STRUCT_BEGIN
198struct Experimentation_Request 198struct Experimentation_Request
199{ 199{
200 struct GNUNET_MessageHeader msg; 200 struct GNUNET_MessageHeader msg;
201 201
202 uint32_t capabilities GNUNET_PACKED; 202 uint32_t capabilities GNUNET_PACKED;
203 203
204 uint32_t issuer_count GNUNET_PACKED; 204 uint32_t issuer_count GNUNET_PACKED;
205}; 205};
206 206
@@ -215,9 +215,9 @@ struct Experimentation_Request
215struct Experimentation_Response 215struct Experimentation_Response
216{ 216{
217 struct GNUNET_MessageHeader msg; 217 struct GNUNET_MessageHeader msg;
218 218
219 uint32_t capabilities GNUNET_PACKED; 219 uint32_t capabilities GNUNET_PACKED;
220 220
221 uint32_t issuer_count GNUNET_PACKED; 221 uint32_t issuer_count GNUNET_PACKED;
222}; 222};
223 223
@@ -233,7 +233,7 @@ struct Issuer
233 233
234/** 234/**
235 * Hashmap containing valid experiment issuers 235 * Hashmap containing valid experiment issuers
236 * (the key is the hash of the respective public key, 236 * (the key is the hash of the respective public key,
237 * the values are of type `struct Issuer'). 237 * the values are of type `struct Issuer').
238 */ 238 */
239struct GNUNET_CONTAINER_MultiHashMap *valid_issuers; 239struct GNUNET_CONTAINER_MultiHashMap *valid_issuers;
@@ -246,19 +246,19 @@ struct GNUNET_CONTAINER_MultiHashMap *valid_issuers;
246struct GED_start_message 246struct GED_start_message
247{ 247{
248 struct GNUNET_MessageHeader header; 248 struct GNUNET_MessageHeader header;
249 249
250 /** 250 /**
251 * String length of experiment name following the struct 251 * String length of experiment name following the struct
252 */ 252 */
253 uint32_t len_name GNUNET_PACKED; 253 uint32_t len_name GNUNET_PACKED;
254 254
255 /** 255 /**
256 * Experiment issuer 256 * Experiment issuer
257 */ 257 */
258 struct GNUNET_CRYPTO_EccPublicSignKey issuer; 258 struct GNUNET_CRYPTO_EccPublicSignKey issuer;
259 259
260 /** 260 /**
261 * Experiment version as timestamp of creation 261 * Experiment version as timestamp of creation
262 */ 262 */
263 struct GNUNET_TIME_AbsoluteNBO version_nbo; 263 struct GNUNET_TIME_AbsoluteNBO version_nbo;
264}; 264};
@@ -267,19 +267,19 @@ struct GED_start_message
267struct GED_start_ack_message 267struct GED_start_ack_message
268{ 268{
269 struct GNUNET_MessageHeader header; 269 struct GNUNET_MessageHeader header;
270 270
271 /** 271 /**
272 * String length of experiment name following the struct 272 * String length of experiment name following the struct
273 */ 273 */
274 uint32_t len_name GNUNET_PACKED; 274 uint32_t len_name GNUNET_PACKED;
275 275
276 /** 276 /**
277 * Experiment issuer 277 * Experiment issuer
278 */ 278 */
279 struct GNUNET_CRYPTO_EccPublicSignKey issuer; 279 struct GNUNET_CRYPTO_EccPublicSignKey issuer;
280 280
281 /** 281 /**
282 * Experiment version as timestamp of creation 282 * Experiment version as timestamp of creation
283 */ 283 */
284 struct GNUNET_TIME_AbsoluteNBO version_nbo; 284 struct GNUNET_TIME_AbsoluteNBO version_nbo;
285}; 285};
@@ -288,19 +288,19 @@ struct GED_start_ack_message
288struct GED_stop_message 288struct GED_stop_message
289{ 289{
290 struct GNUNET_MessageHeader header; 290 struct GNUNET_MessageHeader header;
291 291
292 /** 292 /**
293 * String length of experiment name following the struct 293 * String length of experiment name following the struct
294 */ 294 */
295 uint32_t len_name GNUNET_PACKED; 295 uint32_t len_name GNUNET_PACKED;
296 296
297 /** 297 /**
298 * Experiment issuer 298 * Experiment issuer
299 */ 299 */
300 struct GNUNET_CRYPTO_EccPublicSignKey issuer; 300 struct GNUNET_CRYPTO_EccPublicSignKey issuer;
301 301
302 /** 302 /**
303 * Experiment version as timestamp of creation 303 * Experiment version as timestamp of creation
304 */ 304 */
305 struct GNUNET_TIME_AbsoluteNBO version_nbo; 305 struct GNUNET_TIME_AbsoluteNBO version_nbo;
306}; 306};
@@ -396,7 +396,7 @@ GED_experiments_find (const struct GNUNET_CRYPTO_EccPublicSignKey *issuer,
396 const struct GNUNET_TIME_Absolute version); 396 const struct GNUNET_TIME_Absolute version);
397 397
398 398
399typedef void (*GNUNET_EXPERIMENTATION_experiments_get_cb) (struct Node *n, 399typedef void (*GNUNET_EXPERIMENTATION_experiments_get_cb) (struct Node *n,
400 struct Experiment *e); 400 struct Experiment *e);
401 401
402 402
@@ -461,7 +461,7 @@ GED_scheduler_handle_stop (struct Node *n, struct Experiment *e);
461 */ 461 */
462void 462void
463GED_scheduler_add (struct Node *n, 463GED_scheduler_add (struct Node *n,
464 struct Experiment *e, 464 struct Experiment *e,
465 int outbound); 465 int outbound);
466 466
467 467
diff --git a/src/experimentation/gnunet-daemon-experimentation_experiments.c b/src/experimentation/gnunet-daemon-experimentation_experiments.c
index b4db5188b..928502cf5 100644
--- a/src/experimentation/gnunet-daemon-experimentation_experiments.c
+++ b/src/experimentation/gnunet-daemon-experimentation_experiments.c
@@ -54,14 +54,14 @@ experiment_verify (struct Issuer *i, struct Experiment *e)
54{ 54{
55 GNUNET_assert (NULL != i); 55 GNUNET_assert (NULL != i);
56 GNUNET_assert (NULL != e); 56 GNUNET_assert (NULL != e);
57 57
58 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 58 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
59 "Verification: to be implemented\n"); 59 "Verification: to be implemented\n");
60 return GNUNET_OK; 60 return GNUNET_OK;
61} 61}
62 62
63 63
64static int 64static int
65free_experiment (void *cls, 65free_experiment (void *cls,
66 const struct GNUNET_HashCode * key, 66 const struct GNUNET_HashCode * key,
67 void *value) 67 void *value)
@@ -84,15 +84,15 @@ free_experiment (void *cls,
84 * @param value the issuer element to free 84 * @param value the issuer element to free
85 * @return GNUNET_OK to continue 85 * @return GNUNET_OK to continue
86 */ 86 */
87static int 87static int
88free_issuer (void *cls, 88free_issuer (void *cls,
89 const struct GNUNET_HashCode * key, 89 const struct GNUNET_HashCode * key,
90 void *value) 90 void *value)
91{ 91{
92 struct Issuer *i = value; 92 struct Issuer *i = value;
93 93
94 GNUNET_break (0 == GNUNET_CONTAINER_multihashmap_remove (valid_issuers, 94 GNUNET_break (0 == GNUNET_CONTAINER_multihashmap_remove (valid_issuers,
95 key, 95 key,
96 i)); 96 i));
97 GNUNET_free (i); 97 GNUNET_free (i);
98 return GNUNET_OK; 98 return GNUNET_OK;
@@ -149,8 +149,8 @@ GED_experiments_find (const struct GNUNET_CRYPTO_EccPublicSignKey *issuer,
149 const struct GNUNET_TIME_Absolute version) 149 const struct GNUNET_TIME_Absolute version)
150{ 150{
151 struct GNUNET_HashCode hc; 151 struct GNUNET_HashCode hc;
152 152
153 get_experiment_key (issuer, 153 get_experiment_key (issuer,
154 name, 154 name,
155 version, 155 version,
156 &hc); 156 &hc);
@@ -180,7 +180,7 @@ get_it (void *cls,
180 if (0 == memcmp (&e->issuer, 180 if (0 == memcmp (&e->issuer,
181 get_ctx->issuer, 181 get_ctx->issuer,
182 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))) 182 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)))
183 get_ctx->get_cb (get_ctx->n, e); 183 get_ctx->get_cb (get_ctx->n, e);
184 return GNUNET_OK; 184 return GNUNET_OK;
185} 185}
186 186
@@ -222,7 +222,7 @@ GNUNET_EXPERIMENTATION_experiments_add (struct Issuer *i,
222 struct Experiment *e; 222 struct Experiment *e;
223 struct GNUNET_HashCode hc; 223 struct GNUNET_HashCode hc;
224 224
225 e = GNUNET_new (struct Experiment); 225 e = GNUNET_new (struct Experiment);
226 e->name = GNUNET_strdup (name); 226 e->name = GNUNET_strdup (name);
227 e->issuer = *issuer_id; 227 e->issuer = *issuer_id;
228 e->version = version; 228 e->version = version;
@@ -233,20 +233,20 @@ GNUNET_EXPERIMENTATION_experiments_add (struct Issuer *i,
233 e->frequency = frequency; 233 e->frequency = frequency;
234 e->duration = duration; 234 e->duration = duration;
235 e->stop = stop; 235 e->stop = stop;
236 236
237 /* verify experiment */ 237 /* verify experiment */
238 if (GNUNET_SYSERR == experiment_verify (i, e)) 238 if (GNUNET_SYSERR == experiment_verify (i, e))
239 { 239 {
240 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 240 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
241 _("Experiment `%s': Experiment signature is invalid\n"), 241 _("Experiment `%s': Experiment signature is invalid\n"),
242 name); 242 name);
243 GNUNET_free (e); 243 GNUNET_free (e);
244 GNUNET_free_non_null (e->name); 244 GNUNET_free_non_null (e->name);
245 GNUNET_free_non_null (e->description); 245 GNUNET_free_non_null (e->description);
246 return GNUNET_SYSERR; 246 return GNUNET_SYSERR;
247 } 247 }
248 248
249 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 249 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
250 _("Adding experiment `%s' running from `%s' to `%s' every %llu sec. for %llu sec. \n"), 250 _("Adding experiment `%s' running from `%s' to `%s' every %llu sec. for %llu sec. \n"),
251 e->name, 251 e->name,
252 GNUNET_STRINGS_absolute_time_to_string (start), 252 GNUNET_STRINGS_absolute_time_to_string (start),
@@ -259,12 +259,12 @@ GNUNET_EXPERIMENTATION_experiments_add (struct Issuer *i,
259 &hc); 259 &hc);
260 GNUNET_CONTAINER_multihashmap_put (experiments, 260 GNUNET_CONTAINER_multihashmap_put (experiments,
261 &hc, 261 &hc,
262 e, 262 e,
263 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 263 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
264 GNUNET_STATISTICS_set (GED_stats, 264 GNUNET_STATISTICS_set (GED_stats,
265 "# experiments", 265 "# experiments",
266 GNUNET_CONTAINER_multihashmap_size (experiments), GNUNET_NO); 266 GNUNET_CONTAINER_multihashmap_size (experiments), GNUNET_NO);
267 267
268 return GNUNET_OK; 268 return GNUNET_OK;
269} 269}
270 270
@@ -293,9 +293,9 @@ exp_file_iterator (void *cls,
293 struct GNUNET_TIME_Relative frequency; 293 struct GNUNET_TIME_Relative frequency;
294 struct GNUNET_TIME_Relative duration; 294 struct GNUNET_TIME_Relative duration;
295 struct GNUNET_HashCode phash; 295 struct GNUNET_HashCode phash;
296 296
297 /* Mandatory fields */ 297 /* Mandatory fields */
298 298
299 /* Issuer */ 299 /* Issuer */
300 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (exp, name, "ISSUER", &val)) 300 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (exp, name, "ISSUER", &val))
301 { 301 {
@@ -303,8 +303,8 @@ exp_file_iterator (void *cls,
303 _("Experiment `%s': Issuer missing\n"), name); 303 _("Experiment `%s': Issuer missing\n"), name);
304 return; 304 return;
305 } 305 }
306 if (GNUNET_SYSERR == 306 if (GNUNET_SYSERR ==
307 GNUNET_CRYPTO_ecc_public_sign_key_from_string (val, 307 GNUNET_CRYPTO_ecc_public_sign_key_from_string (val,
308 strlen (val), 308 strlen (val),
309 &issuer)) 309 &issuer))
310 { 310 {
@@ -322,20 +322,20 @@ exp_file_iterator (void *cls,
322 return; 322 return;
323 } 323 }
324 GNUNET_free (val); 324 GNUNET_free (val);
325 325
326 /* Version */ 326 /* Version */
327 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "VERSION", &number)) 327 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "VERSION", &number))
328 { 328 {
329 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 329 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
330 _("Experiment `%s': Version missing or invalid \n"), name); 330 _("Experiment `%s': Version missing or invalid \n"), name);
331 return; 331 return;
332 } 332 }
333 version.abs_value_us = number; // FIXME: what is this supposed to be? Version != TIME!??? 333 version.abs_value_us = number; // FIXME: what is this supposed to be? Version != TIME!???
334 334
335 /* Required capabilities */ 335 /* Required capabilities */
336 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "CAPABILITIES", &number)) 336 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "CAPABILITIES", &number))
337 { 337 {
338 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 338 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
339 _("Experiment `%s': Required capabilities missing \n"), name); 339 _("Experiment `%s': Required capabilities missing \n"), name);
340 return; 340 return;
341 } 341 }
@@ -346,23 +346,23 @@ exp_file_iterator (void *cls,
346 return; 346 return;
347 } 347 }
348 required_capabilities = number; 348 required_capabilities = number;
349 349
350 /* Optional fields */ 350 /* Optional fields */
351 351
352 /* Description */ 352 /* Description */
353 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (exp, name, "DESCRIPTION", &description)) 353 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (exp, name, "DESCRIPTION", &description))
354 description = NULL; 354 description = NULL;
355 355
356 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "START", (long long unsigned int *) &start.abs_value_us)) 356 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "START", (long long unsigned int *) &start.abs_value_us))
357 start = GNUNET_TIME_UNIT_ZERO_ABS; 357 start = GNUNET_TIME_UNIT_ZERO_ABS;
358 358
359 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (exp, name, "FREQUENCY", &frequency)) 359 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (exp, name, "FREQUENCY", &frequency))
360 frequency = EXP_DEFAULT_EXP_FREQ; 360 frequency = EXP_DEFAULT_EXP_FREQ;
361 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (exp, name, "DURATION", &duration)) 361 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (exp, name, "DURATION", &duration))
362 duration = EXP_DEFAULT_EXP_DUR; 362 duration = EXP_DEFAULT_EXP_DUR;
363 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "STOP", (long long unsigned int *)&stop.abs_value_us)) 363 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "STOP", (long long unsigned int *)&stop.abs_value_us))
364 stop = GNUNET_TIME_UNIT_FOREVER_ABS; 364 stop = GNUNET_TIME_UNIT_FOREVER_ABS;
365 365
366 GNUNET_EXPERIMENTATION_experiments_add (i, name, &issuer, version, 366 GNUNET_EXPERIMENTATION_experiments_add (i, name, &issuer, version,
367 description, required_capabilities, 367 description, required_capabilities,
368 start, frequency, duration, stop); 368 start, frequency, duration, stop);
@@ -382,12 +382,12 @@ load_file (const char * file)
382 382
383 if (NULL == exp) 383 if (NULL == exp)
384 return; 384 return;
385 385
386 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_parse (exp, file)) 386 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_parse (exp, file))
387 { 387 {
388 GNUNET_CONFIGURATION_destroy (exp); 388 GNUNET_CONFIGURATION_destroy (exp);
389 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 389 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
390 _("Failed to parse file `%s'\n"), 390 _("Failed to parse file `%s'\n"),
391 file); 391 file);
392 return; 392 return;
393 } 393 }
@@ -408,28 +408,28 @@ GED_experiments_start ()
408 char *pos; 408 char *pos;
409 struct GNUNET_CRYPTO_EccPublicSignKey issuer_ID; 409 struct GNUNET_CRYPTO_EccPublicSignKey issuer_ID;
410 struct GNUNET_HashCode hash; 410 struct GNUNET_HashCode hash;
411 411
412 /* Load valid issuer */ 412 /* Load valid issuer */
413 if (GNUNET_SYSERR == 413 if (GNUNET_SYSERR ==
414 GNUNET_CONFIGURATION_get_value_string (GED_cfg, 414 GNUNET_CONFIGURATION_get_value_string (GED_cfg,
415 "EXPERIMENTATION", 415 "EXPERIMENTATION",
416 "ISSUERS", 416 "ISSUERS",
417 &issuers)) 417 &issuers))
418 { 418 {
419 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 419 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
420 _("No valid experiment issuers configured! Set value to public keys of issuers! Exiting.\n")); 420 _("No valid experiment issuers configured! Set value to public keys of issuers! Exiting.\n"));
421 GED_experiments_stop (); 421 GED_experiments_stop ();
422 return GNUNET_SYSERR; 422 return GNUNET_SYSERR;
423 } 423 }
424 424
425 valid_issuers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); 425 valid_issuers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
426 for (pos = strtok (issuers, " "); pos != NULL; pos = strtok (NULL, " ")) 426 for (pos = strtok (issuers, " "); pos != NULL; pos = strtok (NULL, " "))
427 { 427 {
428 if (GNUNET_SYSERR == GNUNET_CRYPTO_ecc_public_sign_key_from_string (pos, 428 if (GNUNET_SYSERR == GNUNET_CRYPTO_ecc_public_sign_key_from_string (pos,
429 strlen (pos), 429 strlen (pos),
430 &issuer_ID)) 430 &issuer_ID))
431 { 431 {
432 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, 432 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
433 "EXPERIMENTATION", 433 "EXPERIMENTATION",
434 "ISSUERS", 434 "ISSUERS",
435 _("Invalid value for public key\n")); 435 _("Invalid value for public key\n"));
@@ -439,33 +439,33 @@ GED_experiments_start ()
439 i = GNUNET_new (struct Issuer); 439 i = GNUNET_new (struct Issuer);
440 i->pubkey = issuer_ID; 440 i->pubkey = issuer_ID;
441 GNUNET_CRYPTO_hash( &issuer_ID, sizeof (issuer_ID), &hash); 441 GNUNET_CRYPTO_hash( &issuer_ID, sizeof (issuer_ID), &hash);
442 GNUNET_CONTAINER_multihashmap_put (valid_issuers, 442 GNUNET_CONTAINER_multihashmap_put (valid_issuers,
443 &hash, 443 &hash,
444 i, 444 i,
445 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); 445 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
446 } 446 }
447 GNUNET_free (issuers); 447 GNUNET_free (issuers);
448 if (0 == GNUNET_CONTAINER_multihashmap_size (valid_issuers)) 448 if (0 == GNUNET_CONTAINER_multihashmap_size (valid_issuers))
449 { 449 {
450 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 450 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
451 _("No valid experiment issuers configured! Set value to public keys of issuers! Exiting.\n")); 451 _("No valid experiment issuers configured! Set value to public keys of issuers! Exiting.\n"));
452 GED_experiments_stop (); 452 GED_experiments_stop ();
453 return GNUNET_SYSERR; 453 return GNUNET_SYSERR;
454 } 454 }
455 GNUNET_STATISTICS_set (GED_stats, 455 GNUNET_STATISTICS_set (GED_stats,
456 "# issuer", 456 "# issuer",
457 GNUNET_CONTAINER_multihashmap_size (valid_issuers), 457 GNUNET_CONTAINER_multihashmap_size (valid_issuers),
458 GNUNET_NO); 458 GNUNET_NO);
459 459
460 experiments = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); 460 experiments = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
461 /* Load experiments from file */ 461 /* Load experiments from file */
462 if (GNUNET_SYSERR == 462 if (GNUNET_SYSERR ==
463 GNUNET_CONFIGURATION_get_value_string (GED_cfg, 463 GNUNET_CONFIGURATION_get_value_string (GED_cfg,
464 "EXPERIMENTATION", 464 "EXPERIMENTATION",
465 "EXPERIMENTS", 465 "EXPERIMENTS",
466 &file)) 466 &file))
467 return GNUNET_OK; 467 return GNUNET_OK;
468 468
469 if (GNUNET_YES != GNUNET_DISK_file_test (file)) 469 if (GNUNET_YES != GNUNET_DISK_file_test (file))
470 { 470 {
471 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 471 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/experimentation/gnunet-daemon-experimentation_nodes.c b/src/experimentation/gnunet-daemon-experimentation_nodes.c
index 5e29f5f73..f78569146 100644
--- a/src/experimentation/gnunet-daemon-experimentation_nodes.c
+++ b/src/experimentation/gnunet-daemon-experimentation_nodes.c
@@ -64,10 +64,10 @@ struct NodeComCtx
64{ 64{
65 struct NodeComCtx *prev; 65 struct NodeComCtx *prev;
66 struct NodeComCtx *next; 66 struct NodeComCtx *next;
67 67
68 struct Node *n; 68 struct Node *n;
69 struct Experiment *e; 69 struct Experiment *e;
70 70
71 size_t size; 71 size_t size;
72 GNUNET_CONNECTION_TransmitReadyNotify notify; 72 GNUNET_CONNECTION_TransmitReadyNotify notify;
73 void *notify_cls; 73 void *notify_cls;
@@ -79,7 +79,7 @@ struct NodeComCtx
79 * 79 *
80 * @param m peermap to update values from 80 * @param m peermap to update values from
81 */ 81 */
82static void 82static void
83update_stats (struct GNUNET_CONTAINER_MultiPeerMap *m) 83update_stats (struct GNUNET_CONTAINER_MultiPeerMap *m)
84{ 84{
85 GNUNET_assert (NULL != m); 85 GNUNET_assert (NULL != m);
@@ -122,14 +122,14 @@ cleanup_node (void *cls,
122 struct NodeComCtx *e_cur; 122 struct NodeComCtx *e_cur;
123 struct NodeComCtx *e_next; 123 struct NodeComCtx *e_next;
124 struct GNUNET_CONTAINER_MultiPeerMap *cur = cls; 124 struct GNUNET_CONTAINER_MultiPeerMap *cur = cls;
125 125
126 n = value; 126 n = value;
127 if (GNUNET_SCHEDULER_NO_TASK != n->timeout_task) 127 if (GNUNET_SCHEDULER_NO_TASK != n->timeout_task)
128 { 128 {
129 GNUNET_SCHEDULER_cancel (n->timeout_task); 129 GNUNET_SCHEDULER_cancel (n->timeout_task);
130 n->timeout_task = GNUNET_SCHEDULER_NO_TASK; 130 n->timeout_task = GNUNET_SCHEDULER_NO_TASK;
131 } 131 }
132 132
133 if (NULL != n->cth) 133 if (NULL != n->cth)
134 { 134 {
135 GNUNET_CORE_notify_transmit_ready_cancel (n->cth); 135 GNUNET_CORE_notify_transmit_ready_cancel (n->cth);
@@ -154,7 +154,7 @@ cleanup_node (void *cls,
154 * @param id the id to check 154 * @param id the id to check
155 * @return GNUNET_YES or GNUNET_NO 155 * @return GNUNET_YES or GNUNET_NO
156 */ 156 */
157static int 157static int
158is_me (const struct GNUNET_PeerIdentity *id) 158is_me (const struct GNUNET_PeerIdentity *id)
159{ 159{
160 if (0 == memcmp (&me, id, sizeof (me))) 160 if (0 == memcmp (&me, id, sizeof (me)))
@@ -187,14 +187,14 @@ transmit_read_wrapper (void *cls, size_t bufsize, void *buf)
187{ 187{
188 struct NodeComCtx *e_ctx = cls; 188 struct NodeComCtx *e_ctx = cls;
189 struct NodeComCtx *next; 189 struct NodeComCtx *next;
190 190
191 size_t res = e_ctx->notify (e_ctx->notify_cls, bufsize, buf); 191 size_t res = e_ctx->notify (e_ctx->notify_cls, bufsize, buf);
192 e_ctx->n->cth = NULL; 192 e_ctx->n->cth = NULL;
193 193
194 GNUNET_CONTAINER_DLL_remove (e_ctx->n->e_req_head, e_ctx->n->e_req_tail, e_ctx); 194 GNUNET_CONTAINER_DLL_remove (e_ctx->n->e_req_head, e_ctx->n->e_req_tail, e_ctx);
195 next = e_ctx->n->e_req_head; 195 next = e_ctx->n->e_req_head;
196 GNUNET_free (e_ctx); 196 GNUNET_free (e_ctx);
197 197
198 if (NULL != next) 198 if (NULL != next)
199 { 199 {
200 /* Schedule next message */ 200 /* Schedule next message */
@@ -209,9 +209,9 @@ schedule_transmisson (struct NodeComCtx *e_ctx)
209{ 209{
210 if (NULL != e_ctx->n->cth) 210 if (NULL != e_ctx->n->cth)
211 return; 211 return;
212 212
213 e_ctx->n->cth = GNUNET_CORE_notify_transmit_ready (ch, GNUNET_NO, 0, FAST_TIMEOUT, 213 e_ctx->n->cth = GNUNET_CORE_notify_transmit_ready (ch, GNUNET_NO, 0, FAST_TIMEOUT,
214 &e_ctx->n->id, e_ctx->size, 214 &e_ctx->n->id, e_ctx->size,
215 transmit_read_wrapper, e_ctx); 215 transmit_read_wrapper, e_ctx);
216 if (NULL == e_ctx->n->cth) 216 if (NULL == e_ctx->n->cth)
217 { 217 {
@@ -219,7 +219,7 @@ schedule_transmisson (struct NodeComCtx *e_ctx)
219 _("Cannot send message to peer `%s' for experiment `%s'\n"), 219 _("Cannot send message to peer `%s' for experiment `%s'\n"),
220 GNUNET_i2s(&e_ctx->n->id), e_ctx->e->name); 220 GNUNET_i2s(&e_ctx->n->id), e_ctx->e->name);
221 GNUNET_free (e_ctx); 221 GNUNET_free (e_ctx);
222 } 222 }
223} 223}
224 224
225 225
@@ -233,10 +233,10 @@ static void
233remove_request (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 233remove_request (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
234{ 234{
235 struct Node *n = cls; 235 struct Node *n = cls;
236 236
237 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 237 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
238 "Removing request for peer %s due to timeout\n", 238 "Removing request for peer %s due to timeout\n",
239 GNUNET_i2s (&n->id)); 239 GNUNET_i2s (&n->id));
240 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_requested, &n->id)) 240 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_requested, &n->id))
241 { 241 {
242 GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_requested, &n->id, n)); 242 GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_requested, &n->id, n));
@@ -271,7 +271,7 @@ append_public_key (void *cls,
271 * @param buf the buffer to copy to 271 * @param buf the buffer to copy to
272 * @return bytes passed 272 * @return bytes passed
273 */ 273 */
274static size_t 274static size_t
275send_experimentation_request_cb (void *cls, size_t bufsize, void *buf) 275send_experimentation_request_cb (void *cls, size_t bufsize, void *buf)
276{ 276{
277 struct Node *n = cls; 277 struct Node *n = cls;
@@ -315,22 +315,22 @@ send_experimentation_request_cb (void *cls, size_t bufsize, void *buf)
315 * 315 *
316 * @param peer the peer to send to 316 * @param peer the peer to send to
317 */ 317 */
318static void 318static void
319send_experimentation_request (const struct GNUNET_PeerIdentity *peer) 319send_experimentation_request (const struct GNUNET_PeerIdentity *peer)
320{ 320{
321 struct Node *n; 321 struct Node *n;
322 struct NodeComCtx *e_ctx; 322 struct NodeComCtx *e_ctx;
323 size_t size; 323 size_t size;
324 size_t c_issuers; 324 size_t c_issuers;
325 325
326 c_issuers = GNUNET_CONTAINER_multihashmap_size (valid_issuers); 326 c_issuers = GNUNET_CONTAINER_multihashmap_size (valid_issuers);
327 size = sizeof (struct Experimentation_Request) + 327 size = sizeof (struct Experimentation_Request) +
328 c_issuers * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); 328 c_issuers * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey);
329 n = GNUNET_new (struct Node); 329 n = GNUNET_new (struct Node);
330 n->id = *peer; 330 n->id = *peer;
331 n->timeout_task = GNUNET_SCHEDULER_add_delayed (EXP_RESPONSE_TIMEOUT, &remove_request, n); 331 n->timeout_task = GNUNET_SCHEDULER_add_delayed (EXP_RESPONSE_TIMEOUT, &remove_request, n);
332 n->capabilities = NONE; 332 n->capabilities = NONE;
333 333
334 e_ctx = GNUNET_new (struct NodeComCtx); 334 e_ctx = GNUNET_new (struct NodeComCtx);
335 e_ctx->n = n; 335 e_ctx->n = n;
336 e_ctx->e = NULL; 336 e_ctx->e = NULL;
@@ -339,10 +339,10 @@ send_experimentation_request (const struct GNUNET_PeerIdentity *peer)
339 e_ctx->notify_cls = n; 339 e_ctx->notify_cls = n;
340 GNUNET_CONTAINER_DLL_insert_tail(n->e_req_head, n->e_req_tail, e_ctx); 340 GNUNET_CONTAINER_DLL_insert_tail(n->e_req_head, n->e_req_tail, e_ctx);
341 schedule_transmisson (e_ctx); 341 schedule_transmisson (e_ctx);
342 342
343 GNUNET_assert (GNUNET_OK == 343 GNUNET_assert (GNUNET_OK ==
344 GNUNET_CONTAINER_multipeermap_put (nodes_requested, 344 GNUNET_CONTAINER_multipeermap_put (nodes_requested,
345 peer, n, 345 peer, n,
346 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); 346 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
347 update_stats (nodes_requested); 347 update_stats (nodes_requested);
348} 348}
@@ -361,17 +361,17 @@ send_response_cb (void *cls, size_t bufsize, void *buf)
361{ 361{
362 struct Node *n = cls; 362 struct Node *n = cls;
363 struct Experimentation_Response msg; 363 struct Experimentation_Response msg;
364 size_t c_issuers = GNUNET_CONTAINER_multihashmap_size (valid_issuers); 364 size_t c_issuers = GNUNET_CONTAINER_multihashmap_size (valid_issuers);
365 size_t ri_size = c_issuers * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); 365 size_t ri_size = c_issuers * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey);
366 size_t msg_size = sizeof (msg); 366 size_t msg_size = sizeof (msg);
367 size_t total_size = msg_size + ri_size; 367 size_t total_size = msg_size + ri_size;
368 struct GNUNET_CRYPTO_EccPublicSignKey *issuers; 368 struct GNUNET_CRYPTO_EccPublicSignKey *issuers;
369 369
370 n->cth = NULL; 370 n->cth = NULL;
371 if (buf == NULL) 371 if (buf == NULL)
372 { 372 {
373 /* client disconnected */ 373 /* client disconnected */
374 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 374 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
375 "Client disconnected\n"); 375 "Client disconnected\n");
376 return 0; 376 return 0;
377 } 377 }
@@ -399,7 +399,7 @@ get_experiments_cb (struct Node *n, struct Experiment *e)
399 static int counter = 0; 399 static int counter = 0;
400 if (NULL == e) 400 if (NULL == e)
401 return; /* Done */ 401 return; /* Done */
402 402
403 /* Tell the scheduler to add a node with an experiment */ 403 /* Tell the scheduler to add a node with an experiment */
404 GED_scheduler_add (n, e, GNUNET_YES); 404 GED_scheduler_add (n, e, GNUNET_YES);
405 counter ++; 405 counter ++;
@@ -417,19 +417,19 @@ get_node (const struct GNUNET_PeerIdentity *id)
417 tmp = GNUNET_CONTAINER_multipeermap_get (nodes_active, id); 417 tmp = GNUNET_CONTAINER_multipeermap_get (nodes_active, id);
418 if (res == NULL) 418 if (res == NULL)
419 res = tmp; 419 res = tmp;
420 420
421 tmp = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, id); 421 tmp = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, id);
422 if (res == NULL) 422 if (res == NULL)
423 res = tmp; 423 res = tmp;
424 else 424 else
425 GNUNET_break (0); /* Multiple instances */ 425 GNUNET_break (0); /* Multiple instances */
426 426
427 tmp = GNUNET_CONTAINER_multipeermap_get (nodes_requested, id); 427 tmp = GNUNET_CONTAINER_multipeermap_get (nodes_requested, id);
428 if (res == NULL) 428 if (res == NULL)
429 res = tmp; 429 res = tmp;
430 else 430 else
431 GNUNET_break (0); /* Multiple instances */ 431 GNUNET_break (0); /* Multiple instances */
432 432
433 return res; 433 return res;
434} 434}
435 435
@@ -439,7 +439,7 @@ get_node (const struct GNUNET_PeerIdentity *id)
439 * 439 *
440 * @param n the node 440 * @param n the node
441 */ 441 */
442static void 442static void
443node_make_active (struct Node *n) 443node_make_active (struct Node *n)
444{ 444{
445 int c1; 445 int c1;
@@ -452,7 +452,7 @@ node_make_active (struct Node *n)
452 GNUNET_i2s (&n->id)); 452 GNUNET_i2s (&n->id));
453 /* Request experiments for this node to start them */ 453 /* Request experiments for this node to start them */
454 for (c1 = 0; c1 < n->issuer_count; c1++) 454 for (c1 = 0; c1 < n->issuer_count; c1++)
455 { 455 {
456 GED_experiments_get (n, &n->issuer_id[c1], &get_experiments_cb); 456 GED_experiments_get (n, &n->issuer_id[c1], &get_experiments_cb);
457 } 457 }
458} 458}
@@ -478,20 +478,20 @@ handle_request (const struct GNUNET_PeerIdentity *peer,
478 uint32_t ic; 478 uint32_t ic;
479 uint32_t ic_accepted; 479 uint32_t ic_accepted;
480 int make_active; 480 int make_active;
481 481
482 if (ntohs (message->size) < sizeof (struct Experimentation_Request)) 482 if (ntohs (message->size) < sizeof (struct Experimentation_Request))
483 { 483 {
484 GNUNET_break (0); 484 GNUNET_break (0);
485 return; 485 return;
486 } 486 }
487 ic = ntohl (rm->issuer_count); 487 ic = ntohl (rm->issuer_count);
488 if (ntohs (message->size) != 488 if (ntohs (message->size) !=
489 sizeof (struct Experimentation_Request) + ic * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) 489 sizeof (struct Experimentation_Request) + ic * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))
490 { 490 {
491 GNUNET_break (0); 491 GNUNET_break (0);
492 return; 492 return;
493 } 493 }
494 494
495 make_active = GNUNET_NO; 495 make_active = GNUNET_NO;
496 if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer))) 496 if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer)))
497 { 497 {
@@ -522,10 +522,10 @@ handle_request (const struct GNUNET_PeerIdentity *peer,
522 n->capabilities = NONE; 522 n->capabilities = NONE;
523 make_active = GNUNET_YES; 523 make_active = GNUNET_YES;
524 } 524 }
525 525
526 /* Update node */ 526 /* Update node */
527 n->capabilities = ntohl (rm->capabilities); 527 n->capabilities = ntohl (rm->capabilities);
528 528
529 /* Filter accepted issuer */ 529 /* Filter accepted issuer */
530 ic_accepted = 0; 530 ic_accepted = 0;
531 for (c1 = 0; c1 < ic; c1++) 531 for (c1 = 0; c1 < ic; c1++)
@@ -533,7 +533,7 @@ handle_request (const struct GNUNET_PeerIdentity *peer,
533 if (GNUNET_YES == GED_experiments_issuer_accepted(&rmi[c1])) 533 if (GNUNET_YES == GED_experiments_issuer_accepted(&rmi[c1]))
534 ic_accepted ++; 534 ic_accepted ++;
535 } 535 }
536 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 536 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
537 "Request from peer `%s' with %u issuers, we accepted %u issuer \n", 537 "Request from peer `%s' with %u issuers, we accepted %u issuer \n",
538 GNUNET_i2s (peer), ic, ic_accepted); 538 GNUNET_i2s (peer), ic, ic_accepted);
539 GNUNET_free_non_null (n->issuer_id); 539 GNUNET_free_non_null (n->issuer_id);
@@ -548,19 +548,19 @@ handle_request (const struct GNUNET_PeerIdentity *peer,
548 } 548 }
549 } 549 }
550 n->issuer_count = ic_accepted; 550 n->issuer_count = ic_accepted;
551 551
552 if (GNUNET_YES == make_active) 552 if (GNUNET_YES == make_active)
553 node_make_active (n); 553 node_make_active (n);
554 554
555 /* Send response */ 555 /* Send response */
556 e_ctx = GNUNET_new (struct NodeComCtx); 556 e_ctx = GNUNET_new (struct NodeComCtx);
557 e_ctx->n = n; 557 e_ctx->n = n;
558 e_ctx->e = NULL; 558 e_ctx->e = NULL;
559 e_ctx->size = sizeof (struct Experimentation_Response) + 559 e_ctx->size = sizeof (struct Experimentation_Response) +
560 my_issuer_count * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); 560 my_issuer_count * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey);
561 e_ctx->notify = &send_response_cb; 561 e_ctx->notify = &send_response_cb;
562 e_ctx->notify_cls = n; 562 e_ctx->notify_cls = n;
563 563
564 GNUNET_CONTAINER_DLL_insert_tail(n->e_req_head, n->e_req_tail, e_ctx); 564 GNUNET_CONTAINER_DLL_insert_tail(n->e_req_head, n->e_req_tail, e_ctx);
565 schedule_transmisson (e_ctx); 565 schedule_transmisson (e_ctx);
566} 566}
@@ -583,7 +583,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer,
583 int make_active; 583 int make_active;
584 unsigned int c1; 584 unsigned int c1;
585 unsigned int c2; 585 unsigned int c2;
586 586
587 if (ntohs (message->size) < sizeof (struct Experimentation_Response)) 587 if (ntohs (message->size) < sizeof (struct Experimentation_Response))
588 { 588 {
589 GNUNET_break (0); 589 GNUNET_break (0);
@@ -595,7 +595,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer,
595 GNUNET_break (0); 595 GNUNET_break (0);
596 return; 596 return;
597 } 597 }
598 598
599 make_active = GNUNET_NO; 599 make_active = GNUNET_NO;
600 if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer))) 600 if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer)))
601 { 601 {
@@ -618,7 +618,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer,
618 } 618 }
619 else if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, peer))) 619 else if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, peer)))
620 { 620 {
621 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 621 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
622 "Received %s from peer `%s'\n", 622 "Received %s from peer `%s'\n",
623 "RESPONSE", "inactive", GNUNET_i2s (peer)); 623 "RESPONSE", "inactive", GNUNET_i2s (peer));
624 GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_inactive, peer, n)); 624 GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_inactive, peer, n));
@@ -631,10 +631,10 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer,
631 "RESPONSE", "unknown", GNUNET_i2s (peer)); 631 "RESPONSE", "unknown", GNUNET_i2s (peer));
632 return; 632 return;
633 } 633 }
634 634
635 /* Update */ 635 /* Update */
636 n->capabilities = ntohl (rm->capabilities); 636 n->capabilities = ntohl (rm->capabilities);
637 637
638 /* Filter accepted issuer */ 638 /* Filter accepted issuer */
639 ic_accepted = 0; 639 ic_accepted = 0;
640 for (c1 = 0; c1 < ic; c1++) 640 for (c1 = 0; c1 < ic; c1++)
@@ -657,7 +657,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer,
657 } 657 }
658 } 658 }
659 n->issuer_count = ic_accepted; 659 n->issuer_count = ic_accepted;
660 660
661 if (GNUNET_YES == make_active) 661 if (GNUNET_YES == make_active)
662 node_make_active (n); 662 node_make_active (n);
663} 663}
@@ -669,7 +669,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer,
669 * @param peer the source 669 * @param peer the source
670 * @param message the message 670 * @param message the message
671 */ 671 */
672static void 672static void
673handle_start (const struct GNUNET_PeerIdentity *peer, 673handle_start (const struct GNUNET_PeerIdentity *peer,
674 const struct GNUNET_MessageHeader *message) 674 const struct GNUNET_MessageHeader *message)
675{ 675{
@@ -679,7 +679,7 @@ handle_start (const struct GNUNET_PeerIdentity *peer,
679 const char *name; 679 const char *name;
680 struct Node *n; 680 struct Node *n;
681 struct Experiment *e; 681 struct Experiment *e;
682 682
683 if (NULL == peer) 683 if (NULL == peer)
684 { 684 {
685 GNUNET_break (0); 685 GNUNET_break (0);
@@ -690,7 +690,7 @@ handle_start (const struct GNUNET_PeerIdentity *peer,
690 GNUNET_break (0); 690 GNUNET_break (0);
691 return; 691 return;
692 } 692 }
693 693
694 size = ntohs (message->size); 694 size = ntohs (message->size);
695 if (size < sizeof (struct GED_start_message)) 695 if (size < sizeof (struct GED_start_message))
696 { 696 {
@@ -704,7 +704,7 @@ handle_start (const struct GNUNET_PeerIdentity *peer,
704 GNUNET_break (0); 704 GNUNET_break (0);
705 return; 705 return;
706 } 706 }
707 707
708 n = get_node (peer); 708 n = get_node (peer);
709 if (NULL == n) 709 if (NULL == n)
710 { 710 {
@@ -716,18 +716,18 @@ handle_start (const struct GNUNET_PeerIdentity *peer,
716 { 716 {
717 GNUNET_break (0); 717 GNUNET_break (0);
718 return; 718 return;
719 } 719 }
720 if (name_len != strlen (name) + 1) 720 if (name_len != strlen (name) + 1)
721 { 721 {
722 GNUNET_break (0); 722 GNUNET_break (0);
723 return; 723 return;
724 } 724 }
725 e = GED_experiments_find (&msg->issuer, name, GNUNET_TIME_absolute_ntoh(msg->version_nbo)); 725 e = GED_experiments_find (&msg->issuer, name, GNUNET_TIME_absolute_ntoh(msg->version_nbo));
726 if (NULL == e) 726 if (NULL == e)
727 { 727 {
728 GNUNET_break (0); 728 GNUNET_break (0);
729 return; 729 return;
730 } 730 }
731 GED_scheduler_handle_start (n, e); 731 GED_scheduler_handle_start (n, e);
732} 732}
733 733
@@ -748,7 +748,7 @@ handle_start_ack (const struct GNUNET_PeerIdentity *peer,
748 const char *name; 748 const char *name;
749 struct Node *n; 749 struct Node *n;
750 struct Experiment *e; 750 struct Experiment *e;
751 751
752 if (NULL == peer) 752 if (NULL == peer)
753 { 753 {
754 GNUNET_break (0); 754 GNUNET_break (0);
@@ -759,7 +759,7 @@ handle_start_ack (const struct GNUNET_PeerIdentity *peer,
759 GNUNET_break (0); 759 GNUNET_break (0);
760 return; 760 return;
761 } 761 }
762 762
763 size = ntohs (message->size); 763 size = ntohs (message->size);
764 if (size < sizeof (struct GED_start_ack_message)) 764 if (size < sizeof (struct GED_start_ack_message))
765 { 765 {
@@ -773,7 +773,7 @@ handle_start_ack (const struct GNUNET_PeerIdentity *peer,
773 GNUNET_break (0); 773 GNUNET_break (0);
774 return; 774 return;
775 } 775 }
776 776
777 n = get_node (peer); 777 n = get_node (peer);
778 if (NULL == n) 778 if (NULL == n)
779 { 779 {
@@ -791,7 +791,7 @@ handle_start_ack (const struct GNUNET_PeerIdentity *peer,
791 GNUNET_break (0); 791 GNUNET_break (0);
792 return; 792 return;
793 } 793 }
794 794
795 e = GED_experiments_find (&msg->issuer, name, GNUNET_TIME_absolute_ntoh(msg->version_nbo)); 795 e = GED_experiments_find (&msg->issuer, name, GNUNET_TIME_absolute_ntoh(msg->version_nbo));
796 if (NULL == e) 796 if (NULL == e)
797 { 797 {
@@ -885,19 +885,19 @@ core_connect_handler (void *cls,
885{ 885{
886 if (GNUNET_YES == is_me(peer)) 886 if (GNUNET_YES == is_me(peer))
887 return; 887 return;
888 888
889 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connected to peer %s\n"), 889 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connected to peer %s\n"),
890 GNUNET_i2s (peer)); 890 GNUNET_i2s (peer));
891 891
892 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_requested, peer)) 892 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_requested, peer))
893 return; /* We already sent a request */ 893 return; /* We already sent a request */
894 894
895 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_active, peer)) 895 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_active, peer))
896 return; /* This peer is known as active */ 896 return; /* This peer is known as active */
897 897
898 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_inactive, peer)) 898 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_inactive, peer))
899 return; /* This peer is known as inactive */ 899 return; /* This peer is known as inactive */
900 900
901 send_experimentation_request (peer); 901 send_experimentation_request (peer);
902} 902}
903 903
diff --git a/src/experimentation/gnunet-daemon-experimentation_scheduler.c b/src/experimentation/gnunet-daemon-experimentation_scheduler.c
index a203fe4a5..a52d60c37 100644
--- a/src/experimentation/gnunet-daemon-experimentation_scheduler.c
+++ b/src/experimentation/gnunet-daemon-experimentation_scheduler.c
@@ -232,8 +232,8 @@ GED_scheduler_handle_start (struct Node *n, struct Experiment *e)
232 GNUNET_break_op (0); 232 GNUNET_break_op (0);
233 return; 233 return;
234 } 234 }
235 235
236 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 236 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
237 "Received %s message from peer %s for experiment `%s'\n", 237 "Received %s message from peer %s for experiment `%s'\n",
238 "START", GNUNET_i2s (&n->id), e->name); 238 "START", GNUNET_i2s (&n->id), e->name);
239 GED_scheduler_add (n, e, GNUNET_NO); 239 GED_scheduler_add (n, e, GNUNET_NO);
diff --git a/src/experimentation/test_experimentation_clique_connect.c b/src/experimentation/test_experimentation_clique_connect.c
index a84eabd7e..e7604b0da 100644
--- a/src/experimentation/test_experimentation_clique_connect.c
+++ b/src/experimentation/test_experimentation_clique_connect.c
@@ -354,7 +354,7 @@ stat_disconnect_adapter (void *cls, void *op_result)
354 * failed 354 * failed
355 */ 355 */
356static void 356static void
357test_master (void *cls, 357test_master (void *cls,
358 struct GNUNET_TESTBED_RunHandle *h, 358 struct GNUNET_TESTBED_RunHandle *h,
359 unsigned int num_peers, 359 unsigned int num_peers,
360 struct GNUNET_TESTBED_Peer **peers_, 360 struct GNUNET_TESTBED_Peer **peers_,
diff --git a/src/fragmentation/defragmentation.c b/src/fragmentation/defragmentation.c
index f42207046..5f9eace13 100644
--- a/src/fragmentation/defragmentation.c
+++ b/src/fragmentation/defragmentation.c
@@ -459,7 +459,7 @@ GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc,
459 for (mc = dc->head; NULL != mc; mc = mc->next) 459 for (mc = dc->head; NULL != mc; mc = mc->next)
460 if (mc->fragment_id > fid) 460 if (mc->fragment_id > fid)
461 last++; 461 last++;
462 462
463 mc = dc->head; 463 mc = dc->head;
464 while ((NULL != mc) && (fid != mc->fragment_id)) 464 while ((NULL != mc) && (fid != mc->fragment_id))
465 mc = mc->next; 465 mc = mc->next;
@@ -538,13 +538,13 @@ GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc,
538 } 538 }
539 /* send ACK */ 539 /* send ACK */
540 if (mc->frag_times_write_offset - mc->frag_times_start_offset > 1) 540 if (mc->frag_times_write_offset - mc->frag_times_start_offset > 1)
541 { 541 {
542 dc->latency = estimate_latency (mc); 542 dc->latency = estimate_latency (mc);
543 } 543 }
544 delay = GNUNET_TIME_relative_multiply (dc->latency, bc + 1); 544 delay = GNUNET_TIME_relative_multiply (dc->latency, bc + 1);
545 if ( (last + fid == num_fragments) || 545 if ( (last + fid == num_fragments) ||
546 (0 == mc->bits) || 546 (0 == mc->bits) ||
547 (GNUNET_YES == duplicate)) 547 (GNUNET_YES == duplicate))
548 { 548 {
549 /* message complete or duplicate or last missing fragment in 549 /* message complete or duplicate or last missing fragment in
550 linear sequence; ACK now! */ 550 linear sequence; ACK now! */
diff --git a/src/fragmentation/fragmentation.c b/src/fragmentation/fragmentation.c
index 39a5af814..bf7491815 100644
--- a/src/fragmentation/fragmentation.c
+++ b/src/fragmentation/fragmentation.c
@@ -231,7 +231,7 @@ transmit_next (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
231 fc->num_rounds++; 231 fc->num_rounds++;
232 delay = GNUNET_TIME_relative_multiply (fc->ack_delay, 2); 232 delay = GNUNET_TIME_relative_multiply (fc->ack_delay, 2);
233 /* never use zero, need some time for ACK always */ 233 /* never use zero, need some time for ACK always */
234 delay = GNUNET_TIME_relative_max (MIN_ACK_DELAY, delay); 234 delay = GNUNET_TIME_relative_max (MIN_ACK_DELAY, delay);
235 fc->wack = GNUNET_YES; 235 fc->wack = GNUNET_YES;
236 fc->last_round = GNUNET_TIME_absolute_get (); 236 fc->last_round = GNUNET_TIME_absolute_get ();
237 GNUNET_STATISTICS_update (fc->stats, _("# fragments wrap arounds"), 1, 237 GNUNET_STATISTICS_update (fc->stats, _("# fragments wrap arounds"), 1,
@@ -277,7 +277,7 @@ GNUNET_FRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats,
277 struct GNUNET_FRAGMENT_Context *fc; 277 struct GNUNET_FRAGMENT_Context *fc;
278 size_t size; 278 size_t size;
279 uint64_t bits; 279 uint64_t bits;
280 280
281 GNUNET_STATISTICS_update (stats, _("# messages fragmented"), 1, GNUNET_NO); 281 GNUNET_STATISTICS_update (stats, _("# messages fragmented"), 1, GNUNET_NO);
282 GNUNET_assert (mtu >= 1024 + sizeof (struct FragmentHeader)); 282 GNUNET_assert (mtu >= 1024 + sizeof (struct FragmentHeader));
283 size = ntohs (msg->size); 283 size = ntohs (msg->size);
@@ -368,7 +368,7 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc,
368 fc->wack = GNUNET_NO; 368 fc->wack = GNUNET_NO;
369 ndelay = GNUNET_TIME_absolute_get_duration (fc->last_round); 369 ndelay = GNUNET_TIME_absolute_get_duration (fc->last_round);
370 fc->ack_delay.rel_value_us = 370 fc->ack_delay.rel_value_us =
371 (ndelay.rel_value_us / fc->num_transmissions + 3 * fc->ack_delay.rel_value_us) / 4; 371 (ndelay.rel_value_us / fc->num_transmissions + 3 * fc->ack_delay.rel_value_us) / 4;
372 fc->num_transmissions = 0; 372 fc->num_transmissions = 0;
373 /* calculate ratio msg sent vs. msg acked */ 373 /* calculate ratio msg sent vs. msg acked */
374 ack_cnt = 0; 374 ack_cnt = 0;
@@ -385,8 +385,8 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc,
385 if (0 == ack_cnt) 385 if (0 == ack_cnt)
386 { 386 {
387 /* complete loss */ 387 /* complete loss */
388 fc->msg_delay = GNUNET_TIME_relative_multiply (fc->msg_delay, 388 fc->msg_delay = GNUNET_TIME_relative_multiply (fc->msg_delay,
389 snd_cnt); 389 snd_cnt);
390 } 390 }
391 else if (snd_cnt > ack_cnt) 391 else if (snd_cnt > ack_cnt)
392 { 392 {
diff --git a/src/fragmentation/test_fragmentation.c b/src/fragmentation/test_fragmentation.c
index 2a30d7d93..c41272d42 100644
--- a/src/fragmentation/test_fragmentation.c
+++ b/src/fragmentation/test_fragmentation.c
@@ -213,8 +213,8 @@ run (void *cls, char *const *args, const char *cfgfile,
213 htons (sizeof (struct GNUNET_MessageHeader) + (17 * i) % (32 * 1024)); 213 htons (sizeof (struct GNUNET_MessageHeader) + (17 * i) % (32 * 1024));
214 frags[i] = GNUNET_FRAGMENT_context_create (NULL /* no stats */ , 214 frags[i] = GNUNET_FRAGMENT_context_create (NULL /* no stats */ ,
215 MTU, &trackers[i], 215 MTU, &trackers[i],
216 GNUNET_TIME_UNIT_MILLISECONDS, 216 GNUNET_TIME_UNIT_MILLISECONDS,
217 GNUNET_TIME_UNIT_SECONDS, 217 GNUNET_TIME_UNIT_SECONDS,
218 msg, 218 msg,
219 &proc_frac, &frags[i]); 219 &proc_frac, &frags[i]);
220 } 220 }
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c
index c2e2ada3e..04057bc98 100644
--- a/src/fs/fs_api.c
+++ b/src/fs/fs_api.c
@@ -211,8 +211,8 @@ process_job_queue (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
211 /* stop probes if possible */ 211 /* stop probes if possible */
212 num_probes_change = - num_probes_active; 212 num_probes_change = - num_probes_active;
213 num_downloads_change = h->max_parallel_requests - h->active_downloads; 213 num_downloads_change = h->max_parallel_requests - h->active_downloads;
214 } 214 }
215 else 215 else
216 { 216 {
217 /* start all downloads */ 217 /* start all downloads */
218 num_downloads_change = num_downloads_waiting; 218 num_downloads_change = num_downloads_waiting;
@@ -220,7 +220,7 @@ process_job_queue (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
220 num_probes_change = GNUNET_MIN (num_probes_waiting, 220 num_probes_change = GNUNET_MIN (num_probes_waiting,
221 h->max_parallel_requests - (h->active_downloads + num_downloads_waiting)); 221 h->max_parallel_requests - (h->active_downloads + num_downloads_waiting));
222 } 222 }
223 223
224 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 224 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
225 "Changing %d probes and %d downloads\n", 225 "Changing %d probes and %d downloads\n",
226 num_probes_change, 226 num_probes_change,
@@ -232,7 +232,7 @@ process_job_queue (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
232 next = qe->next; 232 next = qe->next;
233 if (GNUNET_FS_QUEUE_PRIORITY_PROBE != qe->priority) 233 if (GNUNET_FS_QUEUE_PRIORITY_PROBE != qe->priority)
234 continue; 234 continue;
235 if (num_probes_change < 0) 235 if (num_probes_change < 0)
236 { 236 {
237 stop_job (qe); 237 stop_job (qe);
238 num_probes_change++; 238 num_probes_change++;
@@ -266,7 +266,7 @@ process_job_queue (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
266 ( (qe->blocks + h->active_blocks <= h->max_parallel_requests) || 266 ( (qe->blocks + h->active_blocks <= h->max_parallel_requests) ||
267 ( (qe->blocks > h->max_parallel_requests) && 267 ( (qe->blocks > h->max_parallel_requests) &&
268 (0 == h->active_downloads) ) ) ) 268 (0 == h->active_downloads) ) ) )
269 { 269 {
270 start_job (qe); 270 start_job (qe);
271 num_downloads_change--; 271 num_downloads_change--;
272 } 272 }
@@ -284,7 +284,7 @@ process_job_queue (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
284 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 284 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
285 "AD: %u, MP: %u; %d probes and %d downloads to start, will run again in %s\n", 285 "AD: %u, MP: %u; %d probes and %d downloads to start, will run again in %s\n",
286 h->active_downloads, 286 h->active_downloads,
287 h->max_parallel_requests, 287 h->max_parallel_requests,
288 num_probes_change, 288 num_probes_change,
289 num_downloads_change, 289 num_downloads_change,
290 GNUNET_STRINGS_relative_time_to_string (restart_at, GNUNET_YES)); 290 GNUNET_STRINGS_relative_time_to_string (restart_at, GNUNET_YES));
@@ -467,7 +467,7 @@ GNUNET_FS_data_reader_file_ (void *cls, uint64_t offset, size_t max, void *buf,
467 return 0; 467 return 0;
468 } 468 }
469 } 469 }
470 if ( (GNUNET_SYSERR == 470 if ( (GNUNET_SYSERR ==
471 GNUNET_DISK_file_seek (fi->fd, offset, GNUNET_DISK_SEEK_SET)) || 471 GNUNET_DISK_file_seek (fi->fd, offset, GNUNET_DISK_SEEK_SET)) ||
472 (-1 == (ret = GNUNET_DISK_file_read (fi->fd, buf, max))) ) 472 (-1 == (ret = GNUNET_DISK_file_read (fi->fd, buf, max))) )
473 { 473 {
@@ -1398,7 +1398,7 @@ cleanup:
1398 * @return NULL if srch was not found in this subtree 1398 * @return NULL if srch was not found in this subtree
1399 */ 1399 */
1400static struct GNUNET_FS_FileInformation * 1400static struct GNUNET_FS_FileInformation *
1401find_file_position (struct GNUNET_FS_FileInformation *pos, 1401find_file_position (struct GNUNET_FS_FileInformation *pos,
1402 const char *srch) 1402 const char *srch)
1403{ 1403{
1404 struct GNUNET_FS_FileInformation *r; 1404 struct GNUNET_FS_FileInformation *r;
@@ -1409,7 +1409,7 @@ find_file_position (struct GNUNET_FS_FileInformation *pos,
1409 return pos; 1409 return pos;
1410 if ( (GNUNET_YES == pos->is_directory) && 1410 if ( (GNUNET_YES == pos->is_directory) &&
1411 (NULL != (r = find_file_position (pos->data.dir.entries, srch))) ) 1411 (NULL != (r = find_file_position (pos->data.dir.entries, srch))) )
1412 return r; 1412 return r;
1413 pos = pos->next; 1413 pos = pos->next;
1414 } 1414 }
1415 return NULL; 1415 return NULL;
@@ -1556,7 +1556,7 @@ deserialize_publish_file (void *cls, const char *filename)
1556 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pc->upload_task); 1556 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pc->upload_task);
1557 pc->upload_task = 1557 pc->upload_task =
1558 GNUNET_SCHEDULER_add_with_priority 1558 GNUNET_SCHEDULER_add_with_priority
1559 (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, 1559 (GNUNET_SCHEDULER_PRIORITY_BACKGROUND,
1560 &GNUNET_FS_publish_main_, pc); 1560 &GNUNET_FS_publish_main_, pc);
1561 } 1561 }
1562 if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg)) 1562 if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg))
@@ -2031,8 +2031,8 @@ cleanup:
2031 if (NULL != wh) 2031 if (NULL != wh)
2032 (void) GNUNET_BIO_write_close (wh); 2032 (void) GNUNET_BIO_write_close (wh);
2033 remove_sync_file_in_dir (sr->h, 2033 remove_sync_file_in_dir (sr->h,
2034 (NULL == sr->sc->psearch_result) 2034 (NULL == sr->sc->psearch_result)
2035 ? GNUNET_FS_SYNC_PATH_MASTER_SEARCH 2035 ? GNUNET_FS_SYNC_PATH_MASTER_SEARCH
2036 : GNUNET_FS_SYNC_PATH_CHILD_SEARCH, 2036 : GNUNET_FS_SYNC_PATH_CHILD_SEARCH,
2037 sr->sc->serialization, sr->serialization); 2037 sr->sc->serialization, sr->serialization);
2038 GNUNET_free (sr->serialization); 2038 GNUNET_free (sr->serialization);
@@ -2057,8 +2057,8 @@ GNUNET_FS_search_sync_ (struct GNUNET_FS_SearchContext *sc)
2057 const char *category; 2057 const char *category;
2058 2058
2059 category = 2059 category =
2060 (NULL == sc->psearch_result) 2060 (NULL == sc->psearch_result)
2061 ? GNUNET_FS_SYNC_PATH_MASTER_SEARCH 2061 ? GNUNET_FS_SYNC_PATH_MASTER_SEARCH
2062 : GNUNET_FS_SYNC_PATH_CHILD_SEARCH; 2062 : GNUNET_FS_SYNC_PATH_CHILD_SEARCH;
2063 if (NULL == sc->serialization) 2063 if (NULL == sc->serialization)
2064 sc->serialization = make_serialization_file_name (sc->h, category); 2064 sc->serialization = make_serialization_file_name (sc->h, category);
@@ -2163,7 +2163,7 @@ deserialize_unindex_file (void *cls, const char *filename)
2163 { 2163 {
2164 GNUNET_break (0); 2164 GNUNET_break (0);
2165 goto cleanup; 2165 goto cleanup;
2166 } 2166 }
2167 uc->state = (enum UnindexState) state; 2167 uc->state = (enum UnindexState) state;
2168 switch (state) 2168 switch (state)
2169 { 2169 {
@@ -2316,8 +2316,8 @@ deserialize_search_result (void *cls, const char *filename)
2316 if (NULL != ser) 2316 if (NULL != ser)
2317 { 2317 {
2318 remove_sync_file_in_dir (sc->h, 2318 remove_sync_file_in_dir (sc->h,
2319 (NULL == sc->psearch_result) 2319 (NULL == sc->psearch_result)
2320 ? GNUNET_FS_SYNC_PATH_MASTER_SEARCH 2320 ? GNUNET_FS_SYNC_PATH_MASTER_SEARCH
2321 : GNUNET_FS_SYNC_PATH_CHILD_SEARCH, 2321 : GNUNET_FS_SYNC_PATH_CHILD_SEARCH,
2322 sc->serialization, ser); 2322 sc->serialization, ser);
2323 GNUNET_free (ser); 2323 GNUNET_free (ser);
diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h
index d8ea21c54..5858c916c 100644
--- a/src/fs/fs_api.h
+++ b/src/fs/fs_api.h
@@ -414,7 +414,7 @@ typedef void (*GNUNET_FS_QueueStop) (void *cls);
414 414
415/** 415/**
416 * Priorities for the queue. 416 * Priorities for the queue.
417 */ 417 */
418enum GNUNET_FS_QueuePriority 418enum GNUNET_FS_QueuePriority
419 { 419 {
420 /** 420 /**
@@ -1259,7 +1259,7 @@ struct GNUNET_FS_PublishContext
1259 * Set to GNUNET_YES if all processing has completed. 1259 * Set to GNUNET_YES if all processing has completed.
1260 */ 1260 */
1261 int all_done; 1261 int all_done;
1262 1262
1263 /** 1263 /**
1264 * Flag set to GNUNET_YES if the next callback from 1264 * Flag set to GNUNET_YES if the next callback from
1265 * GNUNET_FS_file_information_inspect should be skipped because it 1265 * GNUNET_FS_file_information_inspect should be skipped because it
@@ -1284,7 +1284,7 @@ enum UnindexState
1284 * the respective DBlocks and IBlocks. 1284 * the respective DBlocks and IBlocks.
1285 */ 1285 */
1286 UNINDEX_STATE_DS_REMOVE = 1, 1286 UNINDEX_STATE_DS_REMOVE = 1,
1287 1287
1288 /** 1288 /**
1289 * Find out which keywords apply. 1289 * Find out which keywords apply.
1290 */ 1290 */
@@ -1300,12 +1300,12 @@ enum UnindexState
1300 * the unindexing. 1300 * the unindexing.
1301 */ 1301 */
1302 UNINDEX_STATE_FS_NOTIFY = 4, 1302 UNINDEX_STATE_FS_NOTIFY = 4,
1303 1303
1304 /** 1304 /**
1305 * We're done. 1305 * We're done.
1306 */ 1306 */
1307 UNINDEX_STATE_COMPLETE = 5, 1307 UNINDEX_STATE_COMPLETE = 5,
1308 1308
1309 /** 1309 /**
1310 * We've encountered a fatal error. 1310 * We've encountered a fatal error.
1311 */ 1311 */
@@ -1323,7 +1323,7 @@ struct GNUNET_FS_UnindexContext
1323 * The content hash key of the last block we processed, will in the 1323 * The content hash key of the last block we processed, will in the
1324 * end be set to the CHK from the URI. Used to remove the KBlocks. 1324 * end be set to the CHK from the URI. Used to remove the KBlocks.
1325 */ 1325 */
1326 struct ContentHashKey chk; 1326 struct ContentHashKey chk;
1327 1327
1328 /** 1328 /**
1329 * Global FS context. 1329 * Global FS context.
@@ -1460,7 +1460,7 @@ struct SearchRequestEntry
1460 1460
1461 /** 1461 /**
1462 * Derived public key, hashes to 'uquery'. 1462 * Derived public key, hashes to 'uquery'.
1463 */ 1463 */
1464 struct GNUNET_CRYPTO_EccPublicSignKey dpub; 1464 struct GNUNET_CRYPTO_EccPublicSignKey dpub;
1465 1465
1466 /** 1466 /**
diff --git a/src/fs/fs_dirmetascan.c b/src/fs/fs_dirmetascan.c
index d1b6d1c39..1df07a01c 100644
--- a/src/fs/fs_dirmetascan.c
+++ b/src/fs/fs_dirmetascan.c
@@ -53,13 +53,13 @@ struct GNUNET_FS_DirScanner
53 * Second argument to helper process. 53 * Second argument to helper process.
54 */ 54 */
55 char *ex_arg; 55 char *ex_arg;
56 56
57 /** 57 /**
58 * The function that will be called every time there's a progress 58 * The function that will be called every time there's a progress
59 * message. 59 * message.
60 */ 60 */
61 GNUNET_FS_DirScannerProgressCallback progress_callback; 61 GNUNET_FS_DirScannerProgressCallback progress_callback;
62 62
63 /** 63 /**
64 * A closure for progress_callback. 64 * A closure for progress_callback.
65 */ 65 */
@@ -68,7 +68,7 @@ struct GNUNET_FS_DirScanner
68 /** 68 /**
69 * After the scan is finished, it will contain a pointer to the 69 * After the scan is finished, it will contain a pointer to the
70 * top-level directory entry in the directory tree built by the 70 * top-level directory entry in the directory tree built by the
71 * scanner. 71 * scanner.
72 */ 72 */
73 struct GNUNET_FS_ShareTreeItem *toplevel; 73 struct GNUNET_FS_ShareTreeItem *toplevel;
74 74
@@ -103,7 +103,7 @@ GNUNET_FS_directory_scan_abort (struct GNUNET_FS_DirScanner *ds)
103 /* terminate helper */ 103 /* terminate helper */
104 if (NULL != ds->helper) 104 if (NULL != ds->helper)
105 GNUNET_HELPER_stop (ds->helper, GNUNET_NO); 105 GNUNET_HELPER_stop (ds->helper, GNUNET_NO);
106 106
107 /* free resources */ 107 /* free resources */
108 if (NULL != ds->toplevel) 108 if (NULL != ds->toplevel)
109 GNUNET_FS_share_tree_free (ds->toplevel); 109 GNUNET_FS_share_tree_free (ds->toplevel);
@@ -132,7 +132,7 @@ GNUNET_FS_directory_scan_get_result (struct GNUNET_FS_DirScanner *ds)
132 GNUNET_assert (NULL == ds->helper); 132 GNUNET_assert (NULL == ds->helper);
133 /* preserve result */ 133 /* preserve result */
134 result = ds->toplevel; 134 result = ds->toplevel;
135 ds->toplevel = NULL; 135 ds->toplevel = NULL;
136 GNUNET_FS_directory_scan_abort (ds); 136 GNUNET_FS_directory_scan_abort (ds);
137 return result; 137 return result;
138} 138}
@@ -149,7 +149,7 @@ static struct GNUNET_FS_ShareTreeItem *
149advance (struct GNUNET_FS_ShareTreeItem *pos) 149advance (struct GNUNET_FS_ShareTreeItem *pos)
150{ 150{
151 int moved; 151 int moved;
152 152
153 GNUNET_assert (NULL != pos); 153 GNUNET_assert (NULL != pos);
154 moved = 0; /* must not terminate, even on file, otherwise "normal" */ 154 moved = 0; /* must not terminate, even on file, otherwise "normal" */
155 while ( (pos->is_directory == GNUNET_YES) || 155 while ( (pos->is_directory == GNUNET_YES) ||
@@ -214,7 +214,7 @@ expand_tree (struct GNUNET_FS_ShareTreeItem *parent,
214 if (NULL != parent) 214 if (NULL != parent)
215 GNUNET_CONTAINER_DLL_insert (parent->children_head, 215 GNUNET_CONTAINER_DLL_insert (parent->children_head,
216 parent->children_tail, 216 parent->children_tail,
217 chld); 217 chld);
218 return chld; 218 return chld;
219} 219}
220 220
@@ -237,9 +237,9 @@ finish_scan (void *cls,
237 GNUNET_HELPER_stop (ds->helper, GNUNET_NO); 237 GNUNET_HELPER_stop (ds->helper, GNUNET_NO);
238 ds->helper = NULL; 238 ds->helper = NULL;
239 } 239 }
240 ds->progress_callback (ds->progress_callback_cls, 240 ds->progress_callback (ds->progress_callback_cls,
241 NULL, GNUNET_SYSERR, 241 NULL, GNUNET_SYSERR,
242 GNUNET_FS_DIRSCANNER_FINISHED); 242 GNUNET_FS_DIRSCANNER_FINISHED);
243} 243}
244 244
245 245
@@ -252,7 +252,7 @@ finish_scan (void *cls,
252 * @param msg message from the helper process 252 * @param msg message from the helper process
253 */ 253 */
254static int 254static int
255process_helper_msgs (void *cls, 255process_helper_msgs (void *cls,
256 void *client, 256 void *client,
257 const struct GNUNET_MessageHeader *msg) 257 const struct GNUNET_MessageHeader *msg)
258{ 258{
@@ -275,7 +275,7 @@ process_helper_msgs (void *cls,
275 GNUNET_break (0); 275 GNUNET_break (0);
276 break; 276 break;
277 } 277 }
278 ds->progress_callback (ds->progress_callback_cls, 278 ds->progress_callback (ds->progress_callback_cls,
279 filename, GNUNET_NO, 279 filename, GNUNET_NO,
280 GNUNET_FS_DIRSCANNER_FILE_START); 280 GNUNET_FS_DIRSCANNER_FILE_START);
281 if (NULL == ds->toplevel) 281 if (NULL == ds->toplevel)
@@ -301,7 +301,7 @@ process_helper_msgs (void *cls,
301 ds->pos = ds->pos->parent; 301 ds->pos = ds->pos->parent;
302 return GNUNET_OK; 302 return GNUNET_OK;
303 } 303 }
304 ds->progress_callback (ds->progress_callback_cls, 304 ds->progress_callback (ds->progress_callback_cls,
305 filename, GNUNET_YES, 305 filename, GNUNET_YES,
306 GNUNET_FS_DIRSCANNER_FILE_START); 306 GNUNET_FS_DIRSCANNER_FILE_START);
307 ds->pos = expand_tree (ds->pos, 307 ds->pos = expand_tree (ds->pos,
@@ -314,7 +314,7 @@ process_helper_msgs (void *cls,
314 case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_SKIP_FILE: 314 case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_SKIP_FILE:
315 if ('\0' != filename[left-1]) 315 if ('\0' != filename[left-1])
316 break; 316 break;
317 ds->progress_callback (ds->progress_callback_cls, 317 ds->progress_callback (ds->progress_callback_cls,
318 filename, GNUNET_SYSERR, 318 filename, GNUNET_SYSERR,
319 GNUNET_FS_DIRSCANNER_FILE_IGNORED); 319 GNUNET_FS_DIRSCANNER_FILE_IGNORED);
320 return GNUNET_OK; 320 return GNUNET_OK;
@@ -329,7 +329,7 @@ process_helper_msgs (void *cls,
329 GNUNET_break (0); 329 GNUNET_break (0);
330 break; 330 break;
331 } 331 }
332 ds->progress_callback (ds->progress_callback_cls, 332 ds->progress_callback (ds->progress_callback_cls,
333 NULL, GNUNET_SYSERR, 333 NULL, GNUNET_SYSERR,
334 GNUNET_FS_DIRSCANNER_ALL_COUNTED); 334 GNUNET_FS_DIRSCANNER_ALL_COUNTED);
335 ds->pos = ds->toplevel; 335 ds->pos = ds->toplevel;
@@ -340,7 +340,7 @@ process_helper_msgs (void *cls,
340 { 340 {
341 size_t nlen; 341 size_t nlen;
342 const char *end; 342 const char *end;
343 343
344 if (NULL == ds->pos) 344 if (NULL == ds->pos)
345 { 345 {
346 GNUNET_break (0); 346 GNUNET_break (0);
@@ -361,7 +361,7 @@ process_helper_msgs (void *cls,
361 GNUNET_break (0); 361 GNUNET_break (0);
362 break; 362 break;
363 } 363 }
364 ds->progress_callback (ds->progress_callback_cls, 364 ds->progress_callback (ds->progress_callback_cls,
365 filename, GNUNET_YES, 365 filename, GNUNET_YES,
366 GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED); 366 GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED);
367 if (0 < left) 367 if (0 < left)
@@ -373,18 +373,18 @@ process_helper_msgs (void *cls,
373 break; 373 break;
374 } 374 }
375 /* having full filenames is too dangerous; always make sure we clean them up */ 375 /* having full filenames is too dangerous; always make sure we clean them up */
376 GNUNET_CONTAINER_meta_data_delete (ds->pos->meta, 376 GNUNET_CONTAINER_meta_data_delete (ds->pos->meta,
377 EXTRACTOR_METATYPE_FILENAME, 377 EXTRACTOR_METATYPE_FILENAME,
378 NULL, 0); 378 NULL, 0);
379 /* instead, put in our 'safer' original filename */ 379 /* instead, put in our 'safer' original filename */
380 GNUNET_CONTAINER_meta_data_insert (ds->pos->meta, "<libgnunetfs>", 380 GNUNET_CONTAINER_meta_data_insert (ds->pos->meta, "<libgnunetfs>",
381 EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME, 381 EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
382 EXTRACTOR_METAFORMAT_UTF8, "text/plain", 382 EXTRACTOR_METAFORMAT_UTF8, "text/plain",
383 ds->pos->short_filename, 383 ds->pos->short_filename,
384 strlen (ds->pos->short_filename) + 1); 384 strlen (ds->pos->short_filename) + 1);
385 } 385 }
386 ds->pos->ksk_uri = GNUNET_FS_uri_ksk_create_from_meta_data (ds->pos->meta); 386 ds->pos->ksk_uri = GNUNET_FS_uri_ksk_create_from_meta_data (ds->pos->meta);
387 ds->pos = advance (ds->pos); 387 ds->pos = advance (ds->pos);
388 return GNUNET_OK; 388 return GNUNET_OK;
389 } 389 }
390 case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_FINISHED: 390 case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_FINISHED:
@@ -397,7 +397,7 @@ process_helper_msgs (void *cls,
397 { 397 {
398 GNUNET_break (0); 398 GNUNET_break (0);
399 break; 399 break;
400 } 400 }
401 if (NULL == ds->toplevel) 401 if (NULL == ds->toplevel)
402 { 402 {
403 GNUNET_break (0); 403 GNUNET_break (0);
@@ -410,7 +410,7 @@ process_helper_msgs (void *cls,
410 GNUNET_break (0); 410 GNUNET_break (0);
411 break; 411 break;
412 } 412 }
413 ds->progress_callback (ds->progress_callback_cls, 413 ds->progress_callback (ds->progress_callback_cls,
414 NULL, GNUNET_SYSERR, 414 NULL, GNUNET_SYSERR,
415 GNUNET_FS_DIRSCANNER_INTERNAL_ERROR); 415 GNUNET_FS_DIRSCANNER_INTERNAL_ERROR);
416 return GNUNET_OK; 416 return GNUNET_OK;
@@ -430,9 +430,9 @@ helper_died_cb (void *cls)
430 ds->helper = NULL; 430 ds->helper = NULL;
431 if (GNUNET_SCHEDULER_NO_TASK != ds->stop_task) 431 if (GNUNET_SCHEDULER_NO_TASK != ds->stop_task)
432 return; /* normal death, was finished */ 432 return; /* normal death, was finished */
433 ds->progress_callback (ds->progress_callback_cls, 433 ds->progress_callback (ds->progress_callback_cls,
434 NULL, GNUNET_SYSERR, 434 NULL, GNUNET_SYSERR,
435 GNUNET_FS_DIRSCANNER_INTERNAL_ERROR); 435 GNUNET_FS_DIRSCANNER_INTERNAL_ERROR);
436} 436}
437 437
438 438
@@ -449,7 +449,7 @@ helper_died_cb (void *cls)
449struct GNUNET_FS_DirScanner * 449struct GNUNET_FS_DirScanner *
450GNUNET_FS_directory_scan_start (const char *filename, 450GNUNET_FS_directory_scan_start (const char *filename,
451 int disable_extractor, const char *ex, 451 int disable_extractor, const char *ex,
452 GNUNET_FS_DirScannerProgressCallback cb, 452 GNUNET_FS_DirScannerProgressCallback cb,
453 void *cb_cls) 453 void *cb_cls)
454{ 454{
455 struct stat sbuf; 455 struct stat sbuf;
@@ -468,9 +468,9 @@ GNUNET_FS_directory_scan_start (const char *filename,
468 ds->progress_callback = cb; 468 ds->progress_callback = cb;
469 ds->progress_callback_cls = cb_cls; 469 ds->progress_callback_cls = cb_cls;
470 ds->filename_expanded = filename_expanded; 470 ds->filename_expanded = filename_expanded;
471 if (disable_extractor) 471 if (disable_extractor)
472 ds->ex_arg = GNUNET_strdup ("-"); 472 ds->ex_arg = GNUNET_strdup ("-");
473 else 473 else
474 ds->ex_arg = (NULL != ex) ? GNUNET_strdup (ex) : NULL; 474 ds->ex_arg = (NULL != ex) ? GNUNET_strdup (ex) : NULL;
475 ds->args[0] = "gnunet-helper-fs-publish"; 475 ds->args[0] = "gnunet-helper-fs-publish";
476 ds->args[1] = ds->filename_expanded; 476 ds->args[1] = ds->filename_expanded;
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c
index 49c83bdc6..070be0106 100644
--- a/src/fs/fs_download.c
+++ b/src/fs/fs_download.c
@@ -690,7 +690,7 @@ try_top_down_reconstruction (struct GNUNET_FS_DownloadContext *dc,
690 drc = dr->children[i]; 690 drc = dr->children[i];
691 GNUNET_assert (drc->offset >= dr->offset); 691 GNUNET_assert (drc->offset >= dr->offset);
692 child_block_size = GNUNET_FS_tree_compute_tree_size (drc->depth); 692 child_block_size = GNUNET_FS_tree_compute_tree_size (drc->depth);
693 GNUNET_assert (0 == (drc->offset - dr->offset) % child_block_size); 693 GNUNET_assert (0 == (drc->offset - dr->offset) % child_block_size);
694 if (BRS_INIT == drc->state) 694 if (BRS_INIT == drc->state)
695 { 695 {
696 drc->state = BRS_CHK_SET; 696 drc->state = BRS_CHK_SET;
@@ -1083,7 +1083,7 @@ process_result_with_request (void *cls, const struct GNUNET_HashCode * key,
1083 pi.value.download.specifics.progress.respect_offered = prc->respect_offered; 1083 pi.value.download.specifics.progress.respect_offered = prc->respect_offered;
1084 pi.value.download.specifics.progress.num_transmissions = prc->num_transmissions; 1084 pi.value.download.specifics.progress.num_transmissions = prc->num_transmissions;
1085 if (prc->last_transmission.abs_value_us != GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) 1085 if (prc->last_transmission.abs_value_us != GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us)
1086 pi.value.download.specifics.progress.block_download_duration 1086 pi.value.download.specifics.progress.block_download_duration
1087 = GNUNET_TIME_absolute_get_duration (prc->last_transmission); 1087 = GNUNET_TIME_absolute_get_duration (prc->last_transmission);
1088 else 1088 else
1089 pi.value.download.specifics.progress.block_download_duration 1089 pi.value.download.specifics.progress.block_download_duration
@@ -1445,7 +1445,7 @@ try_reconnect (struct GNUNET_FS_DownloadContext *dc)
1445 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Will try to reconnect in %s\n", 1445 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Will try to reconnect in %s\n",
1446 GNUNET_STRINGS_relative_time_to_string (dc->reconnect_backoff, GNUNET_YES)); 1446 GNUNET_STRINGS_relative_time_to_string (dc->reconnect_backoff, GNUNET_YES));
1447 dc->task = 1447 dc->task =
1448 GNUNET_SCHEDULER_add_delayed (dc->reconnect_backoff, 1448 GNUNET_SCHEDULER_add_delayed (dc->reconnect_backoff,
1449 &do_reconnect, 1449 &do_reconnect,
1450 dc); 1450 dc);
1451} 1451}
@@ -1539,7 +1539,7 @@ deactivate_fs_download (void *cls)
1539 * the specified depth 1539 * the specified depth
1540 */ 1540 */
1541static struct DownloadRequest * 1541static struct DownloadRequest *
1542create_download_request (struct DownloadRequest *parent, 1542create_download_request (struct DownloadRequest *parent,
1543 unsigned int chk_idx, 1543 unsigned int chk_idx,
1544 unsigned int depth, 1544 unsigned int depth,
1545 uint64_t dr_offset, uint64_t file_start_offset, 1545 uint64_t dr_offset, uint64_t file_start_offset,
@@ -1558,7 +1558,7 @@ create_download_request (struct DownloadRequest *parent,
1558 if (0 == depth) 1558 if (0 == depth)
1559 return dr; 1559 return dr;
1560 child_block_size = GNUNET_FS_tree_compute_tree_size (depth - 1); 1560 child_block_size = GNUNET_FS_tree_compute_tree_size (depth - 1);
1561 1561
1562 /* calculate how many blocks at this level are not interesting 1562 /* calculate how many blocks at this level are not interesting
1563 * from the start (rounded down), either because of the requested 1563 * from the start (rounded down), either because of the requested
1564 * file offset or because this IBlock is further along */ 1564 * file offset or because this IBlock is further along */
@@ -1570,7 +1570,7 @@ create_download_request (struct DownloadRequest *parent,
1570 { 1570 {
1571 head_skip = 0; 1571 head_skip = 0;
1572 } 1572 }
1573 1573
1574 /* calculate index of last block at this level that is interesting (rounded up) */ 1574 /* calculate index of last block at this level that is interesting (rounded up) */
1575 dr->num_children = (file_start_offset + desired_length - dr_offset) / child_block_size; 1575 dr->num_children = (file_start_offset + desired_length - dr_offset) / child_block_size;
1576 if (dr->num_children * child_block_size < 1576 if (dr->num_children * child_block_size <
@@ -1585,12 +1585,12 @@ create_download_request (struct DownloadRequest *parent,
1585 (unsigned long long) dr_offset, 1585 (unsigned long long) dr_offset,
1586 depth, 1586 depth,
1587 dr->num_children); 1587 dr->num_children);
1588 1588
1589 /* now we can get the total number of *interesting* children for this block */ 1589 /* now we can get the total number of *interesting* children for this block */
1590 1590
1591 /* why else would we have gotten here to begin with? (that'd be a bad logic error) */ 1591 /* why else would we have gotten here to begin with? (that'd be a bad logic error) */
1592 GNUNET_assert (dr->num_children > 0); 1592 GNUNET_assert (dr->num_children > 0);
1593 1593
1594 dr->children = 1594 dr->children =
1595 GNUNET_malloc (dr->num_children * sizeof (struct DownloadRequest *)); 1595 GNUNET_malloc (dr->num_children * sizeof (struct DownloadRequest *));
1596 for (i = 0; i < dr->num_children; i++) 1596 for (i = 0; i < dr->num_children; i++)
@@ -1616,7 +1616,7 @@ reconstruct_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1616{ 1616{
1617 struct GNUNET_FS_DownloadContext *dc = cls; 1617 struct GNUNET_FS_DownloadContext *dc = cls;
1618 1618
1619 /* clean up state from tree encoder */ 1619 /* clean up state from tree encoder */
1620 if (dc->task != GNUNET_SCHEDULER_NO_TASK) 1620 if (dc->task != GNUNET_SCHEDULER_NO_TASK)
1621 { 1621 {
1622 GNUNET_SCHEDULER_cancel (dc->task); 1622 GNUNET_SCHEDULER_cancel (dc->task);
@@ -1965,7 +1965,7 @@ GNUNET_FS_download_start_task_ (void *cls,
1965 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1965 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1966 "Trying bottom-up reconstruction of file `%s'\n", dc->filename); 1966 "Trying bottom-up reconstruction of file `%s'\n", dc->filename);
1967 dc->te = 1967 dc->te =
1968 GNUNET_FS_tree_encoder_create (dc->h, 1968 GNUNET_FS_tree_encoder_create (dc->h,
1969 GNUNET_FS_uri_chk_get_file_size (dc->uri), 1969 GNUNET_FS_uri_chk_get_file_size (dc->uri),
1970 dc, &fh_reader, 1970 dc, &fh_reader,
1971 &reconstruct_cb, NULL, 1971 &reconstruct_cb, NULL,
@@ -2116,7 +2116,7 @@ create_download_context (struct GNUNET_FS_Handle *h,
2116 else 2116 else
2117 dc->temp_filename = GNUNET_DISK_mktemp ("gnunet-directory-download-tmp"); 2117 dc->temp_filename = GNUNET_DISK_mktemp ("gnunet-directory-download-tmp");
2118 } 2118 }
2119 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2119 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2120 "Starting download `%s' of %llu bytes with tree depth %u\n", 2120 "Starting download `%s' of %llu bytes with tree depth %u\n",
2121 filename, 2121 filename,
2122 (unsigned long long) length, 2122 (unsigned long long) length,
@@ -2267,7 +2267,7 @@ GNUNET_FS_download_start_downloading_ (struct GNUNET_FS_DownloadContext *dc)
2267 GNUNET_FS_queue_ (dc->h, &activate_fs_download, &deactivate_fs_download, 2267 GNUNET_FS_queue_ (dc->h, &activate_fs_download, &deactivate_fs_download,
2268 dc, (dc->length + DBLOCK_SIZE - 1) / DBLOCK_SIZE, 2268 dc, (dc->length + DBLOCK_SIZE - 1) / DBLOCK_SIZE,
2269 (0 == (dc->options & GNUNET_FS_DOWNLOAD_IS_PROBE)) 2269 (0 == (dc->options & GNUNET_FS_DOWNLOAD_IS_PROBE))
2270 ? GNUNET_FS_QUEUE_PRIORITY_NORMAL 2270 ? GNUNET_FS_QUEUE_PRIORITY_NORMAL
2271 : GNUNET_FS_QUEUE_PRIORITY_PROBE); 2271 : GNUNET_FS_QUEUE_PRIORITY_PROBE);
2272 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2272 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2273 "Download %p put into queue as job %p\n", 2273 "Download %p put into queue as job %p\n",
diff --git a/src/fs/fs_namespace.c b/src/fs/fs_namespace.c
index 2fe1de7e2..f4cd82978 100644
--- a/src/fs/fs_namespace.c
+++ b/src/fs/fs_namespace.c
@@ -147,9 +147,9 @@ get_update_information_directory (struct GNUNET_FS_Handle *h,
147 GNUNET_CRYPTO_hash (&pub, sizeof (pub), &hc); 147 GNUNET_CRYPTO_hash (&pub, sizeof (pub), &hc);
148 GNUNET_CRYPTO_hash_to_enc (&hc, 148 GNUNET_CRYPTO_hash_to_enc (&hc,
149 &enc); 149 &enc);
150 GNUNET_asprintf (&ret, "%s%s%s", 150 GNUNET_asprintf (&ret, "%s%s%s",
151 dn, 151 dn,
152 DIR_SEPARATOR_STR, 152 DIR_SEPARATOR_STR,
153 (const char *) enc.encoding); 153 (const char *) enc.encoding);
154 GNUNET_free (dn); 154 GNUNET_free (dn);
155 return ret; 155 return ret;
@@ -158,7 +158,7 @@ get_update_information_directory (struct GNUNET_FS_Handle *h,
158 158
159/** 159/**
160 * Release memory occupied by UIG datastructure. 160 * Release memory occupied by UIG datastructure.
161 * 161 *
162 * @param uig data structure to free 162 * @param uig data structure to free
163 */ 163 */
164static void 164static void
@@ -317,7 +317,7 @@ read_update_information_graph (struct GNUNET_FS_Handle *h,
317 END: 317 END:
318 if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg)) 318 if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg))
319 { 319 {
320 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to read `%s': %s\n"), 320 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to read `%s': %s\n"),
321 fn, emsg); 321 fn, emsg);
322 GNUNET_free (emsg); 322 GNUNET_free (emsg);
323 } 323 }
@@ -383,7 +383,7 @@ struct GNUNET_FS_PublishSksContext
383 * @param msg error message (or NULL) 383 * @param msg error message (or NULL)
384 */ 384 */
385static void 385static void
386sks_publish_cont (void *cls, 386sks_publish_cont (void *cls,
387 const char *msg) 387 const char *msg)
388{ 388{
389 struct GNUNET_FS_PublishSksContext *psc = cls; 389 struct GNUNET_FS_PublishSksContext *psc = cls;
@@ -405,7 +405,7 @@ sks_publish_cont (void *cls,
405 uig = read_update_information_graph (psc->h, 405 uig = read_update_information_graph (psc->h,
406 &psc->ns); 406 &psc->ns);
407 GNUNET_array_append (uig->update_nodes, 407 GNUNET_array_append (uig->update_nodes,
408 uig->update_node_count, 408 uig->update_node_count,
409 psc->nsn); 409 psc->nsn);
410 psc->nsn = NULL; 410 psc->nsn = NULL;
411 write_update_information_graph (uig); 411 write_update_information_graph (uig);
@@ -549,16 +549,16 @@ struct ProcessUpdateClosure
549 * GNUNET_NO if not. 549 * GNUNET_NO if not.
550 */ 550 */
551static int 551static int
552process_update_node (void *cls, 552process_update_node (void *cls,
553 const struct GNUNET_HashCode *key, 553 const struct GNUNET_HashCode *key,
554 void *value) 554 void *value)
555{ 555{
556 struct ProcessUpdateClosure *pc = cls; 556 struct ProcessUpdateClosure *pc = cls;
557 struct NamespaceUpdateNode *nsn = value; 557 struct NamespaceUpdateNode *nsn = value;
558 558
559 pc->ip (pc->ip_cls, 559 pc->ip (pc->ip_cls,
560 nsn->id, 560 nsn->id,
561 nsn->uri, 561 nsn->uri,
562 nsn->md, 562 nsn->md,
563 nsn->update); 563 nsn->update);
564 return GNUNET_YES; 564 return GNUNET_YES;
@@ -619,7 +619,7 @@ struct FindTreeClosure
619 */ 619 */
620static int 620static int
621find_trees (void *cls, 621find_trees (void *cls,
622 const struct GNUNET_HashCode *key, 622 const struct GNUNET_HashCode *key,
623 void *value) 623 void *value)
624{ 624{
625 struct FindTreeClosure *fc = cls; 625 struct FindTreeClosure *fc = cls;
@@ -780,7 +780,7 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Handle *h,
780 fc.tree_array[fc.id] = nsn; 780 fc.tree_array[fc.id] = nsn;
781 nsn->tree_id = fc.id; 781 nsn->tree_id = fc.id;
782 } 782 }
783 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 783 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
784 "TREE of node `%s' is %u\n", nsn->id, 784 "TREE of node `%s' is %u\n", nsn->id,
785 fc.id); 785 fc.id);
786 } 786 }
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index 0d2dae283..387ede6a1 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -112,7 +112,7 @@ publish_cleanup (struct GNUNET_FS_PublishContext *pc)
112 * @param msg error message (or NULL) 112 * @param msg error message (or NULL)
113 */ 113 */
114static void 114static void
115ds_put_cont (void *cls, int success, 115ds_put_cont (void *cls, int success,
116 struct GNUNET_TIME_Absolute min_expiration, 116 struct GNUNET_TIME_Absolute min_expiration,
117 const char *msg) 117 const char *msg)
118{ 118{
@@ -206,14 +206,14 @@ signal_publish_error (struct GNUNET_FS_FileInformation *p,
206 * @param msg error message (typically NULL, not used) 206 * @param msg error message (typically NULL, not used)
207 */ 207 */
208static void 208static void
209finish_release_reserve (void *cls, int success, 209finish_release_reserve (void *cls, int success,
210 struct GNUNET_TIME_Absolute min_expiration, 210 struct GNUNET_TIME_Absolute min_expiration,
211 const char *msg) 211 const char *msg)
212{ 212{
213 struct GNUNET_FS_PublishContext *pc = cls; 213 struct GNUNET_FS_PublishContext *pc = cls;
214 214
215 pc->qre = NULL; 215 pc->qre = NULL;
216 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 216 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
217 "Releasing reserve done!\n"); 217 "Releasing reserve done!\n");
218 signal_publish_completion (pc->fi, pc); 218 signal_publish_completion (pc->fi, pc);
219 pc->all_done = GNUNET_YES; 219 pc->all_done = GNUNET_YES;
@@ -268,8 +268,8 @@ publish_sblock (struct GNUNET_FS_PublishContext *pc)
268{ 268{
269 if (NULL != pc->ns) 269 if (NULL != pc->ns)
270 pc->sks_pc = GNUNET_FS_publish_sks (pc->h, 270 pc->sks_pc = GNUNET_FS_publish_sks (pc->h,
271 pc->ns, 271 pc->ns,
272 pc->nid, 272 pc->nid,
273 pc->nuid, 273 pc->nuid,
274 pc->fi->meta, 274 pc->fi->meta,
275 pc->fi->chk_uri, 275 pc->fi->chk_uri,
@@ -300,7 +300,7 @@ publish_kblocks_cont (void *cls, const struct GNUNET_FS_Uri *uri,
300 pc->ksk_pc = NULL; 300 pc->ksk_pc = NULL;
301 if (NULL != emsg) 301 if (NULL != emsg)
302 { 302 {
303 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 303 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
304 "Error uploading KSK blocks: %s\n", 304 "Error uploading KSK blocks: %s\n",
305 emsg); 305 emsg);
306 signal_publish_error (p, pc, emsg); 306 signal_publish_error (p, pc, emsg);
@@ -359,7 +359,7 @@ block_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg)
359 } 359 }
360 else 360 else
361 { 361 {
362 if (UINT64_MAX == offset) 362 if (UINT64_MAX == offset)
363 { 363 {
364 if (&GNUNET_FS_data_reader_file_ == p->data.file.reader) 364 if (&GNUNET_FS_data_reader_file_ == p->data.file.reader)
365 { 365 {
@@ -408,10 +408,10 @@ encode_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
408 if (NULL != emsg) 408 if (NULL != emsg)
409 { 409 {
410 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 410 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
411 "Error during tree walk: %s\n", 411 "Error during tree walk: %s\n",
412 emsg); 412 emsg);
413 GNUNET_asprintf (&p->emsg, 413 GNUNET_asprintf (&p->emsg,
414 _("Publishing failed: %s"), 414 _("Publishing failed: %s"),
415 emsg); 415 emsg);
416 GNUNET_free (emsg); 416 GNUNET_free (emsg);
417 pi.status = GNUNET_FS_STATUS_PUBLISH_ERROR; 417 pi.status = GNUNET_FS_STATUS_PUBLISH_ERROR;
@@ -603,7 +603,7 @@ publish_content (struct GNUNET_FS_PublishContext *pc)
603 GNUNET_FS_file_information_sync_ (p); 603 GNUNET_FS_file_information_sync_ (p);
604 } 604 }
605 size = (GNUNET_YES == p->is_directory) ? p->data.dir.dir_size : p->data.file.file_size; 605 size = (GNUNET_YES == p->is_directory) ? p->data.dir.dir_size : p->data.file.file_size;
606 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 606 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
607 "Creating tree encoder\n"); 607 "Creating tree encoder\n");
608 p->te = 608 p->te =
609 GNUNET_FS_tree_encoder_create (pc->h, size, pc, &block_reader, 609 GNUNET_FS_tree_encoder_create (pc->h, size, pc, &block_reader,
@@ -625,7 +625,7 @@ publish_content (struct GNUNET_FS_PublishContext *pc)
625 * @param msg the response we got 625 * @param msg the response we got
626 */ 626 */
627static void 627static void
628process_index_start_response (void *cls, 628process_index_start_response (void *cls,
629 const struct GNUNET_MessageHeader *msg) 629 const struct GNUNET_MessageHeader *msg)
630{ 630{
631 struct GNUNET_FS_PublishContext *pc = cls; 631 struct GNUNET_FS_PublishContext *pc = cls;
@@ -696,7 +696,7 @@ hash_for_index_cb (void *cls,
696 { 696 {
697 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 697 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
698 _("Can not index file `%s': %s. Will try to insert instead.\n"), 698 _("Can not index file `%s': %s. Will try to insert instead.\n"),
699 p->filename, 699 p->filename,
700 _("failed to compute hash")); 700 _("failed to compute hash"));
701 p->data.file.do_index = GNUNET_NO; 701 p->data.file.do_index = GNUNET_NO;
702 GNUNET_FS_file_information_sync_ (p); 702 GNUNET_FS_file_information_sync_ (p);
@@ -741,7 +741,7 @@ hash_for_index_cb (void *cls,
741 { 741 {
742 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 742 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
743 _("Can not index file `%s': %s. Will try to insert instead.\n"), 743 _("Can not index file `%s': %s. Will try to insert instead.\n"),
744 p->filename, 744 p->filename,
745 _("could not connect to `fs' service")); 745 _("could not connect to `fs' service"));
746 p->data.file.do_index = GNUNET_NO; 746 p->data.file.do_index = GNUNET_NO;
747 publish_content (pc); 747 publish_content (pc);
@@ -810,8 +810,8 @@ GNUNET_FS_publish_main_ (void *cls,
810 return; 810 return;
811 } 811 }
812 /* find starting position */ 812 /* find starting position */
813 while ( (GNUNET_YES == p->is_directory) && 813 while ( (GNUNET_YES == p->is_directory) &&
814 (NULL != p->data.dir.entries) && 814 (NULL != p->data.dir.entries) &&
815 (NULL == p->emsg) && 815 (NULL == p->emsg) &&
816 (NULL == p->data.dir.entries->chk_uri) ) 816 (NULL == p->data.dir.entries->chk_uri) )
817 { 817 {
@@ -822,8 +822,8 @@ GNUNET_FS_publish_main_ (void *cls,
822 /* abort on error */ 822 /* abort on error */
823 if (NULL != p->emsg) 823 if (NULL != p->emsg)
824 { 824 {
825 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 825 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
826 "Error uploading: %s\n", 826 "Error uploading: %s\n",
827 p->emsg); 827 p->emsg);
828 /* error with current file, abort all 828 /* error with current file, abort all
829 * related files as well! */ 829 * related files as well! */
@@ -928,9 +928,9 @@ fip_signal_start (void *cls,
928 struct GNUNET_FS_FileInformation *fi, 928 struct GNUNET_FS_FileInformation *fi,
929 uint64_t length, 929 uint64_t length,
930 struct GNUNET_CONTAINER_MetaData *meta, 930 struct GNUNET_CONTAINER_MetaData *meta,
931 struct GNUNET_FS_Uri **uri, 931 struct GNUNET_FS_Uri **uri,
932 struct GNUNET_FS_BlockOptions *bo, 932 struct GNUNET_FS_BlockOptions *bo,
933 int *do_index, 933 int *do_index,
934 void **client_info) 934 void **client_info)
935{ 935{
936 struct GNUNET_FS_PublishContext *pc = cls; 936 struct GNUNET_FS_PublishContext *pc = cls;
@@ -1013,7 +1013,7 @@ suspend_operation (struct GNUNET_FS_FileInformation *fi,
1013 GNUNET_FS_publish_sks_cancel (pc->sks_pc); 1013 GNUNET_FS_publish_sks_cancel (pc->sks_pc);
1014 pc->sks_pc = NULL; 1014 pc->sks_pc = NULL;
1015 } 1015 }
1016 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1016 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1017 "Suspending publish operation\n"); 1017 "Suspending publish operation\n");
1018 GNUNET_free_non_null (fi->serialization); 1018 GNUNET_free_non_null (fi->serialization);
1019 fi->serialization = NULL; 1019 fi->serialization = NULL;
@@ -1051,10 +1051,10 @@ suspend_operation (struct GNUNET_FS_FileInformation *fi,
1051static int 1051static int
1052fip_signal_suspend (void *cls, 1052fip_signal_suspend (void *cls,
1053 struct GNUNET_FS_FileInformation *fi, 1053 struct GNUNET_FS_FileInformation *fi,
1054 uint64_t length, 1054 uint64_t length,
1055 struct GNUNET_CONTAINER_MetaData *meta, 1055 struct GNUNET_CONTAINER_MetaData *meta,
1056 struct GNUNET_FS_Uri **uri, 1056 struct GNUNET_FS_Uri **uri,
1057 struct GNUNET_FS_BlockOptions *bo, 1057 struct GNUNET_FS_BlockOptions *bo,
1058 int *do_index, 1058 int *do_index,
1059 void **client_info) 1059 void **client_info)
1060{ 1060{
@@ -1112,7 +1112,7 @@ GNUNET_FS_publish_signal_suspend_ (void *cls)
1112 * @param msg error message on error, otherwise NULL 1112 * @param msg error message on error, otherwise NULL
1113 */ 1113 */
1114static void 1114static void
1115finish_reserve (void *cls, int success, 1115finish_reserve (void *cls, int success,
1116 struct GNUNET_TIME_Absolute min_expiration, 1116 struct GNUNET_TIME_Absolute min_expiration,
1117 const char *msg) 1117 const char *msg)
1118{ 1118{
@@ -1122,7 +1122,7 @@ finish_reserve (void *cls, int success,
1122 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Reservation complete (%d)!\n", success); 1122 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Reservation complete (%d)!\n", success);
1123 if ((msg != NULL) || (success <= 0)) 1123 if ((msg != NULL) || (success <= 0))
1124 { 1124 {
1125 GNUNET_asprintf (&pc->fi->emsg, 1125 GNUNET_asprintf (&pc->fi->emsg,
1126 _("Insufficient space for publishing: %s"), 1126 _("Insufficient space for publishing: %s"),
1127 msg); 1127 msg);
1128 signal_publish_error (pc->fi, pc, pc->fi->emsg); 1128 signal_publish_error (pc->fi, pc, pc->fi->emsg);
diff --git a/src/fs/fs_publish_ksk.c b/src/fs/fs_publish_ksk.c
index f844217e8..6aac94011 100644
--- a/src/fs/fs_publish_ksk.c
+++ b/src/fs/fs_publish_ksk.c
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file fs/fs_publish_ksk.c 22 * @file fs/fs_publish_ksk.c
23 * @brief publish a URI under a keyword in GNUnet 23 * @brief publish a URI under a keyword in GNUnet
24 * @see https://gnunet.org/encoding and #2564 24 * @see https://gnunet.org/encoding and #2564
25 * @author Krista Bennett 25 * @author Krista Bennett
26 * @author Christian Grothoff 26 * @author Christian Grothoff
27 */ 27 */
@@ -93,7 +93,7 @@ struct GNUNET_FS_PublishKskContext
93 93
94 /** 94 /**
95 * Options to use. 95 * Options to use.
96 */ 96 */
97 enum GNUNET_FS_PublishOptions options; 97 enum GNUNET_FS_PublishOptions options;
98 98
99 /** 99 /**
@@ -113,7 +113,7 @@ struct GNUNET_FS_PublishKskContext
113 * @param tc unused 113 * @param tc unused
114 */ 114 */
115static void 115static void
116publish_ksk_cont (void *cls, 116publish_ksk_cont (void *cls,
117 const struct GNUNET_SCHEDULER_TaskContext *tc); 117 const struct GNUNET_SCHEDULER_TaskContext *tc);
118 118
119 119
@@ -133,7 +133,7 @@ kb_put_cont (void *cls,
133 pkc->uc = NULL; 133 pkc->uc = NULL;
134 if (NULL != msg) 134 if (NULL != msg)
135 { 135 {
136 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 136 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
137 "KBlock PUT operation failed: %s\n", msg); 137 "KBlock PUT operation failed: %s\n", msg);
138 pkc->cont (pkc->cont_cls, NULL, msg); 138 pkc->cont (pkc->cont_cls, NULL, msg);
139 GNUNET_FS_publish_ksk_cancel (pkc); 139 GNUNET_FS_publish_ksk_cancel (pkc);
diff --git a/src/fs/fs_publish_ublock.c b/src/fs/fs_publish_ublock.c
index c84b21ba8..18f4804d1 100644
--- a/src/fs/fs_publish_ublock.c
+++ b/src/fs/fs_publish_ublock.c
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file fs/fs_publish_ublock.c 22 * @file fs/fs_publish_ublock.c
23 * @brief publish a UBLOCK in GNUnet 23 * @brief publish a UBLOCK in GNUnet
24 * @see https://gnunet.org/encoding and #2564 24 * @see https://gnunet.org/encoding and #2564
25 * @author Krista Bennett 25 * @author Krista Bennett
26 * @author Christian Grothoff 26 * @author Christian Grothoff
27 */ 27 */
@@ -41,7 +41,7 @@
41 * @param iv where to store the IV 41 * @param iv where to store the IV
42 * @param label label to use for key derivation 42 * @param label label to use for key derivation
43 * @param pub public key to use for key derivation 43 * @param pub public key to use for key derivation
44 */ 44 */
45static void 45static void
46derive_ublock_encryption_key (struct GNUNET_CRYPTO_SymmetricSessionKey *skey, 46derive_ublock_encryption_key (struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
47 struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, 47 struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
@@ -69,7 +69,7 @@ derive_ublock_encryption_key (struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
69 * @param ns public key under which the UBlock was stored 69 * @param ns public key under which the UBlock was stored
70 * @param label label under which the UBlock was stored 70 * @param label label under which the UBlock was stored
71 * @param output where to write the result, has input_len bytes 71 * @param output where to write the result, has input_len bytes
72 */ 72 */
73void 73void
74GNUNET_FS_ublock_decrypt_ (const void *input, 74GNUNET_FS_ublock_decrypt_ (const void *input,
75 size_t input_len, 75 size_t input_len,
@@ -124,7 +124,7 @@ struct GNUNET_FS_PublishUblockContext
124 * @param msg NULL on success, otherwise an error message 124 * @param msg NULL on success, otherwise an error message
125 */ 125 */
126static void 126static void
127ublock_put_cont (void *cls, 127ublock_put_cont (void *cls,
128 int32_t success, 128 int32_t success,
129 struct GNUNET_TIME_Absolute min_expiration, 129 struct GNUNET_TIME_Absolute min_expiration,
130 const char *msg) 130 const char *msg)
@@ -221,7 +221,7 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h,
221 } 221 }
222 size = sizeof (struct UBlock) + slen + mdsize + ulen; 222 size = sizeof (struct UBlock) + slen + mdsize + ulen;
223 223
224 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 224 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
225 "Publishing under identifier `%s'\n", 225 "Publishing under identifier `%s'\n",
226 label); 226 label);
227 /* get public key of the namespace */ 227 /* get public key of the namespace */
@@ -232,11 +232,11 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h,
232 232
233 /* encrypt ublock */ 233 /* encrypt ublock */
234 ub_enc = GNUNET_malloc (size); 234 ub_enc = GNUNET_malloc (size);
235 GNUNET_CRYPTO_symmetric_encrypt (&ub_plain[1], 235 GNUNET_CRYPTO_symmetric_encrypt (&ub_plain[1],
236 ulen + slen + mdsize, 236 ulen + slen + mdsize,
237 &skey, &iv, 237 &skey, &iv,
238 &ub_enc[1]); 238 &ub_enc[1]);
239 ub_enc->purpose.size = htonl (ulen + slen + mdsize + 239 ub_enc->purpose.size = htonl (ulen + slen + mdsize +
240 sizeof (struct UBlock) 240 sizeof (struct UBlock)
241 - sizeof (struct GNUNET_CRYPTO_EccSignature)); 241 - sizeof (struct GNUNET_CRYPTO_EccSignature));
242 ub_enc->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_UBLOCK); 242 ub_enc->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_UBLOCK);
diff --git a/src/fs/fs_publish_ublock.h b/src/fs/fs_publish_ublock.h
index 1a7d338d2..ed8d599a8 100644
--- a/src/fs/fs_publish_ublock.h
+++ b/src/fs/fs_publish_ublock.h
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file fs/fs_publish_ublock.h 22 * @file fs/fs_publish_ublock.h
23 * @brief publish a UBLOCK in GNUnet 23 * @brief publish a UBLOCK in GNUnet
24 * @see https://gnunet.org/encoding and #2564 24 * @see https://gnunet.org/encoding and #2564
25 * @author Krista Bennett 25 * @author Krista Bennett
26 * @author Christian Grothoff 26 * @author Christian Grothoff
27 */ 27 */
@@ -42,7 +42,7 @@
42 * @param ns public key under which the UBlock was stored 42 * @param ns public key under which the UBlock was stored
43 * @param label label under which the UBlock was stored 43 * @param label label under which the UBlock was stored
44 * @param output where to write the result, has input_len bytes 44 * @param output where to write the result, has input_len bytes
45 */ 45 */
46void 46void
47GNUNET_FS_ublock_decrypt_ (const void *input, 47GNUNET_FS_ublock_decrypt_ (const void *input,
48 size_t input_len, 48 size_t input_len,
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c
index 2e09c1e22..7a869b4c5 100644
--- a/src/fs/fs_search.c
+++ b/src/fs/fs_search.c
@@ -54,11 +54,11 @@ GNUNET_FS_search_make_status_ (struct GNUNET_FS_ProgressInfo *pi,
54 pi->value.search.sc = sc; 54 pi->value.search.sc = sc;
55 pi->value.search.cctx = (NULL != sc) ? sc->client_info : NULL; 55 pi->value.search.cctx = (NULL != sc) ? sc->client_info : NULL;
56 pi->value.search.pctx = 56 pi->value.search.pctx =
57 ((NULL == sc) || (NULL == sc->psearch_result)) 57 ((NULL == sc) || (NULL == sc->psearch_result))
58 ? NULL 58 ? NULL
59 : sc->psearch_result->client_info; 59 : sc->psearch_result->client_info;
60 pi->value.search.query = (NULL != sc) ? sc->uri : NULL; 60 pi->value.search.query = (NULL != sc) ? sc->uri : NULL;
61 pi->value.search.duration = (NULL != sc) 61 pi->value.search.duration = (NULL != sc)
62 ? GNUNET_TIME_absolute_get_duration (sc->start_time) 62 ? GNUNET_TIME_absolute_get_duration (sc->start_time)
63 : GNUNET_TIME_UNIT_ZERO; 63 : GNUNET_TIME_UNIT_ZERO;
64 pi->value.search.anonymity = (NULL != sc) ? sc->anonymity : 0; 64 pi->value.search.anonymity = (NULL != sc) ? sc->anonymity : 0;
@@ -125,7 +125,7 @@ notify_client_chk_update (struct GNUNET_FS_SearchContext *sc,
125 struct GNUNET_FS_SearchResult *sr) 125 struct GNUNET_FS_SearchResult *sr)
126{ 126{
127 struct GNUNET_FS_ProgressInfo pi; 127 struct GNUNET_FS_ProgressInfo pi;
128 128
129 pi.status = GNUNET_FS_STATUS_SEARCH_UPDATE; 129 pi.status = GNUNET_FS_STATUS_SEARCH_UPDATE;
130 pi.value.search.specifics.update.cctx = sr->client_info; 130 pi.value.search.specifics.update.cctx = sr->client_info;
131 pi.value.search.specifics.update.meta = sr->meta; 131 pi.value.search.specifics.update.meta = sr->meta;
@@ -135,7 +135,7 @@ notify_client_chk_update (struct GNUNET_FS_SearchContext *sc,
135 pi.value.search.specifics.update.availability_certainty = 135 pi.value.search.specifics.update.availability_certainty =
136 sr->availability_trials; 136 sr->availability_trials;
137 pi.value.search.specifics.update.applicability_rank = sr->optional_support; 137 pi.value.search.specifics.update.applicability_rank = sr->optional_support;
138 pi.value.search.specifics.update.current_probe_time 138 pi.value.search.specifics.update.current_probe_time
139 = GNUNET_TIME_absolute_get_duration (sr->probe_active_time); 139 = GNUNET_TIME_absolute_get_duration (sr->probe_active_time);
140 sr->client_info = GNUNET_FS_search_make_status_ (&pi, sc->h, sc); 140 sr->client_info = GNUNET_FS_search_make_status_ (&pi, sc->h, sc);
141} 141}
@@ -194,12 +194,12 @@ signal_probe_result (struct GNUNET_FS_SearchResult *sr)
194 pi.value.search.specifics.update.cctx = sr->client_info; 194 pi.value.search.specifics.update.cctx = sr->client_info;
195 pi.value.search.specifics.update.meta = sr->meta; 195 pi.value.search.specifics.update.meta = sr->meta;
196 pi.value.search.specifics.update.uri = sr->uri; 196 pi.value.search.specifics.update.uri = sr->uri;
197 pi.value.search.specifics.update.availability_rank 197 pi.value.search.specifics.update.availability_rank
198 = 2 * sr->availability_success - sr->availability_trials; 198 = 2 * sr->availability_success - sr->availability_trials;
199 pi.value.search.specifics.update.availability_certainty 199 pi.value.search.specifics.update.availability_certainty
200 = sr->availability_trials; 200 = sr->availability_trials;
201 pi.value.search.specifics.update.applicability_rank = sr->optional_support; 201 pi.value.search.specifics.update.applicability_rank = sr->optional_support;
202 pi.value.search.specifics.update.current_probe_time 202 pi.value.search.specifics.update.current_probe_time
203 = GNUNET_TIME_absolute_get_duration (sr->probe_active_time); 203 = GNUNET_TIME_absolute_get_duration (sr->probe_active_time);
204 sr->client_info = GNUNET_FS_search_make_status_ (&pi, sr->h, sr->sc); 204 sr->client_info = GNUNET_FS_search_make_status_ (&pi, sr->h, sr->sc);
205 GNUNET_FS_search_start_probe_ (sr); 205 GNUNET_FS_search_start_probe_ (sr);
@@ -380,7 +380,7 @@ probe_ping_task (void *cls,
380 struct GNUNET_FS_SearchResult *sr = cls; 380 struct GNUNET_FS_SearchResult *sr = cls;
381 381
382 signal_probe_result (sr); 382 signal_probe_result (sr);
383 sr->probe_ping_task 383 sr->probe_ping_task
384 = GNUNET_SCHEDULER_add_delayed (GNUNET_FS_PROBE_UPDATE_FREQUENCY, 384 = GNUNET_SCHEDULER_add_delayed (GNUNET_FS_PROBE_UPDATE_FREQUENCY,
385 &probe_ping_task, 385 &probe_ping_task,
386 sr); 386 sr);
@@ -434,7 +434,7 @@ GNUNET_FS_search_start_probe_ (struct GNUNET_FS_SearchResult *sr)
434 len, sr->anonymity, 434 len, sr->anonymity,
435 GNUNET_FS_DOWNLOAD_NO_TEMPORARIES | 435 GNUNET_FS_DOWNLOAD_NO_TEMPORARIES |
436 GNUNET_FS_DOWNLOAD_IS_PROBE, sr, NULL); 436 GNUNET_FS_DOWNLOAD_IS_PROBE, sr, NULL);
437 sr->probe_ping_task 437 sr->probe_ping_task
438 = GNUNET_SCHEDULER_add_now (&probe_ping_task, 438 = GNUNET_SCHEDULER_add_now (&probe_ping_task,
439 sr); 439 sr);
440} 440}
@@ -465,7 +465,7 @@ GNUNET_FS_probe (struct GNUNET_FS_Handle *h,
465 sr->uri = GNUNET_FS_uri_dup (uri); 465 sr->uri = GNUNET_FS_uri_dup (uri);
466 sr->meta = GNUNET_CONTAINER_meta_data_duplicate (meta); 466 sr->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
467 sr->client_info = client_info; 467 sr->client_info = client_info;
468 sr->anonymity = anonymity; 468 sr->anonymity = anonymity;
469 GNUNET_FS_search_start_probe_ (sr); 469 GNUNET_FS_search_start_probe_ (sr);
470 return sr; 470 return sr;
471} 471}
@@ -473,8 +473,8 @@ GNUNET_FS_probe (struct GNUNET_FS_Handle *h,
473 473
474/** 474/**
475 * Stop probing activity associated with a search result. 475 * Stop probing activity associated with a search result.
476 * 476 *
477 * @param sr search result 477 * @param sr search result
478 */ 478 */
479static void 479static void
480GNUNET_FS_search_stop_probe_ (struct GNUNET_FS_SearchResult *sr) 480GNUNET_FS_search_stop_probe_ (struct GNUNET_FS_SearchResult *sr)
@@ -674,7 +674,7 @@ process_sks_result (struct GNUNET_FS_SearchContext *sc, const char *id_update,
674 * @param edata encrypted data 674 * @param edata encrypted data
675 * @param edata_size number of bytes in @a edata (and @a data) 675 * @param edata_size number of bytes in @a edata (and @a data)
676 * @param data where to store the plaintext 676 * @param data where to store the plaintext
677 * @return keyword index on success, #GNUNET_SYSERR on error (no such 677 * @return keyword index on success, #GNUNET_SYSERR on error (no such
678 * keyword, internal error) 678 * keyword, internal error)
679 */ 679 */
680static int 680static int
@@ -683,7 +683,7 @@ decrypt_block_with_keyword (const struct GNUNET_FS_SearchContext *sc,
683 const void *edata, 683 const void *edata,
684 size_t edata_size, 684 size_t edata_size,
685 char *data) 685 char *data)
686{ 686{
687 const struct GNUNET_CRYPTO_EccPrivateKey *anon; 687 const struct GNUNET_CRYPTO_EccPrivateKey *anon;
688 struct GNUNET_CRYPTO_EccPublicSignKey anon_pub; 688 struct GNUNET_CRYPTO_EccPublicSignKey anon_pub;
689 unsigned int i; 689 unsigned int i;
@@ -721,7 +721,7 @@ decrypt_block_with_keyword (const struct GNUNET_FS_SearchContext *sc,
721 * @param size size of nb 721 * @param size size of nb
722 */ 722 */
723static void 723static void
724process_kblock (struct GNUNET_FS_SearchContext *sc, 724process_kblock (struct GNUNET_FS_SearchContext *sc,
725 const struct UBlock *ub, 725 const struct UBlock *ub,
726 size_t size) 726 size_t size)
727{ 727{
@@ -749,7 +749,7 @@ process_kblock (struct GNUNET_FS_SearchContext *sc,
749 if (NULL == (uri = GNUNET_FS_uri_parse (&pt[1], &emsg))) 749 if (NULL == (uri = GNUNET_FS_uri_parse (&pt[1], &emsg)))
750 { 750 {
751 GNUNET_break_op (0); /* ublock malformed */ 751 GNUNET_break_op (0); /* ublock malformed */
752 GNUNET_free_non_null (emsg); 752 GNUNET_free_non_null (emsg);
753 return; 753 return;
754 } 754 }
755 j = eos - pt + 1; 755 j = eos - pt + 1;
@@ -781,7 +781,7 @@ process_kblock (struct GNUNET_FS_SearchContext *sc,
781 * @param size size of sb 781 * @param size size of sb
782 */ 782 */
783static void 783static void
784process_sblock (struct GNUNET_FS_SearchContext *sc, 784process_sblock (struct GNUNET_FS_SearchContext *sc,
785 const struct UBlock *ub, 785 const struct UBlock *ub,
786 size_t size) 786 size_t size)
787{ 787{
@@ -811,8 +811,8 @@ process_sblock (struct GNUNET_FS_SearchContext *sc,
811 } 811 }
812 if (NULL == (uri = GNUNET_FS_uri_parse (uris, &emsg))) 812 if (NULL == (uri = GNUNET_FS_uri_parse (uris, &emsg)))
813 { 813 {
814 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 814 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
815 _("Failed to parse URI `%s': %s\n"), 815 _("Failed to parse URI `%s': %s\n"),
816 uris, emsg); 816 uris, emsg);
817 GNUNET_break_op (0); /* ublock malformed */ 817 GNUNET_break_op (0); /* ublock malformed */
818 GNUNET_free_non_null (emsg); 818 GNUNET_free_non_null (emsg);
@@ -837,9 +837,9 @@ process_sblock (struct GNUNET_FS_SearchContext *sc,
837 * @param size size of data 837 * @param size size of data
838 */ 838 */
839static void 839static void
840process_result (struct GNUNET_FS_SearchContext *sc, 840process_result (struct GNUNET_FS_SearchContext *sc,
841 enum GNUNET_BLOCK_Type type, 841 enum GNUNET_BLOCK_Type type,
842 struct GNUNET_TIME_Absolute expiration, 842 struct GNUNET_TIME_Absolute expiration,
843 const void *data, 843 const void *data,
844 size_t size) 844 size_t size)
845{ 845{
@@ -1108,7 +1108,7 @@ transmit_search_request (void *cls, size_t size, void *buf)
1108 &dpub); 1108 &dpub);
1109 GNUNET_CRYPTO_hash (&dpub, 1109 GNUNET_CRYPTO_hash (&dpub,
1110 sizeof (dpub), 1110 sizeof (dpub),
1111 &sm->query); 1111 &sm->query);
1112 mbc.put_cnt = (size - msize) / sizeof (struct GNUNET_HashCode); 1112 mbc.put_cnt = (size - msize) / sizeof (struct GNUNET_HashCode);
1113 sqms = GNUNET_CONTAINER_multihashmap_size (sc->master_result_map); 1113 sqms = GNUNET_CONTAINER_multihashmap_size (sc->master_result_map);
1114 mbc.put_cnt = GNUNET_MIN (mbc.put_cnt, sqms - mbc.skip_cnt); 1114 mbc.put_cnt = GNUNET_MIN (mbc.put_cnt, sqms - mbc.skip_cnt);
@@ -1206,7 +1206,7 @@ try_reconnect (struct GNUNET_FS_SearchContext *sc)
1206 } 1206 }
1207 sc->reconnect_backoff = GNUNET_TIME_STD_BACKOFF (sc->reconnect_backoff); 1207 sc->reconnect_backoff = GNUNET_TIME_STD_BACKOFF (sc->reconnect_backoff);
1208 sc->task = 1208 sc->task =
1209 GNUNET_SCHEDULER_add_delayed (sc->reconnect_backoff, 1209 GNUNET_SCHEDULER_add_delayed (sc->reconnect_backoff,
1210 &do_reconnect, 1210 &do_reconnect,
1211 sc); 1211 sc);
1212} 1212}
@@ -1293,8 +1293,8 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc)
1293 keyword, 1293 keyword,
1294 "fs-ublock", 1294 "fs-ublock",
1295 &sre->dpub); 1295 &sre->dpub);
1296 GNUNET_CRYPTO_hash (&sre->dpub, 1296 GNUNET_CRYPTO_hash (&sre->dpub,
1297 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), 1297 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
1298 &sre->uquery); 1298 &sre->uquery);
1299 sre->mandatory = (sc->uri->data.ksk.keywords[i][0] == '+'); 1299 sre->mandatory = (sc->uri->data.ksk.keywords[i][0] == '+');
1300 if (sre->mandatory) 1300 if (sre->mandatory)
diff --git a/src/fs/fs_sharetree.c b/src/fs/fs_sharetree.c
index 954d450a7..c392ba1ef 100644
--- a/src/fs/fs_sharetree.c
+++ b/src/fs/fs_sharetree.c
@@ -174,7 +174,7 @@ add_to_keyword_counter (void *cls, const char *keyword, int is_mandatory)
174 cnt->value = (const char *) &cnt[1]; 174 cnt->value = (const char *) &cnt[1];
175 memcpy (&cnt[1], keyword, klen); 175 memcpy (&cnt[1], keyword, klen);
176 GNUNET_assert (GNUNET_OK == 176 GNUNET_assert (GNUNET_OK ==
177 GNUNET_CONTAINER_multihashmap_put (mcm, 177 GNUNET_CONTAINER_multihashmap_put (mcm,
178 &hc, cnt, 178 &hc, cnt,
179 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 179 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
180 } 180 }
@@ -313,7 +313,7 @@ migrate_and_drop_metadata (void *cls, const struct GNUNET_HashCode * key, void *
313 counter->type, 313 counter->type,
314 counter->format, 314 counter->format,
315 counter->data_mime_type, counter->data, 315 counter->data_mime_type, counter->data,
316 counter->data_size); 316 counter->data_size);
317 } 317 }
318 GNUNET_assert (GNUNET_YES == 318 GNUNET_assert (GNUNET_YES ==
319 GNUNET_CONTAINER_multihashmap_remove (tc->metacounter, 319 GNUNET_CONTAINER_multihashmap_remove (tc->metacounter,
@@ -350,7 +350,7 @@ share_tree_trim (struct TrimContext *tc,
350 if (tree->is_directory == GNUNET_YES) 350 if (tree->is_directory == GNUNET_YES)
351 { 351 {
352 const char *user = getenv ("USER"); 352 const char *user = getenv ("USER");
353 if ( (user == NULL) || 353 if ( (user == NULL) ||
354 (0 != strncasecmp (user, tree->short_filename, strlen(user)))) 354 (0 != strncasecmp (user, tree->short_filename, strlen(user))))
355 { 355 {
356 /* only use filename if it doesn't match $USER */ 356 /* only use filename if it doesn't match $USER */
@@ -366,12 +366,12 @@ share_tree_trim (struct TrimContext *tc,
366 366
367 if (1 >= num_children) 367 if (1 >= num_children)
368 return; /* nothing to trim */ 368 return; /* nothing to trim */
369 369
370 /* now, count keywords and meta data in children */ 370 /* now, count keywords and meta data in children */
371 for (pos = tree->children_head; NULL != pos; pos = pos->next) 371 for (pos = tree->children_head; NULL != pos; pos = pos->next)
372 { 372 {
373 if (NULL != pos->meta) 373 if (NULL != pos->meta)
374 GNUNET_CONTAINER_meta_data_iterate (pos->meta, &add_to_meta_counter, tc->metacounter); 374 GNUNET_CONTAINER_meta_data_iterate (pos->meta, &add_to_meta_counter, tc->metacounter);
375 if (NULL != pos->ksk_uri) 375 if (NULL != pos->ksk_uri)
376 GNUNET_FS_uri_ksk_get_keywords (pos->ksk_uri, &add_to_keyword_counter, tc->keywordcounter); 376 GNUNET_FS_uri_ksk_get_keywords (pos->ksk_uri, &add_to_keyword_counter, tc->keywordcounter);
377 } 377 }
@@ -393,10 +393,10 @@ share_tree_trim (struct TrimContext *tc,
393 393
394 /* add high-frequency meta data and keywords to parent */ 394 /* add high-frequency meta data and keywords to parent */
395 tc->pos = tree; 395 tc->pos = tree;
396 GNUNET_CONTAINER_multihashmap_iterate (tc->keywordcounter, 396 GNUNET_CONTAINER_multihashmap_iterate (tc->keywordcounter,
397 &migrate_and_drop_keywords, 397 &migrate_and_drop_keywords,
398 tc); 398 tc);
399 GNUNET_CONTAINER_multihashmap_iterate (tc->metacounter, 399 GNUNET_CONTAINER_multihashmap_iterate (tc->metacounter,
400 &migrate_and_drop_metadata, 400 &migrate_and_drop_metadata,
401 tc); 401 tc);
402} 402}
@@ -414,7 +414,7 @@ GNUNET_FS_share_tree_trim (struct GNUNET_FS_ShareTreeItem *toplevel)
414 struct TrimContext tc; 414 struct TrimContext tc;
415 415
416 if (toplevel == NULL) 416 if (toplevel == NULL)
417 return; 417 return;
418 tc.keywordcounter = GNUNET_CONTAINER_multihashmap_create (1024, GNUNET_NO); 418 tc.keywordcounter = GNUNET_CONTAINER_multihashmap_create (1024, GNUNET_NO);
419 tc.metacounter = GNUNET_CONTAINER_multihashmap_create (1024, GNUNET_NO); 419 tc.metacounter = GNUNET_CONTAINER_multihashmap_create (1024, GNUNET_NO);
420 share_tree_trim (&tc, toplevel); 420 share_tree_trim (&tc, toplevel);
diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c
index 0fc36e7ac..925e36a8e 100644
--- a/src/fs/fs_test_lib.c
+++ b/src/fs/fs_test_lib.c
@@ -183,16 +183,16 @@ struct TestDownloadOperation
183 * @param tc scheduler context (unused) 183 * @param tc scheduler context (unused)
184 */ 184 */
185static void 185static void
186report_uri (void *cls, 186report_uri (void *cls,
187 const struct GNUNET_SCHEDULER_TaskContext *tc) 187 const struct GNUNET_SCHEDULER_TaskContext *tc)
188{ 188{
189 struct TestPublishOperation *po = cls; 189 struct TestPublishOperation *po = cls;
190 190
191 GNUNET_FS_publish_stop (po->publish_context); 191 GNUNET_FS_publish_stop (po->publish_context);
192 GNUNET_TESTBED_operation_done (po->fs_op); 192 GNUNET_TESTBED_operation_done (po->fs_op);
193 po->publish_cont (po->publish_cont_cls, 193 po->publish_cont (po->publish_cont_cls,
194 po->publish_uri, 194 po->publish_uri,
195 (GNUNET_YES == po->do_index) 195 (GNUNET_YES == po->do_index)
196 ? po->publish_tmp_file 196 ? po->publish_tmp_file
197 : NULL); 197 : NULL);
198 GNUNET_FS_uri_destroy (po->publish_uri); 198 GNUNET_FS_uri_destroy (po->publish_uri);
@@ -272,15 +272,15 @@ publish_progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
272 * @param cls pointer to uint32_t with publishing seed 272 * @param cls pointer to uint32_t with publishing seed
273 * @param offset offset to generate data for 273 * @param offset offset to generate data for
274 * @param max maximum number of bytes to generate 274 * @param max maximum number of bytes to generate
275 * @param buf where to write generated data 275 * @param buf where to write generated data
276 * @param emsg where to store error message (unused) 276 * @param emsg where to store error message (unused)
277 * @return number of bytes written to buf 277 * @return number of bytes written to buf
278 */ 278 */
279static size_t 279static size_t
280file_generator (void *cls, 280file_generator (void *cls,
281 uint64_t offset, 281 uint64_t offset,
282 size_t max, 282 size_t max,
283 void *buf, 283 void *buf,
284 char **emsg) 284 char **emsg)
285{ 285{
286 uint32_t *publish_seed = cls; 286 uint32_t *publish_seed = cls;
@@ -307,7 +307,7 @@ file_generator (void *cls,
307 307
308/** 308/**
309 * Connect adapter for publishing operation. 309 * Connect adapter for publishing operation.
310 * 310 *
311 * @param cls the 'struct TestPublishOperation' 311 * @param cls the 'struct TestPublishOperation'
312 * @param cfg configuration of the peer to connect to; will be available until 312 * @param cfg configuration of the peer to connect to; will be available until
313 * GNUNET_TESTBED_operation_done() is called on the operation returned 313 * GNUNET_TESTBED_operation_done() is called on the operation returned
@@ -319,7 +319,7 @@ publish_connect_adapter (void *cls,
319 const struct GNUNET_CONFIGURATION_Handle *cfg) 319 const struct GNUNET_CONFIGURATION_Handle *cfg)
320{ 320{
321 struct TestPublishOperation *po = cls; 321 struct TestPublishOperation *po = cls;
322 322
323 return GNUNET_FS_start (cfg, 323 return GNUNET_FS_start (cfg,
324 "fs-test-publish", 324 "fs-test-publish",
325 &publish_progress_cb, po, 325 &publish_progress_cb, po,
@@ -330,11 +330,11 @@ publish_connect_adapter (void *cls,
330 330
331/** 331/**
332 * Adapter function called to destroy connection to file-sharing service. 332 * Adapter function called to destroy connection to file-sharing service.
333 * 333 *
334 * @param cls the 'struct GNUNET_FS_Handle' 334 * @param cls the 'struct GNUNET_FS_Handle'
335 * @param op_result unused (different for publish/download!) 335 * @param op_result unused (different for publish/download!)
336 */ 336 */
337static void 337static void
338fs_disconnect_adapter (void *cls, 338fs_disconnect_adapter (void *cls,
339 void *op_result) 339 void *op_result)
340{ 340{
@@ -412,8 +412,8 @@ publish_fs_connect_complete_cb (void *cls,
412 else 412 else
413 { 413 {
414 fi = GNUNET_FS_file_information_create_from_reader (po->fs, po, 414 fi = GNUNET_FS_file_information_create_from_reader (po->fs, po,
415 po->size, 415 po->size,
416 &file_generator, &po->publish_seed, 416 &file_generator, &po->publish_seed,
417 NULL, NULL, 417 NULL, NULL,
418 po->do_index, &bo); 418 po->do_index, &bo);
419 } 419 }
@@ -557,7 +557,7 @@ download_progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
557 557
558/** 558/**
559 * Connect adapter for download operation. 559 * Connect adapter for download operation.
560 * 560 *
561 * @param cls the 'struct TestDownloadOperation' 561 * @param cls the 'struct TestDownloadOperation'
562 * @param cfg configuration of the peer to connect to; will be available until 562 * @param cfg configuration of the peer to connect to; will be available until
563 * GNUNET_TESTBED_operation_done() is called on the operation returned 563 * GNUNET_TESTBED_operation_done() is called on the operation returned
@@ -569,7 +569,7 @@ download_connect_adapter (void *cls,
569 const struct GNUNET_CONFIGURATION_Handle *cfg) 569 const struct GNUNET_CONFIGURATION_Handle *cfg)
570{ 570{
571 struct TestPublishOperation *po = cls; 571 struct TestPublishOperation *po = cls;
572 572
573 return GNUNET_FS_start (cfg, 573 return GNUNET_FS_start (cfg,
574 "fs-test-download", 574 "fs-test-download",
575 &download_progress_cb, po, 575 &download_progress_cb, po,
diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c
index ecf14112c..7e189d697 100644
--- a/src/fs/fs_unindex.c
+++ b/src/fs/fs_unindex.c
@@ -322,8 +322,8 @@ unindex_finish (struct GNUNET_FS_UnindexContext *uc)
322 * @param reason kind of progress we are making 322 * @param reason kind of progress we are making
323 */ 323 */
324static void 324static void
325unindex_directory_scan_cb (void *cls, 325unindex_directory_scan_cb (void *cls,
326 const char *filename, 326 const char *filename,
327 int is_directory, 327 int is_directory,
328 enum GNUNET_FS_DirScannerProgressUpdateReason reason) 328 enum GNUNET_FS_DirScannerProgressUpdateReason reason)
329{ 329{
@@ -381,7 +381,7 @@ GNUNET_FS_unindex_do_extract_keywords_ (struct GNUNET_FS_UnindexContext *uc)
381 ex = NULL; 381 ex = NULL;
382 uc->dscan = GNUNET_FS_directory_scan_start (uc->filename, 382 uc->dscan = GNUNET_FS_directory_scan_start (uc->filename,
383 GNUNET_NO, ex, 383 GNUNET_NO, ex,
384 &unindex_directory_scan_cb, 384 &unindex_directory_scan_cb,
385 uc); 385 uc);
386 GNUNET_free_non_null (ex); 386 GNUNET_free_non_null (ex);
387} 387}
@@ -391,7 +391,7 @@ GNUNET_FS_unindex_do_extract_keywords_ (struct GNUNET_FS_UnindexContext *uc)
391 * Continuation called to notify client about result of the remove 391 * Continuation called to notify client about result of the remove
392 * operation for the UBlock. 392 * operation for the UBlock.
393 * 393 *
394 * @param cls the 'struct GNUNET_FS_UnindexContext *' 394 * @param cls the 'struct GNUNET_FS_UnindexContext *'
395 * @param success GNUNET_SYSERR on failure (including timeout/queue drop) 395 * @param success GNUNET_SYSERR on failure (including timeout/queue drop)
396 * GNUNET_NO if content was already there 396 * GNUNET_NO if content was already there
397 * GNUNET_YES (or other positive value) on success 397 * GNUNET_YES (or other positive value) on success
@@ -409,10 +409,10 @@ continue_after_remove (void *cls,
409 struct GNUNET_FS_UnindexContext *uc = cls; 409 struct GNUNET_FS_UnindexContext *uc = cls;
410 410
411 uc->dqe = NULL; 411 uc->dqe = NULL;
412 if (success != GNUNET_YES) 412 if (success != GNUNET_YES)
413 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 413 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
414 _("Failed to remove UBlock: %s\n"), 414 _("Failed to remove UBlock: %s\n"),
415 msg); 415 msg);
416 uc->ksk_offset++; 416 uc->ksk_offset++;
417 GNUNET_FS_unindex_do_remove_kblocks_ (uc); 417 GNUNET_FS_unindex_do_remove_kblocks_ (uc);
418} 418}
@@ -464,14 +464,14 @@ process_kblock_for_unindex (void *cls,
464 if (0 == uc->first_uid) 464 if (0 == uc->first_uid)
465 { 465 {
466 /* remember UID of first result to detect cycles */ 466 /* remember UID of first result to detect cycles */
467 uc->first_uid = uid; 467 uc->first_uid = uid;
468 } 468 }
469 else if (uid == uc->first_uid) 469 else if (uid == uc->first_uid)
470 { 470 {
471 /* no more additional results */ 471 /* no more additional results */
472 uc->ksk_offset++; 472 uc->ksk_offset++;
473 GNUNET_FS_unindex_do_remove_kblocks_ (uc); 473 GNUNET_FS_unindex_do_remove_kblocks_ (uc);
474 return; 474 return;
475 } 475 }
476 GNUNET_assert (GNUNET_BLOCK_TYPE_FS_UBLOCK == type); 476 GNUNET_assert (GNUNET_BLOCK_TYPE_FS_UBLOCK == type);
477 if (size < sizeof (struct UBlock)) 477 if (size < sizeof (struct UBlock))
@@ -489,10 +489,10 @@ process_kblock_for_unindex (void *cls,
489 goto get_next; 489 goto get_next;
490 } 490 }
491 { 491 {
492 char pt[size - sizeof (struct UBlock)]; 492 char pt[size - sizeof (struct UBlock)];
493 struct GNUNET_CRYPTO_EccPublicSignKey anon_pub; 493 struct GNUNET_CRYPTO_EccPublicSignKey anon_pub;
494 const char *keyword; 494 const char *keyword;
495 495
496 GNUNET_CRYPTO_ecc_key_get_public_for_signature (GNUNET_CRYPTO_ecc_key_get_anonymous (), 496 GNUNET_CRYPTO_ecc_key_get_public_for_signature (GNUNET_CRYPTO_ecc_key_get_anonymous (),
497 &anon_pub); 497 &anon_pub);
498 keyword = &uc->ksk_uri->data.ksk.keywords[uc->ksk_offset][1]; 498 keyword = &uc->ksk_uri->data.ksk.keywords[uc->ksk_offset][1];
@@ -757,7 +757,7 @@ GNUNET_FS_unindex_signal_suspend_ (void *cls)
757 * @return NULL on error, otherwise handle 757 * @return NULL on error, otherwise handle
758 */ 758 */
759struct GNUNET_FS_UnindexContext * 759struct GNUNET_FS_UnindexContext *
760GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, 760GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h,
761 const char *filename, 761 const char *filename,
762 void *cctx) 762 void *cctx)
763{ 763{
diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c
index 4b25e91ea..90c211415 100644
--- a/src/fs/fs_uri.c
+++ b/src/fs/fs_uri.c
@@ -98,7 +98,7 @@
98 * @param key where to store the unique key 98 * @param key where to store the unique key
99 */ 99 */
100void 100void
101GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, 101GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri,
102 struct GNUNET_HashCode *key) 102 struct GNUNET_HashCode *key)
103{ 103{
104 switch (uri->type) 104 switch (uri->type)
@@ -368,7 +368,7 @@ uri_sks_parse (const char *s, char **emsg)
368 end = strchr (&s[pos], '/'); 368 end = strchr (&s[pos], '/');
369 if ( (NULL == end) || 369 if ( (NULL == end) ||
370 (GNUNET_OK != 370 (GNUNET_OK !=
371 GNUNET_STRINGS_string_to_data (&s[pos], 371 GNUNET_STRINGS_string_to_data (&s[pos],
372 end - &s[pos], 372 end - &s[pos],
373 &ns, 373 &ns,
374 sizeof (ns))) ) 374 sizeof (ns))) )
@@ -526,12 +526,12 @@ struct LocUriAssembly
526 526
527 /** 527 /**
528 * File being offered. 528 * File being offered.
529 */ 529 */
530 struct FileIdentifier fi; 530 struct FileIdentifier fi;
531 531
532 /** 532 /**
533 * Peer offering the file. 533 * Peer offering the file.
534 */ 534 */
535 struct GNUNET_PeerIdentity peer; 535 struct GNUNET_PeerIdentity peer;
536 536
537}; 537};
@@ -947,7 +947,7 @@ GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *baseUri,
947 * @return an FS URI for the given namespace and identifier 947 * @return an FS URI for the given namespace and identifier
948 */ 948 */
949struct GNUNET_FS_Uri * 949struct GNUNET_FS_Uri *
950GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EccPublicSignKey *ns, 950GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EccPublicSignKey *ns,
951 const char *id) 951 const char *id)
952{ 952{
953 struct GNUNET_FS_Uri *ns_uri; 953 struct GNUNET_FS_Uri *ns_uri;
@@ -1424,7 +1424,7 @@ GNUNET_FS_uri_test_loc (const struct GNUNET_FS_Uri *uri)
1424 * Add a keyword as non-mandatory (with ' '-prefix) to the 1424 * Add a keyword as non-mandatory (with ' '-prefix) to the
1425 * given keyword list at offset 'index'. The array is 1425 * given keyword list at offset 'index'. The array is
1426 * guaranteed to be long enough. 1426 * guaranteed to be long enough.
1427 * 1427 *
1428 * @param s keyword to add 1428 * @param s keyword to add
1429 * @param array array to add the keyword to 1429 * @param array array to add the keyword to
1430 * @param index offset where to add the keyword 1430 * @param index offset where to add the keyword
@@ -1439,14 +1439,14 @@ insert_non_mandatory_keyword (const char *s, char **array, int index)
1439 1439
1440 1440
1441/** 1441/**
1442 * Test if the given keyword 's' is already present in the 1442 * Test if the given keyword 's' is already present in the
1443 * given array, ignoring the '+'-mandatory prefix in the array. 1443 * given array, ignoring the '+'-mandatory prefix in the array.
1444 * 1444 *
1445 * @param s keyword to test 1445 * @param s keyword to test
1446 * @param array keywords to test against, with ' ' or '+' prefix to ignore 1446 * @param array keywords to test against, with ' ' or '+' prefix to ignore
1447 * @param array_length length of the array 1447 * @param array_length length of the array
1448 * @return GNUNET_YES if the keyword exists, GNUNET_NO if not 1448 * @return GNUNET_YES if the keyword exists, GNUNET_NO if not
1449 */ 1449 */
1450static int 1450static int
1451find_duplicate (const char *s, const char **array, int array_length) 1451find_duplicate (const char *s, const char **array, int array_length)
1452{ 1452{
@@ -1535,7 +1535,7 @@ u8_strcount (const uint8_t *s)
1535 * to it are used to check for duplicates). ignored if array == NULL. 1535 * to it are used to check for duplicates). ignored if array == NULL.
1536 * @return number of tokens counted (including duplicates), or number of 1536 * @return number of tokens counted (including duplicates), or number of
1537 * tokens extracted (excluding duplicates). 0 if there are no 1537 * tokens extracted (excluding duplicates). 0 if there are no
1538 * matching parens in the string (when counting), or when all tokens 1538 * matching parens in the string (when counting), or when all tokens
1539 * were duplicates (when extracting). 1539 * were duplicates (when extracting).
1540 */ 1540 */
1541static int 1541static int
@@ -1612,7 +1612,7 @@ get_keywords_from_parens (const char *s, char **array, int index)
1612 else 1612 else
1613 count++; 1613 count++;
1614 close_paren[0] = tmp; 1614 close_paren[0] = tmp;
1615 } 1615 }
1616 } 1616 }
1617 GNUNET_free (ss); 1617 GNUNET_free (ss);
1618 return count; 1618 return count;
@@ -1900,7 +1900,7 @@ uri_sks_to_string (const struct GNUNET_FS_Uri *uri)
1900 GNUNET_assert (NULL != ret); 1900 GNUNET_assert (NULL != ret);
1901 ret[0] = '\0'; 1901 ret[0] = '\0';
1902 GNUNET_asprintf (&ret, "%s%s%s/%s", GNUNET_FS_URI_PREFIX, 1902 GNUNET_asprintf (&ret, "%s%s%s/%s", GNUNET_FS_URI_PREFIX,
1903 GNUNET_FS_URI_SKS_INFIX, buf, 1903 GNUNET_FS_URI_SKS_INFIX, buf,
1904 uri->data.sks.identifier); 1904 uri->data.sks.identifier);
1905 return ret; 1905 return ret;
1906} 1906}
@@ -2003,7 +2003,7 @@ uri_loc_to_string (const struct GNUNET_FS_Uri *uri)
2003 peerSig = 2003 peerSig =
2004 bin2enc (&uri->data.loc.contentSignature, 2004 bin2enc (&uri->data.loc.contentSignature,
2005 sizeof (struct GNUNET_CRYPTO_EccSignature)); 2005 sizeof (struct GNUNET_CRYPTO_EccSignature));
2006 GNUNET_asprintf (&ret, 2006 GNUNET_asprintf (&ret,
2007 "%s%s%s.%s.%llu.%s.%s.%llu", GNUNET_FS_URI_PREFIX, 2007 "%s%s%s.%s.%llu.%s.%s.%llu", GNUNET_FS_URI_PREFIX,
2008 GNUNET_FS_URI_LOC_INFIX, (const char *) &keyhash, 2008 GNUNET_FS_URI_LOC_INFIX, (const char *) &keyhash,
2009 (const char *) &queryhash, 2009 (const char *) &queryhash,
diff --git a/src/fs/gnunet-auto-share.c b/src/fs/gnunet-auto-share.c
index 86cab5593..b001cb58c 100644
--- a/src/fs/gnunet-auto-share.c
+++ b/src/fs/gnunet-auto-share.c
@@ -21,7 +21,7 @@
21 * @file fs/gnunet-auto-share.c 21 * @file fs/gnunet-auto-share.c
22 * @brief automatically publish files on GNUnet 22 * @brief automatically publish files on GNUnet
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 * 24 *
25 * TODO: 25 * TODO:
26 * - support loading meta data / keywords from resource file 26 * - support loading meta data / keywords from resource file
27 * - add stability timer (a la buildbot) 27 * - add stability timer (a la buildbot)
@@ -204,7 +204,7 @@ load_state ()
204 while (n-- > 0) 204 while (n-- > 0)
205 { 205 {
206 if ( (GNUNET_OK != 206 if ( (GNUNET_OK !=
207 GNUNET_BIO_read_string (rh, "filename", &fn, 1024)) || 207 GNUNET_BIO_read_string (rh, "filename", &fn, 1024)) ||
208 (GNUNET_OK != 208 (GNUNET_OK !=
209 GNUNET_BIO_read (rh, "id", &id, sizeof (struct GNUNET_HashCode))) ) 209 GNUNET_BIO_read (rh, "id", &id, sizeof (struct GNUNET_HashCode))) )
210 goto error; 210 goto error;
@@ -224,7 +224,7 @@ load_state ()
224 wi, 224 wi,
225 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); 225 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
226 } 226 }
227 if (GNUNET_OK == 227 if (GNUNET_OK ==
228 GNUNET_BIO_read_close (rh, &emsg)) 228 GNUNET_BIO_read_close (rh, &emsg))
229 return; 229 return;
230 rh = NULL; 230 rh = NULL;
@@ -259,7 +259,7 @@ write_item (void *cls,
259 "Saving serialization ID of file `%s' with value `%s'\n", 259 "Saving serialization ID of file `%s' with value `%s'\n",
260 wi->filename, 260 wi->filename,
261 GNUNET_h2s (&wi->id)); 261 GNUNET_h2s (&wi->id));
262 if ( (GNUNET_OK != 262 if ( (GNUNET_OK !=
263 GNUNET_BIO_write_string (wh, wi->filename)) || 263 GNUNET_BIO_write_string (wh, wi->filename)) ||
264 (GNUNET_OK != 264 (GNUNET_OK !=
265 GNUNET_BIO_write (wh, 265 GNUNET_BIO_write (wh,
@@ -381,7 +381,7 @@ maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
381 { 381 {
382 GNUNET_break (0); 382 GNUNET_break (0);
383 GNUNET_OS_process_kill (publish_proc, SIGKILL); 383 GNUNET_OS_process_kill (publish_proc, SIGKILL);
384 type = GNUNET_OS_PROCESS_SIGNALED; 384 type = GNUNET_OS_PROCESS_SIGNALED;
385 } 385 }
386 GNUNET_OS_process_destroy (publish_proc); 386 GNUNET_OS_process_destroy (publish_proc);
387 publish_proc = NULL; 387 publish_proc = NULL;
@@ -415,7 +415,7 @@ maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
415 wi); 415 wi);
416 } 416 }
417 save_state (); 417 save_state ();
418 schedule_next_task (); 418 schedule_next_task ();
419} 419}
420 420
421 421
@@ -452,7 +452,7 @@ work (void *cls,
452 static char content_prio[20]; 452 static char content_prio[20];
453 static char repl_level[20]; 453 static char repl_level[20];
454 struct WorkItem *wi; 454 struct WorkItem *wi;
455 const struct GNUNET_DISK_FileHandle *pr; 455 const struct GNUNET_DISK_FileHandle *pr;
456 int argc; 456 int argc;
457 457
458 run_task = GNUNET_SCHEDULER_NO_TASK; 458 run_task = GNUNET_SCHEDULER_NO_TASK;
@@ -553,7 +553,7 @@ determine_id (void *cls,
553 /* use hash here to make hierarchical structure distinct from 553 /* use hash here to make hierarchical structure distinct from
554 all files on the same level */ 554 all files on the same level */
555 GNUNET_CRYPTO_hash (fx, sizeof (fx), &ft); 555 GNUNET_CRYPTO_hash (fx, sizeof (fx), &ft);
556 /* use XOR here so that order of the files in the directory 556 /* use XOR here so that order of the files in the directory
557 does not matter! */ 557 does not matter! */
558 GNUNET_CRYPTO_hash_xor (&ft, id, id); 558 GNUNET_CRYPTO_hash_xor (&ft, id, id);
559 return GNUNET_OK; 559 return GNUNET_OK;
@@ -613,7 +613,7 @@ add_file (void *cls,
613 work_tail, 613 work_tail,
614 wi); 614 wi);
615 if (GNUNET_YES == do_shutdown) 615 if (GNUNET_YES == do_shutdown)
616 return GNUNET_SYSERR; 616 return GNUNET_SYSERR;
617 return GNUNET_OK; 617 return GNUNET_OK;
618} 618}
619 619
@@ -645,7 +645,7 @@ schedule_next_task ()
645 struct GNUNET_TIME_Relative delay; 645 struct GNUNET_TIME_Relative delay;
646 646
647 if (GNUNET_YES == do_shutdown) 647 if (GNUNET_YES == do_shutdown)
648 return; 648 return;
649 if (NULL == work_head) 649 if (NULL == work_head)
650 { 650 {
651 /* delay by at most 4h, at least 1s, and otherwise in between depending 651 /* delay by at most 4h, at least 1s, and otherwise in between depending
@@ -694,7 +694,7 @@ run (void *cls, char *const *args, const char *cfgfile,
694 load_state (); 694 load_state ();
695 run_task = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE, 695 run_task = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE,
696 &scan, NULL); 696 &scan, NULL);
697 697
698 kill_task = 698 kill_task =
699 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_stop_task, 699 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_stop_task,
700 NULL); 700 NULL);
@@ -707,7 +707,7 @@ run (void *cls, char *const *args, const char *cfgfile,
707 * @param cls NULL (unused) 707 * @param cls NULL (unused)
708 * @param key key of the item in the map (unused) 708 * @param key key of the item in the map (unused)
709 * @param value the 'struct WorkItem' to free 709 * @param value the 'struct WorkItem' to free
710 * @return GNUNET_OK to continue to iterate 710 * @return GNUNET_OK to continue to iterate
711 */ 711 */
712static int 712static int
713free_item (void *cls, 713free_item (void *cls,
@@ -731,7 +731,7 @@ free_item (void *cls,
731 */ 731 */
732int 732int
733main (int argc, char *const *argv) 733main (int argc, char *const *argv)
734{ 734{
735 static const struct GNUNET_GETOPT_CommandLineOption options[] = { 735 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
736 {'a', "anonymity", "LEVEL", 736 {'a', "anonymity", "LEVEL",
737 gettext_noop ("set the desired LEVEL of sender-anonymity"), 737 gettext_noop ("set the desired LEVEL of sender-anonymity"),
diff --git a/src/fs/gnunet-daemon-fsprofiler.c b/src/fs/gnunet-daemon-fsprofiler.c
index a19fa1ef6..d4c2b1c02 100644
--- a/src/fs/gnunet-daemon-fsprofiler.c
+++ b/src/fs/gnunet-daemon-fsprofiler.c
@@ -164,7 +164,7 @@ static struct Pattern *download_tail;
164 164
165 165
166/** 166/**
167 * Parse a pattern string and store the corresponding 167 * Parse a pattern string and store the corresponding
168 * 'struct Pattern' in the given head/tail. 168 * 'struct Pattern' in the given head/tail.
169 * 169 *
170 * @param head where to store the head 170 * @param head where to store the head
@@ -243,7 +243,7 @@ make_file (uint64_t length,
243 return NULL; 243 return NULL;
244 /* initialize data with 'unique' data only depending on 'kval' and 'size', 244 /* initialize data with 'unique' data only depending on 'kval' and 'size',
245 making sure that blocks do not repeat */ 245 making sure that blocks do not repeat */
246 for (i=0;i<length; i+=8) 246 for (i=0;i<length; i+=8)
247 { 247 {
248 xor = length ^ kval ^ (uint64_t) (i / 32 / 1024); 248 xor = length ^ kval ^ (uint64_t) (i / 32 / 1024);
249 memcpy (&data[i], &xor, GNUNET_MIN (length - i, sizeof (uint64_t))); 249 memcpy (&data[i], &xor, GNUNET_MIN (length - i, sizeof (uint64_t)));
@@ -396,8 +396,8 @@ progress_cb (void *cls,
396 case GNUNET_FS_STATUS_PUBLISH_COMPLETED: 396 case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
397 p = info->value.publish.cctx; 397 p = info->value.publish.cctx;
398 GNUNET_STATISTICS_update (stats_handle, 398 GNUNET_STATISTICS_update (stats_handle,
399 "# publishing time (ms)", 399 "# publishing time (ms)",
400 (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL, 400 (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL,
401 GNUNET_NO); 401 GNUNET_NO);
402 p->task = GNUNET_SCHEDULER_add_now (&publish_stop_task, p); 402 p->task = GNUNET_SCHEDULER_add_now (&publish_stop_task, p);
403 return p; 403 return p;
@@ -424,9 +424,9 @@ progress_cb (void *cls,
424 case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: 424 case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED:
425 p = info->value.download.cctx; 425 p = info->value.download.cctx;
426 GNUNET_STATISTICS_update (stats_handle, 426 GNUNET_STATISTICS_update (stats_handle,
427 "# download time (ms)", 427 "# download time (ms)",
428 (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL, 428 (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL,
429 GNUNET_NO); 429 GNUNET_NO);
430 p->task = GNUNET_SCHEDULER_add_now (&download_stop_task, p); 430 p->task = GNUNET_SCHEDULER_add_now (&download_stop_task, p);
431 return p; 431 return p;
432 case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: 432 case GNUNET_FS_STATUS_DOWNLOAD_STOPPED:
@@ -450,12 +450,12 @@ progress_cb (void *cls,
450 if (p->y != GNUNET_FS_uri_chk_get_file_size (uri)) 450 if (p->y != GNUNET_FS_uri_chk_get_file_size (uri))
451 return NULL; /* not what we want */ 451 return NULL; /* not what we want */
452 GNUNET_STATISTICS_update (stats_handle, 452 GNUNET_STATISTICS_update (stats_handle,
453 "# search time (ms)", 453 "# search time (ms)",
454 (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL, 454 (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL,
455 GNUNET_NO); 455 GNUNET_NO);
456 p->start_time = GNUNET_TIME_absolute_get (); 456 p->start_time = GNUNET_TIME_absolute_get ();
457 p->ctx = GNUNET_FS_download_start (fs_handle, uri, 457 p->ctx = GNUNET_FS_download_start (fs_handle, uri,
458 NULL, NULL, NULL, 458 NULL, NULL, NULL,
459 0, GNUNET_FS_uri_chk_get_file_size (uri), 459 0, GNUNET_FS_uri_chk_get_file_size (uri),
460 anonymity_level, 460 anonymity_level,
461 GNUNET_FS_DOWNLOAD_NO_TEMPORARIES, 461 GNUNET_FS_DOWNLOAD_NO_TEMPORARIES,
@@ -483,7 +483,7 @@ progress_cb (void *cls,
483 GNUNET_free (p); 483 GNUNET_free (p);
484 } 484 }
485 return NULL; 485 return NULL;
486 default: 486 default:
487 /* unexpected event during profiling */ 487 /* unexpected event during profiling */
488 GNUNET_break (0); 488 GNUNET_break (0);
489 return NULL; 489 return NULL;
@@ -497,7 +497,7 @@ progress_cb (void *cls,
497 * @param cls the 'struct Pattern' specifying the operation to perform 497 * @param cls the 'struct Pattern' specifying the operation to perform
498 * @param tc scheduler context 498 * @param tc scheduler context
499 */ 499 */
500static void 500static void
501start_publish (void *cls, 501start_publish (void *cls,
502 const struct GNUNET_SCHEDULER_TaskContext *tc) 502 const struct GNUNET_SCHEDULER_TaskContext *tc)
503{ 503{
@@ -522,7 +522,7 @@ start_publish (void *cls,
522 * @param cls the 'struct Pattern' specifying the operation to perform 522 * @param cls the 'struct Pattern' specifying the operation to perform
523 * @param tc scheduler context 523 * @param tc scheduler context
524 */ 524 */
525static void 525static void
526start_download (void *cls, 526start_download (void *cls,
527 const struct GNUNET_SCHEDULER_TaskContext *tc) 527 const struct GNUNET_SCHEDULER_TaskContext *tc)
528{ 528{
@@ -563,7 +563,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
563 NULL); 563 NULL);
564 564
565 if (GNUNET_OK != 565 if (GNUNET_OK !=
566 GNUNET_CONFIGURATION_get_value_number (cfg, 566 GNUNET_CONFIGURATION_get_value_number (cfg,
567 "TESTBED", "PEERID", 567 "TESTBED", "PEERID",
568 &my_peerid)) 568 &my_peerid))
569 { 569 {
@@ -574,28 +574,28 @@ run (void *cls, char *const *args GNUNET_UNUSED,
574 return; 574 return;
575 } 575 }
576 if (GNUNET_OK != 576 if (GNUNET_OK !=
577 GNUNET_CONFIGURATION_get_value_number (cfg, 577 GNUNET_CONFIGURATION_get_value_number (cfg,
578 "FSPROFILER", "ANONYMITY_LEVEL", 578 "FSPROFILER", "ANONYMITY_LEVEL",
579 &anonymity_level)) 579 &anonymity_level))
580 anonymity_level = 1; 580 anonymity_level = 1;
581 if (GNUNET_OK != 581 if (GNUNET_OK !=
582 GNUNET_CONFIGURATION_get_value_number (cfg, 582 GNUNET_CONFIGURATION_get_value_number (cfg,
583 "FSPROFILER", "REPLICATION_LEVEL", 583 "FSPROFILER", "REPLICATION_LEVEL",
584 &replication_level)) 584 &replication_level))
585 replication_level = 1; 585 replication_level = 1;
586 GNUNET_snprintf (myoptname, sizeof (myoptname), 586 GNUNET_snprintf (myoptname, sizeof (myoptname),
587 "DOWNLOAD-PATTERN-%u", my_peerid); 587 "DOWNLOAD-PATTERN-%u", my_peerid);
588 if (GNUNET_OK != 588 if (GNUNET_OK !=
589 GNUNET_CONFIGURATION_get_value_string (cfg, 589 GNUNET_CONFIGURATION_get_value_string (cfg,
590 "FSPROFILER", myoptname, 590 "FSPROFILER", myoptname,
591 &download_pattern)) 591 &download_pattern))
592 download_pattern = GNUNET_strdup (""); 592 download_pattern = GNUNET_strdup ("");
593 GNUNET_snprintf (myoptname, sizeof (myoptname), 593 GNUNET_snprintf (myoptname, sizeof (myoptname),
594 "PUBLISH-PATTERN-%u", my_peerid); 594 "PUBLISH-PATTERN-%u", my_peerid);
595 if (GNUNET_OK != 595 if (GNUNET_OK !=
596 GNUNET_CONFIGURATION_get_value_string (cfg, 596 GNUNET_CONFIGURATION_get_value_string (cfg,
597 "FSPROFILER", myoptname, 597 "FSPROFILER", myoptname,
598 &publish_pattern)) 598 &publish_pattern))
599 publish_pattern = GNUNET_strdup (""); 599 publish_pattern = GNUNET_strdup ("");
600 if ( (GNUNET_OK != 600 if ( (GNUNET_OK !=
601 parse_pattern (&download_head, 601 parse_pattern (&download_head,
diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c
index 5001d4c34..0938e8316 100644
--- a/src/fs/gnunet-download.c
+++ b/src/fs/gnunet-download.c
@@ -79,9 +79,9 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
79 * @param n total size of the download 79 * @param n total size of the download
80 * @param w desired number of steps in the progress bar 80 * @param w desired number of steps in the progress bar
81 */ 81 */
82static void 82static void
83display_bar (unsigned long long x, 83display_bar (unsigned long long x,
84 unsigned long long n, 84 unsigned long long n,
85 unsigned int w) 85 unsigned int w)
86{ 86{
87 char buf[w + 20]; 87 char buf[w + 20];
@@ -142,7 +142,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
142 { 142 {
143 s = GNUNET_strdup (GNUNET_STRINGS_relative_time_to_string (info->value.download.eta, 143 s = GNUNET_strdup (GNUNET_STRINGS_relative_time_to_string (info->value.download.eta,
144 GNUNET_YES)); 144 GNUNET_YES));
145 if (info->value.download.specifics.progress.block_download_duration.rel_value_us 145 if (info->value.download.specifics.progress.block_download_duration.rel_value_us
146 == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) 146 == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us)
147 s2 = _("<unknown time>"); 147 s2 = _("<unknown time>");
148 else 148 else
diff --git a/src/fs/gnunet-fs-profiler.c b/src/fs/gnunet-fs-profiler.c
index 33b293055..56a3084cc 100644
--- a/src/fs/gnunet-fs-profiler.c
+++ b/src/fs/gnunet-fs-profiler.c
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file fs/gnunet-fs-profiler.c 22 * @file fs/gnunet-fs-profiler.c
23 * @brief tool to benchmark/profile file-sharing 23 * @brief tool to benchmark/profile file-sharing
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
@@ -137,7 +137,7 @@ terminate_task (void *cls,
137 * failed 137 * failed
138 */ 138 */
139static void 139static void
140test_master (void *cls, 140test_master (void *cls,
141 struct GNUNET_TESTBED_RunHandle *h, 141 struct GNUNET_TESTBED_RunHandle *h,
142 unsigned int num_peers, 142 unsigned int num_peers,
143 struct GNUNET_TESTBED_Peer **peers, 143 struct GNUNET_TESTBED_Peer **peers,
@@ -152,7 +152,7 @@ test_master (void *cls,
152 terminate_taskid = GNUNET_SCHEDULER_add_delayed (timeout, 152 terminate_taskid = GNUNET_SCHEDULER_add_delayed (timeout,
153 &terminate_task, NULL); 153 &terminate_task, NULL);
154 else 154 else
155 terminate_taskid = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 155 terminate_taskid = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
156 &terminate_task, 156 &terminate_task,
157 NULL); 157 NULL);
158} 158}
diff --git a/src/fs/gnunet-helper-fs-publish.c b/src/fs/gnunet-helper-fs-publish.c
index cc58f62b5..214650b0f 100644
--- a/src/fs/gnunet-helper-fs-publish.c
+++ b/src/fs/gnunet-helper-fs-publish.c
@@ -125,8 +125,8 @@ add_to_md (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type,
125 memcpy (zdata, data, data_len); 125 memcpy (zdata, data, data_len);
126 zdata[data_len] = '\0'; 126 zdata[data_len] = '\0';
127 (void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name, type, format, 127 (void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name, type, format,
128 data_mime_type, zdata, data_len + 1); 128 data_mime_type, zdata, data_len + 1);
129 } 129 }
130 else 130 else
131 { 131 {
132 (void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name, type, format, 132 (void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name, type, format,
@@ -141,7 +141,7 @@ add_to_md (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type,
141 * 141 *
142 * @param tree tree to free 142 * @param tree tree to free
143 */ 143 */
144static void 144static void
145free_tree (struct ScanTreeNode *tree) 145free_tree (struct ScanTreeNode *tree)
146{ 146{
147 struct ScanTreeNode *pos; 147 struct ScanTreeNode *pos;
@@ -151,7 +151,7 @@ free_tree (struct ScanTreeNode *tree)
151 if (NULL != tree->parent) 151 if (NULL != tree->parent)
152 GNUNET_CONTAINER_DLL_remove (tree->parent->children_head, 152 GNUNET_CONTAINER_DLL_remove (tree->parent->children_head,
153 tree->parent->children_tail, 153 tree->parent->children_tail,
154 tree); 154 tree);
155 GNUNET_free (tree->filename); 155 GNUNET_free (tree->filename);
156 GNUNET_free (tree); 156 GNUNET_free (tree);
157} 157}
@@ -205,7 +205,7 @@ write_message (uint16_t message_type,
205 struct GNUNET_MessageHeader hdr; 205 struct GNUNET_MessageHeader hdr;
206 206
207#if 0 207#if 0
208 fprintf (stderr, 208 fprintf (stderr,
209 "Helper sends %u-byte message of type %u\n", 209 "Helper sends %u-byte message of type %u\n",
210 (unsigned int) (sizeof (struct GNUNET_MessageHeader) + data_length), 210 (unsigned int) (sizeof (struct GNUNET_MessageHeader) + data_length),
211 (unsigned int) message_type); 211 (unsigned int) message_type);
@@ -295,7 +295,7 @@ scan_callback (void *cls,
295 * 295 *
296 * @param filename file or directory to scan 296 * @param filename file or directory to scan
297 * @param dst where to store the resulting share tree item; 297 * @param dst where to store the resulting share tree item;
298 * NULL is stored in @a dst upon recoverable errors (#GNUNET_OK is returned) 298 * NULL is stored in @a dst upon recoverable errors (#GNUNET_OK is returned)
299 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 299 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
300 */ 300 */
301static int 301static int
@@ -323,7 +323,7 @@ preprocess_file (const char *filename,
323 323
324 /* Report the progress */ 324 /* Report the progress */
325 if (GNUNET_OK != 325 if (GNUNET_OK !=
326 write_message (S_ISDIR (sbuf.st_mode) 326 write_message (S_ISDIR (sbuf.st_mode)
327 ? GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_DIRECTORY 327 ? GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_DIRECTORY
328 : GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_FILE, 328 : GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_FILE,
329 filename, strlen (filename) + 1)) 329 filename, strlen (filename) + 1))
@@ -338,9 +338,9 @@ preprocess_file (const char *filename,
338 338
339 rc.parent = item; 339 rc.parent = item;
340 rc.stop = GNUNET_NO; 340 rc.stop = GNUNET_NO;
341 GNUNET_DISK_directory_scan (filename, 341 GNUNET_DISK_directory_scan (filename,
342 &scan_callback, 342 &scan_callback,
343 &rc); 343 &rc);
344 if ( (GNUNET_YES == rc.stop) || 344 if ( (GNUNET_YES == rc.stop) ||
345 (GNUNET_OK != 345 (GNUNET_OK !=
346 write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_DIRECTORY, 346 write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_DIRECTORY,
@@ -363,7 +363,7 @@ preprocess_file (const char *filename,
363 */ 363 */
364static int 364static int
365extract_files (struct ScanTreeNode *item) 365extract_files (struct ScanTreeNode *item)
366{ 366{
367 struct GNUNET_CONTAINER_MetaData *meta; 367 struct GNUNET_CONTAINER_MetaData *meta;
368 ssize_t size; 368 ssize_t size;
369 size_t slen; 369 size_t slen;
@@ -380,7 +380,7 @@ extract_files (struct ScanTreeNode *item)
380 return GNUNET_SYSERR; 380 return GNUNET_SYSERR;
381 return GNUNET_OK; 381 return GNUNET_OK;
382 } 382 }
383 383
384 /* this is the expensive operation, *afterwards* we'll check for aborts */ 384 /* this is the expensive operation, *afterwards* we'll check for aborts */
385 meta = GNUNET_CONTAINER_meta_data_create (); 385 meta = GNUNET_CONTAINER_meta_data_create ();
386 EXTRACTOR_extract (plugins, item->filename, NULL, 0, &add_to_md, meta); 386 EXTRACTOR_extract (plugins, item->filename, NULL, 0, &add_to_md, meta);
@@ -393,7 +393,7 @@ extract_files (struct ScanTreeNode *item)
393 if (GNUNET_OK != 393 if (GNUNET_OK !=
394 write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_META_DATA, 394 write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_META_DATA,
395 item->filename, slen)) 395 item->filename, slen))
396 return GNUNET_SYSERR; 396 return GNUNET_SYSERR;
397 return GNUNET_OK; 397 return GNUNET_OK;
398 } 398 }
399 else if (size > (UINT16_MAX - sizeof (struct GNUNET_MessageHeader) - slen)) 399 else if (size > (UINT16_MAX - sizeof (struct GNUNET_MessageHeader) - slen))
@@ -404,7 +404,7 @@ extract_files (struct ScanTreeNode *item)
404 { 404 {
405 char buf[size + slen]; 405 char buf[size + slen];
406 char *dst = &buf[slen]; 406 char *dst = &buf[slen];
407 407
408 memcpy (buf, item->filename, slen); 408 memcpy (buf, item->filename, slen);
409 size = GNUNET_CONTAINER_meta_data_serialize (meta, 409 size = GNUNET_CONTAINER_meta_data_serialize (meta,
410 &dst, size, 410 &dst, size,
@@ -417,7 +417,7 @@ extract_files (struct ScanTreeNode *item)
417 GNUNET_CONTAINER_meta_data_destroy (meta); 417 GNUNET_CONTAINER_meta_data_destroy (meta);
418 if (GNUNET_OK != 418 if (GNUNET_OK !=
419 write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_META_DATA, 419 write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_META_DATA,
420 buf, 420 buf,
421 slen + size)) 421 slen + size))
422 return GNUNET_SYSERR; 422 return GNUNET_SYSERR;
423 } 423 }
@@ -456,7 +456,7 @@ ignore_sigpipe ()
456 * @param flags flags to use (O_RDONLY or O_WRONLY) 456 * @param flags flags to use (O_RDONLY or O_WRONLY)
457 */ 457 */
458static void 458static void
459make_dev_zero (int fd, 459make_dev_zero (int fd,
460 int flags) 460 int flags)
461{ 461{
462 int z; 462 int z;
@@ -483,7 +483,7 @@ make_dev_zero (int fd,
483 * otherwise custom plugins to load from LE 483 * otherwise custom plugins to load from LE
484 * @return 0 on success 484 * @return 0 on success
485 */ 485 */
486int 486int
487main (int argc, 487main (int argc,
488 char *const *argv) 488 char *const *argv)
489{ 489{
@@ -502,7 +502,7 @@ main (int argc,
502 output_stream = 1; /* stdout */ 502 output_stream = 1; /* stdout */
503#else 503#else
504 ignore_sigpipe (); 504 ignore_sigpipe ();
505 /* move stdout to some other FD for IPC, bind 505 /* move stdout to some other FD for IPC, bind
506 stdout/stderr to /dev/null */ 506 stdout/stderr to /dev/null */
507 output_stream = dup (1); 507 output_stream = dup (1);
508 make_dev_zero (1, O_WRONLY); 508 make_dev_zero (1, O_WRONLY);
@@ -512,7 +512,7 @@ main (int argc,
512 /* parse command line */ 512 /* parse command line */
513 if ( (3 != argc) && (2 != argc) ) 513 if ( (3 != argc) && (2 != argc) )
514 { 514 {
515 FPRINTF (stderr, 515 FPRINTF (stderr,
516 "%s", 516 "%s",
517 "gnunet-helper-fs-publish needs exactly one or two arguments\n"); 517 "gnunet-helper-fs-publish needs exactly one or two arguments\n");
518#if WINDOWS 518#if WINDOWS
@@ -532,7 +532,7 @@ main (int argc,
532 } 532 }
533 533
534 /* scan tree to find out how much work there is to be done */ 534 /* scan tree to find out how much work there is to be done */
535 if (GNUNET_OK != preprocess_file (filename_expanded, 535 if (GNUNET_OK != preprocess_file (filename_expanded,
536 &root)) 536 &root))
537 { 537 {
538 (void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_ERROR, NULL, 0); 538 (void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_ERROR, NULL, 0);
@@ -542,7 +542,7 @@ main (int argc,
542#endif 542#endif
543 return 2; 543 return 2;
544 } 544 }
545 /* signal that we're done counting files, so that a percentage of 545 /* signal that we're done counting files, so that a percentage of
546 progress can now be calculated */ 546 progress can now be calculated */
547 if (GNUNET_OK != 547 if (GNUNET_OK !=
548 write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_COUNTING_DONE, NULL, 0)) 548 write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_COUNTING_DONE, NULL, 0))
@@ -551,7 +551,7 @@ main (int argc,
551#if WINDOWS 551#if WINDOWS
552 GNUNET_free ((void*) argv); 552 GNUNET_free ((void*) argv);
553#endif 553#endif
554 return 3; 554 return 3;
555 } 555 }
556 if (NULL != root) 556 if (NULL != root)
557 { 557 {
@@ -572,7 +572,7 @@ main (int argc,
572 (void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_FINISHED, NULL, 0); 572 (void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_FINISHED, NULL, 0);
573 EXTRACTOR_plugin_remove_all (plugins); 573 EXTRACTOR_plugin_remove_all (plugins);
574#if WINDOWS 574#if WINDOWS
575 GNUNET_free ((void*) argv); 575 GNUNET_free ((void*) argv);
576#endif 576#endif
577 return 0; 577 return 0;
578} 578}
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
index f960503c2..83dd45a28 100644
--- a/src/fs/gnunet-publish.c
+++ b/src/fs/gnunet-publish.c
@@ -169,7 +169,7 @@ do_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
169 { 169 {
170 GNUNET_CONTAINER_meta_data_destroy (meta); 170 GNUNET_CONTAINER_meta_data_destroy (meta);
171 meta = NULL; 171 meta = NULL;
172 } 172 }
173} 173}
174 174
175 175
@@ -187,7 +187,7 @@ stop_scanner_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
187 { 187 {
188 GNUNET_FS_directory_scan_abort (ds); 188 GNUNET_FS_directory_scan_abort (ds);
189 ds = NULL; 189 ds = NULL;
190 } 190 }
191 if (NULL != identity) 191 if (NULL != identity)
192 { 192 {
193 GNUNET_IDENTITY_disconnect (identity); 193 GNUNET_IDENTITY_disconnect (identity);
@@ -477,7 +477,7 @@ get_file_information (struct GNUNET_FS_ShareTreeItem *item)
477 if (GNUNET_YES == item->is_directory) 477 if (GNUNET_YES == item->is_directory)
478 { 478 {
479 GNUNET_CONTAINER_meta_data_delete (item->meta, 479 GNUNET_CONTAINER_meta_data_delete (item->meta,
480 EXTRACTOR_METATYPE_MIMETYPE, 480 EXTRACTOR_METATYPE_MIMETYPE,
481 NULL, 0); 481 NULL, 0);
482 GNUNET_FS_meta_data_make_directory (item->meta); 482 GNUNET_FS_meta_data_make_directory (item->meta);
483 if (NULL == item->ksk_uri) 483 if (NULL == item->ksk_uri)
@@ -488,9 +488,9 @@ get_file_information (struct GNUNET_FS_ShareTreeItem *item)
488 else 488 else
489 GNUNET_FS_uri_ksk_add_keyword (item->ksk_uri, GNUNET_FS_DIRECTORY_MIME, 489 GNUNET_FS_uri_ksk_add_keyword (item->ksk_uri, GNUNET_FS_DIRECTORY_MIME,
490 GNUNET_NO); 490 GNUNET_NO);
491 fi = GNUNET_FS_file_information_create_empty_directory (ctx, NULL, 491 fi = GNUNET_FS_file_information_create_empty_directory (ctx, NULL,
492 item->ksk_uri, 492 item->ksk_uri,
493 item->meta, 493 item->meta,
494 &bo, item->filename); 494 &bo, item->filename);
495 for (child = item->children_head; child; child = child->next) 495 for (child = item->children_head; child; child = child->next)
496 { 496 {
@@ -500,9 +500,9 @@ get_file_information (struct GNUNET_FS_ShareTreeItem *item)
500 } 500 }
501 else 501 else
502 { 502 {
503 fi = GNUNET_FS_file_information_create_from_file (ctx, NULL, 503 fi = GNUNET_FS_file_information_create_from_file (ctx, NULL,
504 item->filename, 504 item->filename,
505 item->ksk_uri, item->meta, 505 item->ksk_uri, item->meta,
506 !do_insert, 506 !do_insert,
507 &bo); 507 &bo);
508 } 508 }
@@ -542,7 +542,7 @@ directory_trim_complete (struct GNUNET_FS_ShareTreeItem *directory_scan_result)
542 priv = NULL; 542 priv = NULL;
543 else 543 else
544 priv = GNUNET_IDENTITY_ego_get_private_key (namespace); 544 priv = GNUNET_IDENTITY_ego_get_private_key (namespace);
545 pc = GNUNET_FS_publish_start (ctx, fi, 545 pc = GNUNET_FS_publish_start (ctx, fi,
546 priv, this_id, next_id, 546 priv, this_id, next_id,
547 (do_simulate) ? 547 (do_simulate) ?
548 GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY : 548 GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY :
@@ -569,8 +569,8 @@ directory_trim_complete (struct GNUNET_FS_ShareTreeItem *directory_scan_result)
569 * @param reason kind of progress we are making 569 * @param reason kind of progress we are making
570 */ 570 */
571static void 571static void
572directory_scan_cb (void *cls, 572directory_scan_cb (void *cls,
573 const char *filename, 573 const char *filename,
574 int is_directory, 574 int is_directory,
575 enum GNUNET_FS_DirScannerProgressUpdateReason reason) 575 enum GNUNET_FS_DirScannerProgressUpdateReason reason)
576{ 576{
@@ -584,21 +584,21 @@ directory_scan_cb (void *cls,
584 if (is_directory == GNUNET_YES) 584 if (is_directory == GNUNET_YES)
585 FPRINTF (stdout, _("Scanning directory `%s'.\n"), filename); 585 FPRINTF (stdout, _("Scanning directory `%s'.\n"), filename);
586 else 586 else
587 FPRINTF (stdout, _("Scanning file `%s'.\n"), filename); 587 FPRINTF (stdout, _("Scanning file `%s'.\n"), filename);
588 } 588 }
589 break; 589 break;
590 case GNUNET_FS_DIRSCANNER_FILE_IGNORED: 590 case GNUNET_FS_DIRSCANNER_FILE_IGNORED:
591 FPRINTF (stderr, 591 FPRINTF (stderr,
592 _("There was trouble processing file `%s', skipping it.\n"), 592 _("There was trouble processing file `%s', skipping it.\n"),
593 filename); 593 filename);
594 break; 594 break;
595 case GNUNET_FS_DIRSCANNER_ALL_COUNTED: 595 case GNUNET_FS_DIRSCANNER_ALL_COUNTED:
596 if (verbose) 596 if (verbose)
597 FPRINTF (stdout, "%s", _("Preprocessing complete.\n")); 597 FPRINTF (stdout, "%s", _("Preprocessing complete.\n"));
598 break; 598 break;
599 case GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED: 599 case GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED:
600 if (verbose > 2) 600 if (verbose > 2)
601 FPRINTF (stdout, _("Extracting meta data from file `%s' complete.\n"), filename); 601 FPRINTF (stdout, _("Extracting meta data from file `%s' complete.\n"), filename);
602 break; 602 break;
603 case GNUNET_FS_DIRSCANNER_FINISHED: 603 case GNUNET_FS_DIRSCANNER_FINISHED:
604 if (verbose > 1) 604 if (verbose > 1)
@@ -630,7 +630,7 @@ directory_scan_cb (void *cls,
630 * has been initialized. 630 * has been initialized.
631 * 631 *
632 * @param args0 filename to publish 632 * @param args0 filename to publish
633 */ 633 */
634static void 634static void
635identity_continuation (const char *args0) 635identity_continuation (const char *args0)
636{ 636{
@@ -673,8 +673,8 @@ identity_continuation (const char *args0)
673 return; 673 return;
674 } 674 }
675 ds = GNUNET_FS_directory_scan_start (args0, 675 ds = GNUNET_FS_directory_scan_start (args0,
676 disable_extractor, 676 disable_extractor,
677 ex, 677 ex,
678 &directory_scan_cb, NULL); 678 &directory_scan_cb, NULL);
679 if (NULL == ds) 679 if (NULL == ds)
680 { 680 {
@@ -706,7 +706,7 @@ identity_cb (void *cls,
706{ 706{
707 const char *args0 = cls; 707 const char *args0 = cls;
708 708
709 if (NULL == ego) 709 if (NULL == ego)
710 { 710 {
711 identity_continuation (args0); 711 identity_continuation (args0);
712 return; 712 return;
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 8ecb6bb67..0e38d0dc9 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -248,7 +248,7 @@ update_latencies (void *cls,
248 int active, 248 int active,
249 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 249 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
250 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 250 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
251 const struct GNUNET_ATS_Information *ats, 251 const struct GNUNET_ATS_Information *ats,
252 uint32_t ats_count) 252 uint32_t ats_count)
253{ 253{
254 unsigned int i; 254 unsigned int i;
@@ -270,7 +270,7 @@ update_latencies (void *cls,
270 gettext_noop 270 gettext_noop
271 ("# running average P2P latency (ms)"), 271 ("# running average P2P latency (ms)"),
272 GSF_avg_latency.rel_value_us / 1000LL, GNUNET_NO); 272 GSF_avg_latency.rel_value_us / 1000LL, GNUNET_NO);
273 break; 273 break;
274 } 274 }
275} 275}
276 276
@@ -416,7 +416,7 @@ start_p2p_processing (void *cls, struct GSF_PendingRequest *pr,
416 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 416 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
417 "Considering mesh-based download for block\n"); 417 "Considering mesh-based download for block\n");
418 GSF_mesh_lookup_ (pr); 418 GSF_mesh_lookup_ (pr);
419 break; 419 break;
420 case GNUNET_BLOCK_TYPE_FS_UBLOCK: 420 case GNUNET_BLOCK_TYPE_FS_UBLOCK:
421 /* the above block types are in the DHT */ 421 /* the above block types are in the DHT */
422 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 422 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -625,7 +625,7 @@ main_init (struct GNUNET_SERVER_Handle *server,
625 anon_p2p_off = (GNUNET_YES == 625 anon_p2p_off = (GNUNET_YES ==
626 GNUNET_CONFIGURATION_get_value_yesno (GSF_cfg, 626 GNUNET_CONFIGURATION_get_value_yesno (GSF_cfg,
627 "fs", 627 "fs",
628 "DISABLE_ANON_TRANSFER")); 628 "DISABLE_ANON_TRANSFER"));
629 GSF_core = 629 GSF_core =
630 GNUNET_CORE_connect (GSF_cfg, NULL, &peer_init_handler, 630 GNUNET_CORE_connect (GSF_cfg, NULL, &peer_init_handler,
631 &peer_connect_handler, &GSF_peer_disconnect_handler_, 631 &peer_connect_handler, &GSF_peer_disconnect_handler_,
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index a9e950363..593250e2c 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -328,9 +328,9 @@ get_respect_filename (const struct GNUNET_PeerIdentity *id)
328{ 328{
329 char *fn; 329 char *fn;
330 330
331 GNUNET_asprintf (&fn, 331 GNUNET_asprintf (&fn,
332 "%s%s%s", 332 "%s%s%s",
333 respectDirectory, 333 respectDirectory,
334 DIR_SEPARATOR_STR, 334 DIR_SEPARATOR_STR,
335 GNUNET_i2s_full (id)); 335 GNUNET_i2s_full (id));
336 return fn; 336 return fn;
@@ -542,7 +542,7 @@ ats_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
542 542
543 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 543 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
544 "Reserved %d bytes / need to wait %s for reservation\n", 544 "Reserved %d bytes / need to wait %s for reservation\n",
545 (int) amount, 545 (int) amount,
546 GNUNET_STRINGS_relative_time_to_string (res_delay, GNUNET_YES)); 546 GNUNET_STRINGS_relative_time_to_string (res_delay, GNUNET_YES));
547 cp->rc = NULL; 547 cp->rc = NULL;
548 if (0 == amount) 548 if (0 == amount)
@@ -597,7 +597,7 @@ GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer)
597 GNUNET_free (fn); 597 GNUNET_free (fn);
598 cp->request_map = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); 598 cp->request_map = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO);
599 GNUNET_break (GNUNET_OK == 599 GNUNET_break (GNUNET_OK ==
600 GNUNET_CONTAINER_multipeermap_put (cp_map, 600 GNUNET_CONTAINER_multipeermap_put (cp_map,
601 GSF_connected_peer_get_identity2_ (cp), 601 GSF_connected_peer_get_identity2_ (cp),
602 cp, 602 cp,
603 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 603 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
@@ -682,7 +682,7 @@ GSF_handle_p2p_migration_stop_ (void *cls,
682 bt = GNUNET_TIME_relative_ntoh (msm->duration); 682 bt = GNUNET_TIME_relative_ntoh (msm->duration);
683 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 683 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
684 _("Migration of content to peer `%s' blocked for %s\n"), 684 _("Migration of content to peer `%s' blocked for %s\n"),
685 GNUNET_i2s (other), 685 GNUNET_i2s (other),
686 GNUNET_STRINGS_relative_time_to_string (bt, GNUNET_YES)); 686 GNUNET_STRINGS_relative_time_to_string (bt, GNUNET_YES));
687 cp->ppd.migration_blocked_until = GNUNET_TIME_relative_to_absolute (bt); 687 cp->ppd.migration_blocked_until = GNUNET_TIME_relative_to_absolute (bt);
688 if (GNUNET_SCHEDULER_NO_TASK == cp->mig_revive_task) 688 if (GNUNET_SCHEDULER_NO_TASK == cp->mig_revive_task)
@@ -1254,7 +1254,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
1254 { 1254 {
1255 pr = peerreq->pr; 1255 pr = peerreq->pr;
1256 prd = GSF_pending_request_get_data_ (pr); 1256 prd = GSF_pending_request_get_data_ (pr);
1257 if (prd->type == type) 1257 if (prd->type == type)
1258 { 1258 {
1259 if (prd->ttl.abs_value_us >= GNUNET_TIME_absolute_get ().abs_value_us + ttl * 1000LL) 1259 if (prd->ttl.abs_value_us >= GNUNET_TIME_absolute_get ().abs_value_us + ttl * 1000LL)
1260 { 1260 {
@@ -1278,7 +1278,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
1278 1278
1279 peerreq = GNUNET_new (struct PeerRequest); 1279 peerreq = GNUNET_new (struct PeerRequest);
1280 peerreq->cp = cp; 1280 peerreq->cp = cp;
1281 pr = GSF_pending_request_create_ (options, type, &gm->query, 1281 pr = GSF_pending_request_create_ (options, type, &gm->query,
1282 target, 1282 target,
1283 (bfsize > 1283 (bfsize >
1284 0) ? (const char *) &opt[bits] : NULL, 1284 0) ? (const char *) &opt[bits] : NULL,
@@ -1813,8 +1813,8 @@ GSF_connected_peer_init_ ()
1813 * @return #GNUNET_YES (we should continue to iterate) 1813 * @return #GNUNET_YES (we should continue to iterate)
1814 */ 1814 */
1815static int 1815static int
1816clean_peer (void *cls, 1816clean_peer (void *cls,
1817 const struct GNUNET_PeerIdentity *key, 1817 const struct GNUNET_PeerIdentity *key,
1818 void *value) 1818 void *value)
1819{ 1819{
1820 GSF_peer_disconnect_handler_ (NULL, key); 1820 GSF_peer_disconnect_handler_ (NULL, key);
@@ -1846,8 +1846,8 @@ GSF_connected_peer_done_ ()
1846 * @return #GNUNET_YES (we should continue to iterate) 1846 * @return #GNUNET_YES (we should continue to iterate)
1847 */ 1847 */
1848static int 1848static int
1849clean_local_client (void *cls, 1849clean_local_client (void *cls,
1850 const struct GNUNET_PeerIdentity *key, 1850 const struct GNUNET_PeerIdentity *key,
1851 void *value) 1851 void *value)
1852{ 1852{
1853 const struct GSF_LocalClient *lc = cls; 1853 const struct GSF_LocalClient *lc = cls;
diff --git a/src/fs/gnunet-service-fs_indexing.c b/src/fs/gnunet-service-fs_indexing.c
index c8e9d636e..4f5b547ae 100644
--- a/src/fs/gnunet-service-fs_indexing.c
+++ b/src/fs/gnunet-service-fs_indexing.c
@@ -236,7 +236,7 @@ signal_index_ok (struct IndexInfo *ii)
236 _ 236 _
237 ("Index request received for file `%s' is already indexed as `%s'. Permitting anyway.\n"), 237 ("Index request received for file `%s' is already indexed as `%s'. Permitting anyway.\n"),
238 ii->filename, 238 ii->filename,
239 ir->filename); 239 ir->filename);
240 GNUNET_SERVER_transmit_context_append_data (ii->tc, NULL, 0, 240 GNUNET_SERVER_transmit_context_append_data (ii->tc, NULL, 0,
241 GNUNET_MESSAGE_TYPE_FS_INDEX_START_OK); 241 GNUNET_MESSAGE_TYPE_FS_INDEX_START_OK);
242 GNUNET_SERVER_transmit_context_run (ii->tc, GNUNET_TIME_UNIT_MINUTES); 242 GNUNET_SERVER_transmit_context_run (ii->tc, GNUNET_TIME_UNIT_MINUTES);
@@ -468,7 +468,7 @@ GNUNET_FS_handle_unindex (void *cls, struct GNUNET_SERVER_Client *client,
468 * @param msg error message 468 * @param msg error message
469 */ 469 */
470static void 470static void
471remove_cont (void *cls, int success, 471remove_cont (void *cls, int success,
472 struct GNUNET_TIME_Absolute min_expiration, 472 struct GNUNET_TIME_Absolute min_expiration,
473 const char *msg) 473 const char *msg)
474{ 474{
diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c
index 8066b264a..6d62085e6 100644
--- a/src/fs/gnunet-service-fs_lc.c
+++ b/src/fs/gnunet-service-fs_lc.c
@@ -375,7 +375,7 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client,
375 if (0 != (SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY & ntohl (sm->options))) 375 if (0 != (SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY & ntohl (sm->options)))
376 options |= GSF_PRO_LOCAL_ONLY; 376 options |= GSF_PRO_LOCAL_ONLY;
377 cr->pr = GSF_pending_request_create_ (options, type, 377 cr->pr = GSF_pending_request_create_ (options, type,
378 &sm->query, 378 &sm->query,
379 (0 != 379 (0 !=
380 memcmp (&sm->target, &all_zeros, 380 memcmp (&sm->target, &all_zeros,
381 sizeof (struct GNUNET_HashCode))) 381 sizeof (struct GNUNET_HashCode)))
diff --git a/src/fs/gnunet-service-fs_mesh.h b/src/fs/gnunet-service-fs_mesh.h
index f136940aa..5decb242a 100644
--- a/src/fs/gnunet-service-fs_mesh.h
+++ b/src/fs/gnunet-service-fs_mesh.h
@@ -34,7 +34,7 @@ struct GSF_MeshRequest;
34 34
35/** 35/**
36 * Function called with a reply from the mesh. 36 * Function called with a reply from the mesh.
37 * 37 *
38 * @param cls closure 38 * @param cls closure
39 * @param type type of the block, ANY on error 39 * @param type type of the block, ANY on error
40 * @param expiration expiration time for the block 40 * @param expiration expiration time for the block
diff --git a/src/fs/gnunet-service-fs_mesh_client.c b/src/fs/gnunet-service-fs_mesh_client.c
index ffc3c6179..73ab6bb5d 100644
--- a/src/fs/gnunet-service-fs_mesh_client.c
+++ b/src/fs/gnunet-service-fs_mesh_client.c
@@ -44,7 +44,7 @@
44#define CLIENT_RETRY_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) 44#define CLIENT_RETRY_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
45 45
46 46
47/** 47/**
48 * Handle for a mesh to another peer. 48 * Handle for a mesh to another peer.
49 */ 49 */
50struct MeshHandle; 50struct MeshHandle;
@@ -99,7 +99,7 @@ struct GSF_MeshRequest
99}; 99};
100 100
101 101
102/** 102/**
103 * Handle for a mesh to another peer. 103 * Handle for a mesh to another peer.
104 */ 104 */
105struct MeshHandle 105struct MeshHandle
@@ -127,12 +127,12 @@ struct MeshHandle
127 127
128 /** 128 /**
129 * Handle for active write operation, or NULL. 129 * Handle for active write operation, or NULL.
130 */ 130 */
131 struct GNUNET_MESH_TransmitHandle *wh; 131 struct GNUNET_MESH_TransmitHandle *wh;
132 132
133 /** 133 /**
134 * Which peer does this mesh go to? 134 * Which peer does this mesh go to?
135 */ 135 */
136 struct GNUNET_PeerIdentity target; 136 struct GNUNET_PeerIdentity target;
137 137
138 /** 138 /**
@@ -177,7 +177,7 @@ transmit_pending (struct MeshHandle *mh);
177 177
178 178
179/** 179/**
180 * Iterator called on each entry in a waiting map to 180 * Iterator called on each entry in a waiting map to
181 * move it back to the pending list. 181 * move it back to the pending list.
182 * 182 *
183 * @param cls the 'struct MeshHandle' 183 * @param cls the 'struct MeshHandle'
@@ -192,7 +192,7 @@ move_to_pending (void *cls,
192{ 192{
193 struct MeshHandle *mh = cls; 193 struct MeshHandle *mh = cls;
194 struct GSF_MeshRequest *sr = value; 194 struct GSF_MeshRequest *sr = value;
195 195
196 GNUNET_assert (GNUNET_YES == 196 GNUNET_assert (GNUNET_YES ==
197 GNUNET_CONTAINER_multihashmap_remove (mh->waiting_map, 197 GNUNET_CONTAINER_multihashmap_remove (mh->waiting_map,
198 key, 198 key,
@@ -342,7 +342,7 @@ transmit_sqm (void *cls,
342 transmit_pending (mh); 342 transmit_pending (mh);
343 return sizeof (sqm); 343 return sizeof (sqm);
344} 344}
345 345
346 346
347/** 347/**
348 * Transmit pending requests via the mesh. 348 * Transmit pending requests via the mesh.
@@ -371,7 +371,7 @@ struct HandleReplyClosure
371 371
372 /** 372 /**
373 * Reply payload. 373 * Reply payload.
374 */ 374 */
375 const void *data; 375 const void *data;
376 376
377 /** 377 /**
@@ -384,11 +384,11 @@ struct HandleReplyClosure
384 */ 384 */
385 size_t data_size; 385 size_t data_size;
386 386
387 /** 387 /**
388 * Type of the block. 388 * Type of the block.
389 */ 389 */
390 enum GNUNET_BLOCK_Type type; 390 enum GNUNET_BLOCK_Type type;
391 391
392 /** 392 /**
393 * Did we have a matching query? 393 * Did we have a matching query?
394 */ 394 */
@@ -397,7 +397,7 @@ struct HandleReplyClosure
397 397
398 398
399/** 399/**
400 * Iterator called on each entry in a waiting map to 400 * Iterator called on each entry in a waiting map to
401 * process a result. 401 * process a result.
402 * 402 *
403 * @param cls the 'struct HandleReplyClosure' 403 * @param cls the 'struct HandleReplyClosure'
@@ -412,7 +412,7 @@ handle_reply (void *cls,
412{ 412{
413 struct HandleReplyClosure *hrc = cls; 413 struct HandleReplyClosure *hrc = cls;
414 struct GSF_MeshRequest *sr = value; 414 struct GSF_MeshRequest *sr = value;
415 415
416 sr->proc (sr->proc_cls, 416 sr->proc (sr->proc_cls,
417 hrc->type, 417 hrc->type,
418 hrc->expiration, 418 hrc->expiration,
@@ -462,7 +462,7 @@ reply_cb (void *cls,
462 type, 462 type,
463 &srm[1], msize, &query)) 463 &srm[1], msize, &query))
464 { 464 {
465 GNUNET_break_op (0); 465 GNUNET_break_op (0);
466 reset_mesh_async (mh); 466 reset_mesh_async (mh);
467 return GNUNET_SYSERR; 467 return GNUNET_SYSERR;
468 } 468 }
@@ -611,7 +611,7 @@ GSF_mesh_query_cancel (struct GSF_MeshRequest *sr)
611 611
612 612
613/** 613/**
614 * Iterator called on each entry in a waiting map to 614 * Iterator called on each entry in a waiting map to
615 * call the 'proc' continuation and release associated 615 * call the 'proc' continuation and release associated
616 * resources. 616 * resources.
617 * 617 *
@@ -641,7 +641,7 @@ free_waiting_entry (void *cls,
641 * 641 *
642 * @param cls NULL 642 * @param cls NULL
643 * @param tunnel tunnel of the disconnecting client 643 * @param tunnel tunnel of the disconnecting client
644 * @param tunnel_ctx our 'struct MeshClient' 644 * @param tunnel_ctx our 'struct MeshClient'
645 */ 645 */
646static void 646static void
647cleaner_cb (void *cls, 647cleaner_cb (void *cls,
diff --git a/src/fs/gnunet-service-fs_mesh_server.c b/src/fs/gnunet-service-fs_mesh_server.c
index 206ff6e75..e732da990 100644
--- a/src/fs/gnunet-service-fs_mesh_server.c
+++ b/src/fs/gnunet-service-fs_mesh_server.c
@@ -72,22 +72,22 @@ struct MeshClient
72{ 72{
73 /** 73 /**
74 * DLL 74 * DLL
75 */ 75 */
76 struct MeshClient *next; 76 struct MeshClient *next;
77 77
78 /** 78 /**
79 * DLL 79 * DLL
80 */ 80 */
81 struct MeshClient *prev; 81 struct MeshClient *prev;
82 82
83 /** 83 /**
84 * Tunnel for communication. 84 * Tunnel for communication.
85 */ 85 */
86 struct GNUNET_MESH_Tunnel *tunnel; 86 struct GNUNET_MESH_Tunnel *tunnel;
87 87
88 /** 88 /**
89 * Handle for active write operation, or NULL. 89 * Handle for active write operation, or NULL.
90 */ 90 */
91 struct GNUNET_MESH_TransmitHandle *wh; 91 struct GNUNET_MESH_TransmitHandle *wh;
92 92
93 /** 93 /**
@@ -99,7 +99,7 @@ struct MeshClient
99 * Tail of write queue. 99 * Tail of write queue.
100 */ 100 */
101 struct WriteQueueItem *wqi_tail; 101 struct WriteQueueItem *wqi_tail;
102 102
103 /** 103 /**
104 * Current active request to the datastore, if we have one pending. 104 * Current active request to the datastore, if we have one pending.
105 */ 105 */
@@ -117,7 +117,7 @@ struct MeshClient
117 117
118 /** 118 /**
119 * Size of the last write that was initiated. 119 * Size of the last write that was initiated.
120 */ 120 */
121 size_t reply_size; 121 size_t reply_size;
122 122
123}; 123};
@@ -130,12 +130,12 @@ static struct GNUNET_MESH_Handle *listen_tunnel;
130 130
131/** 131/**
132 * Head of DLL of mesh clients. 132 * Head of DLL of mesh clients.
133 */ 133 */
134static struct MeshClient *sc_head; 134static struct MeshClient *sc_head;
135 135
136/** 136/**
137 * Tail of DLL of mesh clients. 137 * Tail of DLL of mesh clients.
138 */ 138 */
139static struct MeshClient *sc_tail; 139static struct MeshClient *sc_tail;
140 140
141/** 141/**
@@ -155,7 +155,7 @@ static unsigned long long sc_count_max;
155 * 155 *
156 * @param cls the 'struct MeshClient' 156 * @param cls the 'struct MeshClient'
157 * @param tc scheduler context 157 * @param tc scheduler context
158 */ 158 */
159static void 159static void
160timeout_mesh_task (void *cls, 160timeout_mesh_task (void *cls,
161 const struct GNUNET_SCHEDULER_TaskContext *tc) 161 const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -182,7 +182,7 @@ static void
182refresh_timeout_task (struct MeshClient *sc) 182refresh_timeout_task (struct MeshClient *sc)
183{ 183{
184 if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task) 184 if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task)
185 GNUNET_SCHEDULER_cancel (sc->timeout_task); 185 GNUNET_SCHEDULER_cancel (sc->timeout_task);
186 sc->timeout_task = GNUNET_SCHEDULER_add_delayed (IDLE_TIMEOUT, 186 sc->timeout_task = GNUNET_SCHEDULER_add_delayed (IDLE_TIMEOUT,
187 &timeout_mesh_task, 187 &timeout_mesh_task,
188 sc); 188 sc);
@@ -291,7 +291,7 @@ continue_writing (struct MeshClient *sc)
291 } 291 }
292 sc->wh = GNUNET_MESH_notify_transmit_ready (sc->tunnel, GNUNET_NO, 292 sc->wh = GNUNET_MESH_notify_transmit_ready (sc->tunnel, GNUNET_NO,
293 GNUNET_TIME_UNIT_FOREVER_REL, 293 GNUNET_TIME_UNIT_FOREVER_REL,
294 wqi->msize, 294 wqi->msize,
295 &write_continuation, 295 &write_continuation,
296 sc); 296 sc);
297 if (NULL == sc->wh) 297 if (NULL == sc->wh)
@@ -320,7 +320,7 @@ continue_writing (struct MeshClient *sc)
320 * @param uid unique identifier for the datum; 320 * @param uid unique identifier for the datum;
321 * maybe 0 if no unique identifier is available 321 * maybe 0 if no unique identifier is available
322 */ 322 */
323static void 323static void
324handle_datastore_reply (void *cls, 324handle_datastore_reply (void *cls,
325 const struct GNUNET_HashCode *key, 325 const struct GNUNET_HashCode *key,
326 size_t size, const void *data, 326 size_t size, const void *data,
@@ -416,7 +416,7 @@ request_cb (void *cls,
416 0, 416 0,
417 &sqm->query, 417 &sqm->query,
418 ntohl (sqm->type), 418 ntohl (sqm->type),
419 0 /* priority */, 419 0 /* priority */,
420 GSF_datastore_queue_size, 420 GSF_datastore_queue_size,
421 GNUNET_TIME_UNIT_FOREVER_REL, 421 GNUNET_TIME_UNIT_FOREVER_REL,
422 &handle_datastore_reply, sc); 422 &handle_datastore_reply, sc);
@@ -481,7 +481,7 @@ accept_cb (void *cls,
481 * 481 *
482 * @param cls NULL 482 * @param cls NULL
483 * @param tunnel tunnel of the disconnecting client 483 * @param tunnel tunnel of the disconnecting client
484 * @param tunnel_ctx our 'struct MeshClient' 484 * @param tunnel_ctx our 'struct MeshClient'
485 */ 485 */
486static void 486static void
487cleaner_cb (void *cls, 487cleaner_cb (void *cls,
@@ -501,9 +501,9 @@ cleaner_cb (void *cls,
501 gettext_noop ("# mesh connections active"), -1, 501 gettext_noop ("# mesh connections active"), -1,
502 GNUNET_NO); 502 GNUNET_NO);
503 if (GNUNET_SCHEDULER_NO_TASK != sc->terminate_task) 503 if (GNUNET_SCHEDULER_NO_TASK != sc->terminate_task)
504 GNUNET_SCHEDULER_cancel (sc->terminate_task); 504 GNUNET_SCHEDULER_cancel (sc->terminate_task);
505 if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task) 505 if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task)
506 GNUNET_SCHEDULER_cancel (sc->timeout_task); 506 GNUNET_SCHEDULER_cancel (sc->timeout_task);
507 if (NULL != sc->wh) 507 if (NULL != sc->wh)
508 GNUNET_MESH_notify_transmit_ready_cancel (sc->wh); 508 GNUNET_MESH_notify_transmit_ready_cancel (sc->wh);
509 if (NULL != sc->qe) 509 if (NULL != sc->qe)
diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c
index 9e92be2ed..607eb6122 100644
--- a/src/fs/gnunet-service-fs_pe.c
+++ b/src/fs/gnunet-service-fs_pe.c
@@ -57,7 +57,7 @@ struct PeerPlan;
57 * are stored in a 'struct GSF_RequestPlan'. (We need 57 * are stored in a 'struct GSF_RequestPlan'. (We need
58 * to be able to lookup all pending requests corresponding 58 * to be able to lookup all pending requests corresponding
59 * to a given plan entry.) 59 * to a given plan entry.)
60 * 60 *
61 * Similarly head and tail of the "PR" MDLL are stored 61 * Similarly head and tail of the "PR" MDLL are stored
62 * with the 'struct GSF_PendingRequest'. (We need 62 * with the 'struct GSF_PendingRequest'. (We need
63 * to be able to lookup all plan entries corresponding 63 * to be able to lookup all plan entries corresponding
@@ -360,7 +360,7 @@ get_latest (const struct GSF_RequestPlan *rp)
360 if (NULL == bi) 360 if (NULL == bi)
361 return NULL; /* should never happen */ 361 return NULL; /* should never happen */
362 ret = bi->pr; 362 ret = bi->pr;
363 bi = bi->next_PE; 363 bi = bi->next_PE;
364 while (NULL != bi) 364 while (NULL != bi)
365 { 365 {
366 if (GSF_pending_request_get_data_ (bi->pr)->ttl.abs_value_us > 366 if (GSF_pending_request_get_data_ (bi->pr)->ttl.abs_value_us >
@@ -594,7 +594,7 @@ GSF_plan_add_ (struct GSF_ConnectedPeer *cp, struct GSF_PendingRequest *pr)
594 pp->delay_heap = 594 pp->delay_heap =
595 GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); 595 GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
596 pp->cp = cp; 596 pp->cp = cp;
597 GNUNET_CONTAINER_multipeermap_put (plans, 597 GNUNET_CONTAINER_multipeermap_put (plans,
598 id, pp, 598 id, pp,
599 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); 599 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
600 } 600 }
diff --git a/src/fs/gnunet-service-fs_pe.h b/src/fs/gnunet-service-fs_pe.h
index d1362675c..22b760922 100644
--- a/src/fs/gnunet-service-fs_pe.h
+++ b/src/fs/gnunet-service-fs_pe.h
@@ -68,7 +68,7 @@ GSF_plan_notify_request_done_ (struct GSF_PendingRequest *pr);
68 * @return GNUNET_YES if 'result' was changed, GNUNET_NO otherwise. 68 * @return GNUNET_YES if 'result' was changed, GNUNET_NO otherwise.
69 */ 69 */
70int 70int
71GSF_request_plan_reference_get_last_transmission_ (struct GSF_PendingRequestPlanBijection *pr_head, 71GSF_request_plan_reference_get_last_transmission_ (struct GSF_PendingRequestPlanBijection *pr_head,
72 struct GSF_ConnectedPeer *sender, 72 struct GSF_ConnectedPeer *sender,
73 struct GNUNET_TIME_Absolute *result); 73 struct GNUNET_TIME_Absolute *result);
74 74
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index b624f536c..9171bfc2a 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -367,7 +367,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
367 { 367 {
368 refresh_bloomfilter (pr); 368 refresh_bloomfilter (pr);
369 } 369 }
370 GNUNET_CONTAINER_multihashmap_put (pr_map, 370 GNUNET_CONTAINER_multihashmap_put (pr_map,
371 &pr->public_data.query, pr, 371 &pr->public_data.query, pr,
372 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 372 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
373 if (0 == (options & GSF_PRO_REQUEST_NEVER_EXPIRES)) 373 if (0 == (options & GSF_PRO_REQUEST_NEVER_EXPIRES))
@@ -482,7 +482,7 @@ GSF_pending_request_update_ (struct GSF_PendingRequest *pr,
482 } 482 }
483 } 483 }
484 } 484 }
485 if (NULL != pr->gh) 485 if (NULL != pr->gh)
486 GNUNET_DHT_get_filter_known_results (pr->gh, 486 GNUNET_DHT_get_filter_known_results (pr->gh,
487 replies_seen_count, 487 replies_seen_count,
488 replies_seen); 488 replies_seen);
@@ -828,8 +828,8 @@ process_reply (void *cls, const struct GNUNET_HashCode * key, void *value)
828 GNUNET_TIME_absolute_get_duration (pr-> 828 GNUNET_TIME_absolute_get_duration (pr->
829 public_data.start_time).rel_value_us); 829 public_data.start_time).rel_value_us);
830 if (GNUNET_YES != 830 if (GNUNET_YES !=
831 GSF_request_plan_reference_get_last_transmission_ (pr->public_data.pr_head, 831 GSF_request_plan_reference_get_last_transmission_ (pr->public_data.pr_head,
832 prq->sender, 832 prq->sender,
833 &last_transmission)) 833 &last_transmission))
834 last_transmission.abs_value_us = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; 834 last_transmission.abs_value_us = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
835 /* pass on to other peers / local clients */ 835 /* pass on to other peers / local clients */
@@ -890,10 +890,10 @@ process_reply (void *cls, const struct GNUNET_HashCode * key, void *value)
890 prq->request_found = GNUNET_YES; 890 prq->request_found = GNUNET_YES;
891 /* finally, pass on to other peer / local client */ 891 /* finally, pass on to other peer / local client */
892 if (! GSF_request_plan_reference_get_last_transmission_ (pr->public_data.pr_head, 892 if (! GSF_request_plan_reference_get_last_transmission_ (pr->public_data.pr_head,
893 prq->sender, 893 prq->sender,
894 &last_transmission)) 894 &last_transmission))
895 last_transmission.abs_value_us = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; 895 last_transmission.abs_value_us = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
896 pr->rh (pr->rh_cls, prq->eval, pr, 896 pr->rh (pr->rh_cls, prq->eval, pr,
897 prq->anonymity_level, prq->expiration, 897 prq->anonymity_level, prq->expiration,
898 last_transmission, prq->type, prq->data, prq->size); 898 last_transmission, prq->type, prq->data, prq->size);
899 return GNUNET_YES; 899 return GNUNET_YES;
@@ -934,7 +934,7 @@ struct PutMigrationContext
934 * @param msg NULL on success, otherwise an error message 934 * @param msg NULL on success, otherwise an error message
935 */ 935 */
936static void 936static void
937put_migration_continuation (void *cls, int success, 937put_migration_continuation (void *cls, int success,
938 struct GNUNET_TIME_Absolute min_expiration, 938 struct GNUNET_TIME_Absolute min_expiration,
939 const char *msg) 939 const char *msg)
940{ 940{
@@ -947,13 +947,13 @@ put_migration_continuation (void *cls, int success,
947 { 947 {
948 if (GNUNET_SYSERR != success) 948 if (GNUNET_SYSERR != success)
949 { 949 {
950 GNUNET_LOAD_update (datastore_put_load, 950 GNUNET_LOAD_update (datastore_put_load,
951 GNUNET_TIME_absolute_get_duration (pmc->start).rel_value_us); 951 GNUNET_TIME_absolute_get_duration (pmc->start).rel_value_us);
952 } 952 }
953 else 953 else
954 { 954 {
955 /* on queue failure / timeout, increase the put load dramatically */ 955 /* on queue failure / timeout, increase the put load dramatically */
956 GNUNET_LOAD_update (datastore_put_load, 956 GNUNET_LOAD_update (datastore_put_load,
957 GNUNET_TIME_UNIT_MINUTES.rel_value_us); 957 GNUNET_TIME_UNIT_MINUTES.rel_value_us);
958 } 958 }
959 } 959 }
@@ -968,17 +968,17 @@ put_migration_continuation (void *cls, int success,
968 GNUNET_free (pmc); 968 GNUNET_free (pmc);
969 return; 969 return;
970 } 970 }
971 if ( (GNUNET_NO == success) && 971 if ( (GNUNET_NO == success) &&
972 (GNUNET_NO == pmc->requested) && 972 (GNUNET_NO == pmc->requested) &&
973 (NULL != cp) ) 973 (NULL != cp) )
974 { 974 {
975 ppd = GSF_get_peer_performance_data_ (cp); 975 ppd = GSF_get_peer_performance_data_ (cp);
976 if (min_expiration.abs_value_us > 0) 976 if (min_expiration.abs_value_us > 0)
977 { 977 {
978 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 978 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
979 "Asking to stop migration for %s because datastore is full\n", 979 "Asking to stop migration for %s because datastore is full\n",
980 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (min_expiration), GNUNET_YES)); 980 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (min_expiration), GNUNET_YES));
981 GSF_block_peer_migration_ (cp, min_expiration); 981 GSF_block_peer_migration_ (cp, min_expiration);
982 } 982 }
983 else 983 else
984 { 984 {
@@ -989,7 +989,7 @@ put_migration_continuation (void *cls, int success,
989 mig_pause.rel_value_us = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, 989 mig_pause.rel_value_us = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
990 ppd->migration_delay.rel_value_us); 990 ppd->migration_delay.rel_value_us);
991 ppd->migration_delay = GNUNET_TIME_relative_multiply (ppd->migration_delay, 2); 991 ppd->migration_delay = GNUNET_TIME_relative_multiply (ppd->migration_delay, 2);
992 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 992 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
993 "Replicated content already exists locally, asking to stop migration for %s\n", 993 "Replicated content already exists locally, asking to stop migration for %s\n",
994 GNUNET_STRINGS_relative_time_to_string (mig_pause, GNUNET_YES)); 994 GNUNET_STRINGS_relative_time_to_string (mig_pause, GNUNET_YES));
995 GSF_block_peer_migration_ (cp, GNUNET_TIME_relative_to_absolute (mig_pause)); 995 GSF_block_peer_migration_ (cp, GNUNET_TIME_relative_to_absolute (mig_pause));
@@ -1123,12 +1123,12 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr)
1123 xquery_size += sizeof (struct GNUNET_PeerIdentity); 1123 xquery_size += sizeof (struct GNUNET_PeerIdentity);
1124 } 1124 }
1125 pr->gh = 1125 pr->gh =
1126 GNUNET_DHT_get_start (GSF_dht, 1126 GNUNET_DHT_get_start (GSF_dht,
1127 pr->public_data.type, &pr->public_data.query, 1127 pr->public_data.type, &pr->public_data.query,
1128 DHT_GET_REPLICATION, 1128 DHT_GET_REPLICATION,
1129 GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, 1129 GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE,
1130 xquery, xquery_size, &handle_dht_reply, pr); 1130 xquery, xquery_size, &handle_dht_reply, pr);
1131 if ( (NULL != pr->gh) && 1131 if ( (NULL != pr->gh) &&
1132 (0 != pr->replies_seen_count) ) 1132 (0 != pr->replies_seen_count) )
1133 GNUNET_DHT_get_filter_known_results (pr->gh, 1133 GNUNET_DHT_get_filter_known_results (pr->gh,
1134 pr->replies_seen_count, 1134 pr->replies_seen_count,
@@ -1138,7 +1138,7 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr)
1138 1138
1139/** 1139/**
1140 * Function called with a reply from the mesh. 1140 * Function called with a reply from the mesh.
1141 * 1141 *
1142 * @param cls the pending request struct 1142 * @param cls the pending request struct
1143 * @param type type of the block, ANY on error 1143 * @param type type of the block, ANY on error
1144 * @param expiration expiration time for the block 1144 * @param expiration expiration time for the block
@@ -1698,7 +1698,7 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
1698 test_put_load_too_high (prq.priority)); 1698 test_put_load_too_high (prq.priority));
1699 } 1699 }
1700 putl = GNUNET_LOAD_get_load (datastore_put_load); 1700 putl = GNUNET_LOAD_get_load (datastore_put_load);
1701 if ( (NULL != cp) && 1701 if ( (NULL != cp) &&
1702 (GNUNET_NO == prq.request_found) && 1702 (GNUNET_NO == prq.request_found) &&
1703 ( (GNUNET_YES != active_to_migration) || 1703 ( (GNUNET_YES != active_to_migration) ||
1704 (putl > 2.5 * (1 + prq.priority)) ) ) 1704 (putl > 2.5 * (1 + prq.priority)) ) )
@@ -1711,7 +1711,7 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
1711 GNUNET_CRYPTO_random_u32 1711 GNUNET_CRYPTO_random_u32
1712 (GNUNET_CRYPTO_QUALITY_WEAK, 1712 (GNUNET_CRYPTO_QUALITY_WEAK,
1713 (unsigned int) (60000 * putl * putl))); 1713 (unsigned int) (60000 * putl * putl)));
1714 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1714 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1715 "Asking to stop migration for %s because of load %f and events %d/%d\n", 1715 "Asking to stop migration for %s because of load %f and events %d/%d\n",
1716 GNUNET_STRINGS_relative_time_to_string (block_time, 1716 GNUNET_STRINGS_relative_time_to_string (block_time,
1717 GNUNET_YES), 1717 GNUNET_YES),
diff --git a/src/fs/gnunet-service-fs_put.c b/src/fs/gnunet-service-fs_put.c
index ef796f559..8e9d70f72 100644
--- a/src/fs/gnunet-service-fs_put.c
+++ b/src/fs/gnunet-service-fs_put.c
@@ -178,10 +178,10 @@ delay_dht_put_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
178 * maybe 0 if no unique identifier is available 178 * maybe 0 if no unique identifier is available
179 */ 179 */
180static void 180static void
181process_dht_put_content (void *cls, 181process_dht_put_content (void *cls,
182 const struct GNUNET_HashCode * key, 182 const struct GNUNET_HashCode * key,
183 size_t size, 183 size_t size,
184 const void *data, 184 const void *data,
185 enum GNUNET_BLOCK_Type type, 185 enum GNUNET_BLOCK_Type type,
186 uint32_t priority, uint32_t anonymity, 186 uint32_t priority, uint32_t anonymity,
187 struct GNUNET_TIME_Absolute expiration, uint64_t uid) 187 struct GNUNET_TIME_Absolute expiration, uint64_t uid)
diff --git a/src/fs/perf_gnunet_service_fs_p2p.c b/src/fs/perf_gnunet_service_fs_p2p.c
index 61356a644..2462bb3f2 100644
--- a/src/fs/perf_gnunet_service_fs_p2p.c
+++ b/src/fs/perf_gnunet_service_fs_p2p.c
@@ -124,7 +124,7 @@ print_stat (void *cls, const char *subsystem, const char *name, uint64_t value,
124 * Function that gathers stats from all daemons. 124 * Function that gathers stats from all daemons.
125 */ 125 */
126static void 126static void
127stat_run (void *cls, 127stat_run (void *cls,
128 struct GNUNET_TESTBED_Operation *op, 128 struct GNUNET_TESTBED_Operation *op,
129 void *ca_result, 129 void *ca_result,
130 const char *emsg); 130 const char *emsg);
@@ -147,7 +147,7 @@ get_done (void *cls, int success)
147/** 147/**
148 * Adapter function called to establish a connection to 148 * Adapter function called to establish a connection to
149 * statistics service. 149 * statistics service.
150 * 150 *
151 * @param cls closure 151 * @param cls closure
152 * @param cfg configuration of the peer to connect to; will be available until 152 * @param cfg configuration of the peer to connect to; will be available until
153 * GNUNET_TESTBED_operation_done() is called on the operation returned 153 * GNUNET_TESTBED_operation_done() is called on the operation returned
@@ -166,11 +166,11 @@ statistics_connect_adapter (void *cls,
166/** 166/**
167 * Adapter function called to destroy a connection to 167 * Adapter function called to destroy a connection to
168 * statistics service. 168 * statistics service.
169 * 169 *
170 * @param cls closure 170 * @param cls closure
171 * @param op_result service handle returned from the connect adapter 171 * @param op_result service handle returned from the connect adapter
172 */ 172 */
173static void 173static void
174statistics_disconnect_adapter (void *cls, 174statistics_disconnect_adapter (void *cls,
175 void *op_result) 175 void *op_result)
176{ 176{
@@ -182,7 +182,7 @@ statistics_disconnect_adapter (void *cls,
182 * Function that gathers stats from all daemons. 182 * Function that gathers stats from all daemons.
183 */ 183 */
184static void 184static void
185stat_run (void *cls, 185stat_run (void *cls,
186 struct GNUNET_TESTBED_Operation *op, 186 struct GNUNET_TESTBED_Operation *op,
187 void *ca_result, 187 void *ca_result,
188 const char *emsg) 188 const char *emsg)
@@ -244,12 +244,12 @@ do_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
244 GNUNET_DISK_directory_remove (fn); 244 GNUNET_DISK_directory_remove (fn);
245 GNUNET_free (fn); 245 GNUNET_free (fn);
246 } 246 }
247 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) 247 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT))
248 { 248 {
249 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 249 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
250 "Timeout during download, shutting down with error\n"); 250 "Timeout during download, shutting down with error\n");
251 ok = 1; 251 ok = 1;
252 GNUNET_SCHEDULER_shutdown (); 252 GNUNET_SCHEDULER_shutdown ();
253 return; 253 return;
254 } 254 }
255 255
@@ -276,7 +276,7 @@ do_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
276 276
277 277
278static void 278static void
279do_download (void *cls, 279do_download (void *cls,
280 const struct GNUNET_FS_Uri *uri, 280 const struct GNUNET_FS_Uri *uri,
281 const char *fn) 281 const char *fn)
282{ 282{
@@ -298,7 +298,7 @@ do_download (void *cls,
298 else 298 else
299 anonymity = 1; 299 anonymity = 1;
300 GNUNET_FS_TEST_download (daemons[0], TIMEOUT, anonymity, SEED, uri, VERBOSE, 300 GNUNET_FS_TEST_download (daemons[0], TIMEOUT, anonymity, SEED, uri, VERBOSE,
301 &do_report, 301 &do_report,
302 (NULL == fn) ? NULL : GNUNET_strdup (fn)); 302 (NULL == fn) ? NULL : GNUNET_strdup (fn));
303} 303}
304 304
@@ -314,7 +314,7 @@ do_publish (void *cls,
314 unsigned int i; 314 unsigned int i;
315 int do_index; 315 int do_index;
316 int anonymity; 316 int anonymity;
317 317
318 GNUNET_assert (NUM_DAEMONS == num_peers); 318 GNUNET_assert (NUM_DAEMONS == num_peers);
319 for (i=0;i<num_peers;i++) 319 for (i=0;i<num_peers;i++)
320 daemons[i] = peers[i]; 320 daemons[i] = peers[i];
diff --git a/src/fs/perf_gnunet_service_fs_p2p_respect.c b/src/fs/perf_gnunet_service_fs_p2p_respect.c
index 8790dcc75..b2471a8b4 100644
--- a/src/fs/perf_gnunet_service_fs_p2p_respect.c
+++ b/src/fs/perf_gnunet_service_fs_p2p_respect.c
@@ -178,7 +178,7 @@ print_stat (void *cls, const char *subsystem, const char *name, uint64_t value,
178 * Function that gathers stats from all daemons. 178 * Function that gathers stats from all daemons.
179 */ 179 */
180static void 180static void
181stat_run (void *cls, 181stat_run (void *cls,
182 struct GNUNET_TESTBED_Operation *op, 182 struct GNUNET_TESTBED_Operation *op,
183 void *ca_result, 183 void *ca_result,
184 const char *emsg); 184 const char *emsg);
@@ -202,7 +202,7 @@ get_done (void *cls, int success)
202/** 202/**
203 * Adapter function called to establish a connection to 203 * Adapter function called to establish a connection to
204 * statistics service. 204 * statistics service.
205 * 205 *
206 * @param cls closure 206 * @param cls closure
207 * @param cfg configuration of the peer to connect to; will be available until 207 * @param cfg configuration of the peer to connect to; will be available until
208 * GNUNET_TESTBED_operation_done() is called on the operation returned 208 * GNUNET_TESTBED_operation_done() is called on the operation returned
@@ -221,11 +221,11 @@ statistics_connect_adapter (void *cls,
221/** 221/**
222 * Adapter function called to destroy a connection to 222 * Adapter function called to destroy a connection to
223 * statistics service. 223 * statistics service.
224 * 224 *
225 * @param cls closure 225 * @param cls closure
226 * @param op_result service handle returned from the connect adapter 226 * @param op_result service handle returned from the connect adapter
227 */ 227 */
228static void 228static void
229statistics_disconnect_adapter (void *cls, 229statistics_disconnect_adapter (void *cls,
230 void *op_result) 230 void *op_result)
231{ 231{
@@ -237,7 +237,7 @@ statistics_disconnect_adapter (void *cls,
237 * Function that gathers stats from all daemons. 237 * Function that gathers stats from all daemons.
238 */ 238 */
239static void 239static void
240stat_run (void *cls, 240stat_run (void *cls,
241 struct GNUNET_TESTBED_Operation *op, 241 struct GNUNET_TESTBED_Operation *op,
242 void *ca_result, 242 void *ca_result,
243 const char *emsg) 243 const char *emsg)
@@ -362,7 +362,7 @@ do_downloads (void *cls, const struct GNUNET_FS_Uri *u2,
362 362
363 363
364static void 364static void
365do_publish2 (void *cls, 365do_publish2 (void *cls,
366 const struct GNUNET_FS_Uri *u1, 366 const struct GNUNET_FS_Uri *u1,
367 const char *fn) 367 const char *fn)
368{ 368{
@@ -398,7 +398,7 @@ do_publish2 (void *cls,
398 398
399 399
400static void 400static void
401do_publish1 (void *cls, 401do_publish1 (void *cls,
402 struct GNUNET_TESTBED_Operation *op, 402 struct GNUNET_TESTBED_Operation *op,
403 const char *emsg) 403 const char *emsg)
404{ 404{
@@ -433,7 +433,7 @@ do_publish1 (void *cls,
433 433
434 434
435static void 435static void
436do_connect (void *cls, 436do_connect (void *cls,
437 struct GNUNET_TESTBED_RunHandle *h, 437 struct GNUNET_TESTBED_RunHandle *h,
438 unsigned int num_peers, 438 unsigned int num_peers,
439 struct GNUNET_TESTBED_Peer **peers, 439 struct GNUNET_TESTBED_Peer **peers,
@@ -443,7 +443,7 @@ do_connect (void *cls,
443 static unsigned int coco; 443 static unsigned int coco;
444 unsigned int i; 444 unsigned int i;
445 unsigned int j; 445 unsigned int j;
446 446
447 GNUNET_assert (NUM_DAEMONS == num_peers); 447 GNUNET_assert (NUM_DAEMONS == num_peers);
448 for (i=0;i<num_peers;i++) 448 for (i=0;i<num_peers;i++)
449 daemons[i] = peers[i]; 449 daemons[i] = peers[i];
diff --git a/src/fs/test_fs_download.c b/src/fs/test_fs_download.c
index c069875cf..52652dbd3 100644
--- a/src/fs/test_fs_download.c
+++ b/src/fs/test_fs_download.c
@@ -146,8 +146,8 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
146 (1 + 146 (1 +
147 GNUNET_TIME_absolute_get_duration 147 GNUNET_TIME_absolute_get_duration
148 (start).rel_value_us) / 1024LL)); 148 (start).rel_value_us) / 1024LL));
149 GAUGER ("FS", 149 GAUGER ("FS",
150 (GNUNET_YES == indexed) 150 (GNUNET_YES == indexed)
151 ? "Publishing speed (indexing)" 151 ? "Publishing speed (indexing)"
152 : "Publishing speed (insertion)", 152 : "Publishing speed (insertion)",
153 (unsigned long long) (FILESIZE * 1000000LL / 153 (unsigned long long) (FILESIZE * 1000000LL /
@@ -160,7 +160,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
160 GNUNET_FS_download_start (fs, 160 GNUNET_FS_download_start (fs,
161 event->value.publish.specifics. 161 event->value.publish.specifics.
162 completed.chk_uri, NULL, fn, NULL, 0, 162 completed.chk_uri, NULL, fn, NULL, 0,
163 FILESIZE, anonymity_level, 163 FILESIZE, anonymity_level,
164 GNUNET_FS_DOWNLOAD_OPTION_NONE, 164 GNUNET_FS_DOWNLOAD_OPTION_NONE,
165 "download", NULL); 165 "download", NULL);
166 GNUNET_assert (download != NULL); 166 GNUNET_assert (download != NULL);
@@ -173,8 +173,8 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
173 GNUNET_TIME_absolute_get_duration 173 GNUNET_TIME_absolute_get_duration
174 (start).rel_value_us) / 1024LL)); 174 (start).rel_value_us) / 1024LL));
175 GAUGER ("FS", 175 GAUGER ("FS",
176 (GNUNET_YES == indexed) 176 (GNUNET_YES == indexed)
177 ? "Local download speed (indexed)" 177 ? "Local download speed (indexed)"
178 : "Local download speed (inserted)", 178 : "Local download speed (inserted)",
179 (unsigned long long) (FILESIZE * 1000000LL / 179 (unsigned long long) (FILESIZE * 1000000LL /
180 (1 + 180 (1 +
diff --git a/src/fs/test_fs_download_persistence.c b/src/fs/test_fs_download_persistence.c
index b380fd4af..7c9c8c227 100644
--- a/src/fs/test_fs_download_persistence.c
+++ b/src/fs/test_fs_download_persistence.c
@@ -276,7 +276,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
276 276
277 277
278static void 278static void
279run (void *cls, 279run (void *cls,
280 const struct GNUNET_CONFIGURATION_Handle *c, 280 const struct GNUNET_CONFIGURATION_Handle *c,
281 struct GNUNET_TESTING_Peer *peer) 281 struct GNUNET_TESTING_Peer *peer)
282{ 282{
diff --git a/src/fs/test_fs_namespace.c b/src/fs/test_fs_namespace.c
index 11c611e04..b0358e809 100644
--- a/src/fs/test_fs_namespace.c
+++ b/src/fs/test_fs_namespace.c
@@ -281,8 +281,8 @@ testNamespace ()
281 bo.expiration_time = 281 bo.expiration_time =
282 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES); 282 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
283 sks_uri = GNUNET_FS_uri_sks_create (&nsid, "root"); 283 sks_uri = GNUNET_FS_uri_sks_create (&nsid, "root");
284 GNUNET_FS_publish_ksk (fs, 284 GNUNET_FS_publish_ksk (fs,
285 ksk_uri, meta, sks_uri, 285 ksk_uri, meta, sks_uri,
286 &bo, GNUNET_FS_PUBLISH_OPTION_NONE, 286 &bo, GNUNET_FS_PUBLISH_OPTION_NONE,
287 &adv_cont, NULL); 287 &adv_cont, NULL);
288 GNUNET_FS_uri_destroy (sks_uri); 288 GNUNET_FS_uri_destroy (sks_uri);
@@ -296,7 +296,7 @@ testNamespace ()
296 296
297 297
298static void 298static void
299run (void *cls, 299run (void *cls,
300 const struct GNUNET_CONFIGURATION_Handle *cfg, 300 const struct GNUNET_CONFIGURATION_Handle *cfg,
301 struct GNUNET_TESTING_Peer *peer) 301 struct GNUNET_TESTING_Peer *peer)
302{ 302{
diff --git a/src/fs/test_fs_namespace_list_updateable.c b/src/fs/test_fs_namespace_list_updateable.c
index d42dfb7f4..69fc6542c 100644
--- a/src/fs/test_fs_namespace_list_updateable.c
+++ b/src/fs/test_fs_namespace_list_updateable.c
@@ -150,7 +150,7 @@ testNamespace ()
150 150
151 151
152static void 152static void
153run (void *cls, 153run (void *cls,
154 const struct GNUNET_CONFIGURATION_Handle *cfg, 154 const struct GNUNET_CONFIGURATION_Handle *cfg,
155 struct GNUNET_TESTING_Peer *peer) 155 struct GNUNET_TESTING_Peer *peer)
156{ 156{
diff --git a/src/fs/test_fs_publish.c b/src/fs/test_fs_publish.c
index 7ff9c9202..41b4abd26 100644
--- a/src/fs/test_fs_publish.c
+++ b/src/fs/test_fs_publish.c
@@ -153,7 +153,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
153 153
154 154
155static void 155static void
156run (void *cls, 156run (void *cls,
157 const struct GNUNET_CONFIGURATION_Handle *cfg, 157 const struct GNUNET_CONFIGURATION_Handle *cfg,
158 struct GNUNET_TESTING_Peer *peer) 158 struct GNUNET_TESTING_Peer *peer)
159{ 159{
diff --git a/src/fs/test_fs_publish_persistence.c b/src/fs/test_fs_publish_persistence.c
index e3bbc77a1..5beb1b7e5 100644
--- a/src/fs/test_fs_publish_persistence.c
+++ b/src/fs/test_fs_publish_persistence.c
@@ -93,7 +93,7 @@ restart_fs_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
93{ 93{
94 rtask = GNUNET_SCHEDULER_NO_TASK; 94 rtask = GNUNET_SCHEDULER_NO_TASK;
95 GNUNET_FS_stop (fs); 95 GNUNET_FS_stop (fs);
96 fs = GNUNET_FS_start (cfg, "test-fs-publish-persistence", 96 fs = GNUNET_FS_start (cfg, "test-fs-publish-persistence",
97 &progress_cb, NULL, 97 &progress_cb, NULL,
98 GNUNET_FS_FLAGS_PERSISTENCE, 98 GNUNET_FS_FLAGS_PERSISTENCE,
99 GNUNET_FS_OPTIONS_END); 99 GNUNET_FS_OPTIONS_END);
@@ -223,7 +223,7 @@ progress_cb (void *cls,
223 223
224 224
225static void 225static void
226run (void *cls, 226run (void *cls,
227 const struct GNUNET_CONFIGURATION_Handle *c, 227 const struct GNUNET_CONFIGURATION_Handle *c,
228 struct GNUNET_TESTING_Peer *peer) 228 struct GNUNET_TESTING_Peer *peer)
229{ 229{
diff --git a/src/fs/test_fs_search.c b/src/fs/test_fs_search.c
index 5c1644d4a..faf8727a6 100644
--- a/src/fs/test_fs_search.c
+++ b/src/fs/test_fs_search.c
@@ -59,7 +59,7 @@ static int err;
59 59
60static void 60static void
61abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 61abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
62{ 62{
63 if (NULL != publish) 63 if (NULL != publish)
64 { 64 {
65 GNUNET_FS_publish_stop (publish); 65 GNUNET_FS_publish_stop (publish);
diff --git a/src/fs/test_fs_search_probes.c b/src/fs/test_fs_search_probes.c
index 380c857aa..969c525c6 100644
--- a/src/fs/test_fs_search_probes.c
+++ b/src/fs/test_fs_search_probes.c
@@ -203,7 +203,7 @@ run (void *cls,
203 size_t i; 203 size_t i;
204 204
205 fs = GNUNET_FS_start (cfg, "test-fs-search", &progress_cb, NULL, 205 fs = GNUNET_FS_start (cfg, "test-fs-search", &progress_cb, NULL,
206 GNUNET_FS_FLAGS_DO_PROBES, 206 GNUNET_FS_FLAGS_DO_PROBES,
207 GNUNET_FS_OPTIONS_END); 207 GNUNET_FS_OPTIONS_END);
208 GNUNET_assert (NULL != fs); 208 GNUNET_assert (NULL != fs);
209 buf = GNUNET_malloc (FILESIZE); 209 buf = GNUNET_malloc (FILESIZE);
diff --git a/src/fs/test_fs_start_stop.c b/src/fs/test_fs_start_stop.c
index 463274e48..52c54b752 100644
--- a/src/fs/test_fs_start_stop.c
+++ b/src/fs/test_fs_start_stop.c
@@ -37,7 +37,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
37 37
38 38
39static void 39static void
40run (void *cls, 40run (void *cls,
41 const struct GNUNET_CONFIGURATION_Handle *cfg, 41 const struct GNUNET_CONFIGURATION_Handle *cfg,
42 struct GNUNET_TESTING_Peer *peer) 42 struct GNUNET_TESTING_Peer *peer)
43{ 43{
diff --git a/src/fs/test_fs_test_lib.c b/src/fs/test_fs_test_lib.c
index 689456aa4..80b7dcf7c 100644
--- a/src/fs/test_fs_test_lib.c
+++ b/src/fs/test_fs_test_lib.c
@@ -90,7 +90,7 @@ do_download (void *cls, const struct GNUNET_FS_Uri *uri,
90 90
91 91
92static void 92static void
93do_publish (void *cls, 93do_publish (void *cls,
94 struct GNUNET_TESTBED_Operation *op, 94 struct GNUNET_TESTBED_Operation *op,
95 const char *emsg) 95 const char *emsg)
96{ 96{
@@ -113,7 +113,7 @@ do_publish (void *cls,
113 113
114/** 114/**
115 * Actual main function for the test. 115 * Actual main function for the test.
116 * 116 *
117 * @param cls closure 117 * @param cls closure
118 * @param h the run handle 118 * @param h the run handle
119 * @param num_peers number of peers in 'peers' 119 * @param num_peers number of peers in 'peers'
@@ -124,7 +124,7 @@ do_publish (void *cls,
124 * failed 124 * failed
125 */ 125 */
126static void 126static void
127run (void *cls, 127run (void *cls,
128 struct GNUNET_TESTBED_RunHandle *h, 128 struct GNUNET_TESTBED_RunHandle *h,
129 unsigned int num_peers, 129 unsigned int num_peers,
130 struct GNUNET_TESTBED_Peer **peers, 130 struct GNUNET_TESTBED_Peer **peers,
@@ -132,7 +132,7 @@ run (void *cls,
132 unsigned int links_failed) 132 unsigned int links_failed)
133{ 133{
134 unsigned int i; 134 unsigned int i;
135 135
136 GNUNET_assert (NUM_DAEMONS == num_peers); 136 GNUNET_assert (NUM_DAEMONS == num_peers);
137 for (i=0;i<num_peers;i++) 137 for (i=0;i<num_peers;i++)
138 the_peers[i] = peers[i]; 138 the_peers[i] = peers[i];
@@ -147,7 +147,7 @@ run (void *cls,
147/** 147/**
148 * Main function that initializes the testbed. 148 * Main function that initializes the testbed.
149 * 149 *
150 * @param argc ignored 150 * @param argc ignored
151 * @param argv ignored 151 * @param argv ignored
152 * @return 0 on success 152 * @return 0 on success
153 */ 153 */
@@ -157,7 +157,7 @@ main (int argc, char *argv[])
157 GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/"); 157 GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/");
158 (void) GNUNET_TESTBED_test_run ("test_fs_test_lib", 158 (void) GNUNET_TESTBED_test_run ("test_fs_test_lib",
159 "fs_test_lib_data.conf", 159 "fs_test_lib_data.conf",
160 NUM_DAEMONS, 160 NUM_DAEMONS,
161 0, NULL, NULL, 161 0, NULL, NULL,
162 &run, NULL); 162 &run, NULL);
163 GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/"); 163 GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/");
diff --git a/src/fs/test_fs_unindex_persistence.c b/src/fs/test_fs_unindex_persistence.c
index ef143ecef..f90a01a79 100644
--- a/src/fs/test_fs_unindex_persistence.c
+++ b/src/fs/test_fs_unindex_persistence.c
@@ -231,7 +231,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
231 231
232 232
233static void 233static void
234run (void *cls, 234run (void *cls,
235 const struct GNUNET_CONFIGURATION_Handle *c, 235 const struct GNUNET_CONFIGURATION_Handle *c,
236 struct GNUNET_TESTING_Peer *peer) 236 struct GNUNET_TESTING_Peer *peer)
237{ 237{
diff --git a/src/fs/test_gnunet_service_fs_migration.c b/src/fs/test_gnunet_service_fs_migration.c
index 436b8f66d..770c212ba 100644
--- a/src/fs/test_gnunet_service_fs_migration.c
+++ b/src/fs/test_gnunet_service_fs_migration.c
@@ -93,7 +93,7 @@ do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
93 93
94 94
95static void 95static void
96do_download (void *cls, 96do_download (void *cls,
97 const char *emsg) 97 const char *emsg)
98{ 98{
99 struct DownloadContext *dc = cls; 99 struct DownloadContext *dc = cls;
@@ -160,7 +160,7 @@ do_wait (void *cls, const struct GNUNET_FS_Uri *uri,
160 160
161 161
162static void 162static void
163do_publish (void *cls, 163do_publish (void *cls,
164 struct GNUNET_TESTBED_RunHandle *h, 164 struct GNUNET_TESTBED_RunHandle *h,
165 unsigned int num_peers, 165 unsigned int num_peers,
166 struct GNUNET_TESTBED_Peer **peers, 166 struct GNUNET_TESTBED_Peer **peers,
diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c
index 9c01695b5..034bb7b0e 100644
--- a/src/fs/test_gnunet_service_fs_p2p.c
+++ b/src/fs/test_gnunet_service_fs_p2p.c
@@ -103,10 +103,10 @@ do_download (void *cls, const struct GNUNET_FS_Uri *uri,
103 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Downloading %llu bytes\n", 103 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Downloading %llu bytes\n",
104 (unsigned long long) FILESIZE); 104 (unsigned long long) FILESIZE);
105 start_time = GNUNET_TIME_absolute_get (); 105 start_time = GNUNET_TIME_absolute_get ();
106 GNUNET_FS_TEST_download (daemons[0], TIMEOUT, 106 GNUNET_FS_TEST_download (daemons[0], TIMEOUT,
107 anonymity_level, SEED, uri, 107 anonymity_level, SEED, uri,
108 VERBOSE, &do_stop, 108 VERBOSE, &do_stop,
109 (NULL == fn) 109 (NULL == fn)
110 ? NULL 110 ? NULL
111 : GNUNET_strdup (fn)); 111 : GNUNET_strdup (fn));
112} 112}
@@ -121,7 +121,7 @@ do_publish (void *cls,
121 unsigned int links_failed) 121 unsigned int links_failed)
122{ 122{
123 unsigned int i; 123 unsigned int i;
124 124
125 if (NULL != strstr (progname, "mesh")) 125 if (NULL != strstr (progname, "mesh"))
126 anonymity_level = 0; 126 anonymity_level = 0;
127 else 127 else
@@ -131,8 +131,8 @@ do_publish (void *cls,
131 daemons[i] = peers[i]; 131 daemons[i] = peers[i];
132 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Publishing %llu bytes\n", 132 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Publishing %llu bytes\n",
133 (unsigned long long) FILESIZE); 133 (unsigned long long) FILESIZE);
134 GNUNET_FS_TEST_publish (daemons[1], TIMEOUT, 134 GNUNET_FS_TEST_publish (daemons[1], TIMEOUT,
135 anonymity_level, GNUNET_NO, 135 anonymity_level, GNUNET_NO,
136 FILESIZE, SEED, 136 FILESIZE, SEED,
137 VERBOSE, &do_download, NULL); 137 VERBOSE, &do_download, NULL);
138} 138}
diff --git a/src/gns/gns.h b/src/gns/gns.h
index 24f543f71..571b62dc7 100644
--- a/src/gns/gns.h
+++ b/src/gns/gns.h
@@ -79,9 +79,9 @@ struct GNUNET_GNS_ClientLookupMessage
79 * the type of record to look up 79 * the type of record to look up
80 */ 80 */
81 int32_t type GNUNET_PACKED; 81 int32_t type GNUNET_PACKED;
82 82
83 /** 83 /**
84 * The key for shorten, if @e have_key is set 84 * The key for shorten, if @e have_key is set
85 */ 85 */
86 struct GNUNET_CRYPTO_EccPrivateKey shorten_key; 86 struct GNUNET_CRYPTO_EccPrivateKey shorten_key;
87 87
@@ -106,7 +106,7 @@ struct GNUNET_GNS_ClientLookupResultMessage
106 106
107 /** 107 /**
108 * The number of records contained in response 108 * The number of records contained in response
109 */ 109 */
110 uint32_t rd_count GNUNET_PACKED; 110 uint32_t rd_count GNUNET_PACKED;
111 111
112 /* followed by rd_count GNUNET_NAMESTORE_RecordData structs*/ 112 /* followed by rd_count GNUNET_NAMESTORE_RecordData structs*/
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index 7b97c6df8..75c2f9530 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -46,32 +46,32 @@ struct GNUNET_GNS_LookupRequest
46 * DLL 46 * DLL
47 */ 47 */
48 struct GNUNET_GNS_LookupRequest *next; 48 struct GNUNET_GNS_LookupRequest *next;
49 49
50 /** 50 /**
51 * DLL 51 * DLL
52 */ 52 */
53 struct GNUNET_GNS_LookupRequest *prev; 53 struct GNUNET_GNS_LookupRequest *prev;
54 54
55 /** 55 /**
56 * handle to gns 56 * handle to gns
57 */ 57 */
58 struct GNUNET_GNS_Handle *gns_handle; 58 struct GNUNET_GNS_Handle *gns_handle;
59 59
60 /** 60 /**
61 * processor to call on lookup result 61 * processor to call on lookup result
62 */ 62 */
63 GNUNET_GNS_LookupResultProcessor lookup_proc; 63 GNUNET_GNS_LookupResultProcessor lookup_proc;
64 64
65 /** 65 /**
66 * processor closure 66 * processor closure
67 */ 67 */
68 void *proc_cls; 68 void *proc_cls;
69 69
70 /** 70 /**
71 * request id 71 * request id
72 */ 72 */
73 uint32_t r_id; 73 uint32_t r_id;
74 74
75}; 75};
76 76
77 77
@@ -130,7 +130,7 @@ struct GNUNET_GNS_Handle
130 * Currently pending transmission request (or NULL). 130 * Currently pending transmission request (or NULL).
131 */ 131 */
132 struct GNUNET_CLIENT_TransmitHandle *th; 132 struct GNUNET_CLIENT_TransmitHandle *th;
133 133
134 /** 134 /**
135 * Head of linked list of shorten messages we would like to transmit. 135 * Head of linked list of shorten messages we would like to transmit.
136 */ 136 */
@@ -140,7 +140,7 @@ struct GNUNET_GNS_Handle
140 * Tail of linked list of shorten messages we would like to transmit. 140 * Tail of linked list of shorten messages we would like to transmit.
141 */ 141 */
142 struct PendingMessage *pending_tail; 142 struct PendingMessage *pending_tail;
143 143
144 /** 144 /**
145 * Head of linked list of lookup messages we would like to transmit. 145 * Head of linked list of lookup messages we would like to transmit.
146 */ 146 */
@@ -155,7 +155,7 @@ struct GNUNET_GNS_Handle
155 * Reconnect task 155 * Reconnect task
156 */ 156 */
157 GNUNET_SCHEDULER_TaskIdentifier reconnect_task; 157 GNUNET_SCHEDULER_TaskIdentifier reconnect_task;
158 158
159 /** 159 /**
160 * How long do we wait until we try to reconnect? 160 * How long do we wait until we try to reconnect?
161 */ 161 */
@@ -165,7 +165,7 @@ struct GNUNET_GNS_Handle
165 * Request Id generator. Incremented by one for each request. 165 * Request Id generator. Incremented by one for each request.
166 */ 166 */
167 uint32_t r_id_gen; 167 uint32_t r_id_gen;
168 168
169 /** 169 /**
170 * Did we start our receive loop yet? 170 * Did we start our receive loop yet?
171 */ 171 */
@@ -237,7 +237,7 @@ force_reconnect (struct GNUNET_GNS_Handle *handle)
237 p->transmitted = GNUNET_NO; 237 p->transmitted = GNUNET_NO;
238 GNUNET_CONTAINER_DLL_insert (handle->pending_head, 238 GNUNET_CONTAINER_DLL_insert (handle->pending_head,
239 handle->pending_tail, 239 handle->pending_tail,
240 p); 240 p);
241 } 241 }
242 handle->reconnect_backoff = GNUNET_TIME_STD_BACKOFF (handle->reconnect_backoff); 242 handle->reconnect_backoff = GNUNET_TIME_STD_BACKOFF (handle->reconnect_backoff);
243 handle->reconnect_task = GNUNET_SCHEDULER_add_delayed (handle->reconnect_backoff, 243 handle->reconnect_task = GNUNET_SCHEDULER_add_delayed (handle->reconnect_backoff,
@@ -279,17 +279,17 @@ process_pending_messages (struct GNUNET_GNS_Handle *handle)
279 struct PendingMessage *p = handle->pending_head; 279 struct PendingMessage *p = handle->pending_head;
280 280
281 if (NULL == handle->client) 281 if (NULL == handle->client)
282 return; /* wait for reconnect */ 282 return; /* wait for reconnect */
283 if (NULL != handle->th) 283 if (NULL != handle->th)
284 return; /* transmission request already pending */ 284 return; /* transmission request already pending */
285 285
286 while ((NULL != p) && (p->transmitted == GNUNET_YES)) 286 while ((NULL != p) && (p->transmitted == GNUNET_YES))
287 p = p->next; 287 p = p->next;
288 if (NULL == p) 288 if (NULL == p)
289 return; /* no messages pending */ 289 return; /* no messages pending */
290 290
291 LOG (GNUNET_ERROR_TYPE_DEBUG, 291 LOG (GNUNET_ERROR_TYPE_DEBUG,
292 "Trying to transmit %u bytes\n", 292 "Trying to transmit %u bytes\n",
293 (unsigned int) p->size); 293 (unsigned int) p->size);
294 handle->th = 294 handle->th =
295 GNUNET_CLIENT_notify_transmit_ready (handle->client, 295 GNUNET_CLIENT_notify_transmit_ready (handle->client,
@@ -324,7 +324,7 @@ transmit_pending (void *cls, size_t size, void *buf)
324 "Transmission to GNS service failed!\n"); 324 "Transmission to GNS service failed!\n");
325 force_reconnect (handle); 325 force_reconnect (handle);
326 return 0; 326 return 0;
327 } 327 }
328 if (NULL == (p = handle->pending_head)) 328 if (NULL == (p = handle->pending_head))
329 return 0; 329 return 0;
330 330
@@ -388,7 +388,7 @@ process_lookup_reply (struct GNUNET_GNS_LookupRequest *qe,
388 qe->lookup_proc (qe->proc_cls, 0, NULL); 388 qe->lookup_proc (qe->proc_cls, 0, NULL);
389 } 389 }
390 else 390 else
391 { 391 {
392 LOG (GNUNET_ERROR_TYPE_DEBUG, 392 LOG (GNUNET_ERROR_TYPE_DEBUG,
393 "Received lookup reply from GNS service (%u records)\n", 393 "Received lookup reply from GNS service (%u records)\n",
394 (unsigned int) rd_count); 394 (unsigned int) rd_count);
@@ -412,7 +412,7 @@ process_message (void *cls, const struct GNUNET_MessageHeader *msg)
412 struct GNUNET_GNS_LookupRequest *lr; 412 struct GNUNET_GNS_LookupRequest *lr;
413 const struct GNUNET_GNS_ClientLookupResultMessage *lookup_msg; 413 const struct GNUNET_GNS_ClientLookupResultMessage *lookup_msg;
414 uint32_t r_id; 414 uint32_t r_id;
415 415
416 if (NULL == msg) 416 if (NULL == msg)
417 { 417 {
418 force_reconnect (handle); 418 force_reconnect (handle);
@@ -430,11 +430,11 @@ process_message (void *cls, const struct GNUNET_MessageHeader *msg)
430 return; 430 return;
431 } 431 }
432 lookup_msg = (const struct GNUNET_GNS_ClientLookupResultMessage *) msg; 432 lookup_msg = (const struct GNUNET_GNS_ClientLookupResultMessage *) msg;
433 r_id = ntohl (lookup_msg->id); 433 r_id = ntohl (lookup_msg->id);
434 for (lr = handle->lookup_head; NULL != lr; lr = lr->next) 434 for (lr = handle->lookup_head; NULL != lr; lr = lr->next)
435 if (lr->r_id == r_id) 435 if (lr->r_id == r_id)
436 { 436 {
437 process_lookup_reply(lr, lookup_msg); 437 process_lookup_reply(lr, lookup_msg);
438 break; 438 break;
439 } 439 }
440 break; 440 break;
@@ -499,7 +499,7 @@ GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr)
499{ 499{
500 struct PendingMessage *p = (struct PendingMessage*) &lr[1]; 500 struct PendingMessage *p = (struct PendingMessage*) &lr[1];
501 501
502 GNUNET_assert (NULL != lr->gns_handle); 502 GNUNET_assert (NULL != lr->gns_handle);
503 if (GNUNET_NO == p->transmitted) 503 if (GNUNET_NO == p->transmitted)
504 GNUNET_CONTAINER_DLL_remove (lr->gns_handle->pending_head, 504 GNUNET_CONTAINER_DLL_remove (lr->gns_handle->pending_head,
505 lr->gns_handle->pending_tail, 505 lr->gns_handle->pending_tail,
@@ -544,9 +544,9 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
544 { 544 {
545 GNUNET_break (0); 545 GNUNET_break (0);
546 return NULL; 546 return NULL;
547 } 547 }
548 LOG (GNUNET_ERROR_TYPE_DEBUG, 548 LOG (GNUNET_ERROR_TYPE_DEBUG,
549 "Trying to lookup `%s' in GNS\n", 549 "Trying to lookup `%s' in GNS\n",
550 name); 550 name);
551 msize = sizeof (struct GNUNET_GNS_ClientLookupMessage) 551 msize = sizeof (struct GNUNET_GNS_ClientLookupMessage)
552 + strlen (name) + 1; 552 + strlen (name) + 1;
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c
index a6d57f3a9..4dcec6bdc 100644
--- a/src/gns/gnunet-dns2gns.c
+++ b/src/gns/gnunet-dns2gns.c
@@ -65,7 +65,7 @@ struct Request
65 * converted to the DNS response. 65 * converted to the DNS response.
66 */ 66 */
67 struct GNUNET_DNSPARSER_Packet *packet; 67 struct GNUNET_DNSPARSER_Packet *packet;
68 68
69 /** 69 /**
70 * Our GNS request handle. 70 * Our GNS request handle.
71 */ 71 */
@@ -84,7 +84,7 @@ struct Request
84 84
85 /** 85 /**
86 * Number of bytes in 'addr'. 86 * Number of bytes in 'addr'.
87 */ 87 */
88 size_t addr_len; 88 size_t addr_len;
89 89
90}; 90};
@@ -217,7 +217,7 @@ send_response (struct Request *request)
217{ 217{
218 char *buf; 218 char *buf;
219 size_t size; 219 size_t size;
220 220
221 if (GNUNET_SYSERR == 221 if (GNUNET_SYSERR ==
222 GNUNET_DNSPARSER_pack (request->packet, 222 GNUNET_DNSPARSER_pack (request->packet,
223 UINT16_MAX /* is this not too much? */, 223 UINT16_MAX /* is this not too much? */,
@@ -377,7 +377,7 @@ result_processor (void *cls,
377 * @param addr address to use for sending the reply 377 * @param addr address to use for sending the reply
378 * @param addr_len number of bytes in @a addr 378 * @param addr_len number of bytes in @a addr
379 * @param udp_msg DNS request payload 379 * @param udp_msg DNS request payload
380 * @param udp_msg_size number of bytes in @a udp_msg 380 * @param udp_msg_size number of bytes in @a udp_msg
381 */ 381 */
382static void 382static void
383handle_request (struct GNUNET_NETWORK_Handle *lsock, 383handle_request (struct GNUNET_NETWORK_Handle *lsock,
@@ -408,7 +408,7 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock,
408 (int) packet->num_answers, 408 (int) packet->num_answers,
409 (int) packet->num_authority_records, 409 (int) packet->num_authority_records,
410 (int) packet->num_additional_records); 410 (int) packet->num_additional_records);
411 if ( (0 != packet->flags.query_or_response) || 411 if ( (0 != packet->flags.query_or_response) ||
412 (0 != packet->num_answers) || 412 (0 != packet->num_answers) ||
413 (0 != packet->num_authority_records)) 413 (0 != packet->num_authority_records))
414 { 414 {
@@ -439,7 +439,7 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock,
439 name_len = strlen (name); 439 name_len = strlen (name);
440 use_gns = GNUNET_NO; 440 use_gns = GNUNET_NO;
441 441
442 442
443 if ( (name_len > strlen (fcfs_suffix)) && 443 if ( (name_len > strlen (fcfs_suffix)) &&
444 (0 == strcasecmp (fcfs_suffix, 444 (0 == strcasecmp (fcfs_suffix,
445 &name[name_len - strlen (fcfs_suffix)])) ) 445 &name[name_len - strlen (fcfs_suffix)])) )
@@ -481,7 +481,7 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock,
481 else 481 else
482 { 482 {
483 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 483 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
484 "Using DNS resolver IP `%s' to resolve `%s'\n", 484 "Using DNS resolver IP `%s' to resolve `%s'\n",
485 dns_ip, 485 dns_ip,
486 name); 486 name);
487 GNUNET_DNSPARSER_free_packet (request->packet); 487 GNUNET_DNSPARSER_free_packet (request->packet);
@@ -501,7 +501,7 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock,
501 * 501 *
502 * @param cls the 'listen_socket4' 502 * @param cls the 'listen_socket4'
503 * @param tc scheduler context 503 * @param tc scheduler context
504 */ 504 */
505static void 505static void
506read_dns4 (void *cls, 506read_dns4 (void *cls,
507 const struct GNUNET_SCHEDULER_TaskContext *tc) 507 const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -525,9 +525,9 @@ read_dns4 (void *cls,
525 } 525 }
526 { 526 {
527 char buf[size]; 527 char buf[size];
528 528
529 addrlen = sizeof (v4); 529 addrlen = sizeof (v4);
530 GNUNET_break (size == 530 GNUNET_break (size ==
531 GNUNET_NETWORK_socket_recvfrom (listen_socket4, 531 GNUNET_NETWORK_socket_recvfrom (listen_socket4,
532 buf, 532 buf,
533 size, 533 size,
@@ -544,7 +544,7 @@ read_dns4 (void *cls,
544 * 544 *
545 * @param cls the 'listen_socket6' 545 * @param cls the 'listen_socket6'
546 * @param tc scheduler context 546 * @param tc scheduler context
547 */ 547 */
548static void 548static void
549read_dns6 (void *cls, 549read_dns6 (void *cls,
550 const struct GNUNET_SCHEDULER_TaskContext *tc) 550 const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -568,9 +568,9 @@ read_dns6 (void *cls,
568 } 568 }
569 { 569 {
570 char buf[size]; 570 char buf[size];
571 571
572 addrlen = sizeof (v6); 572 addrlen = sizeof (v6);
573 GNUNET_break (size == 573 GNUNET_break (size ==
574 GNUNET_NETWORK_socket_recvfrom (listen_socket6, 574 GNUNET_NETWORK_socket_recvfrom (listen_socket6,
575 buf, 575 buf,
576 size, 576 size,
@@ -601,7 +601,7 @@ run_dnsd ()
601 return; 601 return;
602 } 602 }
603 listen_socket4 = GNUNET_NETWORK_socket_create (PF_INET, 603 listen_socket4 = GNUNET_NETWORK_socket_create (PF_INET,
604 SOCK_DGRAM, 604 SOCK_DGRAM,
605 IPPROTO_UDP); 605 IPPROTO_UDP);
606 if (NULL != listen_socket4) 606 if (NULL != listen_socket4)
607 { 607 {
@@ -625,7 +625,7 @@ run_dnsd ()
625 } 625 }
626 } 626 }
627 listen_socket6 = GNUNET_NETWORK_socket_create (PF_INET6, 627 listen_socket6 = GNUNET_NETWORK_socket_create (PF_INET6,
628 SOCK_DGRAM, 628 SOCK_DGRAM,
629 IPPROTO_UDP); 629 IPPROTO_UDP);
630 if (NULL != listen_socket6) 630 if (NULL != listen_socket6)
631 { 631 {
@@ -671,7 +671,7 @@ run_dnsd ()
671} 671}
672 672
673 673
674/** 674/**
675 * Method called to inform about the egos of this peer. 675 * Method called to inform about the egos of this peer.
676 * 676 *
677 * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get, 677 * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get,
@@ -679,7 +679,7 @@ run_dnsd ()
679 * @a ego does indicate an error (i.e. name is taken or no default 679 * @a ego does indicate an error (i.e. name is taken or no default
680 * value is known). If @a ego is non-NULL and if '*ctx' 680 * value is known). If @a ego is non-NULL and if '*ctx'
681 * is set in those callbacks, the value WILL be passed to a subsequent 681 * is set in those callbacks, the value WILL be passed to a subsequent
682 * call to the identity callback of #GNUNET_IDENTITY_connect (if 682 * call to the identity callback of #GNUNET_IDENTITY_connect (if
683 * that one was not NULL). 683 * that one was not NULL).
684 * 684 *
685 * @param cls closure, NULL 685 * @param cls closure, NULL
@@ -747,7 +747,7 @@ run (void *cls, char *const *args, const char *cfgfile,
747 strlen (gns_zone_str), 747 strlen (gns_zone_str),
748 &my_zone)) ) 748 &my_zone)) )
749 { 749 {
750 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 750 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
751 _("No valid GNS zone specified!\n")); 751 _("No valid GNS zone specified!\n"));
752 GNUNET_SCHEDULER_shutdown (); 752 GNUNET_SCHEDULER_shutdown ();
753 return; 753 return;
@@ -764,7 +764,7 @@ run (void *cls, char *const *args, const char *cfgfile,
764 * @return 0 ok, 1 on error 764 * @return 0 ok, 1 on error
765 */ 765 */
766int 766int
767main (int argc, 767main (int argc,
768 char *const *argv) 768 char *const *argv)
769{ 769{
770 static const struct GNUNET_GETOPT_CommandLineOption options[] = { 770 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -794,7 +794,7 @@ main (int argc,
794 ret = 794 ret =
795 (GNUNET_OK == 795 (GNUNET_OK ==
796 GNUNET_PROGRAM_run (argc, argv, "gnunet-dns2gns", 796 GNUNET_PROGRAM_run (argc, argv, "gnunet-dns2gns",
797 _("GNUnet DNS-to-GNS proxy (a DNS server)"), 797 _("GNUnet DNS-to-GNS proxy (a DNS server)"),
798 options, 798 options,
799 &run, NULL)) ? 0 : 1; 799 &run, NULL)) ? 0 : 1;
800 GNUNET_free ((void*) argv); 800 GNUNET_free ((void*) argv);
diff --git a/src/gns/gnunet-gns-helper-service-w32.c b/src/gns/gnunet-gns-helper-service-w32.c
index 4e5aeffc5..26a3f688a 100644
--- a/src/gns/gnunet-gns-helper-service-w32.c
+++ b/src/gns/gnunet-gns-helper-service-w32.c
@@ -172,7 +172,7 @@ transmit_callback (void *cls, size_t size, void *buf)
172 * @param msg message to transmit, will be freed! 172 * @param msg message to transmit, will be freed!
173 */ 173 */
174static void 174static void
175transmit (struct GNUNET_SERVER_Client *client, 175transmit (struct GNUNET_SERVER_Client *client,
176 struct GNUNET_MessageHeader *msg) 176 struct GNUNET_MessageHeader *msg)
177{ 177{
178 struct TransmitCallbackContext *tcc; 178 struct TransmitCallbackContext *tcc;
@@ -188,7 +188,7 @@ transmit (struct GNUNET_SERVER_Client *client,
188 tcc->msg = msg; 188 tcc->msg = msg;
189 if (NULL == 189 if (NULL ==
190 (tcc->th = 190 (tcc->th =
191 GNUNET_SERVER_notify_transmit_ready (client, 191 GNUNET_SERVER_notify_transmit_ready (client,
192 ntohs (msg->size), 192 ntohs (msg->size),
193 GNUNET_TIME_UNIT_FOREVER_REL, 193 GNUNET_TIME_UNIT_FOREVER_REL,
194 &transmit_callback, tcc))) 194 &transmit_callback, tcc)))
@@ -242,7 +242,7 @@ MarshallWSAQUERYSETW (WSAQUERYSETW *qs, GUID *sc)
242 242
243 243
244static void 244static void
245process_ip_lookup_result (void* cls, 245process_ip_lookup_result (void* cls,
246 uint32_t rd_count, 246 uint32_t rd_count,
247 const struct GNUNET_NAMESTORE_RecordData *rd) 247 const struct GNUNET_NAMESTORE_RecordData *rd)
248{ 248{
@@ -547,7 +547,7 @@ get_ip_from_hostname (struct GNUNET_SERVER_Client *client,
547 namelen = 0; 547 namelen = 0;
548 if (namelen > 0) 548 if (namelen > 0)
549 hostname = (char *) u16_to_u8 (name, namelen + 1, NULL, &strl); 549 hostname = (char *) u16_to_u8 (name, namelen + 1, NULL, &strl);
550 550
551 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 551 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
552 "W32 DNS resolver asked to look up %s for `%s'.\n", 552 "W32 DNS resolver asked to look up %s for `%s'.\n",
553 af == AF_INET ? "IPv4" : af == AF_INET6 ? "IPv6" : "anything", 553 af == AF_INET ? "IPv4" : af == AF_INET6 ? "IPv6" : "anything",
@@ -631,7 +631,7 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client,
631 sc.Data1, sc.Data2, sc.Data3, data4); 631 sc.Data1, sc.Data2, sc.Data3, data4);
632 for (i = 0; i < 8; i++) 632 for (i = 0; i < 8; i++)
633 sc.Data4[i] = 0xFF & (data4 >> ((7 - i) * 8)); 633 sc.Data4[i] = 0xFF & (data4 >> ((7 - i) * 8));
634 634
635 hostname = (const wchar_t *) &msg[1]; 635 hostname = (const wchar_t *) &msg[1];
636 if (hostname[size - 1] != L'\0') 636 if (hostname[size - 1] != L'\0')
637 { 637 {
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c
index fc28d6565..a67f7356e 100644
--- a/src/gns/gnunet-gns-proxy.c
+++ b/src/gns/gnunet-gns-proxy.c
@@ -45,7 +45,7 @@
45 45
46/** 46/**
47 * Default Socks5 listen port. 47 * Default Socks5 listen port.
48 */ 48 */
49#define GNUNET_GNS_PROXY_PORT 7777 49#define GNUNET_GNS_PROXY_PORT 7777
50 50
51/** 51/**
@@ -119,7 +119,7 @@
119 119
120/** 120/**
121 * Commands in Socks5. 121 * Commands in Socks5.
122 */ 122 */
123enum Socks5Commands 123enum Socks5Commands
124{ 124{
125 /** 125 /**
@@ -141,7 +141,7 @@ enum Socks5Commands
141 141
142/** 142/**
143 * Address types in Socks5. 143 * Address types in Socks5.
144 */ 144 */
145enum Socks5AddressType 145enum Socks5AddressType
146{ 146{
147 /** 147 /**
@@ -242,7 +242,7 @@ struct Socks5ClientRequestMessage
242 */ 242 */
243 uint8_t addr_type; 243 uint8_t addr_type;
244 244
245 /* 245 /*
246 * Followed by either an ip4/ipv6 address or a domain name with a 246 * Followed by either an ip4/ipv6 address or a domain name with a
247 * length field (uint8_t) in front (depending on @e addr_type). 247 * length field (uint8_t) in front (depending on @e addr_type).
248 * followed by port number in network byte order (uint16_t). 248 * followed by port number in network byte order (uint16_t).
@@ -275,7 +275,7 @@ struct Socks5ServerResponseMessage
275 */ 275 */
276 uint8_t addr_type; 276 uint8_t addr_type;
277 277
278 /* 278 /*
279 * Followed by either an ip4/ipv6 address or a domain name with a 279 * Followed by either an ip4/ipv6 address or a domain name with a
280 * length field (uint8_t) in front (depending on @e addr_type). 280 * length field (uint8_t) in front (depending on @e addr_type).
281 * followed by port number in network byte order (uint16_t). 281 * followed by port number in network byte order (uint16_t).
@@ -293,12 +293,12 @@ struct Socks5ServerResponseMessage
293struct ProxyCA 293struct ProxyCA
294{ 294{
295 /** 295 /**
296 * The certificate 296 * The certificate
297 */ 297 */
298 gnutls_x509_crt_t cert; 298 gnutls_x509_crt_t cert;
299 299
300 /** 300 /**
301 * The private key 301 * The private key
302 */ 302 */
303 gnutls_x509_privkey_t key; 303 gnutls_x509_privkey_t key;
304}; 304};
@@ -310,12 +310,12 @@ struct ProxyCA
310struct ProxyGNSCertificate 310struct ProxyGNSCertificate
311{ 311{
312 /** 312 /**
313 * The certificate as PEM 313 * The certificate as PEM
314 */ 314 */
315 char cert[MAX_PEM_SIZE]; 315 char cert[MAX_PEM_SIZE];
316 316
317 /** 317 /**
318 * The private key as PEM 318 * The private key as PEM
319 */ 319 */
320 char key[MAX_PEM_SIZE]; 320 char key[MAX_PEM_SIZE];
321}; 321};
@@ -328,22 +328,22 @@ struct ProxyGNSCertificate
328struct MhdHttpList 328struct MhdHttpList
329{ 329{
330 /** 330 /**
331 * DLL for httpds 331 * DLL for httpds
332 */ 332 */
333 struct MhdHttpList *prev; 333 struct MhdHttpList *prev;
334 334
335 /** 335 /**
336 * DLL for httpds 336 * DLL for httpds
337 */ 337 */
338 struct MhdHttpList *next; 338 struct MhdHttpList *next;
339 339
340 /** 340 /**
341 * the domain name to server (only important for SSL) 341 * the domain name to server (only important for SSL)
342 */ 342 */
343 char *domain; 343 char *domain;
344 344
345 /** 345 /**
346 * The daemon handle 346 * The daemon handle
347 */ 347 */
348 struct MHD_Daemon *daemon; 348 struct MHD_Daemon *daemon;
349 349
@@ -353,12 +353,12 @@ struct MhdHttpList
353 struct ProxyGNSCertificate *proxy_cert; 353 struct ProxyGNSCertificate *proxy_cert;
354 354
355 /** 355 /**
356 * The task ID 356 * The task ID
357 */ 357 */
358 GNUNET_SCHEDULER_TaskIdentifier httpd_task; 358 GNUNET_SCHEDULER_TaskIdentifier httpd_task;
359 359
360 /** 360 /**
361 * is this an ssl daemon? 361 * is this an ssl daemon?
362 */ 362 */
363 int is_ssl; 363 int is_ssl;
364 364
@@ -369,7 +369,7 @@ struct MhdHttpList
369 369
370 370
371/** 371/**
372 * The socks phases. 372 * The socks phases.
373 */ 373 */
374enum SocksPhase 374enum SocksPhase
375{ 375{
@@ -443,7 +443,7 @@ struct Socks5Request
443 struct Socks5Request *prev; 443 struct Socks5Request *prev;
444 444
445 /** 445 /**
446 * The client socket 446 * The client socket
447 */ 447 */
448 struct GNUNET_NETWORK_Handle *sock; 448 struct GNUNET_NETWORK_Handle *sock;
449 449
@@ -453,27 +453,27 @@ struct Socks5Request
453 struct GNUNET_GNS_LookupRequest *gns_lookup; 453 struct GNUNET_GNS_LookupRequest *gns_lookup;
454 454
455 /** 455 /**
456 * Client socket read task 456 * Client socket read task
457 */ 457 */
458 GNUNET_SCHEDULER_TaskIdentifier rtask; 458 GNUNET_SCHEDULER_TaskIdentifier rtask;
459 459
460 /** 460 /**
461 * Client socket write task 461 * Client socket write task
462 */ 462 */
463 GNUNET_SCHEDULER_TaskIdentifier wtask; 463 GNUNET_SCHEDULER_TaskIdentifier wtask;
464 464
465 /** 465 /**
466 * Timeout task 466 * Timeout task
467 */ 467 */
468 GNUNET_SCHEDULER_TaskIdentifier timeout_task; 468 GNUNET_SCHEDULER_TaskIdentifier timeout_task;
469 469
470 /** 470 /**
471 * Read buffer 471 * Read buffer
472 */ 472 */
473 char rbuf[SOCKS_BUFFERSIZE]; 473 char rbuf[SOCKS_BUFFERSIZE];
474 474
475 /** 475 /**
476 * Write buffer 476 * Write buffer
477 */ 477 */
478 char wbuf[SOCKS_BUFFERSIZE]; 478 char wbuf[SOCKS_BUFFERSIZE];
479 479
@@ -493,7 +493,7 @@ struct Socks5Request
493 struct MHD_Response *response; 493 struct MHD_Response *response;
494 494
495 /** 495 /**
496 * the domain name to server (only important for SSL) 496 * the domain name to server (only important for SSL)
497 */ 497 */
498 char *domain; 498 char *domain;
499 499
@@ -503,12 +503,12 @@ struct Socks5Request
503 char *leho; 503 char *leho;
504 504
505 /** 505 /**
506 * The URL to fetch 506 * The URL to fetch
507 */ 507 */
508 char *url; 508 char *url;
509 509
510 /** 510 /**
511 * Handle to cURL 511 * Handle to cURL
512 */ 512 */
513 CURL *curl; 513 CURL *curl;
514 514
@@ -516,22 +516,22 @@ struct Socks5Request
516 * HTTP request headers for the curl request. 516 * HTTP request headers for the curl request.
517 */ 517 */
518 struct curl_slist *headers; 518 struct curl_slist *headers;
519 519
520 /** 520 /**
521 * HTTP response code to give to MHD for the response. 521 * HTTP response code to give to MHD for the response.
522 */ 522 */
523 unsigned int response_code; 523 unsigned int response_code;
524 524
525 /** 525 /**
526 * Number of bytes already in read buffer 526 * Number of bytes already in read buffer
527 */ 527 */
528 size_t rbuf_len; 528 size_t rbuf_len;
529 529
530 /** 530 /**
531 * Number of bytes already in write buffer 531 * Number of bytes already in write buffer
532 */ 532 */
533 size_t wbuf_len; 533 size_t wbuf_len;
534 534
535 /** 535 /**
536 * Number of bytes already in the IO buffer. 536 * Number of bytes already in the IO buffer.
537 */ 537 */
@@ -543,7 +543,7 @@ struct Socks5Request
543 struct sockaddr_storage destination_address; 543 struct sockaddr_storage destination_address;
544 544
545 /** 545 /**
546 * The socks state 546 * The socks state
547 */ 547 */
548 enum SocksPhase state; 548 enum SocksPhase state;
549 549
@@ -560,22 +560,22 @@ struct Socks5Request
560 560
561 561
562/** 562/**
563 * The port the proxy is running on (default 7777) 563 * The port the proxy is running on (default 7777)
564 */ 564 */
565static unsigned long port = GNUNET_GNS_PROXY_PORT; 565static unsigned long port = GNUNET_GNS_PROXY_PORT;
566 566
567/** 567/**
568 * The CA file (pem) to use for the proxy CA 568 * The CA file (pem) to use for the proxy CA
569 */ 569 */
570static char *cafile_opt; 570static char *cafile_opt;
571 571
572/** 572/**
573 * The listen socket of the proxy 573 * The listen socket of the proxy
574 */ 574 */
575static struct GNUNET_NETWORK_Handle *lsock; 575static struct GNUNET_NETWORK_Handle *lsock;
576 576
577/** 577/**
578 * The listen task ID 578 * The listen task ID
579 */ 579 */
580static GNUNET_SCHEDULER_TaskIdentifier ltask; 580static GNUNET_SCHEDULER_TaskIdentifier ltask;
581 581
@@ -585,22 +585,22 @@ static GNUNET_SCHEDULER_TaskIdentifier ltask;
585static GNUNET_SCHEDULER_TaskIdentifier curl_download_task; 585static GNUNET_SCHEDULER_TaskIdentifier curl_download_task;
586 586
587/** 587/**
588 * The cURL multi handle 588 * The cURL multi handle
589 */ 589 */
590static CURLM *curl_multi; 590static CURLM *curl_multi;
591 591
592/** 592/**
593 * Handle to the GNS service 593 * Handle to the GNS service
594 */ 594 */
595static struct GNUNET_GNS_Handle *gns_handle; 595static struct GNUNET_GNS_Handle *gns_handle;
596 596
597/** 597/**
598 * DLL for http/https daemons 598 * DLL for http/https daemons
599 */ 599 */
600static struct MhdHttpList *mhd_httpd_head; 600static struct MhdHttpList *mhd_httpd_head;
601 601
602/** 602/**
603 * DLL for http/https daemons 603 * DLL for http/https daemons
604 */ 604 */
605static struct MhdHttpList *mhd_httpd_tail; 605static struct MhdHttpList *mhd_httpd_tail;
606 606
@@ -621,12 +621,12 @@ static struct Socks5Request *s5r_head;
621static struct Socks5Request *s5r_tail; 621static struct Socks5Request *s5r_tail;
622 622
623/** 623/**
624 * The users local GNS master zone 624 * The users local GNS master zone
625 */ 625 */
626static struct GNUNET_CRYPTO_EccPublicSignKey local_gns_zone; 626static struct GNUNET_CRYPTO_EccPublicSignKey local_gns_zone;
627 627
628/** 628/**
629 * The users local shorten zone 629 * The users local shorten zone
630 */ 630 */
631static struct GNUNET_CRYPTO_EccPrivateKey local_shorten_zone; 631static struct GNUNET_CRYPTO_EccPrivateKey local_shorten_zone;
632 632
@@ -636,7 +636,7 @@ static struct GNUNET_CRYPTO_EccPrivateKey local_shorten_zone;
636static int do_shorten; 636static int do_shorten;
637 637
638/** 638/**
639 * The CA for SSL certificate generation 639 * The CA for SSL certificate generation
640 */ 640 */
641static struct ProxyCA proxy_ca; 641static struct ProxyCA proxy_ca;
642 642
@@ -682,11 +682,11 @@ static void
682cleanup_s5r (struct Socks5Request *s5r) 682cleanup_s5r (struct Socks5Request *s5r)
683{ 683{
684 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 684 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
685 "Cleaning up socks request\n"); 685 "Cleaning up socks request\n");
686 if (NULL != s5r->curl) 686 if (NULL != s5r->curl)
687 { 687 {
688 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 688 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
689 "Cleaning up cURL handle\n"); 689 "Cleaning up cURL handle\n");
690 curl_multi_remove_handle (curl_multi, s5r->curl); 690 curl_multi_remove_handle (curl_multi, s5r->curl);
691 curl_easy_cleanup (s5r->curl); 691 curl_easy_cleanup (s5r->curl);
692 s5r->curl = NULL; 692 s5r->curl = NULL;
@@ -703,7 +703,7 @@ cleanup_s5r (struct Socks5Request *s5r)
703 GNUNET_SCHEDULER_cancel (s5r->wtask); 703 GNUNET_SCHEDULER_cancel (s5r->wtask);
704 if (NULL != s5r->gns_lookup) 704 if (NULL != s5r->gns_lookup)
705 GNUNET_GNS_lookup_cancel (s5r->gns_lookup); 705 GNUNET_GNS_lookup_cancel (s5r->gns_lookup);
706 if (NULL != s5r->sock) 706 if (NULL != s5r->sock)
707 { 707 {
708 if (SOCKS5_SOCKET_WITH_MHD <= s5r->state) 708 if (SOCKS5_SOCKET_WITH_MHD <= s5r->state)
709 GNUNET_NETWORK_socket_free_memory_only_ (s5r->sock); 709 GNUNET_NETWORK_socket_free_memory_only_ (s5r->sock);
@@ -796,13 +796,13 @@ check_ssl_certificate (struct Socks5Request *s5r)
796 gnutls_session_t session; 796 gnutls_session_t session;
797 struct curl_slist * to_slist; 797 struct curl_slist * to_slist;
798 } gptr; 798 } gptr;
799 unsigned int cert_list_size; 799 unsigned int cert_list_size;
800 const gnutls_datum_t *chainp; 800 const gnutls_datum_t *chainp;
801 801
802 gptr.to_slist = NULL; 802 gptr.to_slist = NULL;
803 if (CURLE_OK != 803 if (CURLE_OK !=
804 curl_easy_getinfo (s5r->curl, 804 curl_easy_getinfo (s5r->curl,
805 CURLINFO_GNUTLS_SESSION, 805 CURLINFO_GNUTLS_SESSION,
806 &gptr)) 806 &gptr))
807 return GNUNET_SYSERR; 807 return GNUNET_SYSERR;
808 808
@@ -832,7 +832,7 @@ check_ssl_certificate (struct Socks5Request *s5r)
832 return GNUNET_OK; 832 return GNUNET_OK;
833} 833}
834 834
835 835
836/** 836/**
837 * We're getting an HTTP response header from cURL. Convert it to the 837 * We're getting an HTTP response header from cURL. Convert it to the
838 * MHD response headers. Mostly copies the headers, but makes special 838 * MHD response headers. Mostly copies the headers, but makes special
@@ -869,7 +869,7 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls)
869 (GNUNET_OK != check_ssl_certificate (s5r)) ) 869 (GNUNET_OK != check_ssl_certificate (s5r)) )
870 return 0; 870 return 0;
871 871
872 GNUNET_break (CURLE_OK == 872 GNUNET_break (CURLE_OK ==
873 curl_easy_getinfo (s5r->curl, 873 curl_easy_getinfo (s5r->curl,
874 CURLINFO_RESPONSE_CODE, 874 CURLINFO_RESPONSE_CODE,
875 &resp_code)); 875 &resp_code));
@@ -885,27 +885,27 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls)
885 if (NULL != s5r->leho) 885 if (NULL != s5r->leho)
886 { 886 {
887 char *cors_hdr; 887 char *cors_hdr;
888 888
889 GNUNET_asprintf (&cors_hdr, 889 GNUNET_asprintf (&cors_hdr,
890 (HTTPS_PORT == s5r->port) 890 (HTTPS_PORT == s5r->port)
891 ? "https://%s" 891 ? "https://%s"
892 : "http://%s", 892 : "http://%s",
893 s5r->leho); 893 s5r->leho);
894 894
895 GNUNET_break (MHD_YES == 895 GNUNET_break (MHD_YES ==
896 MHD_add_response_header (s5r->response, 896 MHD_add_response_header (s5r->response,
897 MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, 897 MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN,
898 cors_hdr)); 898 cors_hdr));
899 GNUNET_free (cors_hdr); 899 GNUNET_free (cors_hdr);
900 } 900 }
901 /* force connection to be closed after each request, as we 901 /* force connection to be closed after each request, as we
902 do not support HTTP pipelining */ 902 do not support HTTP pipelining */
903 GNUNET_break (MHD_YES == 903 GNUNET_break (MHD_YES ==
904 MHD_add_response_header (s5r->response, 904 MHD_add_response_header (s5r->response,
905 MHD_HTTP_HEADER_CONNECTION, 905 MHD_HTTP_HEADER_CONNECTION,
906 "close")); 906 "close"));
907 } 907 }
908 908
909 ndup = GNUNET_strndup (buffer, bytes); 909 ndup = GNUNET_strndup (buffer, bytes);
910 hdr_type = strtok (ndup, ":"); 910 hdr_type = strtok (ndup, ":");
911 if (NULL == hdr_type) 911 if (NULL == hdr_type)
@@ -927,9 +927,9 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls)
927 if ( (NULL != s5r->leho) && 927 if ( (NULL != s5r->leho) &&
928 (0 == strcasecmp (hdr_type, 928 (0 == strcasecmp (hdr_type,
929 MHD_HTTP_HEADER_SET_COOKIE)) ) 929 MHD_HTTP_HEADER_SET_COOKIE)) )
930 930
931 { 931 {
932 new_cookie_hdr = GNUNET_malloc (strlen (hdr_val) + 932 new_cookie_hdr = GNUNET_malloc (strlen (hdr_val) +
933 strlen (s5r->domain) + 1); 933 strlen (s5r->domain) + 1);
934 offset = 0; 934 offset = 0;
935 domain_matched = GNUNET_NO; /* make sure we match domain at most once */ 935 domain_matched = GNUNET_NO; /* make sure we match domain at most once */
@@ -946,7 +946,7 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls)
946 if (0 == strcasecmp (cookie_domain, s5r->leho + delta_cdomain)) 946 if (0 == strcasecmp (cookie_domain, s5r->leho + delta_cdomain))
947 { 947 {
948 offset += sprintf (new_cookie_hdr + offset, 948 offset += sprintf (new_cookie_hdr + offset,
949 " domain=%s;", 949 " domain=%s;",
950 s5r->domain); 950 s5r->domain);
951 continue; 951 continue;
952 } 952 }
@@ -954,9 +954,9 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls)
954 else if (0 == strcmp (cookie_domain, s5r->leho)) 954 else if (0 == strcmp (cookie_domain, s5r->leho))
955 { 955 {
956 offset += sprintf (new_cookie_hdr + offset, 956 offset += sprintf (new_cookie_hdr + offset,
957 " domain=%s;", 957 " domain=%s;",
958 s5r->domain); 958 s5r->domain);
959 continue; 959 continue;
960 } 960 }
961 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 961 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
962 _("Cookie domain `%s' supplied by server is invalid\n"), 962 _("Cookie domain `%s' supplied by server is invalid\n"),
@@ -973,14 +973,14 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls)
973 if (0 == strcasecmp (MHD_HTTP_HEADER_LOCATION, hdr_type)) 973 if (0 == strcasecmp (MHD_HTTP_HEADER_LOCATION, hdr_type))
974 { 974 {
975 char *leho_host; 975 char *leho_host;
976 976
977 GNUNET_asprintf (&leho_host, 977 GNUNET_asprintf (&leho_host,
978 (HTTPS_PORT != s5r->port) 978 (HTTPS_PORT != s5r->port)
979 ? "http://%s" 979 ? "http://%s"
980 : "https://%s", 980 : "https://%s",
981 s5r->leho); 981 s5r->leho);
982 if (0 == strncmp (leho_host, 982 if (0 == strncmp (leho_host,
983 hdr_val, 983 hdr_val,
984 strlen (leho_host))) 984 strlen (leho_host)))
985 { 985 {
986 GNUNET_asprintf (&new_location, 986 GNUNET_asprintf (&new_location,
@@ -1051,12 +1051,12 @@ curl_download_cb (void *ptr, size_t size, size_t nmemb, void* ctx)
1051 "Pausing CURL download, not enough space\n"); 1051 "Pausing CURL download, not enough space\n");
1052 return CURL_WRITEFUNC_PAUSE; /* not enough space */ 1052 return CURL_WRITEFUNC_PAUSE; /* not enough space */
1053 } 1053 }
1054 memcpy (&s5r->io_buf[s5r->io_len], 1054 memcpy (&s5r->io_buf[s5r->io_len],
1055 ptr, 1055 ptr,
1056 total); 1056 total);
1057 s5r->io_len += total; 1057 s5r->io_len += total;
1058 if (s5r->io_len == total) 1058 if (s5r->io_len == total)
1059 run_mhd_now (s5r->hd); 1059 run_mhd_now (s5r->hd);
1060 return total; 1060 return total;
1061} 1061}
1062 1062
@@ -1178,7 +1178,7 @@ curl_download_prepare ()
1178 GNUNET_NETWORK_fdset_destroy (gws); 1178 GNUNET_NETWORK_fdset_destroy (gws);
1179 GNUNET_NETWORK_fdset_destroy (grs); 1179 GNUNET_NETWORK_fdset_destroy (grs);
1180 } 1180 }
1181 else 1181 else
1182 { 1182 {
1183 curl_download_task = GNUNET_SCHEDULER_add_delayed (rtime, 1183 curl_download_task = GNUNET_SCHEDULER_add_delayed (rtime,
1184 &curl_task_download, 1184 &curl_task_download,
@@ -1194,7 +1194,7 @@ curl_download_prepare ()
1194 * @param tc task context 1194 * @param tc task context
1195 */ 1195 */
1196static void 1196static void
1197curl_task_download (void *cls, 1197curl_task_download (void *cls,
1198 const struct GNUNET_SCHEDULER_TaskContext *tc) 1198 const struct GNUNET_SCHEDULER_TaskContext *tc)
1199{ 1199{
1200 int running; 1200 int running;
@@ -1206,7 +1206,7 @@ curl_task_download (void *cls,
1206 curl_download_task = GNUNET_SCHEDULER_NO_TASK; 1206 curl_download_task = GNUNET_SCHEDULER_NO_TASK;
1207 do 1207 do
1208 { 1208 {
1209 running = 0; 1209 running = 0;
1210 mret = curl_multi_perform (curl_multi, &running); 1210 mret = curl_multi_perform (curl_multi, &running);
1211 while (NULL != (msg = curl_multi_info_read (curl_multi, &msgnum))) 1211 while (NULL != (msg = curl_multi_info_read (curl_multi, &msgnum)))
1212 { 1212 {
@@ -1232,7 +1232,7 @@ curl_task_download (void *cls,
1232 case CURLE_GOT_NOTHING: 1232 case CURLE_GOT_NOTHING:
1233 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1233 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1234 "CURL download completed.\n"); 1234 "CURL download completed.\n");
1235 s5r->state = SOCKS5_SOCKET_DOWNLOAD_DONE; 1235 s5r->state = SOCKS5_SOCKET_DOWNLOAD_DONE;
1236 run_mhd_now (s5r->hd); 1236 run_mhd_now (s5r->hd);
1237 break; 1237 break;
1238 default: 1238 default:
@@ -1241,7 +1241,7 @@ curl_task_download (void *cls,
1241 curl_easy_strerror (msg->data.result)); 1241 curl_easy_strerror (msg->data.result));
1242 /* FIXME: indicate error somehow? close MHD connection badly as well? */ 1242 /* FIXME: indicate error somehow? close MHD connection badly as well? */
1243 s5r->state = SOCKS5_SOCKET_DOWNLOAD_DONE; 1243 s5r->state = SOCKS5_SOCKET_DOWNLOAD_DONE;
1244 run_mhd_now (s5r->hd); 1244 run_mhd_now (s5r->hd);
1245 break; 1245 break;
1246 } 1246 }
1247 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1247 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1262,12 +1262,12 @@ curl_task_download (void *cls,
1262 break; 1262 break;
1263 } 1263 }
1264 }; 1264 };
1265 } while (mret == CURLM_CALL_MULTI_PERFORM); 1265 } while (mret == CURLM_CALL_MULTI_PERFORM);
1266 if (CURLM_OK != mret) 1266 if (CURLM_OK != mret)
1267 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1267 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1268 "%s failed at %s:%d: `%s'\n", 1268 "%s failed at %s:%d: `%s'\n",
1269 "curl_multi_perform", __FILE__, __LINE__, 1269 "curl_multi_perform", __FILE__, __LINE__,
1270 curl_multi_strerror (mret)); 1270 curl_multi_strerror (mret));
1271 if (0 == running) 1271 if (0 == running)
1272 { 1272 {
1273 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1273 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1418,7 +1418,7 @@ create_response (void *cls,
1418 if (NULL == s5r->curl) 1418 if (NULL == s5r->curl)
1419 return MHD_queue_response (con, 1419 return MHD_queue_response (con,
1420 MHD_HTTP_INTERNAL_SERVER_ERROR, 1420 MHD_HTTP_INTERNAL_SERVER_ERROR,
1421 curl_failure_response); 1421 curl_failure_response);
1422 curl_easy_setopt (s5r->curl, CURLOPT_HEADERFUNCTION, &curl_check_hdr); 1422 curl_easy_setopt (s5r->curl, CURLOPT_HEADERFUNCTION, &curl_check_hdr);
1423 curl_easy_setopt (s5r->curl, CURLOPT_HEADERDATA, s5r); 1423 curl_easy_setopt (s5r->curl, CURLOPT_HEADERDATA, s5r);
1424 curl_easy_setopt (s5r->curl, CURLOPT_FOLLOWLOCATION, 0); 1424 curl_easy_setopt (s5r->curl, CURLOPT_FOLLOWLOCATION, 0);
@@ -1436,11 +1436,11 @@ create_response (void *cls,
1436 ? "http://%s:%d%s" 1436 ? "http://%s:%d%s"
1437 : "https://%s:%d%s", 1437 : "https://%s:%d%s",
1438 ipaddr, 1438 ipaddr,
1439 port, 1439 port,
1440 s5r->url); 1440 s5r->url);
1441 curl_easy_setopt (s5r->curl, 1441 curl_easy_setopt (s5r->curl,
1442 CURLOPT_URL, 1442 CURLOPT_URL,
1443 curlurl); 1443 curlurl);
1444 GNUNET_free (curlurl); 1444 GNUNET_free (curlurl);
1445 1445
1446 if (0 == strcasecmp (meth, MHD_HTTP_METHOD_PUT)) 1446 if (0 == strcasecmp (meth, MHD_HTTP_METHOD_PUT))
@@ -1451,10 +1451,10 @@ create_response (void *cls,
1451 curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r); 1451 curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r);
1452 curl_easy_setopt (s5r->curl, CURLOPT_READFUNCTION, &curl_upload_cb); 1452 curl_easy_setopt (s5r->curl, CURLOPT_READFUNCTION, &curl_upload_cb);
1453 curl_easy_setopt (s5r->curl, CURLOPT_READDATA, s5r); 1453 curl_easy_setopt (s5r->curl, CURLOPT_READDATA, s5r);
1454 } 1454 }
1455 else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_POST)) 1455 else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_POST))
1456 { 1456 {
1457 s5r->state = SOCKS5_SOCKET_UPLOAD_STARTED; 1457 s5r->state = SOCKS5_SOCKET_UPLOAD_STARTED;
1458 curl_easy_setopt (s5r->curl, CURLOPT_POST, 1); 1458 curl_easy_setopt (s5r->curl, CURLOPT_POST, 1);
1459 curl_easy_setopt (s5r->curl, CURLOPT_WRITEFUNCTION, &curl_download_cb); 1459 curl_easy_setopt (s5r->curl, CURLOPT_WRITEFUNCTION, &curl_download_cb);
1460 curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r); 1460 curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r);
@@ -1463,12 +1463,12 @@ create_response (void *cls,
1463 } 1463 }
1464 else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_HEAD)) 1464 else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_HEAD))
1465 { 1465 {
1466 s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED; 1466 s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED;
1467 curl_easy_setopt (s5r->curl, CURLOPT_NOBODY, 1); 1467 curl_easy_setopt (s5r->curl, CURLOPT_NOBODY, 1);
1468 } 1468 }
1469 else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_GET)) 1469 else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_GET))
1470 { 1470 {
1471 s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED; 1471 s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED;
1472 curl_easy_setopt (s5r->curl, CURLOPT_HTTPGET, 1); 1472 curl_easy_setopt (s5r->curl, CURLOPT_HTTPGET, 1);
1473 curl_easy_setopt (s5r->curl, CURLOPT_WRITEFUNCTION, &curl_download_cb); 1473 curl_easy_setopt (s5r->curl, CURLOPT_WRITEFUNCTION, &curl_download_cb);
1474 curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r); 1474 curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r);
@@ -1479,10 +1479,10 @@ create_response (void *cls,
1479 _("Unsupported HTTP method `%s'\n"), 1479 _("Unsupported HTTP method `%s'\n"),
1480 meth); 1480 meth);
1481 curl_easy_cleanup (s5r->curl); 1481 curl_easy_cleanup (s5r->curl);
1482 s5r->curl = NULL; 1482 s5r->curl = NULL;
1483 return MHD_NO; 1483 return MHD_NO;
1484 } 1484 }
1485 1485
1486 if (0 == strcasecmp (ver, MHD_HTTP_VERSION_1_0)) 1486 if (0 == strcasecmp (ver, MHD_HTTP_VERSION_1_0))
1487 { 1487 {
1488 curl_easy_setopt (s5r->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); 1488 curl_easy_setopt (s5r->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
@@ -1495,26 +1495,26 @@ create_response (void *cls,
1495 { 1495 {
1496 curl_easy_setopt (s5r->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_NONE); 1496 curl_easy_setopt (s5r->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_NONE);
1497 } 1497 }
1498 1498
1499 if (HTTPS_PORT == s5r->port) 1499 if (HTTPS_PORT == s5r->port)
1500 { 1500 {
1501 curl_easy_setopt (s5r->curl, CURLOPT_USE_SSL, CURLUSESSL_ALL); 1501 curl_easy_setopt (s5r->curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
1502 curl_easy_setopt (s5r->curl, CURLOPT_SSL_VERIFYPEER, 1L); 1502 curl_easy_setopt (s5r->curl, CURLOPT_SSL_VERIFYPEER, 1L);
1503 /* Disable cURL checking the hostname, as we will check ourselves 1503 /* Disable cURL checking the hostname, as we will check ourselves
1504 as only we have the domain name or the LEHO or the DANE record */ 1504 as only we have the domain name or the LEHO or the DANE record */
1505 curl_easy_setopt (s5r->curl, CURLOPT_SSL_VERIFYHOST, 0L); 1505 curl_easy_setopt (s5r->curl, CURLOPT_SSL_VERIFYHOST, 0L);
1506 } 1506 }
1507 else 1507 else
1508 { 1508 {
1509 curl_easy_setopt (s5r->curl, CURLOPT_USE_SSL, CURLUSESSL_NONE); 1509 curl_easy_setopt (s5r->curl, CURLOPT_USE_SSL, CURLUSESSL_NONE);
1510 } 1510 }
1511 1511
1512 if (CURLM_OK != curl_multi_add_handle (curl_multi, s5r->curl)) 1512 if (CURLM_OK != curl_multi_add_handle (curl_multi, s5r->curl))
1513 { 1513 {
1514 GNUNET_break (0); 1514 GNUNET_break (0);
1515 curl_easy_cleanup (s5r->curl); 1515 curl_easy_cleanup (s5r->curl);
1516 s5r->curl = NULL; 1516 s5r->curl = NULL;
1517 return MHD_NO; 1517 return MHD_NO;
1518 } 1518 }
1519 MHD_get_connection_values (con, 1519 MHD_get_connection_values (con,
1520 MHD_HEADER_KIND, 1520 MHD_HEADER_KIND,
@@ -1522,18 +1522,18 @@ create_response (void *cls,
1522 curl_easy_setopt (s5r->curl, CURLOPT_HTTPHEADER, s5r->headers); 1522 curl_easy_setopt (s5r->curl, CURLOPT_HTTPHEADER, s5r->headers);
1523 curl_download_prepare (); 1523 curl_download_prepare ();
1524 return MHD_YES; 1524 return MHD_YES;
1525 } 1525 }
1526 1526
1527 /* continuing to process request */ 1527 /* continuing to process request */
1528 if (0 != *upload_data_size) 1528 if (0 != *upload_data_size)
1529 { 1529 {
1530 left = GNUNET_MIN (*upload_data_size, 1530 left = GNUNET_MIN (*upload_data_size,
1531 sizeof (s5r->io_buf) - s5r->io_len); 1531 sizeof (s5r->io_buf) - s5r->io_len);
1532 memcpy (&s5r->io_buf[s5r->io_len], 1532 memcpy (&s5r->io_buf[s5r->io_len],
1533 upload_data, 1533 upload_data,
1534 left); 1534 left);
1535 s5r->io_len += left; 1535 s5r->io_len += left;
1536 *upload_data_size -= left; 1536 *upload_data_size -= left;
1537 GNUNET_assert (NULL != s5r->curl); 1537 GNUNET_assert (NULL != s5r->curl);
1538 curl_easy_pause (s5r->curl, CURLPAUSE_CONT); 1538 curl_easy_pause (s5r->curl, CURLPAUSE_CONT);
1539 curl_download_prepare (); 1539 curl_download_prepare ();
@@ -1545,12 +1545,12 @@ create_response (void *cls,
1545 "Finished processing UPLOAD\n"); 1545 "Finished processing UPLOAD\n");
1546 s5r->state = SOCKS5_SOCKET_UPLOAD_DONE; 1546 s5r->state = SOCKS5_SOCKET_UPLOAD_DONE;
1547 } 1547 }
1548 if (NULL == s5r->response) 1548 if (NULL == s5r->response)
1549 return MHD_YES; /* too early to queue response, did not yet get headers from cURL */ 1549 return MHD_YES; /* too early to queue response, did not yet get headers from cURL */
1550 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1550 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1551 "Queueing response with MHD\n"); 1551 "Queueing response with MHD\n");
1552 return MHD_queue_response (con, 1552 return MHD_queue_response (con,
1553 s5r->response_code, 1553 s5r->response_code,
1554 s5r->response); 1554 s5r->response);
1555} 1555}
1556 1556
@@ -1582,7 +1582,7 @@ mhd_completed_cb (void *cls,
1582 "MHD encountered error handling request: %d\n", 1582 "MHD encountered error handling request: %d\n",
1583 toe); 1583 toe);
1584 cleanup_s5r (s5r); 1584 cleanup_s5r (s5r);
1585 *con_cls = NULL; 1585 *con_cls = NULL;
1586} 1586}
1587 1587
1588 1588
@@ -1590,7 +1590,7 @@ mhd_completed_cb (void *cls,
1590 * Function called when MHD first processes an incoming connection. 1590 * Function called when MHD first processes an incoming connection.
1591 * Gives us the respective URI information. 1591 * Gives us the respective URI information.
1592 * 1592 *
1593 * We use this to associate the `struct MHD_Connection` with our 1593 * We use this to associate the `struct MHD_Connection` with our
1594 * internal `struct Socks5Request` data structure (by checking 1594 * internal `struct Socks5Request` data structure (by checking
1595 * for matching sockets). 1595 * for matching sockets).
1596 * 1596 *
@@ -1600,7 +1600,7 @@ mhd_completed_cb (void *cls,
1600 * @return the `struct Socks5Request` that this @a connection is for 1600 * @return the `struct Socks5Request` that this @a connection is for
1601 */ 1601 */
1602static void * 1602static void *
1603mhd_log_callback (void *cls, 1603mhd_log_callback (void *cls,
1604 const char *url, 1604 const char *url,
1605 struct MHD_Connection *connection) 1605 struct MHD_Connection *connection)
1606{ 1606{
@@ -1610,7 +1610,7 @@ mhd_log_callback (void *cls,
1610 1610
1611 ci = MHD_get_connection_info (connection, 1611 ci = MHD_get_connection_info (connection,
1612 MHD_CONNECTION_INFO_CONNECTION_FD); 1612 MHD_CONNECTION_INFO_CONNECTION_FD);
1613 if (NULL == ci) 1613 if (NULL == ci)
1614 { 1614 {
1615 GNUNET_break (0); 1615 GNUNET_break (0);
1616 return NULL; 1616 return NULL;
@@ -1770,8 +1770,8 @@ do_httpd (void *cls,
1770 const struct GNUNET_SCHEDULER_TaskContext *tc) 1770 const struct GNUNET_SCHEDULER_TaskContext *tc)
1771{ 1771{
1772 struct MhdHttpList *hd = cls; 1772 struct MhdHttpList *hd = cls;
1773 1773
1774 hd->httpd_task = GNUNET_SCHEDULER_NO_TASK; 1774 hd->httpd_task = GNUNET_SCHEDULER_NO_TASK;
1775 MHD_run (hd->daemon); 1775 MHD_run (hd->daemon);
1776 schedule_httpd (hd); 1776 schedule_httpd (hd);
1777} 1777}
@@ -1785,10 +1785,10 @@ do_httpd (void *cls,
1785static void 1785static void
1786run_mhd_now (struct MhdHttpList *hd) 1786run_mhd_now (struct MhdHttpList *hd)
1787{ 1787{
1788 if (GNUNET_SCHEDULER_NO_TASK != 1788 if (GNUNET_SCHEDULER_NO_TASK !=
1789 hd->httpd_task) 1789 hd->httpd_task)
1790 GNUNET_SCHEDULER_cancel (hd->httpd_task); 1790 GNUNET_SCHEDULER_cancel (hd->httpd_task);
1791 hd->httpd_task = GNUNET_SCHEDULER_add_now (&do_httpd, 1791 hd->httpd_task = GNUNET_SCHEDULER_add_now (&do_httpd,
1792 hd); 1792 hd);
1793} 1793}
1794 1794
@@ -1801,7 +1801,7 @@ run_mhd_now (struct MhdHttpList *hd)
1801 * @return NULL on error 1801 * @return NULL on error
1802 */ 1802 */
1803static void* 1803static void*
1804load_file (const char* filename, 1804load_file (const char* filename,
1805 unsigned int* size) 1805 unsigned int* size)
1806{ 1806{
1807 void *buffer; 1807 void *buffer;
@@ -1832,7 +1832,7 @@ load_file (const char* filename,
1832 * @return #GNUNET_OK on success 1832 * @return #GNUNET_OK on success
1833 */ 1833 */
1834static int 1834static int
1835load_key_from_file (gnutls_x509_privkey_t key, 1835load_key_from_file (gnutls_x509_privkey_t key,
1836 const char* keyfile) 1836 const char* keyfile)
1837{ 1837{
1838 gnutls_datum_t key_data; 1838 gnutls_datum_t key_data;
@@ -1860,7 +1860,7 @@ load_key_from_file (gnutls_x509_privkey_t key,
1860 * @return #GNUNET_OK on success 1860 * @return #GNUNET_OK on success
1861 */ 1861 */
1862static int 1862static int
1863load_cert_from_file (gnutls_x509_crt_t crt, 1863load_cert_from_file (gnutls_x509_crt_t crt,
1864 const char* certfile) 1864 const char* certfile)
1865{ 1865{
1866 gnutls_datum_t cert_data; 1866 gnutls_datum_t cert_data;
@@ -1896,8 +1896,8 @@ generate_gns_certificate (const char *name)
1896 struct tm *tm_data; 1896 struct tm *tm_data;
1897 struct ProxyGNSCertificate *pgc; 1897 struct ProxyGNSCertificate *pgc;
1898 1898
1899 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1899 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1900 "Generating TLS/SSL certificate for `%s'\n", 1900 "Generating TLS/SSL certificate for `%s'\n",
1901 name); 1901 name);
1902 GNUNET_break (GNUTLS_E_SUCCESS == gnutls_x509_crt_init (&request)); 1902 GNUNET_break (GNUTLS_E_SUCCESS == gnutls_x509_crt_init (&request));
1903 GNUNET_break (GNUTLS_E_SUCCESS == gnutls_x509_crt_set_key (request, proxy_ca.key)); 1903 GNUNET_break (GNUTLS_E_SUCCESS == gnutls_x509_crt_set_key (request, proxy_ca.key));
@@ -1914,15 +1914,15 @@ generate_gns_certificate (const char *name)
1914 &serial, 1914 &serial,
1915 sizeof (serial)); 1915 sizeof (serial));
1916 etime = time (NULL); 1916 etime = time (NULL);
1917 tm_data = localtime (&etime); 1917 tm_data = localtime (&etime);
1918 gnutls_x509_crt_set_activation_time (request, 1918 gnutls_x509_crt_set_activation_time (request,
1919 etime); 1919 etime);
1920 tm_data->tm_year++; 1920 tm_data->tm_year++;
1921 etime = mktime (tm_data); 1921 etime = mktime (tm_data);
1922 gnutls_x509_crt_set_expiration_time (request, 1922 gnutls_x509_crt_set_expiration_time (request,
1923 etime); 1923 etime);
1924 gnutls_x509_crt_sign (request, 1924 gnutls_x509_crt_sign (request,
1925 proxy_ca.cert, 1925 proxy_ca.cert,
1926 proxy_ca.key); 1926 proxy_ca.key);
1927 key_buf_size = sizeof (pgc->key); 1927 key_buf_size = sizeof (pgc->key);
1928 cert_buf_size = sizeof (pgc->cert); 1928 cert_buf_size = sizeof (pgc->cert);
@@ -1954,10 +1954,10 @@ lookup_ssl_httpd (const char* domain)
1954 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1954 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1955 "Starting fresh MHD HTTPS instance for domain `%s'\n", 1955 "Starting fresh MHD HTTPS instance for domain `%s'\n",
1956 domain); 1956 domain);
1957 pgc = generate_gns_certificate (domain); 1957 pgc = generate_gns_certificate (domain);
1958 hd = GNUNET_new (struct MhdHttpList); 1958 hd = GNUNET_new (struct MhdHttpList);
1959 hd->is_ssl = GNUNET_YES; 1959 hd->is_ssl = GNUNET_YES;
1960 hd->domain = GNUNET_strdup (domain); 1960 hd->domain = GNUNET_strdup (domain);
1961 hd->proxy_cert = pgc; 1961 hd->proxy_cert = pgc;
1962 hd->daemon = MHD_start_daemon (MHD_USE_DEBUG | MHD_USE_SSL | MHD_USE_NO_LISTEN_SOCKET, 1962 hd->daemon = MHD_start_daemon (MHD_USE_DEBUG | MHD_USE_SSL | MHD_USE_NO_LISTEN_SOCKET,
1963 0, 1963 0,
@@ -1975,8 +1975,8 @@ lookup_ssl_httpd (const char* domain)
1975 GNUNET_free (hd); 1975 GNUNET_free (hd);
1976 return NULL; 1976 return NULL;
1977 } 1977 }
1978 GNUNET_CONTAINER_DLL_insert (mhd_httpd_head, 1978 GNUNET_CONTAINER_DLL_insert (mhd_httpd_head,
1979 mhd_httpd_tail, 1979 mhd_httpd_tail,
1980 hd); 1980 hd);
1981 return hd; 1981 return hd;
1982} 1982}
@@ -2003,7 +2003,7 @@ timeout_s5r_handshake (void *cls,
2003 2003
2004/** 2004/**
2005 * We're done with the Socks5 protocol, now we need to pass the 2005 * We're done with the Socks5 protocol, now we need to pass the
2006 * connection data through to the final destination, either 2006 * connection data through to the final destination, either
2007 * direct (if the protocol might not be HTTP), or via MHD 2007 * direct (if the protocol might not be HTTP), or via MHD
2008 * (if the port looks like it should be HTTP). 2008 * (if the port looks like it should be HTTP).
2009 * 2009 *
@@ -2078,7 +2078,7 @@ do_write (void *cls,
2078 if (len <= 0) 2078 if (len <= 0)
2079 { 2079 {
2080 /* write error: connection closed, shutdown, etc.; just clean up */ 2080 /* write error: connection closed, shutdown, etc.; just clean up */
2081 cleanup_s5r (s5r); 2081 cleanup_s5r (s5r);
2082 return; 2082 return;
2083 } 2083 }
2084 memmove (s5r->wbuf, 2084 memmove (s5r->wbuf,
@@ -2099,10 +2099,10 @@ do_write (void *cls,
2099 2099
2100 switch (s5r->state) 2100 switch (s5r->state)
2101 { 2101 {
2102 case SOCKS5_INIT: 2102 case SOCKS5_INIT:
2103 GNUNET_assert (0); 2103 GNUNET_assert (0);
2104 break; 2104 break;
2105 case SOCKS5_REQUEST: 2105 case SOCKS5_REQUEST:
2106 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != s5r->rtask); 2106 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != s5r->rtask);
2107 break; 2107 break;
2108 case SOCKS5_DATA_TRANSFER: 2108 case SOCKS5_DATA_TRANSFER:
@@ -2136,7 +2136,7 @@ signal_socks_failure (struct Socks5Request *s5r,
2136 s_resp->reply = sc; 2136 s_resp->reply = sc;
2137 s5r->state = SOCKS5_WRITE_THEN_CLEANUP; 2137 s5r->state = SOCKS5_WRITE_THEN_CLEANUP;
2138 if (GNUNET_SCHEDULER_NO_TASK != s5r->wtask) 2138 if (GNUNET_SCHEDULER_NO_TASK != s5r->wtask)
2139 s5r->wtask = 2139 s5r->wtask =
2140 GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, 2140 GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL,
2141 s5r->sock, 2141 s5r->sock,
2142 &do_write, s5r); 2142 &do_write, s5r);
@@ -2159,16 +2159,16 @@ signal_socks_success (struct Socks5Request *s5r)
2159 s_resp->reserved = 0; 2159 s_resp->reserved = 0;
2160 s_resp->addr_type = SOCKS5_AT_IPV4; 2160 s_resp->addr_type = SOCKS5_AT_IPV4;
2161 /* zero out IPv4 address and port */ 2161 /* zero out IPv4 address and port */
2162 memset (&s_resp[1], 2162 memset (&s_resp[1],
2163 0, 2163 0,
2164 sizeof (struct in_addr) + sizeof (uint16_t)); 2164 sizeof (struct in_addr) + sizeof (uint16_t));
2165 s5r->wbuf_len += sizeof (struct Socks5ServerResponseMessage) + 2165 s5r->wbuf_len += sizeof (struct Socks5ServerResponseMessage) +
2166 sizeof (struct in_addr) + sizeof (uint16_t); 2166 sizeof (struct in_addr) + sizeof (uint16_t);
2167 if (GNUNET_SCHEDULER_NO_TASK == s5r->wtask) 2167 if (GNUNET_SCHEDULER_NO_TASK == s5r->wtask)
2168 s5r->wtask = 2168 s5r->wtask =
2169 GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, 2169 GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL,
2170 s5r->sock, 2170 s5r->sock,
2171 &do_write, s5r); 2171 &do_write, s5r);
2172} 2172}
2173 2173
2174 2174
@@ -2207,7 +2207,7 @@ handle_gns_result (void *cls,
2207 } 2207 }
2208 if (GNUNET_YES == got_ip) 2208 if (GNUNET_YES == got_ip)
2209 break; 2209 break;
2210 if (GNUNET_OK != 2210 if (GNUNET_OK !=
2211 GNUNET_NETWORK_test_pf (PF_INET)) 2211 GNUNET_NETWORK_test_pf (PF_INET))
2212 break; 2212 break;
2213 got_ip = GNUNET_YES; 2213 got_ip = GNUNET_YES;
@@ -2222,7 +2222,7 @@ handle_gns_result (void *cls,
2222#endif 2222#endif
2223 } 2223 }
2224 break; 2224 break;
2225 case GNUNET_DNSPARSER_TYPE_AAAA: 2225 case GNUNET_DNSPARSER_TYPE_AAAA:
2226 { 2226 {
2227 struct sockaddr_in6 *in; 2227 struct sockaddr_in6 *in;
2228 2228
@@ -2232,8 +2232,8 @@ handle_gns_result (void *cls,
2232 break; 2232 break;
2233 } 2233 }
2234 if (GNUNET_YES == got_ip) 2234 if (GNUNET_YES == got_ip)
2235 break; 2235 break;
2236 if (GNUNET_OK != 2236 if (GNUNET_OK !=
2237 GNUNET_NETWORK_test_pf (PF_INET)) 2237 GNUNET_NETWORK_test_pf (PF_INET))
2238 break; 2238 break;
2239 /* FIXME: allow user to disable IPv6 per configuration option... */ 2239 /* FIXME: allow user to disable IPv6 per configuration option... */
@@ -2248,7 +2248,7 @@ handle_gns_result (void *cls,
2248 in->sin6_len = sizeof (*in); 2248 in->sin6_len = sizeof (*in);
2249#endif 2249#endif
2250 } 2250 }
2251 break; 2251 break;
2252 case GNUNET_NAMESTORE_TYPE_VPN: 2252 case GNUNET_NAMESTORE_TYPE_VPN:
2253 GNUNET_break (0); /* should have been translated within GNS */ 2253 GNUNET_break (0); /* should have been translated within GNS */
2254 break; 2254 break;
@@ -2264,14 +2264,14 @@ handle_gns_result (void *cls,
2264 } 2264 }
2265 if (GNUNET_YES != got_ip) 2265 if (GNUNET_YES != got_ip)
2266 { 2266 {
2267 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2267 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2268 "Name resolution failed to yield useful IP address.\n"); 2268 "Name resolution failed to yield useful IP address.\n");
2269 signal_socks_failure (s5r, 2269 signal_socks_failure (s5r,
2270 SOCKS5_STATUS_GENERAL_FAILURE); 2270 SOCKS5_STATUS_GENERAL_FAILURE);
2271 return; 2271 return;
2272 } 2272 }
2273 s5r->state = SOCKS5_DATA_TRANSFER; 2273 s5r->state = SOCKS5_DATA_TRANSFER;
2274 signal_socks_success (s5r); 2274 signal_socks_success (s5r);
2275} 2275}
2276 2276
2277 2277
@@ -2314,12 +2314,12 @@ do_s5r_read (void *cls,
2314 if ( (NULL != tc->read_ready) && 2314 if ( (NULL != tc->read_ready) &&
2315 (GNUNET_NETWORK_fdset_isset (tc->read_ready, s5r->sock)) ) 2315 (GNUNET_NETWORK_fdset_isset (tc->read_ready, s5r->sock)) )
2316 { 2316 {
2317 rlen = GNUNET_NETWORK_socket_recv (s5r->sock, 2317 rlen = GNUNET_NETWORK_socket_recv (s5r->sock,
2318 &s5r->rbuf[s5r->rbuf_len], 2318 &s5r->rbuf[s5r->rbuf_len],
2319 sizeof (s5r->rbuf) - s5r->rbuf_len); 2319 sizeof (s5r->rbuf) - s5r->rbuf_len);
2320 if (rlen <= 0) 2320 if (rlen <= 0)
2321 { 2321 {
2322 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2322 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2323 "socks5 client disconnected.\n"); 2323 "socks5 client disconnected.\n");
2324 cleanup_s5r (s5r); 2324 cleanup_s5r (s5r);
2325 return; 2325 return;
@@ -2449,7 +2449,7 @@ do_s5r_read (void *cls,
2449 GNUNET_NO /* only cached */, 2449 GNUNET_NO /* only cached */,
2450 (GNUNET_YES == do_shorten) ? &local_shorten_zone : NULL, 2450 (GNUNET_YES == do_shorten) ? &local_shorten_zone : NULL,
2451 &handle_gns_result, 2451 &handle_gns_result,
2452 s5r); 2452 s5r);
2453 break; 2453 break;
2454 } 2454 }
2455 default: 2455 default:
@@ -2469,7 +2469,7 @@ do_s5r_read (void *cls,
2469 GNUNET_break_op (0); 2469 GNUNET_break_op (0);
2470 signal_socks_failure (s5r, 2470 signal_socks_failure (s5r,
2471 SOCKS5_STATUS_GENERAL_FAILURE); 2471 SOCKS5_STATUS_GENERAL_FAILURE);
2472 return; 2472 return;
2473 } 2473 }
2474 if (SOCKS5_DATA_TRANSFER == s5r->state) 2474 if (SOCKS5_DATA_TRANSFER == s5r->state)
2475 { 2475 {
@@ -2478,7 +2478,7 @@ do_s5r_read (void *cls,
2478 } 2478 }
2479 /* We are done reading right now */ 2479 /* We are done reading right now */
2480 GNUNET_SCHEDULER_cancel (s5r->rtask); 2480 GNUNET_SCHEDULER_cancel (s5r->rtask);
2481 s5r->rtask = GNUNET_SCHEDULER_NO_TASK; 2481 s5r->rtask = GNUNET_SCHEDULER_NO_TASK;
2482 return; 2482 return;
2483 case SOCKS5_RESOLVING: 2483 case SOCKS5_RESOLVING:
2484 GNUNET_assert (0); 2484 GNUNET_assert (0);
@@ -2500,7 +2500,7 @@ do_s5r_read (void *cls,
2500 * @param tc the scheduler context 2500 * @param tc the scheduler context
2501 */ 2501 */
2502static void 2502static void
2503do_accept (void *cls, 2503do_accept (void *cls,
2504 const struct GNUNET_SCHEDULER_TaskContext *tc) 2504 const struct GNUNET_SCHEDULER_TaskContext *tc)
2505{ 2505{
2506 struct GNUNET_NETWORK_Handle *s; 2506 struct GNUNET_NETWORK_Handle *s;
@@ -2595,8 +2595,8 @@ do_shutdown (void *cls,
2595/** 2595/**
2596 * Continue initialization after we have our zone information. 2596 * Continue initialization after we have our zone information.
2597 */ 2597 */
2598static void 2598static void
2599run_cont () 2599run_cont ()
2600{ 2600{
2601 struct MhdHttpList *hd; 2601 struct MhdHttpList *hd;
2602 struct sockaddr_in sa; 2602 struct sockaddr_in sa;
@@ -2612,7 +2612,7 @@ run_cont ()
2612 lsock = GNUNET_NETWORK_socket_create (AF_INET, 2612 lsock = GNUNET_NETWORK_socket_create (AF_INET,
2613 SOCK_STREAM, 2613 SOCK_STREAM,
2614 0); 2614 0);
2615 if (NULL == lsock) 2615 if (NULL == lsock)
2616 { 2616 {
2617 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket"); 2617 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket");
2618 GNUNET_SCHEDULER_shutdown (); 2618 GNUNET_SCHEDULER_shutdown ();
@@ -2666,7 +2666,7 @@ run_cont ()
2666} 2666}
2667 2667
2668 2668
2669/** 2669/**
2670 * Method called to inform about the egos of the shorten zone of this peer. 2670 * Method called to inform about the egos of the shorten zone of this peer.
2671 * 2671 *
2672 * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get, 2672 * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get,
@@ -2674,7 +2674,7 @@ run_cont ()
2674 * @a ego does indicate an error (i.e. name is taken or no default 2674 * @a ego does indicate an error (i.e. name is taken or no default
2675 * value is known). If @a ego is non-NULL and if '*ctx' 2675 * value is known). If @a ego is non-NULL and if '*ctx'
2676 * is set in those callbacks, the value WILL be passed to a subsequent 2676 * is set in those callbacks, the value WILL be passed to a subsequent
2677 * call to the identity callback of #GNUNET_IDENTITY_connect (if 2677 * call to the identity callback of #GNUNET_IDENTITY_connect (if
2678 * that one was not NULL). 2678 * that one was not NULL).
2679 * 2679 *
2680 * @param cls closure, NULL 2680 * @param cls closure, NULL
@@ -2706,7 +2706,7 @@ identity_shorten_cb (void *cls,
2706} 2706}
2707 2707
2708 2708
2709/** 2709/**
2710 * Method called to inform about the egos of the master zone of this peer. 2710 * Method called to inform about the egos of the master zone of this peer.
2711 * 2711 *
2712 * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get, 2712 * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get,
@@ -2714,7 +2714,7 @@ identity_shorten_cb (void *cls,
2714 * @a ego does indicate an error (i.e. name is taken or no default 2714 * @a ego does indicate an error (i.e. name is taken or no default
2715 * value is known). If @a ego is non-NULL and if '*ctx' 2715 * value is known). If @a ego is non-NULL and if '*ctx'
2716 * is set in those callbacks, the value WILL be passed to a subsequent 2716 * is set in those callbacks, the value WILL be passed to a subsequent
2717 * call to the identity callback of #GNUNET_IDENTITY_connect (if 2717 * call to the identity callback of #GNUNET_IDENTITY_connect (if
2718 * that one was not NULL). 2718 * that one was not NULL).
2719 * 2719 *
2720 * @param cls closure, NULL 2720 * @param cls closure, NULL
@@ -2770,7 +2770,7 @@ run (void *cls, char *const *args, const char *cfgfile,
2770 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2770 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2771 "Failed to create cURL multi handle!\n"); 2771 "Failed to create cURL multi handle!\n");
2772 return; 2772 return;
2773 } 2773 }
2774 cafile = cafile_opt; 2774 cafile = cafile_opt;
2775 if (NULL == cafile) 2775 if (NULL == cafile)
2776 { 2776 {
@@ -2787,11 +2787,11 @@ run (void *cls, char *const *args, const char *cfgfile,
2787 } 2787 }
2788 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2788 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2789 "Using %s as CA\n", cafile); 2789 "Using %s as CA\n", cafile);
2790 2790
2791 gnutls_global_init (); 2791 gnutls_global_init ();
2792 gnutls_x509_crt_init (&proxy_ca.cert); 2792 gnutls_x509_crt_init (&proxy_ca.cert);
2793 gnutls_x509_privkey_init (&proxy_ca.key); 2793 gnutls_x509_privkey_init (&proxy_ca.key);
2794 2794
2795 if ( (GNUNET_OK != load_cert_from_file (proxy_ca.cert, cafile)) || 2795 if ( (GNUNET_OK != load_cert_from_file (proxy_ca.cert, cafile)) ||
2796 (GNUNET_OK != load_key_from_file (proxy_ca.key, cafile)) ) 2796 (GNUNET_OK != load_key_from_file (proxy_ca.key, cafile)) )
2797 { 2797 {
@@ -2801,7 +2801,7 @@ run (void *cls, char *const *args, const char *cfgfile,
2801 gnutls_x509_crt_deinit (proxy_ca.cert); 2801 gnutls_x509_crt_deinit (proxy_ca.cert);
2802 gnutls_x509_privkey_deinit (proxy_ca.key); 2802 gnutls_x509_privkey_deinit (proxy_ca.key);
2803 gnutls_global_deinit (); 2803 gnutls_global_deinit ();
2804 GNUNET_free_non_null (cafile_cfg); 2804 GNUNET_free_non_null (cafile_cfg);
2805 return; 2805 return;
2806 } 2806 }
2807 GNUNET_free_non_null (cafile_cfg); 2807 GNUNET_free_non_null (cafile_cfg);
@@ -2815,11 +2815,11 @@ run (void *cls, char *const *args, const char *cfgfile,
2815 return; 2815 return;
2816 } 2816 }
2817 identity = GNUNET_IDENTITY_connect (cfg, 2817 identity = GNUNET_IDENTITY_connect (cfg,
2818 NULL, NULL); 2818 NULL, NULL);
2819 id_op = GNUNET_IDENTITY_get (identity, 2819 id_op = GNUNET_IDENTITY_get (identity,
2820 "gns-proxy", 2820 "gns-proxy",
2821 &identity_master_cb, 2821 &identity_master_cb,
2822 NULL); 2822 NULL);
2823 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 2823 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
2824 &do_shutdown, NULL); 2824 &do_shutdown, NULL);
2825} 2825}
@@ -2844,7 +2844,7 @@ main (int argc, char *const *argv)
2844 &GNUNET_GETOPT_set_string, &cafile_opt}, 2844 &GNUNET_GETOPT_set_string, &cafile_opt},
2845 GNUNET_GETOPT_OPTION_END 2845 GNUNET_GETOPT_OPTION_END
2846 }; 2846 };
2847 static const char* page = 2847 static const char* page =
2848 "<html><head><title>gnunet-gns-proxy</title>" 2848 "<html><head><title>gnunet-gns-proxy</title>"
2849 "</head><body>cURL fail</body></html>"; 2849 "</head><body>cURL fail</body></html>";
2850 int ret; 2850 int ret;
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c
index e7e2404f6..713f94b92 100644
--- a/src/gns/gnunet-gns.c
+++ b/src/gns/gnunet-gns.c
@@ -70,7 +70,7 @@ static int raw;
70static int rtype; 70static int rtype;
71 71
72/** 72/**
73 * Handle to lookup request 73 * Handle to lookup request
74 */ 74 */
75static struct GNUNET_GNS_LookupRequest *lookup_request; 75static struct GNUNET_GNS_LookupRequest *lookup_request;
76 76
@@ -144,13 +144,13 @@ process_lookup_result (void *cls, uint32_t rd_count,
144 const char *typename; 144 const char *typename;
145 char* string_val; 145 char* string_val;
146 146
147 lookup_request = NULL; 147 lookup_request = NULL;
148 if (!raw) 148 if (!raw)
149 { 149 {
150 if (0 == rd_count) 150 if (0 == rd_count)
151 printf ("No results.\n"); 151 printf ("No results.\n");
152 else 152 else
153 printf ("%s:\n", 153 printf ("%s:\n",
154 name); 154 name);
155 } 155 }
156 for (i=0; i<rd_count; i++) 156 for (i=0; i<rd_count; i++)
@@ -171,11 +171,11 @@ process_lookup_result (void *cls, uint32_t rd_count,
171 continue; 171 continue;
172 } 172 }
173 if (raw) 173 if (raw)
174 printf ("%s\n", 174 printf ("%s\n",
175 string_val); 175 string_val);
176 else 176 else
177 printf ("Got `%s' record: %s\n", 177 printf ("Got `%s' record: %s\n",
178 typename, 178 typename,
179 string_val); 179 string_val);
180 GNUNET_free (string_val); 180 GNUNET_free (string_val);
181 } 181 }
@@ -201,13 +201,13 @@ lookup_with_keys (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey,
201 201
202 if (NULL != lookup_name) 202 if (NULL != lookup_name)
203 { 203 {
204 lookup_request = GNUNET_GNS_lookup (gns, 204 lookup_request = GNUNET_GNS_lookup (gns,
205 lookup_name, 205 lookup_name,
206 pkey, 206 pkey,
207 rtype, 207 rtype,
208 GNUNET_NO, /* Use DHT */ 208 GNUNET_NO, /* Use DHT */
209 shorten_key, 209 shorten_key,
210 &process_lookup_result, 210 &process_lookup_result,
211 lookup_name); 211 lookup_name);
212 } 212 }
213 else 213 else
@@ -220,7 +220,7 @@ lookup_with_keys (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey,
220} 220}
221 221
222 222
223/** 223/**
224 * Method called to with the ego we are to use for shortening 224 * Method called to with the ego we are to use for shortening
225 * during the lookup. 225 * during the lookup.
226 * 226 *
@@ -232,7 +232,7 @@ lookup_with_keys (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey,
232 * NULL if the user just deleted the ego and it 232 * NULL if the user just deleted the ego and it
233 * must thus no longer be used 233 * must thus no longer be used
234 */ 234 */
235static void 235static void
236identity_shorten_cb (void *cls, 236identity_shorten_cb (void *cls,
237 struct GNUNET_IDENTITY_Ego *ego, 237 struct GNUNET_IDENTITY_Ego *ego,
238 void **ctx, 238 void **ctx,
@@ -276,21 +276,21 @@ lookup_with_public_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey)
276} 276}
277 277
278 278
279/** 279/**
280 * Method called to with the ego we are to use for the lookup, 280 * Method called to with the ego we are to use for the lookup,
281 * when the ego is determined by a name. 281 * when the ego is determined by a name.
282 * 282 *
283 * @param cls closure (NULL, unused) 283 * @param cls closure (NULL, unused)
284 * @param ego ego handle, NULL if not found 284 * @param ego ego handle, NULL if not found
285 */ 285 */
286static void 286static void
287identity_zone_cb (void *cls, 287identity_zone_cb (void *cls,
288 const struct GNUNET_IDENTITY_Ego *ego) 288 const struct GNUNET_IDENTITY_Ego *ego)
289{ 289{
290 struct GNUNET_CRYPTO_EccPublicSignKey pkey; 290 struct GNUNET_CRYPTO_EccPublicSignKey pkey;
291 291
292 el = NULL; 292 el = NULL;
293 if (NULL == ego) 293 if (NULL == ego)
294 { 294 {
295 fprintf (stderr, 295 fprintf (stderr,
296 _("Ego for `%s' not found, cannot perform lookup.\n"), 296 _("Ego for `%s' not found, cannot perform lookup.\n"),
@@ -307,7 +307,7 @@ identity_zone_cb (void *cls,
307} 307}
308 308
309 309
310/** 310/**
311 * Method called to with the ego we are to use for the lookup, 311 * Method called to with the ego we are to use for the lookup,
312 * when the ego is the one for the default master zone. 312 * when the ego is the one for the default master zone.
313 * 313 *
@@ -319,7 +319,7 @@ identity_zone_cb (void *cls,
319 * NULL if the user just deleted the ego and it 319 * NULL if the user just deleted the ego and it
320 * must thus no longer be used 320 * must thus no longer be used
321 */ 321 */
322static void 322static void
323identity_master_cb (void *cls, 323identity_master_cb (void *cls,
324 struct GNUNET_IDENTITY_Ego *ego, 324 struct GNUNET_IDENTITY_Ego *ego,
325 void **ctx, 325 void **ctx,
@@ -328,7 +328,7 @@ identity_master_cb (void *cls,
328 struct GNUNET_CRYPTO_EccPublicSignKey pkey; 328 struct GNUNET_CRYPTO_EccPublicSignKey pkey;
329 329
330 id_op = NULL; 330 id_op = NULL;
331 if (NULL == ego) 331 if (NULL == ego)
332 { 332 {
333 fprintf (stderr, 333 fprintf (stderr,
334 _("Ego for `master-zone' not found, cannot perform lookup. Did you run gnunet-gns-import.sh?\n")); 334 _("Ego for `master-zone' not found, cannot perform lookup. Did you run gnunet-gns-import.sh?\n"));
@@ -372,7 +372,7 @@ run (void *cls, char *const *args, const char *cfgfile,
372 strlen (public_key), 372 strlen (public_key),
373 &pkey)) 373 &pkey))
374 { 374 {
375 fprintf (stderr, 375 fprintf (stderr,
376 _("Public key `%s' is not well-formed\n"), 376 _("Public key `%s' is not well-formed\n"),
377 public_key); 377 public_key);
378 GNUNET_SCHEDULER_shutdown (); 378 GNUNET_SCHEDULER_shutdown ();
@@ -383,7 +383,7 @@ run (void *cls, char *const *args, const char *cfgfile,
383 } 383 }
384 if (NULL != zone_ego_name) 384 if (NULL != zone_ego_name)
385 { 385 {
386 el = GNUNET_IDENTITY_ego_lookup (cfg, 386 el = GNUNET_IDENTITY_ego_lookup (cfg,
387 zone_ego_name, 387 zone_ego_name,
388 &identity_zone_cb, 388 &identity_zone_cb,
389 NULL); 389 NULL);
@@ -447,7 +447,7 @@ main (int argc, char *const *argv)
447 ret = 447 ret =
448 (GNUNET_OK == 448 (GNUNET_OK ==
449 GNUNET_PROGRAM_run (argc, argv, "gnunet-gns", 449 GNUNET_PROGRAM_run (argc, argv, "gnunet-gns",
450 _("GNUnet GNS resolver tool"), 450 _("GNUnet GNS resolver tool"),
451 options, 451 options,
452 &run, NULL)) ? 0 : 1; 452 &run, NULL)) ? 0 : 1;
453 GNUNET_free ((void*) argv); 453 GNUNET_free ((void*) argv);
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index 0cf0fca56..8fcd75e7c 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -98,7 +98,7 @@ struct ClientLookupHandle
98 struct GNS_ResolverHandle *lookup; 98 struct GNS_ResolverHandle *lookup;
99 99
100 /** 100 /**
101 * request id 101 * request id
102 */ 102 */
103 uint32_t request_id; 103 uint32_t request_id;
104 104
@@ -199,7 +199,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
199 199
200 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 200 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
201 "Shutting down!\n"); 201 "Shutting down!\n");
202 GNUNET_SERVER_notification_context_destroy (nc); 202 GNUNET_SERVER_notification_context_destroy (nc);
203 while (NULL != (clh = clh_head)) 203 while (NULL != (clh = clh_head))
204 { 204 {
205 GNUNET_SERVER_client_set_user_context (clh->client, NULL); 205 GNUNET_SERVER_client_set_user_context (clh->client, NULL);
@@ -266,7 +266,7 @@ publish_zone_dht_next (void *cls,
266 * @param tc task context 266 * @param tc task context
267 */ 267 */
268static void 268static void
269publish_zone_dht_start (void *cls, 269publish_zone_dht_start (void *cls,
270 const struct GNUNET_SCHEDULER_TaskContext *tc); 270 const struct GNUNET_SCHEDULER_TaskContext *tc);
271 271
272 272
@@ -280,10 +280,10 @@ static void
280dht_put_continuation (void *cls, 280dht_put_continuation (void *cls,
281 int success) 281 int success)
282{ 282{
283 struct GNUNET_TIME_Relative next_put_interval; 283 struct GNUNET_TIME_Relative next_put_interval;
284 284
285 active_put = NULL; 285 active_put = NULL;
286 num_public_records++; 286 num_public_records++;
287 if ( (num_public_records > last_num_public_records) && 287 if ( (num_public_records > last_num_public_records) &&
288 (GNUNET_NO == first_zone_iteration) ) 288 (GNUNET_NO == first_zone_iteration) )
289 { 289 {
@@ -300,7 +300,7 @@ dht_put_continuation (void *cls,
300 GNUNET_STATISTICS_set (statistics, 300 GNUNET_STATISTICS_set (statistics,
301 "Current zone iteration interval (ms)", 301 "Current zone iteration interval (ms)",
302 next_put_interval.rel_value_us / 1000LL, 302 next_put_interval.rel_value_us / 1000LL,
303 GNUNET_NO); 303 GNUNET_NO);
304 zone_publish_task = GNUNET_SCHEDULER_add_delayed (next_put_interval, 304 zone_publish_task = GNUNET_SCHEDULER_add_delayed (next_put_interval,
305 &publish_zone_dht_next, 305 &publish_zone_dht_next,
306 NULL); 306 NULL);
@@ -322,10 +322,10 @@ put_gns_record (void *cls,
322 const char *name, 322 const char *name,
323 unsigned int rd_count, 323 unsigned int rd_count,
324 const struct GNUNET_NAMESTORE_RecordData *rd) 324 const struct GNUNET_NAMESTORE_RecordData *rd)
325{ 325{
326 struct GNUNET_NAMESTORE_Block *block; 326 struct GNUNET_NAMESTORE_Block *block;
327 struct GNUNET_HashCode query; 327 struct GNUNET_HashCode query;
328 struct GNUNET_TIME_Absolute expire; 328 struct GNUNET_TIME_Absolute expire;
329 struct GNUNET_TIME_Absolute now; 329 struct GNUNET_TIME_Absolute now;
330 size_t block_size; 330 size_t block_size;
331 struct GNUNET_NAMESTORE_RecordData rd_public[rd_count]; 331 struct GNUNET_NAMESTORE_RecordData rd_public[rd_count];
@@ -365,8 +365,8 @@ put_gns_record (void *cls,
365 put_interval.rel_value_us / 1000LL, 365 put_interval.rel_value_us / 1000LL,
366 GNUNET_NO); 366 GNUNET_NO);
367 GNUNET_STATISTICS_update (statistics, 367 GNUNET_STATISTICS_update (statistics,
368 "Number of zone iterations", 368 "Number of zone iterations",
369 1, 369 1,
370 GNUNET_NO); 370 GNUNET_NO);
371 GNUNET_STATISTICS_set (statistics, 371 GNUNET_STATISTICS_set (statistics,
372 "Number of public records in DHT", 372 "Number of public records in DHT",
@@ -377,7 +377,7 @@ put_gns_record (void *cls,
377 &publish_zone_dht_start, 377 &publish_zone_dht_start,
378 NULL); 378 NULL);
379 else 379 else
380 zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, 380 zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start,
381 NULL); 381 NULL);
382 return; 382 return;
383 } 383 }
@@ -413,8 +413,8 @@ put_gns_record (void *cls,
413 name, 413 name,
414 rd_public, 414 rd_public,
415 rd_public_count); 415 rd_public_count);
416 block_size = ntohl (block->purpose.size) 416 block_size = ntohl (block->purpose.size)
417 + sizeof (struct GNUNET_CRYPTO_EccSignature) 417 + sizeof (struct GNUNET_CRYPTO_EccSignature)
418 + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); 418 + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey);
419 GNUNET_NAMESTORE_query_from_private_key (key, 419 GNUNET_NAMESTORE_query_from_private_key (key,
420 name, 420 name,
@@ -429,7 +429,7 @@ put_gns_record (void *cls,
429 expire, 429 expire,
430 DHT_OPERATION_TIMEOUT, 430 DHT_OPERATION_TIMEOUT,
431 &dht_put_continuation, 431 &dht_put_continuation,
432 NULL); 432 NULL);
433 if (NULL == active_put) 433 if (NULL == active_put)
434 { 434 {
435 GNUNET_break (0); 435 GNUNET_break (0);
@@ -446,13 +446,13 @@ put_gns_record (void *cls,
446 * @param tc task context 446 * @param tc task context
447 */ 447 */
448static void 448static void
449publish_zone_dht_start (void *cls, 449publish_zone_dht_start (void *cls,
450 const struct GNUNET_SCHEDULER_TaskContext *tc) 450 const struct GNUNET_SCHEDULER_TaskContext *tc)
451{ 451{
452 zone_publish_task = GNUNET_SCHEDULER_NO_TASK; 452 zone_publish_task = GNUNET_SCHEDULER_NO_TASK;
453 453
454 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 454 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
455 "Scheduling DHT zone update!\n"); 455 "Scheduling DHT zone update!\n");
456 /* start counting again */ 456 /* start counting again */
457 num_public_records = 0; 457 num_public_records = 0;
458 namestore_iter = GNUNET_NAMESTORE_zone_iteration_start (namestore_handle, 458 namestore_iter = GNUNET_NAMESTORE_zone_iteration_start (namestore_handle,
@@ -480,21 +480,21 @@ send_lookup_response (void* cls,
480 struct ClientLookupHandle *clh = cls; 480 struct ClientLookupHandle *clh = cls;
481 struct GNUNET_GNS_ClientLookupResultMessage *rmsg; 481 struct GNUNET_GNS_ClientLookupResultMessage *rmsg;
482 size_t len; 482 size_t len;
483 483
484 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 484 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
485 "Sending `%s' message with %d results\n", 485 "Sending `%s' message with %d results\n",
486 "LOOKUP_RESULT", 486 "LOOKUP_RESULT",
487 rd_count); 487 rd_count);
488 488
489 len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); 489 len = GNUNET_NAMESTORE_records_get_size (rd_count, rd);
490 rmsg = GNUNET_malloc (len + sizeof (struct GNUNET_GNS_ClientLookupResultMessage)); 490 rmsg = GNUNET_malloc (len + sizeof (struct GNUNET_GNS_ClientLookupResultMessage));
491 rmsg->header.type = htons (GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT); 491 rmsg->header.type = htons (GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT);
492 rmsg->header.size = htons (len + sizeof(struct GNUNET_GNS_ClientLookupResultMessage)); 492 rmsg->header.size = htons (len + sizeof(struct GNUNET_GNS_ClientLookupResultMessage));
493 rmsg->id = clh->request_id; 493 rmsg->id = clh->request_id;
494 rmsg->rd_count = htonl (rd_count); 494 rmsg->rd_count = htonl (rd_count);
495 GNUNET_NAMESTORE_records_serialize (rd_count, rd, len, 495 GNUNET_NAMESTORE_records_serialize (rd_count, rd, len,
496 (char*) &rmsg[1]); 496 (char*) &rmsg[1]);
497 GNUNET_SERVER_notification_context_unicast (nc, 497 GNUNET_SERVER_notification_context_unicast (nc,
498 clh->client, 498 clh->client,
499 &rmsg->header, 499 &rmsg->header,
500 GNUNET_NO); 500 GNUNET_NO);
@@ -503,11 +503,11 @@ send_lookup_response (void* cls,
503 GNUNET_SERVER_client_set_user_context (clh->client, NULL); 503 GNUNET_SERVER_client_set_user_context (clh->client, NULL);
504 GNUNET_free (clh); 504 GNUNET_free (clh);
505 GNUNET_STATISTICS_update (statistics, 505 GNUNET_STATISTICS_update (statistics,
506 "Completed lookups", 1, 506 "Completed lookups", 1,
507 GNUNET_NO); 507 GNUNET_NO);
508 GNUNET_STATISTICS_update (statistics, 508 GNUNET_STATISTICS_update (statistics,
509 "Records resolved", 509 "Records resolved",
510 rd_count, 510 rd_count,
511 GNUNET_NO); 511 GNUNET_NO);
512} 512}
513 513
@@ -531,9 +531,9 @@ handle_lookup (void *cls,
531 const struct GNUNET_CRYPTO_EccPrivateKey *key; 531 const struct GNUNET_CRYPTO_EccPrivateKey *key;
532 uint16_t msg_size; 532 uint16_t msg_size;
533 const struct GNUNET_GNS_ClientLookupMessage *sh_msg; 533 const struct GNUNET_GNS_ClientLookupMessage *sh_msg;
534 534
535 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 535 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
536 "Received `%s' message\n", 536 "Received `%s' message\n",
537 "LOOKUP"); 537 "LOOKUP");
538 msg_size = ntohs (message->size); 538 msg_size = ntohs (message->size);
539 if (msg_size < sizeof (struct GNUNET_GNS_ClientLookupMessage)) 539 if (msg_size < sizeof (struct GNUNET_GNS_ClientLookupMessage))
@@ -557,8 +557,8 @@ handle_lookup (void *cls,
557 return; 557 return;
558 } 558 }
559 GNUNET_STRINGS_utf8_tolower (utf_in, &nameptr); 559 GNUNET_STRINGS_utf8_tolower (utf_in, &nameptr);
560 GNUNET_SERVER_receive_done (client, GNUNET_OK); 560 GNUNET_SERVER_receive_done (client, GNUNET_OK);
561 561
562 clh = GNUNET_new (struct ClientLookupHandle); 562 clh = GNUNET_new (struct ClientLookupHandle);
563 GNUNET_SERVER_client_set_user_context (client, clh); 563 GNUNET_SERVER_client_set_user_context (client, clh);
564 GNUNET_CONTAINER_DLL_insert (clh_head, clh_tail, clh); 564 GNUNET_CONTAINER_DLL_insert (clh_head, clh_tail, clh);
@@ -571,7 +571,7 @@ handle_lookup (void *cls,
571 "LOOKUP: Query for A record but AF_INET not supported!"); 571 "LOOKUP: Query for A record but AF_INET not supported!");
572 send_lookup_response (clh, 0, NULL); 572 send_lookup_response (clh, 0, NULL);
573 return; 573 return;
574 } 574 }
575 if ( (GNUNET_DNSPARSER_TYPE_AAAA == ntohl (sh_msg->type)) && 575 if ( (GNUNET_DNSPARSER_TYPE_AAAA == ntohl (sh_msg->type)) &&
576 (GNUNET_OK != v6_enabled) ) 576 (GNUNET_OK != v6_enabled) )
577 { 577 {
@@ -580,14 +580,14 @@ handle_lookup (void *cls,
580 send_lookup_response (clh, 0, NULL); 580 send_lookup_response (clh, 0, NULL);
581 return; 581 return;
582 } 582 }
583 clh->lookup = GNS_resolver_lookup (&sh_msg->zone, 583 clh->lookup = GNS_resolver_lookup (&sh_msg->zone,
584 ntohl (sh_msg->type), 584 ntohl (sh_msg->type),
585 name, 585 name,
586 key, 586 key,
587 ntohl (sh_msg->only_cached), 587 ntohl (sh_msg->only_cached),
588 &send_lookup_response, clh); 588 &send_lookup_response, clh);
589 GNUNET_STATISTICS_update (statistics, 589 GNUNET_STATISTICS_update (statistics,
590 "Lookup attempts", 590 "Lookup attempts",
591 1, GNUNET_NO); 591 1, GNUNET_NO);
592} 592}
593 593
@@ -645,7 +645,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
645 GNUNET_SCHEDULER_shutdown (); 645 GNUNET_SCHEDULER_shutdown ();
646 return; 646 return;
647 } 647 }
648 648
649 put_interval = INITIAL_PUT_INTERVAL; 649 put_interval = INITIAL_PUT_INTERVAL;
650 zone_publish_time_window = DEFAULT_ZONE_PUBLISH_TIME_WINDOW; 650 zone_publish_time_window = DEFAULT_ZONE_PUBLISH_TIME_WINDOW;
651 651
@@ -677,7 +677,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
677 GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); 677 GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
678 return; 678 return;
679 } 679 }
680 680
681 if (GNUNET_OK == 681 if (GNUNET_OK ==
682 GNUNET_CONFIGURATION_get_value_string (c, "gns", "DNS_ROOT", 682 GNUNET_CONFIGURATION_get_value_string (c, "gns", "DNS_ROOT",
683 &dns_root_name)) 683 &dns_root_name))
@@ -688,7 +688,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
688 &dns_root)) 688 &dns_root))
689 { 689 {
690 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, 690 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
691 "gns", "DNS_ROOT", 691 "gns", "DNS_ROOT",
692 _("valid public key required")); 692 _("valid public key required"));
693 GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); 693 GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
694 GNUNET_free (dns_root_name); 694 GNUNET_free (dns_root_name);
@@ -697,7 +697,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
697 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 697 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
698 "DNS hijacking with root `%s' enabled. Connecting to DNS service.\n", 698 "DNS hijacking with root `%s' enabled. Connecting to DNS service.\n",
699 dns_root_name); 699 dns_root_name);
700 GNUNET_free (dns_root_name); 700 GNUNET_free (dns_root_name);
701 if (GNUNET_SYSERR == 701 if (GNUNET_SYSERR ==
702 GNS_interceptor_init (&dns_root, c)) 702 GNS_interceptor_init (&dns_root, c))
703 { 703 {
@@ -705,21 +705,21 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
705 return; 705 return;
706 } 706 }
707 } 707 }
708 GNS_resolver_init (namestore_handle, dht_handle, 708 GNS_resolver_init (namestore_handle, dht_handle,
709 c, 709 c,
710 max_parallel_bg_queries); 710 max_parallel_bg_queries);
711 GNS_shorten_init (namestore_handle, dht_handle); 711 GNS_shorten_init (namestore_handle, dht_handle);
712 GNUNET_SERVER_disconnect_notify (server, 712 GNUNET_SERVER_disconnect_notify (server,
713 &notify_client_disconnect, 713 &notify_client_disconnect,
714 NULL); 714 NULL);
715 /* Schedule periodic put for our records. */ 715 /* Schedule periodic put for our records. */
716 first_zone_iteration = GNUNET_YES; 716 first_zone_iteration = GNUNET_YES;
717 GNUNET_SERVER_add_handlers (server, handlers); 717 GNUNET_SERVER_add_handlers (server, handlers);
718 statistics = GNUNET_STATISTICS_create ("gns", c); 718 statistics = GNUNET_STATISTICS_create ("gns", c);
719 nc = GNUNET_SERVER_notification_context_create (server, 1); 719 nc = GNUNET_SERVER_notification_context_create (server, 1);
720 zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, 720 zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start,
721 NULL); 721 NULL);
722 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 722 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
723 &shutdown_task, NULL); 723 &shutdown_task, NULL);
724} 724}
725 725
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c
index be7a46f51..8cb1951bf 100644
--- a/src/gns/gnunet-service-gns_interceptor.c
+++ b/src/gns/gnunet-service-gns_interceptor.c
@@ -50,12 +50,12 @@ struct InterceptLookupHandle
50 struct InterceptLookupHandle *prev; 50 struct InterceptLookupHandle *prev;
51 51
52 /** 52 /**
53 * the request handle to reply to 53 * the request handle to reply to
54 */ 54 */
55 struct GNUNET_DNS_RequestHandle *request_handle; 55 struct GNUNET_DNS_RequestHandle *request_handle;
56 56
57 /** 57 /**
58 * the dns parser packet received 58 * the dns parser packet received
59 */ 59 */
60 struct GNUNET_DNSPARSER_Packet *packet; 60 struct GNUNET_DNSPARSER_Packet *packet;
61 61
@@ -102,7 +102,7 @@ reply_to_dns (void *cls, uint32_t rd_count,
102 struct InterceptLookupHandle *ilh = cls; 102 struct InterceptLookupHandle *ilh = cls;
103 struct GNUNET_DNSPARSER_Packet *packet = ilh->packet; 103 struct GNUNET_DNSPARSER_Packet *packet = ilh->packet;
104 struct GNUNET_DNSPARSER_Query *query = &packet->queries[0]; 104 struct GNUNET_DNSPARSER_Query *query = &packet->queries[0];
105 uint32_t i; 105 uint32_t i;
106 size_t len; 106 size_t len;
107 int ret; 107 int ret;
108 char *buf; 108 char *buf;
@@ -110,7 +110,7 @@ reply_to_dns (void *cls, uint32_t rd_count,
110 unsigned int skip_answers; 110 unsigned int skip_answers;
111 unsigned int skip_additional; 111 unsigned int skip_additional;
112 size_t off; 112 size_t off;
113 113
114 /* Put records in the DNS packet */ 114 /* Put records in the DNS packet */
115 num_answers = 0; 115 num_answers = 0;
116 for (i=0; i < rd_count; i++) 116 for (i=0; i < rd_count; i++)
@@ -151,7 +151,7 @@ reply_to_dns (void *cls, uint32_t rd_count,
151 } 151 }
152 break; 152 break;
153 case GNUNET_DNSPARSER_TYPE_SOA: 153 case GNUNET_DNSPARSER_TYPE_SOA:
154 answer_records[i - skip_answers].data.soa 154 answer_records[i - skip_answers].data.soa
155 = GNUNET_DNSPARSER_parse_soa (rd[i].data, 155 = GNUNET_DNSPARSER_parse_soa (rd[i].data,
156 rd[i].data_size, 156 rd[i].data_size,
157 &off); 157 &off);
@@ -167,7 +167,7 @@ reply_to_dns (void *cls, uint32_t rd_count,
167 skip_answers++; 167 skip_answers++;
168 break; 168 break;
169 case GNUNET_DNSPARSER_TYPE_MX: 169 case GNUNET_DNSPARSER_TYPE_MX:
170 answer_records[i - skip_answers].data.mx 170 answer_records[i - skip_answers].data.mx
171 = GNUNET_DNSPARSER_parse_mx (rd[i].data, 171 = GNUNET_DNSPARSER_parse_mx (rd[i].data,
172 rd[i].data_size, 172 rd[i].data_size,
173 &off); 173 &off);
@@ -196,7 +196,7 @@ reply_to_dns (void *cls, uint32_t rd_count,
196 case GNUNET_DNSPARSER_TYPE_NS: 196 case GNUNET_DNSPARSER_TYPE_NS:
197 case GNUNET_DNSPARSER_TYPE_CNAME: 197 case GNUNET_DNSPARSER_TYPE_CNAME:
198 case GNUNET_DNSPARSER_TYPE_PTR: 198 case GNUNET_DNSPARSER_TYPE_PTR:
199 additional_records[i - skip_additional].data.hostname 199 additional_records[i - skip_additional].data.hostname
200 = GNUNET_DNSPARSER_parse_name (rd[i].data, 200 = GNUNET_DNSPARSER_parse_name (rd[i].data,
201 rd[i].data_size, 201 rd[i].data_size,
202 &off); 202 &off);
@@ -208,7 +208,7 @@ reply_to_dns (void *cls, uint32_t rd_count,
208 } 208 }
209 break; 209 break;
210 case GNUNET_DNSPARSER_TYPE_SOA: 210 case GNUNET_DNSPARSER_TYPE_SOA:
211 additional_records[i - skip_additional].data.soa 211 additional_records[i - skip_additional].data.soa
212 = GNUNET_DNSPARSER_parse_soa (rd[i].data, 212 = GNUNET_DNSPARSER_parse_soa (rd[i].data,
213 rd[i].data_size, 213 rd[i].data_size,
214 &off); 214 &off);
@@ -220,7 +220,7 @@ reply_to_dns (void *cls, uint32_t rd_count,
220 } 220 }
221 break; 221 break;
222 case GNUNET_DNSPARSER_TYPE_MX: 222 case GNUNET_DNSPARSER_TYPE_MX:
223 additional_records[i - skip_additional].data.mx 223 additional_records[i - skip_additional].data.mx
224 = GNUNET_DNSPARSER_parse_mx (rd[i].data, 224 = GNUNET_DNSPARSER_parse_mx (rd[i].data,
225 rd[i].data_size, 225 rd[i].data_size,
226 &off); 226 &off);
@@ -242,7 +242,7 @@ reply_to_dns (void *cls, uint32_t rd_count,
242 } 242 }
243 GNUNET_break (0 == (rd[i - skip_additional].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); 243 GNUNET_break (0 == (rd[i - skip_additional].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION));
244 additional_records[i - skip_additional].expiration_time.abs_value_us = rd[i].expiration_time; 244 additional_records[i - skip_additional].expiration_time.abs_value_us = rd[i].expiration_time;
245 additional_records[i - skip_additional].dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET; 245 additional_records[i - skip_additional].dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET;
246 } 246 }
247 } 247 }
248 packet->num_answers = num_answers - skip_answers; 248 packet->num_answers = num_answers - skip_answers;
@@ -261,14 +261,14 @@ reply_to_dns (void *cls, uint32_t rd_count,
261 { 261 {
262 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 262 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
263 _("Error converting GNS response to DNS response!\n")); 263 _("Error converting GNS response to DNS response!\n"));
264 } 264 }
265 else 265 else
266 { 266 {
267 GNUNET_DNS_request_answer (ilh->request_handle, 267 GNUNET_DNS_request_answer (ilh->request_handle,
268 len, 268 len,
269 buf); 269 buf);
270 GNUNET_free (buf); 270 GNUNET_free (buf);
271 } 271 }
272 packet->num_answers = 0; 272 packet->num_answers = 0;
273 packet->answers = NULL; 273 packet->answers = NULL;
274 packet->num_additional_records = 0; 274 packet->num_additional_records = 0;
@@ -297,7 +297,7 @@ handle_dns_request (void *cls,
297 struct GNUNET_DNSPARSER_Packet *p; 297 struct GNUNET_DNSPARSER_Packet *p;
298 struct InterceptLookupHandle *ilh; 298 struct InterceptLookupHandle *ilh;
299 299
300 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 300 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
301 "Hijacked a DNS request. Processing.\n"); 301 "Hijacked a DNS request. Processing.\n");
302 if (NULL == (p = GNUNET_DNSPARSER_parse (request, request_length))) 302 if (NULL == (p = GNUNET_DNSPARSER_parse (request, request_length)))
303 { 303 {
@@ -307,7 +307,7 @@ handle_dns_request (void *cls,
307 GNUNET_DNSPARSER_free_packet (p); 307 GNUNET_DNSPARSER_free_packet (p);
308 return; 308 return;
309 } 309 }
310 310
311 /* Check TLD and decide if we or legacy dns is responsible */ 311 /* Check TLD and decide if we or legacy dns is responsible */
312 if (1 != p->num_queries) 312 if (1 != p->num_queries)
313 { 313 {
@@ -318,7 +318,7 @@ handle_dns_request (void *cls,
318 return; 318 return;
319 } 319 }
320 320
321 /* Check for GNS TLDs. */ 321 /* Check for GNS TLDs. */
322 if ( (GNUNET_YES == is_gnu_tld (p->queries[0].name)) || 322 if ( (GNUNET_YES == is_gnu_tld (p->queries[0].name)) ||
323 (GNUNET_YES == is_zkey_tld (p->queries[0].name)) || 323 (GNUNET_YES == is_zkey_tld (p->queries[0].name)) ||
324 (0 == strcmp (p->queries[0].name, GNUNET_GNS_TLD)) ) 324 (0 == strcmp (p->queries[0].name, GNUNET_GNS_TLD)) )
@@ -328,8 +328,8 @@ handle_dns_request (void *cls,
328 GNUNET_CONTAINER_DLL_insert (ilh_head, ilh_tail, ilh); 328 GNUNET_CONTAINER_DLL_insert (ilh_head, ilh_tail, ilh);
329 ilh->packet = p; 329 ilh->packet = p;
330 ilh->request_handle = rh; 330 ilh->request_handle = rh;
331 ilh->lookup = GNS_resolver_lookup (&zone, 331 ilh->lookup = GNS_resolver_lookup (&zone,
332 p->queries[0].type, 332 p->queries[0].type,
333 p->queries[0].name, 333 p->queries[0].name,
334 NULL /* FIXME: enable shorten for DNS intercepts? */, 334 NULL /* FIXME: enable shorten for DNS intercepts? */,
335 GNUNET_NO, 335 GNUNET_NO,
@@ -338,7 +338,7 @@ handle_dns_request (void *cls,
338 } 338 }
339 /* This request does not concern us. Forward to real DNS. */ 339 /* This request does not concern us. Forward to real DNS. */
340 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 340 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
341 "Request for `%s' is forwarded to DNS untouched.\n", 341 "Request for `%s' is forwarded to DNS untouched.\n",
342 p->queries[0].name); 342 p->queries[0].name);
343 GNUNET_DNS_request_forward (rh); 343 GNUNET_DNS_request_forward (rh);
344 GNUNET_DNSPARSER_free_packet (p); 344 GNUNET_DNSPARSER_free_packet (p);
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index 110263eee..7a7c1633e 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -93,10 +93,10 @@ struct AuthorityChain
93 struct GNS_ResolverHandle *rh; 93 struct GNS_ResolverHandle *rh;
94 94
95 /** 95 /**
96 * label/name corresponding to the authority 96 * label/name corresponding to the authority
97 */ 97 */
98 char *label; 98 char *label;
99 99
100 /** 100 /**
101 * #GNUNET_YES if the authority was a GNS authority, 101 * #GNUNET_YES if the authority was a GNS authority,
102 * #GNUNET_NO if the authority was a DNS authority. 102 * #GNUNET_NO if the authority was a DNS authority.
@@ -110,7 +110,7 @@ struct AuthorityChain
110 { 110 {
111 111
112 /** 112 /**
113 * The zone of the GNS authority 113 * The zone of the GNS authority
114 */ 114 */
115 struct GNUNET_CRYPTO_EccPublicSignKey gns_authority; 115 struct GNUNET_CRYPTO_EccPublicSignKey gns_authority;
116 116
@@ -133,7 +133,7 @@ struct AuthorityChain
133 } dns_authority; 133 } dns_authority;
134 134
135 } authority_info; 135 } authority_info;
136 136
137}; 137};
138 138
139 139
@@ -180,10 +180,10 @@ struct DnsResult
180/** 180/**
181 * Closure for #vpn_allocation_cb. 181 * Closure for #vpn_allocation_cb.
182 */ 182 */
183struct VpnContext 183struct VpnContext
184{ 184{
185 185
186 /** 186 /**
187 * Which resolution process are we processing. 187 * Which resolution process are we processing.
188 */ 188 */
189 struct GNS_ResolverHandle *rh; 189 struct GNS_ResolverHandle *rh;
@@ -197,12 +197,12 @@ struct VpnContext
197 * Number of records serialized in 'rd_data'. 197 * Number of records serialized in 'rd_data'.
198 */ 198 */
199 unsigned int rd_count; 199 unsigned int rd_count;
200 200
201 /** 201 /**
202 * Serialized records. 202 * Serialized records.
203 */ 203 */
204 char *rd_data; 204 char *rd_data;
205 205
206 /** 206 /**
207 * Number of bytes in 'rd_data'. 207 * Number of bytes in 'rd_data'.
208 */ 208 */
@@ -212,38 +212,38 @@ struct VpnContext
212 212
213/** 213/**
214 * Handle to a currenty pending resolution. On result (positive or 214 * Handle to a currenty pending resolution. On result (positive or
215 * negative) the #GNS_ResultProcessor is called. 215 * negative) the #GNS_ResultProcessor is called.
216 */ 216 */
217struct GNS_ResolverHandle 217struct GNS_ResolverHandle
218{ 218{
219 219
220 /** 220 /**
221 * DLL 221 * DLL
222 */ 222 */
223 struct GNS_ResolverHandle *next; 223 struct GNS_ResolverHandle *next;
224 224
225 /** 225 /**
226 * DLL 226 * DLL
227 */ 227 */
228 struct GNS_ResolverHandle *prev; 228 struct GNS_ResolverHandle *prev;
229 229
230 /** 230 /**
231 * The top-level GNS authoritative zone to query 231 * The top-level GNS authoritative zone to query
232 */ 232 */
233 struct GNUNET_CRYPTO_EccPublicSignKey authority_zone; 233 struct GNUNET_CRYPTO_EccPublicSignKey authority_zone;
234 234
235 /** 235 /**
236 * called when resolution phase finishes 236 * called when resolution phase finishes
237 */ 237 */
238 GNS_ResultProcessor proc; 238 GNS_ResultProcessor proc;
239 239
240 /** 240 /**
241 * closure passed to proc 241 * closure passed to proc
242 */ 242 */
243 void* proc_cls; 243 void* proc_cls;
244 244
245 /** 245 /**
246 * Handle for DHT lookups. should be NULL if no lookups are in progress 246 * Handle for DHT lookups. should be NULL if no lookups are in progress
247 */ 247 */
248 struct GNUNET_DHT_GetHandle *get_handle; 248 struct GNUNET_DHT_GetHandle *get_handle;
249 249
@@ -274,12 +274,12 @@ struct GNS_ResolverHandle
274 struct GNUNET_CONTAINER_HeapNode *dht_heap_node; 274 struct GNUNET_CONTAINER_HeapNode *dht_heap_node;
275 275
276 /** 276 /**
277 * DLL to store the authority chain 277 * DLL to store the authority chain
278 */ 278 */
279 struct AuthorityChain *ac_head; 279 struct AuthorityChain *ac_head;
280 280
281 /** 281 /**
282 * DLL to store the authority chain 282 * DLL to store the authority chain
283 */ 283 */
284 struct AuthorityChain *ac_tail; 284 struct AuthorityChain *ac_tail;
285 285
@@ -294,7 +294,7 @@ struct GNS_ResolverHandle
294 GNUNET_SCHEDULER_TaskIdentifier task_id; 294 GNUNET_SCHEDULER_TaskIdentifier task_id;
295 295
296 /** 296 /**
297 * The name to resolve 297 * The name to resolve
298 */ 298 */
299 char *name; 299 char *name;
300 300
@@ -314,7 +314,7 @@ struct GNS_ResolverHandle
314 size_t name_resolution_pos; 314 size_t name_resolution_pos;
315 315
316 /** 316 /**
317 * Use only cache 317 * Use only cache
318 */ 318 */
319 int only_cached; 319 int only_cached;
320 320
@@ -325,7 +325,7 @@ struct GNS_ResolverHandle
325 325
326 /** 326 /**
327 * We increment the loop limiter for each step in a recursive 327 * We increment the loop limiter for each step in a recursive
328 * resolution. If it passes our threshold (i.e. due to 328 * resolution. If it passes our threshold (i.e. due to
329 * self-recursion in the resolution, i.e CNAME fun), we stop. 329 * self-recursion in the resolution, i.e CNAME fun), we stop.
330 */ 330 */
331 unsigned int loop_limiter; 331 unsigned int loop_limiter;
@@ -470,7 +470,7 @@ is_canonical (const char *name)
470 if ('_' != name[0]) 470 if ('_' != name[0])
471 return GNUNET_NO; 471 return GNUNET_NO;
472 pos = &name[1]; 472 pos = &name[1];
473 while (NULL != (dot = strchr (pos, '.'))) 473 while (NULL != (dot = strchr (pos, '.')))
474 if ('_' != dot[1]) 474 if ('_' != dot[1])
475 return GNUNET_NO; 475 return GNUNET_NO;
476 else 476 else
@@ -530,8 +530,8 @@ fail_resolution (void *cls,
530/* Don't have this on W32, here's a naive implementation 530/* Don't have this on W32, here's a naive implementation
531 * Was somehow removed on OS X ... */ 531 * Was somehow removed on OS X ... */
532void * 532void *
533memrchr (const void *s, 533memrchr (const void *s,
534 int c, 534 int c,
535 size_t n) 535 size_t n)
536{ 536{
537 const unsigned char *ucs = s; 537 const unsigned char *ucs = s;
@@ -567,7 +567,7 @@ resolver_lookup_get_next_label (struct GNS_ResolverHandle *rh)
567 /* done, this was the last one */ 567 /* done, this was the last one */
568 len = rh->name_resolution_pos; 568 len = rh->name_resolution_pos;
569 rp = rh->name; 569 rp = rh->name;
570 rh->name_resolution_pos = 0; 570 rh->name_resolution_pos = 0;
571 } 571 }
572 else 572 else
573 { 573 {
@@ -575,8 +575,8 @@ resolver_lookup_get_next_label (struct GNS_ResolverHandle *rh)
575 len = rh->name_resolution_pos - (dot - rh->name) - 1; 575 len = rh->name_resolution_pos - (dot - rh->name) - 1;
576 rp = dot + 1; 576 rp = dot + 1;
577 rh->name_resolution_pos = dot - rh->name; 577 rh->name_resolution_pos = dot - rh->name;
578 } 578 }
579 return GNUNET_strndup (rp, len); 579 return GNUNET_strndup (rp, len);
580} 580}
581 581
582 582
@@ -617,7 +617,7 @@ transmit_lookup_dns_result (struct GNS_ResolverHandle *rh)
617 i++; 617 i++;
618 } 618 }
619 GNUNET_assert (i == n); 619 GNUNET_assert (i == n);
620 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 620 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
621 "Transmitting standard DNS result with %u records\n", 621 "Transmitting standard DNS result with %u records\n",
622 n); 622 n);
623 rh->proc (rh->proc_cls, 623 rh->proc (rh->proc_cls,
@@ -754,7 +754,7 @@ dns_result_parser (void *cls,
754 rh->dns_request = NULL; 754 rh->dns_request = NULL;
755 GNUNET_SCHEDULER_cancel (rh->task_id); 755 GNUNET_SCHEDULER_cancel (rh->task_id);
756 rh->task_id = GNUNET_SCHEDULER_NO_TASK; 756 rh->task_id = GNUNET_SCHEDULER_NO_TASK;
757 p = GNUNET_DNSPARSER_parse ((const char *) dns, 757 p = GNUNET_DNSPARSER_parse ((const char *) dns,
758 dns_len); 758 dns_len);
759 if (NULL == p) 759 if (NULL == p)
760 { 760 {
@@ -776,7 +776,7 @@ dns_result_parser (void *cls,
776 rh->name = GNUNET_strdup (p->answers[0].data.hostname); 776 rh->name = GNUNET_strdup (p->answers[0].data.hostname);
777 start_resolver_lookup (rh); 777 start_resolver_lookup (rh);
778 GNUNET_DNSPARSER_free_packet (p); 778 GNUNET_DNSPARSER_free_packet (p);
779 return; 779 return;
780 } 780 }
781 /* FIXME: add DNAME support */ 781 /* FIXME: add DNAME support */
782 782
@@ -798,7 +798,7 @@ dns_result_parser (void *cls,
798 rec = &p->answers[i]; 798 rec = &p->answers[i];
799 else if (i < p->num_answers + p->num_authority_records) 799 else if (i < p->num_answers + p->num_authority_records)
800 rec = &p->authority_records[i - p->num_answers]; 800 rec = &p->authority_records[i - p->num_answers];
801 else 801 else
802 rec = &p->authority_records[i - p->num_answers - p->num_authority_records]; 802 rec = &p->authority_records[i - p->num_answers - p->num_authority_records];
803 /* As we copied the full DNS name to 'rh->ac_tail->label', this 803 /* As we copied the full DNS name to 'rh->ac_tail->label', this
804 should be the correct check to see if this record is actually 804 should be the correct check to see if this record is actually
@@ -909,7 +909,7 @@ dns_result_parser (void *cls,
909 } 909 }
910 rh->proc (rh->proc_cls, rd_count - skip, rd); 910 rh->proc (rh->proc_cls, rd_count - skip, rd);
911 GNS_resolver_lookup_cancel (rh); 911 GNS_resolver_lookup_cancel (rh);
912 } 912 }
913 GNUNET_DNSPARSER_free_packet (p); 913 GNUNET_DNSPARSER_free_packet (p);
914} 914}
915 915
@@ -963,7 +963,7 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh)
963 UINT16_MAX); 963 UINT16_MAX);
964 p->flags.opcode = GNUNET_TUN_DNS_OPCODE_QUERY; 964 p->flags.opcode = GNUNET_TUN_DNS_OPCODE_QUERY;
965 p->flags.recursion_desired = 1; 965 p->flags.recursion_desired = 1;
966 if (GNUNET_OK != 966 if (GNUNET_OK !=
967 GNUNET_DNSPARSER_pack (p, 1024, &dns_request, &dns_request_length)) 967 GNUNET_DNSPARSER_pack (p, 1024, &dns_request, &dns_request_length))
968 { 968 {
969 GNUNET_break (0); 969 GNUNET_break (0);
@@ -993,7 +993,7 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh)
993 * Merge it into our chain. 993 * Merge it into our chain.
994 * 994 *
995 * @param rh resolution we are performing 995 * @param rh resolution we are performing
996 * @param cname value of the cname record we got for the current 996 * @param cname value of the cname record we got for the current
997 * authority chain tail 997 * authority chain tail
998 */ 998 */
999static void 999static void
@@ -1030,13 +1030,13 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
1030 ac = GNUNET_new (struct AuthorityChain); 1030 ac = GNUNET_new (struct AuthorityChain);
1031 ac->rh = rh; 1031 ac->rh = rh;
1032 ac->gns_authority = GNUNET_YES; 1032 ac->gns_authority = GNUNET_YES;
1033 ac->authority_info.gns_authority = rh->ac_tail->authority_info.gns_authority; 1033 ac->authority_info.gns_authority = rh->ac_tail->authority_info.gns_authority;
1034 ac->label = resolver_lookup_get_next_label (rh); 1034 ac->label = resolver_lookup_get_next_label (rh);
1035 /* tigger shortening */ 1035 /* tigger shortening */
1036 if (NULL != rh->shorten_key) 1036 if (NULL != rh->shorten_key)
1037 GNS_shorten_start (rh->ac_tail->label, 1037 GNS_shorten_start (rh->ac_tail->label,
1038 &ac->authority_info.gns_authority, 1038 &ac->authority_info.gns_authority,
1039 rh->shorten_key); 1039 rh->shorten_key);
1040 /* add AC to tail */ 1040 /* add AC to tail */
1041 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, 1041 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
1042 rh->ac_tail, 1042 rh->ac_tail,
@@ -1076,7 +1076,7 @@ handle_gns_resolution_result (void *cls,
1076 * will match 'result_af' from the request 1076 * will match 'result_af' from the request
1077 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af') 1077 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af')
1078 * that the VPN allocated for the redirection; 1078 * that the VPN allocated for the redirection;
1079 * traffic to this IP will now be redirected to the 1079 * traffic to this IP will now be redirected to the
1080 * specified target peer; NULL on error 1080 * specified target peer; NULL on error
1081 */ 1081 */
1082static void 1082static void
@@ -1102,7 +1102,7 @@ vpn_allocation_cb (void *cls,
1102 { 1102 {
1103 switch (af) 1103 switch (af)
1104 { 1104 {
1105 case AF_INET: 1105 case AF_INET:
1106 rd[i].record_type = GNUNET_DNSPARSER_TYPE_A; 1106 rd[i].record_type = GNUNET_DNSPARSER_TYPE_A;
1107 rd[i].data_size = sizeof (struct in_addr); 1107 rd[i].data_size = sizeof (struct in_addr);
1108 rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (VPN_TIMEOUT).abs_value_us; 1108 rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (VPN_TIMEOUT).abs_value_us;
@@ -1118,12 +1118,12 @@ vpn_allocation_cb (void *cls,
1118 break; 1118 break;
1119 default: 1119 default:
1120 GNUNET_assert (0); 1120 GNUNET_assert (0);
1121 } 1121 }
1122 break; 1122 break;
1123 } 1123 }
1124 } 1124 }
1125 GNUNET_assert (i < vpn_ctx->rd_count); 1125 GNUNET_assert (i < vpn_ctx->rd_count);
1126 handle_gns_resolution_result (rh, 1126 handle_gns_resolution_result (rh,
1127 vpn_ctx->rd_count, 1127 vpn_ctx->rd_count,
1128 rd); 1128 rd);
1129 GNUNET_free (vpn_ctx->rd_data); 1129 GNUNET_free (vpn_ctx->rd_data);
@@ -1168,7 +1168,7 @@ handle_gns_resolution_result (void *cls,
1168 "Resolution succeeded for `%s' in zone %s, got %u records\n", 1168 "Resolution succeeded for `%s' in zone %s, got %u records\n",
1169 rh->ac_tail->label, 1169 rh->ac_tail->label,
1170 GNUNET_NAMESTORE_z2s (&rh->ac_tail->authority_info.gns_authority), 1170 GNUNET_NAMESTORE_z2s (&rh->ac_tail->authority_info.gns_authority),
1171 rd_count); 1171 rd_count);
1172 if (0 == rh->name_resolution_pos) 1172 if (0 == rh->name_resolution_pos)
1173 { 1173 {
1174 /* top-level match, are we done yet? */ 1174 /* top-level match, are we done yet? */
@@ -1188,10 +1188,10 @@ handle_gns_resolution_result (void *cls,
1188 GNS_resolver_lookup_cancel (rh); 1188 GNS_resolver_lookup_cancel (rh);
1189 return; 1189 return;
1190 } 1190 }
1191 handle_gns_cname_result (rh, 1191 handle_gns_cname_result (rh,
1192 cname); 1192 cname);
1193 GNUNET_free (cname); 1193 GNUNET_free (cname);
1194 return; 1194 return;
1195 } 1195 }
1196 /* If A/AAAA was requested, but we got a VPN 1196 /* If A/AAAA was requested, but we got a VPN
1197 record, we convert it to A/AAAA using GNUnet VPN */ 1197 record, we convert it to A/AAAA using GNUnet VPN */
@@ -1211,7 +1211,7 @@ handle_gns_resolution_result (void *cls,
1211 GNUNET_break_op (0); 1211 GNUNET_break_op (0);
1212 rh->proc (rh->proc_cls, 0, NULL); 1212 rh->proc (rh->proc_cls, 0, NULL);
1213 GNS_resolver_lookup_cancel (rh); 1213 GNS_resolver_lookup_cancel (rh);
1214 return; 1214 return;
1215 } 1215 }
1216 vpn = (const struct GNUNET_TUN_GnsVpnRecord *) rd[i].data; 1216 vpn = (const struct GNUNET_TUN_GnsVpnRecord *) rd[i].data;
1217 vname = (const char *) &vpn[1]; 1217 vname = (const char *) &vpn[1];
@@ -1300,7 +1300,7 @@ handle_gns_resolution_result (void *cls,
1300 rd_off++; 1300 rd_off++;
1301 } 1301 }
1302 } 1302 }
1303 GNUNET_free_non_null (cname); 1303 GNUNET_free_non_null (cname);
1304 } 1304 }
1305 break; 1305 break;
1306 case GNUNET_DNSPARSER_TYPE_SOA: 1306 case GNUNET_DNSPARSER_TYPE_SOA:
@@ -1337,7 +1337,7 @@ handle_gns_resolution_result (void *cls,
1337 } 1337 }
1338 } 1338 }
1339 if (NULL != soa) 1339 if (NULL != soa)
1340 GNUNET_DNSPARSER_free_soa (soa); 1340 GNUNET_DNSPARSER_free_soa (soa);
1341 } 1341 }
1342 break; 1342 break;
1343 case GNUNET_DNSPARSER_TYPE_MX: 1343 case GNUNET_DNSPARSER_TYPE_MX:
@@ -1373,7 +1373,7 @@ handle_gns_resolution_result (void *cls,
1373 } 1373 }
1374 } 1374 }
1375 if (NULL != mx) 1375 if (NULL != mx)
1376 GNUNET_DNSPARSER_free_mx (mx); 1376 GNUNET_DNSPARSER_free_mx (mx);
1377 } 1377 }
1378 break; 1378 break;
1379 case GNUNET_DNSPARSER_TYPE_SRV: 1379 case GNUNET_DNSPARSER_TYPE_SRV:
@@ -1381,7 +1381,7 @@ handle_gns_resolution_result (void *cls,
1381 struct GNUNET_DNSPARSER_SrvRecord *srv; 1381 struct GNUNET_DNSPARSER_SrvRecord *srv;
1382 1382
1383 off = 0; 1383 off = 0;
1384 /* FIXME: passing rh->name here is is not necessarily what we want 1384 /* FIXME: passing rh->name here is is not necessarily what we want
1385 (SRV support not finished) */ 1385 (SRV support not finished) */
1386 srv = GNUNET_DNSPARSER_parse_srv (rh->name, 1386 srv = GNUNET_DNSPARSER_parse_srv (rh->name,
1387 rd[i].data, 1387 rd[i].data,
@@ -1413,7 +1413,7 @@ handle_gns_resolution_result (void *cls,
1413 } 1413 }
1414 } 1414 }
1415 if (NULL != srv) 1415 if (NULL != srv)
1416 GNUNET_DNSPARSER_free_srv (srv); 1416 GNUNET_DNSPARSER_free_srv (srv);
1417 } 1417 }
1418 break; 1418 break;
1419 case GNUNET_NAMESTORE_TYPE_PKEY: 1419 case GNUNET_NAMESTORE_TYPE_PKEY:
@@ -1421,7 +1421,7 @@ handle_gns_resolution_result (void *cls,
1421 if (NULL != rh->shorten_key) 1421 if (NULL != rh->shorten_key)
1422 { 1422 {
1423 struct GNUNET_CRYPTO_EccPublicSignKey pub; 1423 struct GNUNET_CRYPTO_EccPublicSignKey pub;
1424 1424
1425 if (rd[i].data_size != sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) 1425 if (rd[i].data_size != sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))
1426 { 1426 {
1427 GNUNET_break_op (0); 1427 GNUNET_break_op (0);
@@ -1439,11 +1439,11 @@ handle_gns_resolution_result (void *cls,
1439 break; 1439 break;
1440 } 1440 }
1441 } 1441 }
1442 1442
1443 /* yes, we are done, return result */ 1443 /* yes, we are done, return result */
1444 rh->proc (rh->proc_cls, rd_off, rd_new); 1444 rh->proc (rh->proc_cls, rd_off, rd_new);
1445 GNS_resolver_lookup_cancel (rh); 1445 GNS_resolver_lookup_cancel (rh);
1446 return; 1446 return;
1447 } 1447 }
1448 do_recurse: 1448 do_recurse:
1449 /* need to recurse, check if we can */ 1449 /* need to recurse, check if we can */
@@ -1459,7 +1459,7 @@ handle_gns_resolution_result (void *cls,
1459 GNUNET_break_op (0); 1459 GNUNET_break_op (0);
1460 rh->proc (rh->proc_cls, 0, NULL); 1460 rh->proc (rh->proc_cls, 0, NULL);
1461 GNS_resolver_lookup_cancel (rh); 1461 GNS_resolver_lookup_cancel (rh);
1462 return; 1462 return;
1463 } 1463 }
1464 /* expand authority chain */ 1464 /* expand authority chain */
1465 ac = GNUNET_new (struct AuthorityChain); 1465 ac = GNUNET_new (struct AuthorityChain);
@@ -1470,10 +1470,10 @@ handle_gns_resolution_result (void *cls,
1470 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)); 1470 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey));
1471 ac->label = resolver_lookup_get_next_label (rh); 1471 ac->label = resolver_lookup_get_next_label (rh);
1472 /* tigger shortening */ 1472 /* tigger shortening */
1473 if (NULL != rh->shorten_key) 1473 if (NULL != rh->shorten_key)
1474 GNS_shorten_start (rh->ac_tail->label, 1474 GNS_shorten_start (rh->ac_tail->label,
1475 &ac->authority_info.gns_authority, 1475 &ac->authority_info.gns_authority,
1476 rh->shorten_key); 1476 rh->shorten_key);
1477 /* add AC to tail */ 1477 /* add AC to tail */
1478 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, 1478 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
1479 rh->ac_tail, 1479 rh->ac_tail,
@@ -1491,7 +1491,7 @@ handle_gns_resolution_result (void *cls,
1491 GNUNET_break_op (0); 1491 GNUNET_break_op (0);
1492 rh->proc (rh->proc_cls, 0, NULL); 1492 rh->proc (rh->proc_cls, 0, NULL);
1493 GNS_resolver_lookup_cancel (rh); 1493 GNS_resolver_lookup_cancel (rh);
1494 return; 1494 return;
1495 } 1495 }
1496 /* find associated A/AAAA record */ 1496 /* find associated A/AAAA record */
1497 sa = NULL; 1497 sa = NULL;
@@ -1506,7 +1506,7 @@ handle_gns_resolution_result (void *cls,
1506 GNUNET_break_op (0); 1506 GNUNET_break_op (0);
1507 rh->proc (rh->proc_cls, 0, NULL); 1507 rh->proc (rh->proc_cls, 0, NULL);
1508 GNS_resolver_lookup_cancel (rh); 1508 GNS_resolver_lookup_cancel (rh);
1509 return; 1509 return;
1510 } 1510 }
1511 /* FIXME: might want to check if we support IPv4 here, 1511 /* FIXME: might want to check if we support IPv4 here,
1512 and otherwise skip this one and hope we find another */ 1512 and otherwise skip this one and hope we find another */
@@ -1528,7 +1528,7 @@ handle_gns_resolution_result (void *cls,
1528 GNUNET_break_op (0); 1528 GNUNET_break_op (0);
1529 rh->proc (rh->proc_cls, 0, NULL); 1529 rh->proc (rh->proc_cls, 0, NULL);
1530 GNS_resolver_lookup_cancel (rh); 1530 GNS_resolver_lookup_cancel (rh);
1531 return; 1531 return;
1532 } 1532 }
1533 /* FIXME: might want to check if we support IPv6 here, 1533 /* FIXME: might want to check if we support IPv6 here,
1534 and otherwise skip this one and hope we find another */ 1534 and otherwise skip this one and hope we find another */
@@ -1620,7 +1620,7 @@ handle_gns_resolution_result (void *cls,
1620 GNS_resolver_lookup_cancel (rh); 1620 GNS_resolver_lookup_cancel (rh);
1621 return; 1621 return;
1622 } 1622 }
1623 handle_gns_cname_result (rh, 1623 handle_gns_cname_result (rh,
1624 cname); 1624 cname);
1625 GNUNET_free (cname); 1625 GNUNET_free (cname);
1626 return; 1626 return;
@@ -1688,7 +1688,7 @@ handle_dht_response (void *cls,
1688 const struct GNUNET_HashCode *key, 1688 const struct GNUNET_HashCode *key,
1689 const struct GNUNET_PeerIdentity *get_path, 1689 const struct GNUNET_PeerIdentity *get_path,
1690 unsigned int get_path_length, 1690 unsigned int get_path_length,
1691 const struct GNUNET_PeerIdentity *put_path, 1691 const struct GNUNET_PeerIdentity *put_path,
1692 unsigned int put_path_length, 1692 unsigned int put_path_length,
1693 enum GNUNET_BLOCK_Type type, 1693 enum GNUNET_BLOCK_Type type,
1694 size_t size, const void *data) 1694 size_t size, const void *data)
@@ -1697,11 +1697,11 @@ handle_dht_response (void *cls,
1697 struct AuthorityChain *ac = rh->ac_tail; 1697 struct AuthorityChain *ac = rh->ac_tail;
1698 const struct GNUNET_NAMESTORE_Block *block; 1698 const struct GNUNET_NAMESTORE_Block *block;
1699 struct CacheOps *co; 1699 struct CacheOps *co;
1700 1700
1701 GNUNET_DHT_get_stop (rh->get_handle); 1701 GNUNET_DHT_get_stop (rh->get_handle);
1702 rh->get_handle = NULL; 1702 rh->get_handle = NULL;
1703 GNUNET_CONTAINER_heap_remove_node (rh->dht_heap_node); 1703 GNUNET_CONTAINER_heap_remove_node (rh->dht_heap_node);
1704 rh->dht_heap_node = NULL; 1704 rh->dht_heap_node = NULL;
1705 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1705 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1706 "Handling response from the DHT\n"); 1706 "Handling response from the DHT\n");
1707 if (size < sizeof (struct GNUNET_NAMESTORE_Block)) 1707 if (size < sizeof (struct GNUNET_NAMESTORE_Block))
@@ -1710,11 +1710,11 @@ handle_dht_response (void *cls,
1710 GNUNET_break (0); 1710 GNUNET_break (0);
1711 rh->proc (rh->proc_cls, 0, NULL); 1711 rh->proc (rh->proc_cls, 0, NULL);
1712 GNS_resolver_lookup_cancel (rh); 1712 GNS_resolver_lookup_cancel (rh);
1713 return; 1713 return;
1714 } 1714 }
1715 block = data; 1715 block = data;
1716 if (size != 1716 if (size !=
1717 ntohl (block->purpose.size) + 1717 ntohl (block->purpose.size) +
1718 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + 1718 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
1719 sizeof (struct GNUNET_CRYPTO_EccSignature)) 1719 sizeof (struct GNUNET_CRYPTO_EccSignature))
1720 { 1720 {
@@ -1722,7 +1722,7 @@ handle_dht_response (void *cls,
1722 GNUNET_break (0); 1722 GNUNET_break (0);
1723 rh->proc (rh->proc_cls, 0, NULL); 1723 rh->proc (rh->proc_cls, 0, NULL);
1724 GNS_resolver_lookup_cancel (rh); 1724 GNS_resolver_lookup_cancel (rh);
1725 return; 1725 return;
1726 } 1726 }
1727 if (GNUNET_OK != 1727 if (GNUNET_OK !=
1728 GNUNET_NAMESTORE_block_decrypt (block, 1728 GNUNET_NAMESTORE_block_decrypt (block,
@@ -1756,7 +1756,7 @@ handle_dht_response (void *cls,
1756 * @param cls closure with the `struct GNS_ResolverHandle` 1756 * @param cls closure with the `struct GNS_ResolverHandle`
1757 * @param block block that was stored in the namestore 1757 * @param block block that was stored in the namestore
1758 */ 1758 */
1759static void 1759static void
1760handle_namestore_block_response (void *cls, 1760handle_namestore_block_response (void *cls,
1761 const struct GNUNET_NAMESTORE_Block *block) 1761 const struct GNUNET_NAMESTORE_Block *block)
1762{ 1762{
@@ -1879,10 +1879,10 @@ recursive_resolution (void *cls,
1879 GNS_resolver_lookup_cancel (rh); 1879 GNS_resolver_lookup_cancel (rh);
1880 return; 1880 return;
1881 } 1881 }
1882 if (GNUNET_YES == rh->ac_tail->gns_authority) 1882 if (GNUNET_YES == rh->ac_tail->gns_authority)
1883 recursive_gns_resolution_namestore (rh); 1883 recursive_gns_resolution_namestore (rh);
1884 else 1884 else
1885 recursive_dns_resolution (rh); 1885 recursive_dns_resolution (rh);
1886} 1886}
1887 1887
1888 1888
@@ -1919,11 +1919,11 @@ start_resolver_lookup (struct GNS_ResolverHandle *rh)
1919 default: 1919 default:
1920 af = AF_UNSPEC; 1920 af = AF_UNSPEC;
1921 break; 1921 break;
1922 } 1922 }
1923 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1923 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1924 "Doing standard DNS lookup for `%s'\n", 1924 "Doing standard DNS lookup for `%s'\n",
1925 rh->name); 1925 rh->name);
1926 rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name, 1926 rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name,
1927 af, 1927 af,
1928 DNS_LOOKUP_TIMEOUT, 1928 DNS_LOOKUP_TIMEOUT,
1929 &handle_dns_result, 1929 &handle_dns_result,
@@ -2002,7 +2002,7 @@ GNS_resolver_lookup (const struct GNUNET_CRYPTO_EccPublicSignKey *zone,
2002 2002
2003 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2003 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2004 (NULL == shorten_key) 2004 (NULL == shorten_key)
2005 ? "Starting lookup for `%s' with shortening disabled\n" 2005 ? "Starting lookup for `%s' with shortening disabled\n"
2006 : "Starting lookup for `%s' with shortening enabled\n", 2006 : "Starting lookup for `%s' with shortening enabled\n",
2007 name); 2007 name);
2008 rh = GNUNET_new (struct GNS_ResolverHandle); 2008 rh = GNUNET_new (struct GNS_ResolverHandle);
@@ -2153,7 +2153,7 @@ GNS_resolver_done ()
2153 while (NULL != (rh = rlh_head)) 2153 while (NULL != (rh = rlh_head))
2154 { 2154 {
2155 rh->proc (rh->proc_cls, 0, NULL); 2155 rh->proc (rh->proc_cls, 0, NULL);
2156 GNS_resolver_lookup_cancel (rh); 2156 GNS_resolver_lookup_cancel (rh);
2157 } 2157 }
2158 while (NULL != (co = co_head)) 2158 while (NULL != (co = co_head))
2159 { 2159 {
diff --git a/src/gns/gnunet-service-gns_resolver.h b/src/gns/gnunet-service-gns_resolver.h
index 84d4c2bd7..e9916c778 100644
--- a/src/gns/gnunet-service-gns_resolver.h
+++ b/src/gns/gnunet-service-gns_resolver.h
@@ -111,7 +111,7 @@ GNS_resolver_lookup_cancel (struct GNS_ResolverHandle *rh);
111 * @return #GNUNET_YES or #GNUNET_NO 111 * @return #GNUNET_YES or #GNUNET_NO
112 */ 112 */
113int 113int
114is_tld (const char *name, 114is_tld (const char *name,
115 const char *tld); 115 const char *tld);
116 116
117 117
diff --git a/src/gns/gnunet-service-gns_shorten.c b/src/gns/gnunet-service-gns_shorten.c
index 8b69e670c..ff2cab097 100644
--- a/src/gns/gnunet-service-gns_shorten.c
+++ b/src/gns/gnunet-service-gns_shorten.c
@@ -83,12 +83,12 @@ struct GetPseuAuthorityHandle
83 struct GNUNET_CRYPTO_EccPublicSignKey target_zone; 83 struct GNUNET_CRYPTO_EccPublicSignKey target_zone;
84 84
85 /** 85 /**
86 * Handle for DHT lookups. Should be NULL if no lookups are in progress 86 * Handle for DHT lookups. Should be NULL if no lookups are in progress
87 */ 87 */
88 struct GNUNET_DHT_GetHandle *get_handle; 88 struct GNUNET_DHT_GetHandle *get_handle;
89 89
90 /** 90 /**
91 * Handle to namestore request 91 * Handle to namestore request
92 */ 92 */
93 struct GNUNET_NAMESTORE_QueueEntry *namestore_task; 93 struct GNUNET_NAMESTORE_QueueEntry *namestore_task;
94 94
@@ -158,8 +158,8 @@ free_get_pseu_authority_handle (struct GetPseuAuthorityHandle *gph)
158 * @param emsg unused 158 * @param emsg unused
159 */ 159 */
160static void 160static void
161create_pkey_cont (void* cls, 161create_pkey_cont (void* cls,
162 int32_t success, 162 int32_t success,
163 const char *emsg) 163 const char *emsg)
164{ 164{
165 struct GetPseuAuthorityHandle* gph = cls; 165 struct GetPseuAuthorityHandle* gph = cls;
@@ -205,7 +205,7 @@ process_pseu_block_ns (void *cls,
205 } 205 }
206 GNUNET_CRYPTO_ecc_key_get_public_for_signature (&gph->shorten_zone_key, 206 GNUNET_CRYPTO_ecc_key_get_public_for_signature (&gph->shorten_zone_key,
207 &pub); 207 &pub);
208 if (GNUNET_OK != 208 if (GNUNET_OK !=
209 GNUNET_NAMESTORE_block_decrypt (block, 209 GNUNET_NAMESTORE_block_decrypt (block,
210 &pub, 210 &pub,
211 gph->current_label, 211 gph->current_label,
@@ -225,10 +225,10 @@ process_pseu_block_ns (void *cls,
225 * @param gph the handle to our shorten operation 225 * @param gph the handle to our shorten operation
226 * @param label the label to lookup 226 * @param label the label to lookup
227 */ 227 */
228static void 228static void
229perform_pseu_lookup (struct GetPseuAuthorityHandle *gph, 229perform_pseu_lookup (struct GetPseuAuthorityHandle *gph,
230 const char *label) 230 const char *label)
231{ 231{
232 struct GNUNET_CRYPTO_EccPublicSignKey pub; 232 struct GNUNET_CRYPTO_EccPublicSignKey pub;
233 struct GNUNET_HashCode query; 233 struct GNUNET_HashCode query;
234 234
@@ -266,7 +266,7 @@ process_pseu_lookup_ns (void *cls,
266 if (rd_count > 0) 266 if (rd_count > 0)
267 { 267 {
268 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 268 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
269 "Name `%s' already taken, cannot shorten.\n", 269 "Name `%s' already taken, cannot shorten.\n",
270 gph->current_label); 270 gph->current_label);
271 /* if this was not yet the original label, try one more 271 /* if this was not yet the original label, try one more
272 time, this time not using PSEU but the original label */ 272 time, this time not using PSEU but the original label */
@@ -283,7 +283,7 @@ process_pseu_lookup_ns (void *cls,
283 } 283 }
284 /* name is available */ 284 /* name is available */
285 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 285 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
286 "Shortening `%s' to `%s'\n", 286 "Shortening `%s' to `%s'\n",
287 GNUNET_NAMESTORE_z2s (&gph->target_zone), 287 GNUNET_NAMESTORE_z2s (&gph->target_zone),
288 gph->current_label); 288 gph->current_label);
289 new_pkey.expiration_time = UINT64_MAX; 289 new_pkey.expiration_time = UINT64_MAX;
@@ -293,7 +293,7 @@ process_pseu_lookup_ns (void *cls,
293 new_pkey.flags = GNUNET_NAMESTORE_RF_NONE 293 new_pkey.flags = GNUNET_NAMESTORE_RF_NONE
294 | GNUNET_NAMESTORE_RF_PRIVATE 294 | GNUNET_NAMESTORE_RF_PRIVATE
295 | GNUNET_NAMESTORE_RF_PENDING; 295 | GNUNET_NAMESTORE_RF_PENDING;
296 gph->namestore_task 296 gph->namestore_task
297 = GNUNET_NAMESTORE_records_store (namestore_handle, 297 = GNUNET_NAMESTORE_records_store (namestore_handle,
298 &gph->shorten_zone_key, 298 &gph->shorten_zone_key,
299 gph->current_label, 299 gph->current_label,
@@ -309,7 +309,7 @@ process_pseu_lookup_ns (void *cls,
309 * @param pseu the pseu result or NULL 309 * @param pseu the pseu result or NULL
310 */ 310 */
311static void 311static void
312process_pseu_result (struct GetPseuAuthorityHandle* gph, 312process_pseu_result (struct GetPseuAuthorityHandle* gph,
313 const char *pseu) 313 const char *pseu)
314{ 314{
315 if (NULL == pseu) 315 if (NULL == pseu)
@@ -320,7 +320,7 @@ process_pseu_result (struct GetPseuAuthorityHandle* gph,
320 gph->label); 320 gph->label);
321 perform_pseu_lookup (gph, gph->label); 321 perform_pseu_lookup (gph, gph->label);
322 return; 322 return;
323 } 323 }
324 /* check if 'pseu' is taken */ 324 /* check if 'pseu' is taken */
325 perform_pseu_lookup (gph, pseu); 325 perform_pseu_lookup (gph, pseu);
326} 326}
@@ -373,7 +373,7 @@ process_auth_records (void *cls,
373 rd[i].data, 373 rd[i].data,
374 rd[i].data_size); 374 rd[i].data_size);
375 pseu[rd[i].data_size] = '\0'; 375 pseu[rd[i].data_size] = '\0';
376 process_pseu_result (gph, 376 process_pseu_result (gph,
377 pseu); 377 pseu);
378 return; 378 return;
379 } 379 }
@@ -432,18 +432,18 @@ process_auth_discovery_dht_result (void* cls,
432 /* how did this pass DHT block validation!? */ 432 /* how did this pass DHT block validation!? */
433 GNUNET_break (0); 433 GNUNET_break (0);
434 process_pseu_result (gph, NULL); 434 process_pseu_result (gph, NULL);
435 return; 435 return;
436 } 436 }
437 block = data; 437 block = data;
438 if (size != 438 if (size !=
439 ntohl (block->purpose.size) + 439 ntohl (block->purpose.size) +
440 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + 440 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
441 sizeof (struct GNUNET_CRYPTO_EccSignature)) 441 sizeof (struct GNUNET_CRYPTO_EccSignature))
442 { 442 {
443 /* how did this pass DHT block validation!? */ 443 /* how did this pass DHT block validation!? */
444 GNUNET_break (0); 444 GNUNET_break (0);
445 process_pseu_result (gph, NULL); 445 process_pseu_result (gph, NULL);
446 return; 446 return;
447 } 447 }
448 if (GNUNET_OK != 448 if (GNUNET_OK !=
449 GNUNET_NAMESTORE_block_decrypt (block, 449 GNUNET_NAMESTORE_block_decrypt (block,
@@ -455,7 +455,7 @@ process_auth_discovery_dht_result (void* cls,
455 /* other peer encrypted invalid block, complain */ 455 /* other peer encrypted invalid block, complain */
456 GNUNET_break_op (0); 456 GNUNET_break_op (0);
457 process_pseu_result (gph, NULL); 457 process_pseu_result (gph, NULL);
458 return; 458 return;
459 } 459 }
460} 460}
461 461
@@ -479,7 +479,7 @@ process_zone_to_name_discover (void *cls,
479{ 479{
480 struct GetPseuAuthorityHandle* gph = cls; 480 struct GetPseuAuthorityHandle* gph = cls;
481 struct GNUNET_HashCode lookup_key; 481 struct GNUNET_HashCode lookup_key;
482 482
483 gph->namestore_task = NULL; 483 gph->namestore_task = NULL;
484 if (0 != rd_len) 484 if (0 != rd_len)
485 { 485 {
@@ -492,10 +492,10 @@ process_zone_to_name_discover (void *cls,
492 } 492 }
493 /* record does not yet exist, go into DHT to find PSEU record */ 493 /* record does not yet exist, go into DHT to find PSEU record */
494 GNUNET_NAMESTORE_query_from_public_key (&gph->target_zone, 494 GNUNET_NAMESTORE_query_from_public_key (&gph->target_zone,
495 GNUNET_GNS_TLD_PLUS, 495 GNUNET_GNS_TLD_PLUS,
496 &lookup_key); 496 &lookup_key);
497 gph->timeout_task = GNUNET_SCHEDULER_add_delayed (DHT_LOOKUP_TIMEOUT, 497 gph->timeout_task = GNUNET_SCHEDULER_add_delayed (DHT_LOOKUP_TIMEOUT,
498 &handle_auth_discovery_timeout, 498 &handle_auth_discovery_timeout,
499 gph); 499 gph);
500 gph->get_handle = GNUNET_DHT_get_start (dht_handle, 500 gph->get_handle = GNUNET_DHT_get_start (dht_handle,
501 GNUNET_BLOCK_TYPE_GNS_NAMERECORD, 501 GNUNET_BLOCK_TYPE_GNS_NAMERECORD,
diff --git a/src/gns/gnunet_w32nsp_lib.h b/src/gns/gnunet_w32nsp_lib.h
index f20859c7c..bd1360acd 100644
--- a/src/gns/gnunet_w32nsp_lib.h
+++ b/src/gns/gnunet_w32nsp_lib.h
@@ -1,9 +1,9 @@
1#if !defined(GNUENT_W32NSP_LIB_H) 1#if !defined(GNUENT_W32NSP_LIB_H)
2#define GNUENT_W32NSP_LIB_H 2#define GNUENT_W32NSP_LIB_H
3 3
4#include <basetyps.h> 4#include <basetyps.h>
5 5
6/* E0D24085-622C-4A93-9A0018-034469DE28DA */ 6/* E0D24085-622C-4A93-9A0018-034469DE28DA */
7DEFINE_GUID (GNUNET_NAMESPACE_PROVIDER_DNS, 0xE0D24085L, 0x622C, 0x4A93, 0x9A, 0x18, 0x03, 0x44, 0x69, 0xDE, 0x28, 0xDA); 7DEFINE_GUID (GNUNET_NAMESPACE_PROVIDER_DNS, 0xE0D24085L, 0x622C, 0x4A93, 0x9A, 0x18, 0x03, 0x44, 0x69, 0xDE, 0x28, 0xDA);
8 8
9#endif /* GNUENT_W32NSP_LIB_H */ \ No newline at end of file 9#endif /* GNUENT_W32NSP_LIB_H */ \ No newline at end of file
diff --git a/src/gns/nss/nss_gns.c b/src/gns/nss/nss_gns.c
index 29dbfd87b..5991c5a0f 100644
--- a/src/gns/nss/nss_gns.c
+++ b/src/gns/nss/nss_gns.c
@@ -7,12 +7,12 @@
7 it under the terms of the GNU General Public License as published 7 it under the terms of the GNU General Public License as published
8 by the Free Software Foundation; either version 3 of the License, 8 by the Free Software Foundation; either version 3 of the License,
9 or (at your option) any later version. 9 or (at your option) any later version.
10 10
11 nss-mdns is distributed in the hope that it will be useful, but1 11 nss-mdns is distributed in the hope that it will be useful, but1
12 WITHOUT ANY WARRANTY; without even the implied warranty of 12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details. 14 General Public License for more details.
15 15
16 You should have received a copy of the GNU Lesser General Public License 16 You should have received a copy of the GNU Lesser General Public License
17 along with nss-mdns; if not, write to the Free Software 17 along with nss-mdns; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -67,7 +67,7 @@ static int ends_with(const char *name, const char* suffix) {
67 * @return 1 if true 67 * @return 1 if true
68 */ 68 */
69static int verify_name_allowed (const char *name) { 69static int verify_name_allowed (const char *name) {
70 return ends_with(name, ".gnu") || ends_with(name, ".zkey"); 70 return ends_with(name, ".gnu") || ends_with(name, ".zkey");
71} 71}
72 72
73/** 73/**
@@ -96,7 +96,7 @@ enum nss_status _nss_gns_gethostbyname2_r(
96 int i; 96 int i;
97 size_t address_length, l, idx, astart; 97 size_t address_length, l, idx, astart;
98 int name_allowed; 98 int name_allowed;
99 99
100 if (af == AF_UNSPEC) 100 if (af == AF_UNSPEC)
101#ifdef NSS_IPV6_ONLY 101#ifdef NSS_IPV6_ONLY
102 af = AF_INET6; 102 af = AF_INET6;
@@ -105,13 +105,13 @@ enum nss_status _nss_gns_gethostbyname2_r(
105#endif 105#endif
106 106
107#ifdef NSS_IPV4_ONLY 107#ifdef NSS_IPV4_ONLY
108 if (af != AF_INET) 108 if (af != AF_INET)
109#elif NSS_IPV6_ONLY 109#elif NSS_IPV6_ONLY
110 if (af != AF_INET6) 110 if (af != AF_INET6)
111#else 111#else
112 if (af != AF_INET && af != AF_INET6) 112 if (af != AF_INET && af != AF_INET6)
113#endif 113#endif
114 { 114 {
115 *errnop = EINVAL; 115 *errnop = EINVAL;
116 *h_errnop = NO_RECOVERY; 116 *h_errnop = NO_RECOVERY;
117 117
@@ -122,19 +122,19 @@ enum nss_status _nss_gns_gethostbyname2_r(
122 if (buflen < 122 if (buflen <
123 sizeof(char*)+ /* alias names */ 123 sizeof(char*)+ /* alias names */
124 strlen(name)+1) { /* official name */ 124 strlen(name)+1) { /* official name */
125 125
126 *errnop = ERANGE; 126 *errnop = ERANGE;
127 *h_errnop = NO_RECOVERY; 127 *h_errnop = NO_RECOVERY;
128 status = NSS_STATUS_TRYAGAIN; 128 status = NSS_STATUS_TRYAGAIN;
129 129
130 goto finish; 130 goto finish;
131 } 131 }
132 132
133 u.count = 0; 133 u.count = 0;
134 u.data_len = 0; 134 u.data_len = 0;
135 135
136 name_allowed = verify_name_allowed(name); 136 name_allowed = verify_name_allowed(name);
137 137
138 if (name_allowed) { 138 if (name_allowed) {
139 139
140 if (!gns_resolve_name(af, name, &u) == 0) 140 if (!gns_resolve_name(af, name, &u) == 0)
@@ -156,22 +156,22 @@ enum nss_status _nss_gns_gethostbyname2_r(
156 goto finish; 156 goto finish;
157 } 157 }
158 158
159 159
160 /* Alias names */ 160 /* Alias names */
161 *((char**) buffer) = NULL; 161 *((char**) buffer) = NULL;
162 result->h_aliases = (char**) buffer; 162 result->h_aliases = (char**) buffer;
163 idx = sizeof(char*); 163 idx = sizeof(char*);
164 164
165 /* Official name */ 165 /* Official name */
166 strcpy(buffer+idx, name); 166 strcpy(buffer+idx, name);
167 result->h_name = buffer+idx; 167 result->h_name = buffer+idx;
168 idx += strlen(name)+1; 168 idx += strlen(name)+1;
169 169
170 ALIGN(idx); 170 ALIGN(idx);
171 171
172 result->h_addrtype = af; 172 result->h_addrtype = af;
173 result->h_length = address_length; 173 result->h_length = address_length;
174 174
175 /* Check if there's enough space for the addresses */ 175 /* Check if there's enough space for the addresses */
176 if (buflen < idx+u.data_len+sizeof(char*)*(u.count+1)) { 176 if (buflen < idx+u.data_len+sizeof(char*)*(u.count+1)) {
177 *errnop = ERANGE; 177 *errnop = ERANGE;
@@ -195,7 +195,7 @@ enum nss_status _nss_gns_gethostbyname2_r(
195 result->h_addr_list = (char**) (buffer+idx); 195 result->h_addr_list = (char**) (buffer+idx);
196 196
197 status = NSS_STATUS_SUCCESS; 197 status = NSS_STATUS_SUCCESS;
198 198
199finish: 199finish:
200 return status; 200 return status;
201} 201}
@@ -254,9 +254,9 @@ enum nss_status _nss_gns_gethostbyaddr_r(
254 int *h_errnop) { 254 int *h_errnop) {
255 255
256 /* we dont do this */ 256 /* we dont do this */
257 257
258 enum nss_status status = NSS_STATUS_UNAVAIL; 258 enum nss_status status = NSS_STATUS_UNAVAIL;
259 259
260 *errnop = EINVAL; 260 *errnop = EINVAL;
261 *h_errnop = NO_RECOVERY; 261 *h_errnop = NO_RECOVERY;
262 262
diff --git a/src/gns/nss/nss_gns_query.c b/src/gns/nss/nss_gns_query.c
index 359b6aa20..b90fd6d05 100644
--- a/src/gns/nss/nss_gns_query.c
+++ b/src/gns/nss/nss_gns_query.c
@@ -36,9 +36,9 @@
36 * @param u the userdata (result struct) 36 * @param u the userdata (result struct)
37 * @return -1 on error else 0 37 * @return -1 on error else 0
38 */ 38 */
39int 39int
40gns_resolve_name (int af, 40gns_resolve_name (int af,
41 const char *name, 41 const char *name,
42 struct userdata *u) 42 struct userdata *u)
43{ 43{
44 FILE *p; 44 FILE *p;
@@ -47,15 +47,15 @@ gns_resolve_name (int af,
47 47
48 if (AF_INET6 == af) 48 if (AF_INET6 == af)
49 { 49 {
50 if (-1 == asprintf (&cmd, 50 if (-1 == asprintf (&cmd,
51 "%s -t AAAA -u %s\n", 51 "%s -t AAAA -u %s\n",
52 "gnunet-gns -r", name)) 52 "gnunet-gns -r", name))
53 return -1; 53 return -1;
54 } 54 }
55 else 55 else
56 { 56 {
57 if (-1 == asprintf (&cmd, 57 if (-1 == asprintf (&cmd,
58 "%s %s\n", 58 "%s %s\n",
59 "gnunet-gns -r -u", name)) 59 "gnunet-gns -r -u", name))
60 return -1; 60 return -1;
61 } 61 }
diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c
index d28d1ab0b..932900910 100644
--- a/src/gns/plugin_block_gns.c
+++ b/src/gns/plugin_block_gns.c
@@ -77,7 +77,7 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
77 } 77 }
78 return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; 78 return GNUNET_BLOCK_EVALUATION_REQUEST_VALID;
79 } 79 }
80 80
81 /* this is a reply */ 81 /* this is a reply */
82 if (reply_block_size < sizeof (struct GNUNET_NAMESTORE_Block)) 82 if (reply_block_size < sizeof (struct GNUNET_NAMESTORE_Block))
83 { 83 {
@@ -99,7 +99,7 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
99 GNUNET_break_op (0); 99 GNUNET_break_op (0);
100 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 100 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
101 } 101 }
102 if (GNUNET_OK != 102 if (GNUNET_OK !=
103 GNUNET_NAMESTORE_block_verify (block)) 103 GNUNET_NAMESTORE_block_verify (block))
104 { 104 {
105 GNUNET_break_op (0); 105 GNUNET_break_op (0);
diff --git a/src/gns/test_gns_proxy.c b/src/gns/test_gns_proxy.c
index 16c94eced..8563eda2f 100644
--- a/src/gns/test_gns_proxy.c
+++ b/src/gns/test_gns_proxy.c
@@ -220,9 +220,9 @@ curl_main ()
220 } 220 }
221 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download complete, shutting down!\n"); 221 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download complete, shutting down!\n");
222 do_shutdown (); 222 do_shutdown ();
223 return; 223 return;
224 } 224 }
225 GNUNET_assert (CURLM_OK == curl_multi_fdset (multi, &rs, &ws, &es, &max)); 225 GNUNET_assert (CURLM_OK == curl_multi_fdset (multi, &rs, &ws, &es, &max));
226 if ( (CURLM_OK != curl_multi_timeout (multi, &timeout)) || 226 if ( (CURLM_OK != curl_multi_timeout (multi, &timeout)) ||
227 (-1 == timeout) ) 227 (-1 == timeout) )
228 delay = GNUNET_TIME_UNIT_SECONDS; 228 delay = GNUNET_TIME_UNIT_SECONDS;
@@ -239,13 +239,13 @@ curl_main ()
239 &nrs, 239 &nrs,
240 &nws, 240 &nws,
241 &curl_task, 241 &curl_task,
242 NULL); 242 NULL);
243} 243}
244 244
245static void 245static void
246start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 246start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
247{ 247{
248 GNUNET_asprintf (&url, 248 GNUNET_asprintf (&url,
249 "http://%s:%d/hello_world", 249 "http://%s:%d/hello_world",
250 TEST_DOMAIN, PORT); 250 TEST_DOMAIN, PORT);
251 curl = curl_easy_init (); 251 curl = curl_easy_init ();
@@ -280,7 +280,7 @@ disco_ns (void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
280 * will match 'result_af' from the request 280 * will match 'result_af' from the request
281 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af') 281 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af')
282 * that the VPN allocated for the redirection; 282 * that the VPN allocated for the redirection;
283 * traffic to this IP will now be redirected to the 283 * traffic to this IP will now be redirected to the
284 * specified target peer; NULL on error 284 * specified target peer; NULL on error
285 */ 285 */
286static void 286static void
@@ -290,12 +290,12 @@ commence_testing (void *cls, int32_t success, const char *emsg)
290 290
291 if ((emsg != NULL) && (GNUNET_YES != success)) 291 if ((emsg != NULL) && (GNUNET_YES != success))
292 { 292 {
293 fprintf (stderr, 293 fprintf (stderr,
294 "NS failed to create record %s\n", emsg); 294 "NS failed to create record %s\n", emsg);
295 GNUNET_SCHEDULER_shutdown (); 295 GNUNET_SCHEDULER_shutdown ();
296 return; 296 return;
297 } 297 }
298 298
299 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1), start_curl, NULL); 299 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1), start_curl, NULL);
300 300
301} 301}
@@ -306,7 +306,7 @@ commence_testing (void *cls, int32_t success, const char *emsg)
306/** 306/**
307 * Function to keep the HTTP server running. 307 * Function to keep the HTTP server running.
308 */ 308 */
309static void 309static void
310mhd_main (void); 310mhd_main (void);
311 311
312 312
@@ -320,7 +320,7 @@ mhd_task (void *cls,
320} 320}
321 321
322 322
323static void 323static void
324mhd_main () 324mhd_main ()
325{ 325{
326 struct GNUNET_NETWORK_FDSet nrs; 326 struct GNUNET_NETWORK_FDSet nrs;
@@ -355,7 +355,7 @@ mhd_main ()
355 &nrs, 355 &nrs,
356 &nws, 356 &nws,
357 &mhd_task, 357 &mhd_task,
358 NULL); 358 NULL);
359} 359}
360 360
361static void 361static void
@@ -367,7 +367,7 @@ run (void *cls,
367 struct GNUNET_CRYPTO_EccPrivateKey *host_key; 367 struct GNUNET_CRYPTO_EccPrivateKey *host_key;
368 struct GNUNET_NAMESTORE_RecordData rd; 368 struct GNUNET_NAMESTORE_RecordData rd;
369 char *zone_keyfile; 369 char *zone_keyfile;
370 370
371 namestore = GNUNET_NAMESTORE_connect (cfg); 371 namestore = GNUNET_NAMESTORE_connect (cfg);
372 GNUNET_assert (NULL != namestore); 372 GNUNET_assert (NULL != namestore);
373 flags = MHD_USE_DEBUG; 373 flags = MHD_USE_DEBUG;
@@ -396,7 +396,7 @@ run (void *cls,
396 do_shutdown (); 396 do_shutdown ();
397 return; 397 return;
398 } 398 }
399 399
400 proxy_proc = GNUNET_OS_start_process (GNUNET_NO, 400 proxy_proc = GNUNET_OS_start_process (GNUNET_NO,
401 GNUNET_OS_INHERIT_STD_ALL, 401 GNUNET_OS_INHERIT_STD_ALL,
402 NULL, 402 NULL,
@@ -412,7 +412,7 @@ run (void *cls,
412 do_shutdown (); 412 do_shutdown ();
413 return; 413 return;
414 } 414 }
415 415
416 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", 416 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
417 "ZONEKEY", 417 "ZONEKEY",
418 &zone_keyfile)) 418 &zone_keyfile))
diff --git a/src/gns/test_gns_pseu_shorten.c b/src/gns/test_gns_pseu_shorten.c
index 8610179b2..a4c337067 100644
--- a/src/gns/test_gns_pseu_shorten.c
+++ b/src/gns/test_gns_pseu_shorten.c
@@ -127,7 +127,7 @@ end_badly_now ()
127} 127}
128 128
129 129
130static void 130static void
131shutdown_task (void *cls, 131shutdown_task (void *cls,
132 const struct GNUNET_SCHEDULER_TaskContext *tc) 132 const struct GNUNET_SCHEDULER_TaskContext *tc)
133{ 133{
@@ -186,7 +186,7 @@ on_lookup_result (void *cls, uint32_t rd_count,
186 struct in_addr a; 186 struct in_addr a;
187 int i; 187 int i;
188 char* addr; 188 char* addr;
189 189
190 if (rd_count == 0) 190 if (rd_count == 0)
191 { 191 {
192 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 192 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -267,7 +267,7 @@ put_pseu_dht (void *cls, int success)
267 char* nrb_data = NULL; 267 char* nrb_data = NULL;
268 struct GNUNET_CRYPTO_EccSignature *sig; 268 struct GNUNET_CRYPTO_EccSignature *sig;
269 struct GNUNET_NAMESTORE_RecordData rd; 269 struct GNUNET_NAMESTORE_RecordData rd;
270 270
271 memset (&rd, 0, sizeof (struct GNUNET_NAMESTORE_RecordData)); 271 memset (&rd, 0, sizeof (struct GNUNET_NAMESTORE_RecordData));
272 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; 272 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
273 rd.data_size = strlen(TEST_PSEU_ALICE)+1; 273 rd.data_size = strlen(TEST_PSEU_ALICE)+1;
@@ -336,7 +336,7 @@ put_pseu_dht (void *cls, int success)
336 DHT_OPERATION_TIMEOUT, 336 DHT_OPERATION_TIMEOUT,
337 &commence_testing, 337 &commence_testing,
338 NULL); 338 NULL);
339 339
340 GNUNET_free(sig); 340 GNUNET_free(sig);
341 GNUNET_free (nrb); 341 GNUNET_free (nrb);
342} 342}
@@ -357,19 +357,19 @@ put_www_dht (void *cls, int success)
357 struct GNUNET_NAMESTORE_RecordData rd; 357 struct GNUNET_NAMESTORE_RecordData rd;
358 char* ip = TEST_IP; 358 char* ip = TEST_IP;
359 struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr)); 359 struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr));
360 360
361 rd.expiration_time = UINT64_MAX; 361 rd.expiration_time = UINT64_MAX;
362 GNUNET_assert(1 == inet_pton (AF_INET, ip, web)); 362 GNUNET_assert(1 == inet_pton (AF_INET, ip, web));
363 rd.data_size = sizeof(struct in_addr); 363 rd.data_size = sizeof(struct in_addr);
364 rd.data = web; 364 rd.data = web;
365 rd.record_type = GNUNET_DNSPARSER_TYPE_A; 365 rd.record_type = GNUNET_DNSPARSER_TYPE_A;
366 rd.flags = GNUNET_NAMESTORE_RF_NONE; 366 rd.flags = GNUNET_NAMESTORE_RF_NONE;
367 367
368 sig = GNUNET_NAMESTORE_create_signature(alice_key, 368 sig = GNUNET_NAMESTORE_create_signature(alice_key,
369 GNUNET_TIME_UNIT_FOREVER_ABS, 369 GNUNET_TIME_UNIT_FOREVER_ABS,
370 TEST_RECORD_NAME, 370 TEST_RECORD_NAME,
371 &rd, 1); 371 &rd, 1);
372 372
373 GNUNET_break (GNUNET_OK == GNUNET_NAMESTORE_verify_signature (&alice_pkey, 373 GNUNET_break (GNUNET_OK == GNUNET_NAMESTORE_verify_signature (&alice_pkey,
374 GNUNET_TIME_UNIT_FOREVER_ABS, 374 GNUNET_TIME_UNIT_FOREVER_ABS,
375 TEST_RECORD_NAME, 375 TEST_RECORD_NAME,
@@ -443,13 +443,13 @@ put_pkey_dht (void *cls, int32_t success, const char *emsg)
443 char* nrb_data = NULL; 443 char* nrb_data = NULL;
444 struct GNUNET_CRYPTO_EccSignature *sig; 444 struct GNUNET_CRYPTO_EccSignature *sig;
445 struct GNUNET_NAMESTORE_RecordData rd; 445 struct GNUNET_NAMESTORE_RecordData rd;
446 446
447 rd.expiration_time = UINT64_MAX; 447 rd.expiration_time = UINT64_MAX;
448 rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode); 448 rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
449 rd.data = &alice_hash; 449 rd.data = &alice_hash;
450 rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; 450 rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY;
451 rd.flags = GNUNET_NAMESTORE_RF_NONE; 451 rd.flags = GNUNET_NAMESTORE_RF_NONE;
452 452
453 sig = GNUNET_NAMESTORE_create_signature (bob_key, 453 sig = GNUNET_NAMESTORE_create_signature (bob_key,
454 GNUNET_TIME_UNIT_FOREVER_ABS, 454 GNUNET_TIME_UNIT_FOREVER_ABS,
455 TEST_AUTHORITY_ALICE, 455 TEST_AUTHORITY_ALICE,
@@ -474,7 +474,7 @@ put_pkey_dht (void *cls, int32_t success, const char *emsg)
474 { 474 {
475 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n"); 475 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n");
476 ok = 3; 476 ok = 3;
477 477
478 GNUNET_free (our_key); 478 GNUNET_free (our_key);
479 GNUNET_free (bob_key); 479 GNUNET_free (bob_key);
480 GNUNET_free (alice_key); 480 GNUNET_free (alice_key);
@@ -492,7 +492,7 @@ put_pkey_dht (void *cls, int32_t success, const char *emsg)
492 &zone_hash); 492 &zone_hash);
493 GNUNET_CRYPTO_short_hash_double(&zone_hash, &zone_hash_double); 493 GNUNET_CRYPTO_short_hash_double(&zone_hash, &zone_hash_double);
494 GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double); 494 GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double);
495 GNUNET_CRYPTO_hash_xor(&zone_hash_double, &name_hash_double, &xor_hash); 495 GNUNET_CRYPTO_hash_xor(&zone_hash_double, &name_hash_double, &xor_hash);
496 496
497 rd_payload_length += sizeof(struct GNSNameRecordBlock) + 497 rd_payload_length += sizeof(struct GNSNameRecordBlock) +
498 strlen(TEST_AUTHORITY_ALICE) + 1; 498 strlen(TEST_AUTHORITY_ALICE) + 1;
@@ -520,7 +520,7 @@ fin_init_zone (void *cls, int32_t success, const char *emsg)
520 rd.data = &bob_hash; 520 rd.data = &bob_hash;
521 rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; 521 rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY;
522 rd.flags = GNUNET_NAMESTORE_RF_NONE; 522 rd.flags = GNUNET_NAMESTORE_RF_NONE;
523 523
524 GNUNET_NAMESTORE_record_put_by_authority (namestore_handle, 524 GNUNET_NAMESTORE_record_put_by_authority (namestore_handle,
525 our_key, 525 our_key,
526 TEST_AUTHORITY_BOB, 526 TEST_AUTHORITY_BOB,
@@ -560,7 +560,7 @@ do_check (void *cls,
560 char *shorten_keyfile; 560 char *shorten_keyfile;
561 char *our_keyfile; 561 char *our_keyfile;
562 struct GNUNET_NAMESTORE_RecordData rd; 562 struct GNUNET_NAMESTORE_RecordData rd;
563 563
564 cfg = ccfg; 564 cfg = ccfg;
565 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); 565 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
566 566
@@ -572,7 +572,7 @@ do_check (void *cls,
572 end_badly_now(); 572 end_badly_now();
573 return; 573 return;
574 } 574 }
575 575
576 /* dht */ 576 /* dht */
577 dht_handle = GNUNET_DHT_connect(cfg, 1); 577 dht_handle = GNUNET_DHT_connect(cfg, 1);
578 if (NULL == dht_handle) 578 if (NULL == dht_handle)
@@ -591,7 +591,7 @@ do_check (void *cls,
591 GNUNET_free (our_keyfile); 591 GNUNET_free (our_keyfile);
592 return; 592 return;
593 } 593 }
594 594
595 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", 595 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
596 "SHORTEN_ZONEKEY", 596 "SHORTEN_ZONEKEY",
597 &shorten_keyfile)) 597 &shorten_keyfile))
@@ -603,7 +603,7 @@ do_check (void *cls,
603 GNUNET_free (shorten_keyfile); 603 GNUNET_free (shorten_keyfile);
604 return; 604 return;
605 } 605 }
606 606
607 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", 607 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
608 "PRIVATE_ZONEKEY", 608 "PRIVATE_ZONEKEY",
609 &private_keyfile)) 609 &private_keyfile))
@@ -621,7 +621,7 @@ do_check (void *cls,
621 short_key = GNUNET_CRYPTO_ecc_key_create_from_file (shorten_keyfile); 621 short_key = GNUNET_CRYPTO_ecc_key_create_from_file (shorten_keyfile);
622 bob_key = GNUNET_CRYPTO_ecc_key_create (); 622 bob_key = GNUNET_CRYPTO_ecc_key_create ();
623 alice_key = GNUNET_CRYPTO_ecc_key_create (); 623 alice_key = GNUNET_CRYPTO_ecc_key_create ();
624 624
625 GNUNET_free (our_keyfile); 625 GNUNET_free (our_keyfile);
626 GNUNET_free (shorten_keyfile); 626 GNUNET_free (shorten_keyfile);
627 GNUNET_free (private_keyfile); 627 GNUNET_free (private_keyfile);
@@ -636,7 +636,7 @@ do_check (void *cls,
636 GNUNET_CRYPTO_short_hash (&our_pkey, sizeof(our_pkey), &our_zone); 636 GNUNET_CRYPTO_short_hash (&our_pkey, sizeof(our_pkey), &our_zone);
637 GNUNET_CRYPTO_short_hash (&priv_pkey, sizeof(priv_pkey), &priv_zone); 637 GNUNET_CRYPTO_short_hash (&priv_pkey, sizeof(priv_pkey), &priv_zone);
638 GNUNET_CRYPTO_short_hash (&short_pkey, sizeof(short_pkey), &short_zone); 638 GNUNET_CRYPTO_short_hash (&short_pkey, sizeof(short_pkey), &short_zone);
639 639
640 rd.expiration_time = UINT64_MAX; 640 rd.expiration_time = UINT64_MAX;
641 rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode); 641 rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
642 rd.data = &priv_zone; 642 rd.data = &priv_zone;
diff --git a/src/gns/test_gns_revocation.c b/src/gns/test_gns_revocation.c
index 459a40c97..30fe5eb66 100644
--- a/src/gns/test_gns_revocation.c
+++ b/src/gns/test_gns_revocation.c
@@ -92,7 +92,7 @@ end_badly_now ()
92} 92}
93 93
94 94
95static void 95static void
96shutdown_task (void *cls, 96shutdown_task (void *cls,
97 const struct GNUNET_SCHEDULER_TaskContext *tc) 97 const struct GNUNET_SCHEDULER_TaskContext *tc)
98{ 98{
@@ -109,7 +109,7 @@ on_lookup_result(void *cls, uint32_t rd_count,
109 struct in_addr a; 109 struct in_addr a;
110 int i; 110 int i;
111 char* addr; 111 char* addr;
112 112
113 if (GNUNET_SCHEDULER_NO_TASK != die_task) 113 if (GNUNET_SCHEDULER_NO_TASK != die_task)
114 { 114 {
115 GNUNET_SCHEDULER_cancel (die_task); 115 GNUNET_SCHEDULER_cancel (die_task);
@@ -221,7 +221,7 @@ do_check (void *cls,
221 struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr)); 221 struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr));
222 rd.expiration_time = UINT64_MAX; 222 rd.expiration_time = UINT64_MAX;
223 GNUNET_assert(1 == inet_pton (AF_INET, ip, web)); 223 GNUNET_assert(1 == inet_pton (AF_INET, ip, web));
224 224
225 GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash); 225 GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash);
226 226
227 rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode); 227 rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
diff --git a/src/gns/test_gns_simple_shorten.c b/src/gns/test_gns_simple_shorten.c
index 8cab0dbb2..1b383a0bd 100644
--- a/src/gns/test_gns_simple_shorten.c
+++ b/src/gns/test_gns_simple_shorten.c
@@ -135,7 +135,7 @@ process_shorten_result(void* cls, const char* sname)
135 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shorten test succeeded!\n"); 135 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shorten test succeeded!\n");
136 ok = 0; 136 ok = 0;
137 } 137 }
138 138
139 GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); 139 GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
140} 140}
141 141
@@ -205,7 +205,7 @@ void do_check (void *cls,
205 end_badly_now (); 205 end_badly_now ();
206 return; 206 return;
207 } 207 }
208 208
209 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", 209 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
210 "SHORTEN_ZONEKEY", 210 "SHORTEN_ZONEKEY",
211 &shorten_keyfile)) 211 &shorten_keyfile))
@@ -215,7 +215,7 @@ void do_check (void *cls,
215 end_badly_now (); 215 end_badly_now ();
216 return; 216 return;
217 } 217 }
218 218
219 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", 219 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
220 "PRIVATE_ZONEKEY", 220 "PRIVATE_ZONEKEY",
221 &private_keyfile)) 221 &private_keyfile))
@@ -236,7 +236,7 @@ void do_check (void *cls,
236 236
237 GNUNET_free(shorten_keyfile); 237 GNUNET_free(shorten_keyfile);
238 GNUNET_free(private_keyfile); 238 GNUNET_free(private_keyfile);
239 239
240 GNUNET_CRYPTO_ecc_key_get_public_for_signature (our_key, &our_pkey); 240 GNUNET_CRYPTO_ecc_key_get_public_for_signature (our_key, &our_pkey);
241 GNUNET_CRYPTO_ecc_key_get_public_for_signature (alice_key, &alice_pkey); 241 GNUNET_CRYPTO_ecc_key_get_public_for_signature (alice_key, &alice_pkey);
242 GNUNET_CRYPTO_ecc_key_get_public_for_signature (bob_key, &bob_pkey); 242 GNUNET_CRYPTO_ecc_key_get_public_for_signature (bob_key, &bob_pkey);
@@ -251,14 +251,14 @@ void do_check (void *cls,
251 struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr)); 251 struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr));
252 rd.expiration_time = UINT64_MAX; 252 rd.expiration_time = UINT64_MAX;
253 GNUNET_assert(1 == inet_pton (AF_INET, ip, web)); 253 GNUNET_assert(1 == inet_pton (AF_INET, ip, web));
254 254
255 GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash); 255 GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash);
256 256
257 rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode); 257 rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
258 rd.data = &bob_hash; 258 rd.data = &bob_hash;
259 rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; 259 rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY;
260 rd.flags = GNUNET_NAMESTORE_RF_NONE; 260 rd.flags = GNUNET_NAMESTORE_RF_NONE;
261 261
262 /* put bob into our zone */ 262 /* put bob into our zone */
263 GNUNET_NAMESTORE_record_put_by_authority (namestore_handle, 263 GNUNET_NAMESTORE_record_put_by_authority (namestore_handle,
264 our_key, 264 our_key,
@@ -267,7 +267,7 @@ void do_check (void *cls,
267 &rd, 267 &rd,
268 NULL, 268 NULL,
269 NULL); 269 NULL);
270 270
271 /* put alice into bobs zone */ 271 /* put alice into bobs zone */
272 GNUNET_CRYPTO_short_hash(&alice_pkey, sizeof(alice_pkey), &alice_hash); 272 GNUNET_CRYPTO_short_hash(&alice_pkey, sizeof(alice_pkey), &alice_hash);
273 rd.data = &alice_hash; 273 rd.data = &alice_hash;
@@ -305,7 +305,7 @@ void do_check (void *cls,
305 sig, 305 sig,
306 NULL, 306 NULL,
307 NULL); 307 NULL);
308 308
309 rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode); 309 rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
310 rd.data = &alice_hash; 310 rd.data = &alice_hash;
311 rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; 311 rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY;
@@ -336,7 +336,7 @@ main (int argc, char *argv[])
336 "WARNING", 336 "WARNING",
337 NULL); 337 NULL);
338 GNUNET_TESTING_peer_run ("test-gns-simple-shorten", 338 GNUNET_TESTING_peer_run ("test-gns-simple-shorten",
339 "test_gns_simple_lookup.conf", 339 "test_gns_simple_lookup.conf",
340 &do_check, NULL); 340 &do_check, NULL);
341 return ok; 341 return ok;
342} 342}
diff --git a/src/gns/test_gns_simple_srv_lookup.c b/src/gns/test_gns_simple_srv_lookup.c
index 7efa57803..76e564f41 100644
--- a/src/gns/test_gns_simple_srv_lookup.c
+++ b/src/gns/test_gns_simple_srv_lookup.c
@@ -109,7 +109,7 @@ on_lookup_result(void *cls, uint32_t rd_count,
109 int i; 109 int i;
110 uint16_t *srv_data; 110 uint16_t *srv_data;
111 char* srv; 111 char* srv;
112 112
113 if (GNUNET_SCHEDULER_NO_TASK != die_task) 113 if (GNUNET_SCHEDULER_NO_TASK != die_task)
114 { 114 {
115 GNUNET_SCHEDULER_cancel (die_task); 115 GNUNET_SCHEDULER_cancel (die_task);
@@ -229,7 +229,7 @@ do_check (void *cls,
229 229
230 rd.expiration_time = UINT64_MAX; 230 rd.expiration_time = UINT64_MAX;
231 GNUNET_assert(1 == inet_pton (AF_INET, ip, sipserver)); 231 GNUNET_assert(1 == inet_pton (AF_INET, ip, sipserver));
232 232
233 GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash); 233 GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash);
234 234
235 rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode); 235 rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
@@ -262,7 +262,7 @@ do_check (void *cls,
262 NULL, 262 NULL,
263 NULL); 263 NULL);
264 GNUNET_free (sig); 264 GNUNET_free (sig);
265 265
266 rd.data_size = sizeof (struct GNUNET_TUN_DnsSrvRecord)+strlen(TEST_SRV_NAME)+1; 266 rd.data_size = sizeof (struct GNUNET_TUN_DnsSrvRecord)+strlen(TEST_SRV_NAME)+1;
267 srv_data->port = srv_port; 267 srv_data->port = srv_port;
268 srv_data->prio = srv_prio; 268 srv_data->prio = srv_prio;
diff --git a/src/gns/test_gns_simple_zkey_lookup.c b/src/gns/test_gns_simple_zkey_lookup.c
index 798fa5b5d..52a550ebf 100644
--- a/src/gns/test_gns_simple_zkey_lookup.c
+++ b/src/gns/test_gns_simple_zkey_lookup.c
@@ -93,7 +93,7 @@ end_badly_now ()
93} 93}
94 94
95 95
96static void 96static void
97shutdown_task (void *cls, 97shutdown_task (void *cls,
98 const struct GNUNET_SCHEDULER_TaskContext *tc) 98 const struct GNUNET_SCHEDULER_TaskContext *tc)
99{ 99{
@@ -110,7 +110,7 @@ on_lookup_result(void *cls, uint32_t rd_count,
110 struct in_addr a; 110 struct in_addr a;
111 int i; 111 int i;
112 char* addr; 112 char* addr;
113 113
114 if (GNUNET_SCHEDULER_NO_TASK != die_task) 114 if (GNUNET_SCHEDULER_NO_TASK != die_task)
115 { 115 {
116 GNUNET_SCHEDULER_cancel (die_task); 116 GNUNET_SCHEDULER_cancel (die_task);
@@ -150,7 +150,7 @@ on_lookup_result(void *cls, uint32_t rd_count,
150 } 150 }
151 } 151 }
152 } 152 }
153 153
154 GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); 154 GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
155} 155}
156 156
@@ -165,7 +165,7 @@ commence_testing (void *cls, int32_t success, const char *emsg)
165 char name[GNUNET_DNSPARSER_MAX_NAME_LENGTH]; 165 char name[GNUNET_DNSPARSER_MAX_NAME_LENGTH];
166 char* pos; 166 char* pos;
167 struct GNUNET_CRYPTO_ShortHashAsciiEncoded hash_str; 167 struct GNUNET_CRYPTO_ShortHashAsciiEncoded hash_str;
168 168
169 gns_handle = GNUNET_GNS_connect(cfg); 169 gns_handle = GNUNET_GNS_connect(cfg);
170 if (NULL == gns_handle) 170 if (NULL == gns_handle)
171 { 171 {
@@ -286,8 +286,8 @@ main (int argc, char *argv[])
286 GNUNET_log_setup ("test-gns-simple-zkey-lookup", 286 GNUNET_log_setup ("test-gns-simple-zkey-lookup",
287 "WARNING", 287 "WARNING",
288 NULL); 288 NULL);
289 GNUNET_TESTING_peer_run ("test-gns-simple-zkey-lookup", 289 GNUNET_TESTING_peer_run ("test-gns-simple-zkey-lookup",
290 "test_gns_simple_lookup.conf", 290 "test_gns_simple_lookup.conf",
291 &do_check, NULL); 291 &do_check, NULL);
292 return ok; 292 return ok;
293} 293}
diff --git a/src/gns/w32nsp-install.c b/src/gns/w32nsp-install.c
index dcdd16a86..5c2ccf23e 100644
--- a/src/gns/w32nsp-install.c
+++ b/src/gns/w32nsp-install.c
@@ -1,81 +1,81 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2012 Christian Grothoff (and other contributing authors) 3 (C) 2012 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version. 8 option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20/** 20/**
21 * @file gns/w32nsp-install.c 21 * @file gns/w32nsp-install.c
22 * @brief W32 integration installer for GNS 22 * @brief W32 integration installer for GNS
23 * @author LRN 23 * @author LRN
24 */ 24 */
25 25
26#define INITGUID 26#define INITGUID
27#include <windows.h> 27#include <windows.h>
28#include <nspapi.h> 28#include <nspapi.h>
29#include <ws2spi.h> 29#include <ws2spi.h>
30#include "gnunet_w32nsp_lib.h" 30#include "gnunet_w32nsp_lib.h"
31#include <stdio.h> 31#include <stdio.h>
32 32
33int 33int
34main (int argc, char **argv) 34main (int argc, char **argv)
35{ 35{
36 int ret; 36 int ret;
37 int r = 1; 37 int r = 1;
38 WSADATA wsd; 38 WSADATA wsd;
39 GUID id = GNUNET_NAMESPACE_PROVIDER_DNS; 39 GUID id = GNUNET_NAMESPACE_PROVIDER_DNS;
40 wchar_t *cmdl; 40 wchar_t *cmdl;
41 int wargc; 41 int wargc;
42 wchar_t **wargv; 42 wchar_t **wargv;
43 43
44 if (WSAStartup(MAKEWORD(2,2), &wsd) != 0) 44 if (WSAStartup(MAKEWORD(2,2), &wsd) != 0)
45 { 45 {
46 fprintf (stderr, "WSAStartup() failed: %lu\n", GetLastError()); 46 fprintf (stderr, "WSAStartup() failed: %lu\n", GetLastError());
47 return 5; 47 return 5;
48 } 48 }
49 49
50 cmdl = GetCommandLineW (); 50 cmdl = GetCommandLineW ();
51 if (cmdl == NULL) 51 if (cmdl == NULL)
52 { 52 {
53 WSACleanup(); 53 WSACleanup();
54 return 2; 54 return 2;
55 } 55 }
56 wargv = CommandLineToArgvW (cmdl, &wargc); 56 wargv = CommandLineToArgvW (cmdl, &wargc);
57 if (wargv == NULL) 57 if (wargv == NULL)
58 { 58 {
59 WSACleanup(); 59 WSACleanup();
60 return 3; 60 return 3;
61 } 61 }
62 r = 4; 62 r = 4;
63 63
64 if (wargc == 2) 64 if (wargc == 2)
65 { 65 {
66 ret = WSCInstallNameSpace (L"GNUnet DNS provider", wargv[1], NS_DNS, 1, &id); 66 ret = WSCInstallNameSpace (L"GNUnet DNS provider", wargv[1], NS_DNS, 1, &id);
67 if (ret == NO_ERROR) 67 if (ret == NO_ERROR)
68 { 68 {
69 r = 0; 69 r = 0;
70 } 70 }
71 else 71 else
72 { 72 {
73 r = 1; 73 r = 1;
74 fprintf (stderr, 74 fprintf (stderr,
75 "WSCInstallNameSpace(L\"GNUnet DNS provider\", \"%S\", %d, 0, %p) failed: %lu\n", 75 "WSCInstallNameSpace(L\"GNUnet DNS provider\", \"%S\", %d, 0, %p) failed: %lu\n",
76 wargv[1], NS_DNS, &id, GetLastError ()); 76 wargv[1], NS_DNS, &id, GetLastError ());
77 } 77 }
78 } 78 }
79 WSACleanup(); 79 WSACleanup();
80 return r; 80 return r;
81} 81}
diff --git a/src/gns/w32nsp-resolve.c b/src/gns/w32nsp-resolve.c
index 8e08d0717..2bbe45021 100644
--- a/src/gns/w32nsp-resolve.c
+++ b/src/gns/w32nsp-resolve.c
@@ -34,7 +34,7 @@
34typedef int (WSPAPI *LPNSPSTARTUP) (LPGUID lpProviderId, LPNSP_ROUTINE lpnspRoutines); 34typedef int (WSPAPI *LPNSPSTARTUP) (LPGUID lpProviderId, LPNSP_ROUTINE lpnspRoutines);
35 35
36GUID host = {0x0002a800,0,0,{ 0xC0,0,0,0,0,0,0,0x46 }}; 36GUID host = {0x0002a800,0,0,{ 0xC0,0,0,0,0,0,0,0x46 }};
37GUID ip4 = {0x00090035,0,1,{ 0xc0,0,0,0,0,0,0,0x046}}; 37GUID ip4 = {0x00090035,0,1,{ 0xc0,0,0,0,0,0,0,0x046}};
38GUID ip6 = {0x00090035,0,0x001c, { 0xc0,0,0,0,0,0,0,0x046}}; 38GUID ip6 = {0x00090035,0,0x001c, { 0xc0,0,0,0,0,0,0,0x046}};
39 39
40DEFINE_GUID(W32_DNS, 0x22059D40, 0x7E9E, 0x11CF, 0xAE, 0x5A, 0x00, 0xAA, 0x00, 0xA7, 0x11, 0x2B); 40DEFINE_GUID(W32_DNS, 0x22059D40, 0x7E9E, 0x11CF, 0xAE, 0x5A, 0x00, 0xAA, 0x00, 0xA7, 0x11, 0x2B);
@@ -57,7 +57,7 @@ DEFINE_GUID(SVCID_INET_HOSTADDRBYNAME, 0x0002a803, 0x0000, 0x0000, 0xc0, 0x00, 0
57// to convert structures returned as BLOBs. 57// to convert structures returned as BLOBs.
58// 58//
59 59
60VOID 60VOID
61FixList(PCHAR ** List, PCHAR Base) 61FixList(PCHAR ** List, PCHAR Base)
62{ 62{
63 if(*List) 63 if(*List)
@@ -78,7 +78,7 @@ FixList(PCHAR ** List, PCHAR Base)
78// Routine to convert a hostent returned in a BLOB to one with 78// Routine to convert a hostent returned in a BLOB to one with
79// usable pointers. The structure is converted in-place. 79// usable pointers. The structure is converted in-place.
80// 80//
81VOID 81VOID
82UnpackHostEnt(struct hostent * hostent) 82UnpackHostEnt(struct hostent * hostent)
83{ 83{
84 PCHAR pch; 84 PCHAR pch;
@@ -210,7 +210,7 @@ main (int argc, char **argv)
210 if (wargc == 5) 210 if (wargc == 5)
211 { 211 {
212 HMODULE nsp; 212 HMODULE nsp;
213 213
214 nsp = LoadLibraryW (wargv[3]); 214 nsp = LoadLibraryW (wargv[3]);
215 if (nsp == NULL) 215 if (nsp == NULL)
216 { 216 {
diff --git a/src/gns/w32nsp-uninstall.c b/src/gns/w32nsp-uninstall.c
index bb8db668b..ac5aafe2d 100644
--- a/src/gns/w32nsp-uninstall.c
+++ b/src/gns/w32nsp-uninstall.c
@@ -1,30 +1,30 @@
1#define INITGUID 1#define INITGUID
2#include <windows.h> 2#include <windows.h>
3#include <nspapi.h> 3#include <nspapi.h>
4#include <ws2spi.h> 4#include <ws2spi.h>
5#include "gnunet_w32nsp_lib.h" 5#include "gnunet_w32nsp_lib.h"
6#include <stdio.h> 6#include <stdio.h>
7 7
8int 8int
9main (int argc, char **argv) 9main (int argc, char **argv)
10{ 10{
11 int ret; 11 int ret;
12 GUID id = GNUNET_NAMESPACE_PROVIDER_DNS; 12 GUID id = GNUNET_NAMESPACE_PROVIDER_DNS;
13 WSADATA wsd; 13 WSADATA wsd;
14 14
15 if (WSAStartup(MAKEWORD(2,2), &wsd) != 0) 15 if (WSAStartup(MAKEWORD(2,2), &wsd) != 0)
16 { 16 {
17 fprintf (stderr, "WSAStartup() failed: %lu\n", GetLastError()); 17 fprintf (stderr, "WSAStartup() failed: %lu\n", GetLastError());
18 return 5; 18 return 5;
19 } 19 }
20 20
21 ret = WSCUnInstallNameSpace (&id); 21 ret = WSCUnInstallNameSpace (&id);
22 if (ret == NO_ERROR) 22 if (ret == NO_ERROR)
23 { 23 {
24 WSACleanup (); 24 WSACleanup ();
25 return 0; 25 return 0;
26 } 26 }
27 fprintf (stderr, "WSCUnInstallNameSpace() failed: %lu\n", GetLastError ()); 27 fprintf (stderr, "WSCUnInstallNameSpace() failed: %lu\n", GetLastError ());
28 WSACleanup (); 28 WSACleanup ();
29 return 1; 29 return 1;
30} \ No newline at end of file 30} \ No newline at end of file
diff --git a/src/hello/gnunet-hello.c b/src/hello/gnunet-hello.c
index f96a999b8..795f4f29b 100644
--- a/src/hello/gnunet-hello.c
+++ b/src/hello/gnunet-hello.c
@@ -35,7 +35,7 @@ struct AddContext
35 * Where to add. 35 * Where to add.
36 */ 36 */
37 char *buf; 37 char *buf;
38 38
39 /** 39 /**
40 * Maximum number of bytes left 40 * Maximum number of bytes left
41 */ 41 */
@@ -65,7 +65,7 @@ add_to_buf (void *cls, const struct GNUNET_HELLO_Address *address,
65 struct AddContext *ac = cls; 65 struct AddContext *ac = cls;
66 size_t ret; 66 size_t ret;
67 67
68 ret = GNUNET_HELLO_add_address (address, 68 ret = GNUNET_HELLO_add_address (address,
69 GNUNET_TIME_UNIT_FOREVER_ABS, 69 GNUNET_TIME_UNIT_FOREVER_ABS,
70 ac->buf, 70 ac->buf,
71 ac->max); 71 ac->max);
@@ -97,7 +97,7 @@ add_from_hello (void *cls, size_t max, void *buf)
97 ac.max = max; 97 ac.max = max;
98 ac.ret = 0; 98 ac.ret = 0;
99 GNUNET_assert (NULL == 99 GNUNET_assert (NULL ==
100 GNUNET_HELLO_iterate_addresses (*orig, 100 GNUNET_HELLO_iterate_addresses (*orig,
101 GNUNET_NO, &add_to_buf, 101 GNUNET_NO, &add_to_buf,
102 &ac)); 102 &ac));
103 *orig = NULL; 103 *orig = NULL;
@@ -145,7 +145,7 @@ main (int argc, char *argv[])
145 argv[1]); 145 argv[1]);
146 return 1; 146 return 1;
147 } 147 }
148 fh = GNUNET_DISK_file_open (argv[1], 148 fh = GNUNET_DISK_file_open (argv[1],
149 GNUNET_DISK_OPEN_READ, 149 GNUNET_DISK_OPEN_READ,
150 GNUNET_DISK_PERM_USER_READ); 150 GNUNET_DISK_PERM_USER_READ);
151 if (NULL == fh) 151 if (NULL == fh)
@@ -158,8 +158,8 @@ main (int argc, char *argv[])
158 } 158 }
159 { 159 {
160 char buf[fsize] GNUNET_ALIGN; 160 char buf[fsize] GNUNET_ALIGN;
161 161
162 GNUNET_assert (fsize == 162 GNUNET_assert (fsize ==
163 GNUNET_DISK_file_read (fh, buf, fsize)); 163 GNUNET_DISK_file_read (fh, buf, fsize));
164 GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh)); 164 GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh));
165 orig = (struct GNUNET_HELLO_Message *) buf; 165 orig = (struct GNUNET_HELLO_Message *) buf;
@@ -174,7 +174,7 @@ main (int argc, char *argv[])
174 result = GNUNET_HELLO_create (&pk, &add_from_hello, &orig, 174 result = GNUNET_HELLO_create (&pk, &add_from_hello, &orig,
175 GNUNET_HELLO_is_friend_only (orig)); 175 GNUNET_HELLO_is_friend_only (orig));
176 GNUNET_assert (NULL != result); 176 GNUNET_assert (NULL != result);
177 fh = GNUNET_DISK_file_open (argv[1], 177 fh = GNUNET_DISK_file_open (argv[1],
178 GNUNET_DISK_OPEN_WRITE, 178 GNUNET_DISK_OPEN_WRITE,
179 GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); 179 GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
180 if (NULL == fh) 180 if (NULL == fh)
diff --git a/src/hello/hello.c b/src/hello/hello.c
index 9e246d473..6261dcb6b 100644
--- a/src/hello/hello.c
+++ b/src/hello/hello.c
@@ -166,7 +166,7 @@ GNUNET_HELLO_add_address (const struct GNUNET_HELLO_Address *address,
166 */ 166 */
167static size_t 167static size_t
168get_hello_address_size (const char *buf, 168get_hello_address_size (const char *buf,
169 size_t max, 169 size_t max,
170 uint16_t *ralen) 170 uint16_t *ralen)
171{ 171{
172 const char *pos; 172 const char *pos;
@@ -716,9 +716,9 @@ GNUNET_HELLO_get_last_expiration (const struct GNUNET_HELLO_Message *msg)
716 * maybe differenciated into additional subcategories if applicable. 716 * maybe differenciated into additional subcategories if applicable.
717 * This module only deals with hello identifiers (MODULE = "hello"). 717 * This module only deals with hello identifiers (MODULE = "hello").
718 * <p> 718 * <p>
719 * 719 *
720 * The concrete URI format is: 720 * The concrete URI format is:
721 * 721 *
722 * "gnunet://hello/PEER[!YYYYMMDDHHMMSS!<TYPE>!<ADDRESS>]...". 722 * "gnunet://hello/PEER[!YYYYMMDDHHMMSS!<TYPE>!<ADDRESS>]...".
723 * These URIs can be used to add a peer record to peerinfo service. 723 * These URIs can be used to add a peer record to peerinfo service.
724 * PEER is the string representation of peer's public key. 724 * PEER is the string representation of peer's public key.
@@ -726,29 +726,29 @@ GNUNET_HELLO_get_last_expiration (const struct GNUNET_HELLO_Message *msg)
726 * TYPE is a transport type. 726 * TYPE is a transport type.
727 * ADDRESS is the address, its format depends upon the transport type. 727 * ADDRESS is the address, its format depends upon the transport type.
728 * The concrete transport types and corresponding address formats are: 728 * The concrete transport types and corresponding address formats are:
729 * 729 *
730 * <ul><li> 730 * <ul><li>
731 * 731 *
732 * <TCP|UDP>!IPADDRESS 732 * <TCP|UDP>!IPADDRESS
733 * IPVDDRESS is either IPV4 .-delimited address in form of XXX.XXX.XXX.XXX:PPPPP 733 * IPVDDRESS is either IPV4 .-delimited address in form of XXX.XXX.XXX.XXX:PPPPP
734 * or IPV6 :-delimited address, but with '(' and ')' instead of '[' and ']' (RFC2396 advises against using square brackets in URIs): 734 * or IPV6 :-delimited address, but with '(' and ')' instead of '[' and ']' (RFC2396 advises against using square brackets in URIs):
735 * (XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX):PPPPP 735 * (XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX):PPPPP
736 * PPPPP is the port number. May be 0. 736 * PPPPP is the port number. May be 0.
737 * 737 *
738 * </li><li> 738 * </li><li>
739 * 739 *
740 * [add SMTP, HTTP and other addresses here] 740 * [add SMTP, HTTP and other addresses here]
741 * 741 *
742 * </li></ul> 742 * </li></ul>
743 * 743 *
744 * The encoding for hexadecimal values is defined in the crypto_hash.c 744 * The encoding for hexadecimal values is defined in the crypto_hash.c
745 * module in the gnunetutil library and discussed there. 745 * module in the gnunetutil library and discussed there.
746 * 746 *
747 * Examples: 747 * Examples:
748 * 748 *
749 * gnunet://hello/0430205UC7D56PTQK8NV05776671CNN44FK4TL6D0GQ35OMF8MEN4RNMKA5UF6AL3DQO8B1SC5AQF50SQ2MABIRU4HC8H2HAJKJ59JL1JVRJAK308F9GASRFLMGUBB5TQ5AKR94AS5T3MDG8B9O1EMPRKB0HVCG7T6QPP4CDJ913LAEHVJ2DI1TOBB15Q1JIT5ARBOD12U4SIGRFDV3Q7T66G4TBVSJJ90UQF1BG29TGJJKLGEIMSPHHKO544D6EALQ4F2K0416311JC22GVAD48R616I7VK03K7MP7N0RS2MBV1TE9JV8CK1LSQMR7KCDRTLDA6917UGA67DHTGHERIACCGQ54TGSR48RMSGS9BA5HLMOKASFC1I6V4TT09TUGCU8GNDHQF0JF3H7LPV59UL5I38QID040G000!20120302010059!TCP!192.168.0.1:2086!TCP!64.23.8.174:0 749 * gnunet://hello/0430205UC7D56PTQK8NV05776671CNN44FK4TL6D0GQ35OMF8MEN4RNMKA5UF6AL3DQO8B1SC5AQF50SQ2MABIRU4HC8H2HAJKJ59JL1JVRJAK308F9GASRFLMGUBB5TQ5AKR94AS5T3MDG8B9O1EMPRKB0HVCG7T6QPP4CDJ913LAEHVJ2DI1TOBB15Q1JIT5ARBOD12U4SIGRFDV3Q7T66G4TBVSJJ90UQF1BG29TGJJKLGEIMSPHHKO544D6EALQ4F2K0416311JC22GVAD48R616I7VK03K7MP7N0RS2MBV1TE9JV8CK1LSQMR7KCDRTLDA6917UGA67DHTGHERIACCGQ54TGSR48RMSGS9BA5HLMOKASFC1I6V4TT09TUGCU8GNDHQF0JF3H7LPV59UL5I38QID040G000!20120302010059!TCP!192.168.0.1:2086!TCP!64.23.8.174:0
750 * gnunet://hello/0430205UC7D56PTQK8NV05776671CNN44FK4TL6D0GQ35OMF8MEN4RNMKA5UF6AL3DQO8B1SC5AQF50SQ2MABIRU4HC8H2HAJKJ59JL1JVRJAK308F9GASRFLMGUBB5TQ5AKR94AS5T3MDG8B9O1EMPRKB0HVCG7T6QPP4CDJ913LAEHVJ2DI1TOBB15Q1JIT5ARBOD12U4SIGRFDV3Q7T66G4TBVSJJ90UQF1BG29TGJJKLGEIMSPHHKO544D6EALQ4F2K0416311JC22GVAD48R616I7VK03K7MP7N0RS2MBV1TE9JV8CK1LSQMR7KCDRTLDA6917UGA67DHTGHERIACCGQ54TGSR48RMSGS9BA5HLMOKASFC1I6V4TT09TUGCU8GNDHQF0JF3H7LPV59UL5I38QID040G000!20120302010059!TCP!(2001:db8:85a3:8d3:1319:8a2e:370:7348):2086 750 * gnunet://hello/0430205UC7D56PTQK8NV05776671CNN44FK4TL6D0GQ35OMF8MEN4RNMKA5UF6AL3DQO8B1SC5AQF50SQ2MABIRU4HC8H2HAJKJ59JL1JVRJAK308F9GASRFLMGUBB5TQ5AKR94AS5T3MDG8B9O1EMPRKB0HVCG7T6QPP4CDJ913LAEHVJ2DI1TOBB15Q1JIT5ARBOD12U4SIGRFDV3Q7T66G4TBVSJJ90UQF1BG29TGJJKLGEIMSPHHKO544D6EALQ4F2K0416311JC22GVAD48R616I7VK03K7MP7N0RS2MBV1TE9JV8CK1LSQMR7KCDRTLDA6917UGA67DHTGHERIACCGQ54TGSR48RMSGS9BA5HLMOKASFC1I6V4TT09TUGCU8GNDHQF0JF3H7LPV59UL5I38QID040G000!20120302010059!TCP!(2001:db8:85a3:8d3:1319:8a2e:370:7348):2086
751 * 751 *
752 * <p> 752 * <p>
753 */ 753 */
754 754
diff --git a/src/hostlist/hostlist-client.c b/src/hostlist/hostlist-client.c
index 4ad03bc78..488443f6e 100644
--- a/src/hostlist/hostlist-client.c
+++ b/src/hostlist/hostlist-client.c
@@ -1035,7 +1035,7 @@ task_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1035 GNUNET_STATISTICS_set (stats, 1035 GNUNET_STATISTICS_set (stats,
1036 gettext_noop 1036 gettext_noop
1037 ("# milliseconds between hostlist downloads"), 1037 ("# milliseconds between hostlist downloads"),
1038 hostlist_delay.rel_value_us / 1000LL, 1038 hostlist_delay.rel_value_us / 1000LL,
1039 GNUNET_YES); 1039 GNUNET_YES);
1040 if (0 == once) 1040 if (0 == once)
1041 { 1041 {
diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c
index d888c89b3..49d3a5283 100644
--- a/src/hostlist/hostlist-server.c
+++ b/src/hostlist/hostlist-server.c
@@ -434,8 +434,8 @@ process_notify (void *cls, const struct GNUNET_PeerIdentity *peer,
434 else 434 else
435 { 435 {
436 builder = GNUNET_malloc (sizeof (struct HostSet)); 436 builder = GNUNET_malloc (sizeof (struct HostSet));
437 } 437 }
438 GNUNET_assert (NULL != peerinfo); 438 GNUNET_assert (NULL != peerinfo);
439 builder->pitr = 439 builder->pitr =
440 GNUNET_PEERINFO_iterate (peerinfo, GNUNET_NO, NULL, GNUNET_TIME_UNIT_MINUTES, 440 GNUNET_PEERINFO_iterate (peerinfo, GNUNET_NO, NULL, GNUNET_TIME_UNIT_MINUTES,
441 &host_processor, NULL); 441 &host_processor, NULL);
@@ -601,7 +601,7 @@ GNUNET_HOSTLIST_server_start (const struct GNUNET_CONFIGURATION_Handle *c,
601 GNUNET_CONFIGURATION_get_value_string (cfg, "HOSTLIST", 601 GNUNET_CONFIGURATION_get_value_string (cfg, "HOSTLIST",
602 "BINDTOIP", &ip)); 602 "BINDTOIP", &ip));
603 } 603 }
604 else 604 else
605 ip = NULL; 605 ip = NULL;
606 if (NULL != ip) 606 if (NULL != ip)
607 { 607 {
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
index 2ee4fed10..21b2973de 100644
--- a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
+++ b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
@@ -201,7 +201,7 @@ run (void *cls, char *const *args, const char *cfgfile,
201int 201int
202main (int argcx, char *argvx[]) 202main (int argcx, char *argvx[])
203{ 203{
204 static char *const argv[] = { 204 static char *const argv[] = {
205 "test-gnunet-daemon-hostlist", 205 "test-gnunet-daemon-hostlist",
206 "-c", "test_gnunet_daemon_hostlist_data.conf", 206 "-c", "test_gnunet_daemon_hostlist_data.conf",
207 NULL 207 NULL
diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c
index 8dac356e4..c2c381604 100644
--- a/src/identity/gnunet-identity.c
+++ b/src/identity/gnunet-identity.c
@@ -104,7 +104,7 @@ shutdown_task (void *cls,
104 { 104 {
105 GNUNET_IDENTITY_cancel (delete_op); 105 GNUNET_IDENTITY_cancel (delete_op);
106 delete_op = NULL; 106 delete_op = NULL;
107 } 107 }
108 GNUNET_IDENTITY_disconnect (sh); 108 GNUNET_IDENTITY_disconnect (sh);
109 sh = NULL; 109 sh = NULL;
110} 110}
@@ -121,7 +121,7 @@ test_finished ()
121 (NULL == set_op) && 121 (NULL == set_op) &&
122 (NULL == set_ego) && 122 (NULL == set_ego) &&
123 (! list) && 123 (! list) &&
124 (! monitor) ) 124 (! monitor) )
125 GNUNET_SCHEDULER_shutdown (); 125 GNUNET_SCHEDULER_shutdown ();
126} 126}
127 127
@@ -201,11 +201,11 @@ set_done (void *cls,
201 * 'ego' does indicate an error (i.e. name is taken or no default 201 * 'ego' does indicate an error (i.e. name is taken or no default
202 * value is known). If 'ego' is non-NULL and if '*ctx' 202 * value is known). If 'ego' is non-NULL and if '*ctx'
203 * is set in those callbacks, the value WILL be passed to a subsequent 203 * is set in those callbacks, the value WILL be passed to a subsequent
204 * call to the identity callback of 'GNUNET_IDENTITY_connect' (if 204 * call to the identity callback of 'GNUNET_IDENTITY_connect' (if
205 * that one was not NULL). 205 * that one was not NULL).
206 * 206 *
207 * When an identity is renamed, this function is called with the 207 * When an identity is renamed, this function is called with the
208 * (known) ego but the NEW identifier. 208 * (known) ego but the NEW identifier.
209 * 209 *
210 * When an identity is deleted, this function is called with the 210 * When an identity is deleted, this function is called with the
211 * (known) ego and "NULL" for the 'identifier'. In this case, 211 * (known) ego and "NULL" for the 'identifier'. In this case,
@@ -232,7 +232,7 @@ print_ego (void *cls,
232 if ( (NULL != set_ego) && 232 if ( (NULL != set_ego) &&
233 (NULL != ego) && 233 (NULL != ego) &&
234 (NULL != identifier) && 234 (NULL != identifier) &&
235 (0 == strcmp (identifier, 235 (0 == strcmp (identifier,
236 set_ego)) ) 236 set_ego)) )
237 { 237 {
238 set_op = GNUNET_IDENTITY_set (sh, 238 set_op = GNUNET_IDENTITY_set (sh,
@@ -348,7 +348,7 @@ main (int argc, char *const *argv)
348 return 2; 348 return 2;
349 349
350 res = GNUNET_PROGRAM_run (argc, argv, "gnunet-identity", 350 res = GNUNET_PROGRAM_run (argc, argv, "gnunet-identity",
351 gettext_noop ("Maintain egos"), 351 gettext_noop ("Maintain egos"),
352 options, &run, 352 options, &run,
353 NULL); 353 NULL);
354 GNUNET_free ((void *) argv); 354 GNUNET_free ((void *) argv);
diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c
index 52d072967..c61286bd5 100644
--- a/src/identity/gnunet-service-identity.c
+++ b/src/identity/gnunet-service-identity.c
@@ -47,12 +47,12 @@ struct Ego
47 47
48 /** 48 /**
49 * We keep egos in a DLL. 49 * We keep egos in a DLL.
50 */ 50 */
51 struct Ego *next; 51 struct Ego *next;
52 52
53 /** 53 /**
54 * We keep egos in a DLL. 54 * We keep egos in a DLL.
55 */ 55 */
56 struct Ego *prev; 56 struct Ego *prev;
57 57
58 /** 58 /**
@@ -195,7 +195,7 @@ send_result_code (struct GNUNET_SERVER_Client *client,
195 "Sending result %d (%s) to client\n", 195 "Sending result %d (%s) to client\n",
196 (int) result_code, 196 (int) result_code,
197 emsg); 197 emsg);
198 GNUNET_SERVER_notification_context_unicast (nc, client, &rcm->header, GNUNET_NO); 198 GNUNET_SERVER_notification_context_unicast (nc, client, &rcm->header, GNUNET_NO);
199 GNUNET_free (rcm); 199 GNUNET_free (rcm);
200} 200}
201 201
@@ -211,7 +211,7 @@ create_update_message (struct Ego *ego)
211{ 211{
212 struct GNUNET_IDENTITY_UpdateMessage *um; 212 struct GNUNET_IDENTITY_UpdateMessage *um;
213 size_t name_len; 213 size_t name_len;
214 214
215 name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1); 215 name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1);
216 um = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_UpdateMessage) + name_len); 216 um = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_UpdateMessage) + name_len);
217 um->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE); 217 um->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
@@ -252,7 +252,7 @@ create_set_default_message (struct Ego *ego,
252 252
253/** 253/**
254 * Handler for START message from client, sends information 254 * Handler for START message from client, sends information
255 * about all identities to the client immediately and 255 * about all identities to the client immediately and
256 * adds the client to the notification context for future 256 * adds the client to the notification context for future
257 * updates. 257 * updates.
258 * 258 *
@@ -268,7 +268,7 @@ handle_start_message (void *cls, struct GNUNET_SERVER_Client *client,
268 struct GNUNET_IDENTITY_UpdateMessage ume; 268 struct GNUNET_IDENTITY_UpdateMessage ume;
269 struct Ego *ego; 269 struct Ego *ego;
270 270
271 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 271 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
272 "Received START message from client\n"); 272 "Received START message from client\n");
273 GNUNET_SERVER_notification_context_add (nc, client); 273 GNUNET_SERVER_notification_context_add (nc, client);
274 for (ego = ego_head; NULL != ego; ego = ego->next) 274 for (ego = ego_head; NULL != ego; ego = ego->next)
@@ -282,7 +282,7 @@ handle_start_message (void *cls, struct GNUNET_SERVER_Client *client,
282 ume.header.size = htons (sizeof (struct GNUNET_IDENTITY_UpdateMessage)); 282 ume.header.size = htons (sizeof (struct GNUNET_IDENTITY_UpdateMessage));
283 ume.end_of_list = htons (GNUNET_YES); 283 ume.end_of_list = htons (GNUNET_YES);
284 ume.name_len = htons (0); 284 ume.name_len = htons (0);
285 GNUNET_SERVER_notification_context_unicast (nc, client, &ume.header, GNUNET_NO); 285 GNUNET_SERVER_notification_context_unicast (nc, client, &ume.header, GNUNET_NO);
286 GNUNET_SERVER_receive_done (client, GNUNET_OK); 286 GNUNET_SERVER_receive_done (client, GNUNET_OK);
287} 287}
288 288
@@ -325,7 +325,7 @@ handle_get_default_message (void *cls, struct GNUNET_SERVER_Client *client,
325 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 325 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
326 return; 326 return;
327 } 327 }
328 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 328 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
329 "Received GET_DEFAULT for service `%s' from client\n", 329 "Received GET_DEFAULT for service `%s' from client\n",
330 name); 330 name);
331 if (GNUNET_OK != 331 if (GNUNET_OK !=
@@ -335,7 +335,7 @@ handle_get_default_message (void *cls, struct GNUNET_SERVER_Client *client,
335 &identifier)) 335 &identifier))
336 { 336 {
337 send_result_code (client, 1, gettext_noop ("no default known")); 337 send_result_code (client, 1, gettext_noop ("no default known"));
338 GNUNET_SERVER_receive_done (client, GNUNET_OK); 338 GNUNET_SERVER_receive_done (client, GNUNET_OK);
339 return; 339 return;
340 } 340 }
341 for (ego = ego_head; NULL != ego; ego = ego->next) 341 for (ego = ego_head; NULL != ego; ego = ego->next)
@@ -356,7 +356,7 @@ handle_get_default_message (void *cls, struct GNUNET_SERVER_Client *client,
356 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 356 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
357 "Failed to find ego `%s'\n", 357 "Failed to find ego `%s'\n",
358 name); 358 name);
359 send_result_code (client, 1, 359 send_result_code (client, 1,
360 gettext_noop ("default configured, but ego unknown (internal error)")); 360 gettext_noop ("default configured, but ego unknown (internal error)"));
361 GNUNET_SERVER_receive_done (client, GNUNET_OK); 361 GNUNET_SERVER_receive_done (client, GNUNET_OK);
362} 362}
@@ -364,7 +364,7 @@ handle_get_default_message (void *cls, struct GNUNET_SERVER_Client *client,
364 364
365/** 365/**
366 * Compare the given two private keys for equality. 366 * Compare the given two private keys for equality.
367 * 367 *
368 * @param pk1 one private key 368 * @param pk1 one private key
369 * @param pk2 another private key 369 * @param pk2 another private key
370 * @return 0 if the keys are equal 370 * @return 0 if the keys are equal
@@ -405,7 +405,7 @@ handle_set_default_message (void *cls, struct GNUNET_SERVER_Client *client,
405 sdm = (const struct GNUNET_IDENTITY_SetDefaultMessage *) message; 405 sdm = (const struct GNUNET_IDENTITY_SetDefaultMessage *) message;
406 name_len = ntohs (sdm->name_len); 406 name_len = ntohs (sdm->name_len);
407 GNUNET_break (0 == ntohs (sdm->reserved)); 407 GNUNET_break (0 == ntohs (sdm->reserved));
408 if (name_len + sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) != size) 408 if (name_len + sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) != size)
409 { 409 {
410 GNUNET_break (0); 410 GNUNET_break (0);
411 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 411 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -418,7 +418,7 @@ handle_set_default_message (void *cls, struct GNUNET_SERVER_Client *client,
418 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 418 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
419 return; 419 return;
420 } 420 }
421 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 421 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
422 "Received SET_DEFAULT for service `%s' from client\n", 422 "Received SET_DEFAULT for service `%s' from client\n",
423 str); 423 str);
424 for (ego = ego_head; NULL != ego; ego = ego->next) 424 for (ego = ego_head; NULL != ego; ego = ego->next)
@@ -430,7 +430,7 @@ handle_set_default_message (void *cls, struct GNUNET_SERVER_Client *client,
430 str, 430 str,
431 "DEFAULT_IDENTIFIER", 431 "DEFAULT_IDENTIFIER",
432 ego->identifier); 432 ego->identifier);
433 if (GNUNET_OK != 433 if (GNUNET_OK !=
434 GNUNET_CONFIGURATION_write (subsystem_cfg, 434 GNUNET_CONFIGURATION_write (subsystem_cfg,
435 subsystem_cfg_file)) 435 subsystem_cfg_file))
436 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 436 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -440,7 +440,7 @@ handle_set_default_message (void *cls, struct GNUNET_SERVER_Client *client,
440 GNUNET_SERVER_receive_done (client, GNUNET_OK); 440 GNUNET_SERVER_receive_done (client, GNUNET_OK);
441 return; 441 return;
442 } 442 }
443 } 443 }
444 send_result_code (client, 1, _("Unknown ego specified for service (internal error)")); 444 send_result_code (client, 1, _("Unknown ego specified for service (internal error)"));
445 GNUNET_SERVER_receive_done (client, GNUNET_OK); 445 GNUNET_SERVER_receive_done (client, GNUNET_OK);
446} 446}
@@ -481,7 +481,7 @@ handle_create_message (void *cls, struct GNUNET_SERVER_Client *client,
481 const char *str; 481 const char *str;
482 char *fn; 482 char *fn;
483 483
484 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 484 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
485 "Received CREATE message from client\n"); 485 "Received CREATE message from client\n");
486 size = ntohs (message->size); 486 size = ntohs (message->size);
487 if (size <= sizeof (struct GNUNET_IDENTITY_CreateRequestMessage)) 487 if (size <= sizeof (struct GNUNET_IDENTITY_CreateRequestMessage))
@@ -493,7 +493,7 @@ handle_create_message (void *cls, struct GNUNET_SERVER_Client *client,
493 crm = (const struct GNUNET_IDENTITY_CreateRequestMessage *) message; 493 crm = (const struct GNUNET_IDENTITY_CreateRequestMessage *) message;
494 name_len = ntohs (crm->name_len); 494 name_len = ntohs (crm->name_len);
495 GNUNET_break (0 == ntohs (crm->reserved)); 495 GNUNET_break (0 == ntohs (crm->reserved));
496 if (name_len + sizeof (struct GNUNET_IDENTITY_CreateRequestMessage) != size) 496 if (name_len + sizeof (struct GNUNET_IDENTITY_CreateRequestMessage) != size)
497 { 497 {
498 GNUNET_break (0); 498 GNUNET_break (0);
499 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 499 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -528,14 +528,14 @@ handle_create_message (void *cls, struct GNUNET_SERVER_Client *client,
528 (void) GNUNET_DISK_directory_create_for_file (fn); 528 (void) GNUNET_DISK_directory_create_for_file (fn);
529 if (sizeof (struct GNUNET_CRYPTO_EccPrivateKey) != 529 if (sizeof (struct GNUNET_CRYPTO_EccPrivateKey) !=
530 GNUNET_DISK_fn_write (fn, 530 GNUNET_DISK_fn_write (fn,
531 &crm->private_key, 531 &crm->private_key,
532 sizeof (struct GNUNET_CRYPTO_EccPrivateKey), 532 sizeof (struct GNUNET_CRYPTO_EccPrivateKey),
533 GNUNET_DISK_PERM_USER_READ | 533 GNUNET_DISK_PERM_USER_READ |
534 GNUNET_DISK_PERM_USER_WRITE)) 534 GNUNET_DISK_PERM_USER_WRITE))
535 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, 535 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
536 "write", fn); 536 "write", fn);
537 GNUNET_free (fn); 537 GNUNET_free (fn);
538 notify_listeners (ego); 538 notify_listeners (ego);
539 GNUNET_SERVER_receive_done (client, GNUNET_OK); 539 GNUNET_SERVER_receive_done (client, GNUNET_OK);
540} 540}
541 541
@@ -543,7 +543,7 @@ handle_create_message (void *cls, struct GNUNET_SERVER_Client *client,
543/** 543/**
544 * Closure for 'handle_ego_rename'. 544 * Closure for 'handle_ego_rename'.
545 */ 545 */
546struct RenameContext 546struct RenameContext
547{ 547{
548 /** 548 /**
549 * Old name. 549 * Old name.
@@ -579,14 +579,14 @@ handle_ego_rename (void *cls,
579 return; 579 return;
580 if (0 != strcmp (id, rc->old_name)) 580 if (0 != strcmp (id, rc->old_name))
581 { 581 {
582 GNUNET_free (id); 582 GNUNET_free (id);
583 return; 583 return;
584 } 584 }
585 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg, 585 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
586 section, 586 section,
587 "DEFAULT_IDENTIFIER", 587 "DEFAULT_IDENTIFIER",
588 rc->new_name); 588 rc->new_name);
589 GNUNET_free (id); 589 GNUNET_free (id);
590} 590}
591 591
592 592
@@ -613,7 +613,7 @@ handle_rename_message (void *cls, struct GNUNET_SERVER_Client *client,
613 char *fn_old; 613 char *fn_old;
614 char *fn_new; 614 char *fn_new;
615 615
616 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 616 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
617 "Received RENAME message from client\n"); 617 "Received RENAME message from client\n");
618 size = ntohs (message->size); 618 size = ntohs (message->size);
619 if (size <= sizeof (struct GNUNET_IDENTITY_RenameMessage)) 619 if (size <= sizeof (struct GNUNET_IDENTITY_RenameMessage))
@@ -643,7 +643,7 @@ handle_rename_message (void *cls, struct GNUNET_SERVER_Client *client,
643 new_name)) 643 new_name))
644 { 644 {
645 send_result_code (client, 1, gettext_noop ("target name already exists")); 645 send_result_code (client, 1, gettext_noop ("target name already exists"));
646 GNUNET_SERVER_receive_done (client, GNUNET_OK); 646 GNUNET_SERVER_receive_done (client, GNUNET_OK);
647 return; 647 return;
648 } 648 }
649 } 649 }
@@ -661,14 +661,14 @@ handle_rename_message (void *cls, struct GNUNET_SERVER_Client *client,
661 GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg, 661 GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg,
662 &handle_ego_rename, 662 &handle_ego_rename,
663 &rename_ctx); 663 &rename_ctx);
664 if (GNUNET_OK != 664 if (GNUNET_OK !=
665 GNUNET_CONFIGURATION_write (subsystem_cfg, 665 GNUNET_CONFIGURATION_write (subsystem_cfg,
666 subsystem_cfg_file)) 666 subsystem_cfg_file))
667 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 667 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
668 _("Failed to write subsystem default identifier map to `%s'.\n"), 668 _("Failed to write subsystem default identifier map to `%s'.\n"),
669 subsystem_cfg_file); 669 subsystem_cfg_file);
670 ego->identifier = GNUNET_strdup (new_name); 670 ego->identifier = GNUNET_strdup (new_name);
671 fn_new = get_ego_filename (ego); 671 fn_new = get_ego_filename (ego);
672 if (0 != RENAME (fn_old, fn_new)) 672 if (0 != RENAME (fn_old, fn_new))
673 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "rename", fn_old); 673 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "rename", fn_old);
674 GNUNET_free (fn_old); 674 GNUNET_free (fn_old);
@@ -708,14 +708,14 @@ handle_ego_delete (void *cls,
708 return; 708 return;
709 if (0 != strcmp (id, identifier)) 709 if (0 != strcmp (id, identifier))
710 { 710 {
711 GNUNET_free (id); 711 GNUNET_free (id);
712 return; 712 return;
713 } 713 }
714 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg, 714 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
715 section, 715 section,
716 "DEFAULT_IDENTIFIER", 716 "DEFAULT_IDENTIFIER",
717 NULL); 717 NULL);
718 GNUNET_free (id); 718 GNUNET_free (id);
719} 719}
720 720
721 721
@@ -738,7 +738,7 @@ handle_delete_message (void *cls, struct GNUNET_SERVER_Client *client,
738 const char *name; 738 const char *name;
739 char *fn; 739 char *fn;
740 740
741 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 741 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
742 "Received DELETE message from client\n"); 742 "Received DELETE message from client\n");
743 size = ntohs (message->size); 743 size = ntohs (message->size);
744 if (size <= sizeof (struct GNUNET_IDENTITY_DeleteMessage)) 744 if (size <= sizeof (struct GNUNET_IDENTITY_DeleteMessage))
@@ -769,7 +769,7 @@ handle_delete_message (void *cls, struct GNUNET_SERVER_Client *client,
769 GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg, 769 GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg,
770 &handle_ego_delete, 770 &handle_ego_delete,
771 ego->identifier); 771 ego->identifier);
772 if (GNUNET_OK != 772 if (GNUNET_OK !=
773 GNUNET_CONFIGURATION_write (subsystem_cfg, 773 GNUNET_CONFIGURATION_write (subsystem_cfg,
774 subsystem_cfg_file)) 774 subsystem_cfg_file))
775 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 775 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -830,7 +830,7 @@ process_ego_file (void *cls,
830 } 830 }
831 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 831 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
832 "Loaded ego `%s'\n", 832 "Loaded ego `%s'\n",
833 fn + 1); 833 fn + 1);
834 ego->identifier = GNUNET_strdup (fn + 1); 834 ego->identifier = GNUNET_strdup (fn + 1);
835 GNUNET_CONTAINER_DLL_insert (ego_head, 835 GNUNET_CONTAINER_DLL_insert (ego_head,
836 ego_tail, 836 ego_tail,
@@ -847,7 +847,7 @@ process_ego_file (void *cls,
847 * @param c configuration to use 847 * @param c configuration to use
848 */ 848 */
849static void 849static void
850run (void *cls, 850run (void *cls,
851 struct GNUNET_SERVER_Handle *server, 851 struct GNUNET_SERVER_Handle *server,
852 const struct GNUNET_CONFIGURATION_Handle *c) 852 const struct GNUNET_CONFIGURATION_Handle *c)
853{ 853{
@@ -892,7 +892,7 @@ run (void *cls,
892 subsystem_cfg = GNUNET_CONFIGURATION_create (); 892 subsystem_cfg = GNUNET_CONFIGURATION_create ();
893 if ( (GNUNET_YES == 893 if ( (GNUNET_YES ==
894 GNUNET_DISK_file_test (subsystem_cfg_file)) && 894 GNUNET_DISK_file_test (subsystem_cfg_file)) &&
895 (GNUNET_OK != 895 (GNUNET_OK !=
896 GNUNET_CONFIGURATION_parse (subsystem_cfg, 896 GNUNET_CONFIGURATION_parse (subsystem_cfg,
897 subsystem_cfg_file)) ) 897 subsystem_cfg_file)) )
898 { 898 {
@@ -931,7 +931,7 @@ int
931main (int argc, char *const *argv) 931main (int argc, char *const *argv)
932{ 932{
933 return (GNUNET_OK == 933 return (GNUNET_OK ==
934 GNUNET_SERVICE_run (argc, argv, "identity", 934 GNUNET_SERVICE_run (argc, argv, "identity",
935 GNUNET_SERVICE_OPTION_NONE, 935 GNUNET_SERVICE_OPTION_NONE,
936 &run, NULL)) ? 0 : 1; 936 &run, NULL)) ? 0 : 1;
937} 937}
diff --git a/src/identity/identity.h b/src/identity/identity.h
index 13ac91e46..5e965b2c7 100644
--- a/src/identity/identity.h
+++ b/src/identity/identity.h
@@ -138,7 +138,7 @@ struct GNUNET_IDENTITY_SetDefaultMessage
138 uint16_t reserved GNUNET_PACKED; 138 uint16_t reserved GNUNET_PACKED;
139 139
140 /** 140 /**
141 * The private key 141 * The private key
142 */ 142 */
143 struct GNUNET_CRYPTO_EccPrivateKey private_key; 143 struct GNUNET_CRYPTO_EccPrivateKey private_key;
144 144
@@ -149,7 +149,7 @@ struct GNUNET_IDENTITY_SetDefaultMessage
149 149
150/** 150/**
151 * Client requests creation of an identity. Service 151 * Client requests creation of an identity. Service
152 * will respond with a result code. 152 * will respond with a result code.
153 */ 153 */
154struct GNUNET_IDENTITY_CreateRequestMessage 154struct GNUNET_IDENTITY_CreateRequestMessage
155{ 155{
@@ -169,7 +169,7 @@ struct GNUNET_IDENTITY_CreateRequestMessage
169 uint16_t reserved GNUNET_PACKED; 169 uint16_t reserved GNUNET_PACKED;
170 170
171 /** 171 /**
172 * The private key 172 * The private key
173 */ 173 */
174 struct GNUNET_CRYPTO_EccPrivateKey private_key; 174 struct GNUNET_CRYPTO_EccPrivateKey private_key;
175 175
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index 143f9e7e8..dc4613cdb 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -32,7 +32,7 @@
32 32
33#define LOG(kind,...) GNUNET_log_from (kind, "identity-api",__VA_ARGS__) 33#define LOG(kind,...) GNUNET_log_from (kind, "identity-api",__VA_ARGS__)
34 34
35/** 35/**
36 * Handle for an ego. 36 * Handle for an ego.
37 */ 37 */
38struct GNUNET_IDENTITY_Ego 38struct GNUNET_IDENTITY_Ego
@@ -59,7 +59,7 @@ struct GNUNET_IDENTITY_Ego
59}; 59};
60 60
61 61
62/** 62/**
63 * Handle for an operation with the identity service. 63 * Handle for an operation with the identity service.
64 */ 64 */
65struct GNUNET_IDENTITY_Operation 65struct GNUNET_IDENTITY_Operation
@@ -69,7 +69,7 @@ struct GNUNET_IDENTITY_Operation
69 * Main identity handle. 69 * Main identity handle.
70 */ 70 */
71 struct GNUNET_IDENTITY_Handle *h; 71 struct GNUNET_IDENTITY_Handle *h;
72 72
73 /** 73 /**
74 * We keep operations in a DLL. 74 * We keep operations in a DLL.
75 */ 75 */
@@ -139,12 +139,12 @@ struct GNUNET_IDENTITY_Handle
139 139
140 /** 140 /**
141 * Head of active operations. 141 * Head of active operations.
142 */ 142 */
143 struct GNUNET_IDENTITY_Operation *op_head; 143 struct GNUNET_IDENTITY_Operation *op_head;
144 144
145 /** 145 /**
146 * Tail of active operations. 146 * Tail of active operations.
147 */ 147 */
148 struct GNUNET_IDENTITY_Operation *op_tail; 148 struct GNUNET_IDENTITY_Operation *op_tail;
149 149
150 /** 150 /**
@@ -172,7 +172,7 @@ struct GNUNET_IDENTITY_Handle
172 172
173/** 173/**
174 * Obtain the ego representing 'anonymous' users. 174 * Obtain the ego representing 'anonymous' users.
175 * 175 *
176 * @return handle for the anonymous user, must not be freed 176 * @return handle for the anonymous user, must not be freed
177 */ 177 */
178const struct GNUNET_IDENTITY_Ego * 178const struct GNUNET_IDENTITY_Ego *
@@ -240,7 +240,7 @@ reschedule_connect (struct GNUNET_IDENTITY_Handle *h)
240 * @param msg message received, NULL on timeout or fatal error 240 * @param msg message received, NULL on timeout or fatal error
241 */ 241 */
242static void 242static void
243message_handler (void *cls, 243message_handler (void *cls,
244 const struct GNUNET_MessageHeader *msg) 244 const struct GNUNET_MessageHeader *msg)
245{ 245{
246 struct GNUNET_IDENTITY_Handle *h = cls; 246 struct GNUNET_IDENTITY_Handle *h = cls;
@@ -307,7 +307,7 @@ message_handler (void *cls,
307 } 307 }
308 um = (const struct GNUNET_IDENTITY_UpdateMessage *) msg; 308 um = (const struct GNUNET_IDENTITY_UpdateMessage *) msg;
309 name_len = ntohs (um->name_len); 309 name_len = ntohs (um->name_len);
310 310
311 str = (const char *) &um[1]; 311 str = (const char *) &um[1];
312 if ( (size != name_len + sizeof (struct GNUNET_IDENTITY_UpdateMessage)) || 312 if ( (size != name_len + sizeof (struct GNUNET_IDENTITY_UpdateMessage)) ||
313 ( (0 != name_len) && 313 ( (0 != name_len) &&
@@ -369,7 +369,7 @@ message_handler (void *cls,
369 /* ego changed name */ 369 /* ego changed name */
370 GNUNET_free (ego->name); 370 GNUNET_free (ego->name);
371 ego->name = GNUNET_strdup (str); 371 ego->name = GNUNET_strdup (str);
372 } 372 }
373 GNUNET_CLIENT_receive (h->client, &message_handler, h, 373 GNUNET_CLIENT_receive (h->client, &message_handler, h,
374 GNUNET_TIME_UNIT_FOREVER_REL); 374 GNUNET_TIME_UNIT_FOREVER_REL);
375 /* inform application about change */ 375 /* inform application about change */
@@ -456,14 +456,14 @@ transmit_next (struct GNUNET_IDENTITY_Handle *h);
456 * @return number of bytes copied to buf 456 * @return number of bytes copied to buf
457 */ 457 */
458static size_t 458static size_t
459send_next_message (void *cls, 459send_next_message (void *cls,
460 size_t size, 460 size_t size,
461 void *buf) 461 void *buf)
462{ 462{
463 struct GNUNET_IDENTITY_Handle *h = cls; 463 struct GNUNET_IDENTITY_Handle *h = cls;
464 struct GNUNET_IDENTITY_Operation *op = h->op_head; 464 struct GNUNET_IDENTITY_Operation *op = h->op_head;
465 size_t ret; 465 size_t ret;
466 466
467 h->th = NULL; 467 h->th = NULL;
468 if (NULL == op) 468 if (NULL == op)
469 return 0; 469 return 0;
@@ -472,7 +472,7 @@ send_next_message (void *cls,
472 { 472 {
473 reschedule_connect (h); 473 reschedule_connect (h);
474 return 0; 474 return 0;
475 } 475 }
476 LOG (GNUNET_ERROR_TYPE_DEBUG, 476 LOG (GNUNET_ERROR_TYPE_DEBUG,
477 "Sending message of type %d to identity service\n", 477 "Sending message of type %d to identity service\n",
478 ntohs (op->msg->type)); 478 ntohs (op->msg->type));
@@ -543,7 +543,7 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
543 if ( (NULL == h->op_head) || 543 if ( (NULL == h->op_head) ||
544 (GNUNET_MESSAGE_TYPE_IDENTITY_START != ntohs (h->op_head->msg->type)) ) 544 (GNUNET_MESSAGE_TYPE_IDENTITY_START != ntohs (h->op_head->msg->type)) )
545 { 545 {
546 op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) + 546 op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) +
547 sizeof (struct GNUNET_MessageHeader)); 547 sizeof (struct GNUNET_MessageHeader));
548 op->h = h; 548 op->h = h;
549 op->msg = (const struct GNUNET_MessageHeader *) &op[1]; 549 op->msg = (const struct GNUNET_MessageHeader *) &op[1];
@@ -633,7 +633,7 @@ GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *id,
633 struct GNUNET_IDENTITY_GetDefaultMessage *gdm; 633 struct GNUNET_IDENTITY_GetDefaultMessage *gdm;
634 size_t slen; 634 size_t slen;
635 635
636 slen = strlen (service_name) + 1; 636 slen = strlen (service_name) + 1;
637 if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_GetDefaultMessage)) 637 if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_GetDefaultMessage))
638 { 638 {
639 GNUNET_break (0); 639 GNUNET_break (0);
@@ -641,7 +641,7 @@ GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *id,
641 } 641 }
642 op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) + 642 op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) +
643 sizeof (struct GNUNET_IDENTITY_GetDefaultMessage) + 643 sizeof (struct GNUNET_IDENTITY_GetDefaultMessage) +
644 slen); 644 slen);
645 op->h = id; 645 op->h = id;
646 op->cb = cb; 646 op->cb = cb;
647 op->cls = cb_cls; 647 op->cls = cb_cls;
@@ -691,7 +691,7 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *id,
691 } 691 }
692 op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) + 692 op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) +
693 sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) + 693 sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) +
694 slen); 694 slen);
695 op->h = id; 695 op->h = id;
696 op->cont = cont; 696 op->cont = cont;
697 op->cls = cont_cls; 697 op->cls = cont_cls;
@@ -713,7 +713,7 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *id,
713} 713}
714 714
715 715
716/** 716/**
717 * Create a new identity with the given name. 717 * Create a new identity with the given name.
718 * 718 *
719 * @param id identity service to use 719 * @param id identity service to use
@@ -744,7 +744,7 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id,
744 } 744 }
745 op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) + 745 op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) +
746 sizeof (struct GNUNET_IDENTITY_CreateRequestMessage) + 746 sizeof (struct GNUNET_IDENTITY_CreateRequestMessage) +
747 slen); 747 slen);
748 op->h = id; 748 op->h = id;
749 op->cont = cont; 749 op->cont = cont;
750 op->cls = cont_cls; 750 op->cls = cont_cls;
@@ -767,7 +767,7 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id,
767} 767}
768 768
769 769
770/** 770/**
771 * Renames an existing identity. 771 * Renames an existing identity.
772 * 772 *
773 * @param id identity service to use 773 * @param id identity service to use
@@ -824,7 +824,7 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id,
824} 824}
825 825
826 826
827/** 827/**
828 * Delete an existing identity. 828 * Delete an existing identity.
829 * 829 *
830 * @param id identity service to use 830 * @param id identity service to use
@@ -851,7 +851,7 @@ GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *id,
851 } 851 }
852 op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) + 852 op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) +
853 sizeof (struct GNUNET_IDENTITY_DeleteMessage) + 853 sizeof (struct GNUNET_IDENTITY_DeleteMessage) +
854 slen); 854 slen);
855 op->h = id; 855 op->h = id;
856 op->cont = cb; 856 op->cont = cb;
857 op->cls = cb_cls; 857 op->cls = cb_cls;
diff --git a/src/identity/identity_api_lookup.c b/src/identity/identity_api_lookup.c
index 87e4face1..b813f5b41 100644
--- a/src/identity/identity_api_lookup.c
+++ b/src/identity/identity_api_lookup.c
@@ -32,25 +32,25 @@
32 32
33/** 33/**
34 * Handle for ego lookup. 34 * Handle for ego lookup.
35 */ 35 */
36struct GNUNET_IDENTITY_EgoLookup 36struct GNUNET_IDENTITY_EgoLookup
37{ 37{
38 38
39 /** 39 /**
40 * Handle to the identity service. 40 * Handle to the identity service.
41 */ 41 */
42 struct GNUNET_IDENTITY_Handle *identity; 42 struct GNUNET_IDENTITY_Handle *identity;
43 43
44 /** 44 /**
45 * Name of the ego we are looking up. 45 * Name of the ego we are looking up.
46 */ 46 */
47 char *name; 47 char *name;
48 48
49 /** 49 /**
50 * Function to call with the result. 50 * Function to call with the result.
51 */ 51 */
52 GNUNET_IDENTITY_EgoCallback cb; 52 GNUNET_IDENTITY_EgoCallback cb;
53 53
54 /** 54 /**
55 * Closure for @e cb 55 * Closure for @e cb
56 */ 56 */
@@ -58,7 +58,7 @@ struct GNUNET_IDENTITY_EgoLookup
58}; 58};
59 59
60 60
61/** 61/**
62 * Method called to inform about the egos of this peer. 62 * Method called to inform about the egos of this peer.
63 * 63 *
64 * When used with #GNUNET_IDENTITY_connect, this function is 64 * When used with #GNUNET_IDENTITY_connect, this function is
@@ -81,7 +81,7 @@ struct GNUNET_IDENTITY_EgoLookup
81 * NULL if the user just deleted the ego and it 81 * NULL if the user just deleted the ego and it
82 * must thus no longer be used 82 * must thus no longer be used
83 */ 83 */
84static void 84static void
85identity_cb (void *cls, 85identity_cb (void *cls,
86 struct GNUNET_IDENTITY_Ego *ego, 86 struct GNUNET_IDENTITY_Ego *ego,
87 void **ctx, 87 void **ctx,
@@ -98,7 +98,7 @@ identity_cb (void *cls,
98 GNUNET_IDENTITY_ego_lookup_cancel (el); 98 GNUNET_IDENTITY_ego_lookup_cancel (el);
99 return; 99 return;
100 } 100 }
101 if (NULL == ego) 101 if (NULL == ego)
102 { 102 {
103 /* not found */ 103 /* not found */
104 el->cb (el->cb_cls, 104 el->cb (el->cb_cls,
diff --git a/src/identity/test_identity.c b/src/identity/test_identity.c
index 60c6c2dad..6e8408ea8 100644
--- a/src/identity/test_identity.c
+++ b/src/identity/test_identity.c
@@ -50,7 +50,7 @@ static struct GNUNET_IDENTITY_Operation *op;
50 50
51/** 51/**
52 * Handle for task for timeout termination. 52 * Handle for task for timeout termination.
53 */ 53 */
54static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; 54static GNUNET_SCHEDULER_TaskIdentifier endbadly_task;
55 55
56 56
@@ -105,7 +105,7 @@ end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
105/** 105/**
106 * Finish the testcase (successfully). 106 * Finish the testcase (successfully).
107 */ 107 */
108static void 108static void
109end () 109end ()
110{ 110{
111 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) 111 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
@@ -195,9 +195,9 @@ fail_rename_cont (void *cls,
195 const char *emsg) 195 const char *emsg)
196{ 196{
197 GNUNET_assert (NULL != emsg); 197 GNUNET_assert (NULL != emsg);
198 op = GNUNET_IDENTITY_delete (h, 198 op = GNUNET_IDENTITY_delete (h,
199 "test", 199 "test",
200 &delete_cont, 200 &delete_cont,
201 NULL); 201 NULL);
202 end (); /* yepee */ 202 end (); /* yepee */
203} 203}
@@ -214,10 +214,10 @@ success_rename_cont (void *cls,
214 const char *emsg) 214 const char *emsg)
215{ 215{
216 GNUNET_assert (NULL == emsg); 216 GNUNET_assert (NULL == emsg);
217 op = GNUNET_IDENTITY_rename (h, 217 op = GNUNET_IDENTITY_rename (h,
218 "test-id", 218 "test-id",
219 "test", 219 "test",
220 &fail_rename_cont, 220 &fail_rename_cont,
221 NULL); 221 NULL);
222} 222}
223 223
@@ -231,12 +231,12 @@ success_rename_cont (void *cls,
231static void 231static void
232create_cb (void *cls, 232create_cb (void *cls,
233 const char *emsg) 233 const char *emsg)
234{ 234{
235 GNUNET_assert (NULL == emsg); 235 GNUNET_assert (NULL == emsg);
236 op = GNUNET_IDENTITY_rename (h, 236 op = GNUNET_IDENTITY_rename (h,
237 "test-id", 237 "test-id",
238 "test", 238 "test",
239 &success_rename_cont, 239 &success_rename_cont,
240 NULL); 240 NULL);
241} 241}
242 242
@@ -249,19 +249,19 @@ create_cb (void *cls,
249 * @param peer handle to access more of the peer (not used) 249 * @param peer handle to access more of the peer (not used)
250 */ 250 */
251static void 251static void
252run (void *cls, 252run (void *cls,
253 const struct GNUNET_CONFIGURATION_Handle *cfg, 253 const struct GNUNET_CONFIGURATION_Handle *cfg,
254 struct GNUNET_TESTING_Peer *peer) 254 struct GNUNET_TESTING_Peer *peer)
255{ 255{
256 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 256 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
257 &endbadly, NULL); 257 &endbadly, NULL);
258 h = GNUNET_IDENTITY_connect (cfg, &notification_cb, NULL); 258 h = GNUNET_IDENTITY_connect (cfg, &notification_cb, NULL);
259 GNUNET_assert (NULL != h); 259 GNUNET_assert (NULL != h);
260 op = GNUNET_IDENTITY_create (h, 260 op = GNUNET_IDENTITY_create (h,
261 "test-id", 261 "test-id",
262 &create_cb, 262 &create_cb,
263 NULL); 263 NULL);
264 264
265} 265}
266 266
267 267
@@ -270,7 +270,7 @@ main (int argc, char *argv[])
270{ 270{
271 GNUNET_DISK_directory_remove ("/tmp/test-identity-service"); 271 GNUNET_DISK_directory_remove ("/tmp/test-identity-service");
272 res = 1; 272 res = 1;
273 if (0 != 273 if (0 !=
274 GNUNET_TESTING_service_run ("test-identity", 274 GNUNET_TESTING_service_run ("test-identity",
275 "identity", 275 "identity",
276 "test_identity.conf", 276 "test_identity.conf",
diff --git a/src/identity/test_identity_defaults.c b/src/identity/test_identity_defaults.c
index 2caf03a1e..ad4b91ae9 100644
--- a/src/identity/test_identity_defaults.c
+++ b/src/identity/test_identity_defaults.c
@@ -50,7 +50,7 @@ static struct GNUNET_IDENTITY_Operation *op;
50 50
51/** 51/**
52 * Handle for task for timeout termination. 52 * Handle for task for timeout termination.
53 */ 53 */
54static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; 54static GNUNET_SCHEDULER_TaskIdentifier endbadly_task;
55 55
56 56
@@ -105,7 +105,7 @@ end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
105/** 105/**
106 * Finish the testcase (successfully). 106 * Finish the testcase (successfully).
107 */ 107 */
108static void 108static void
109end () 109end ()
110{ 110{
111 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) 111 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
@@ -149,9 +149,9 @@ get_cb (void *cls,
149 GNUNET_assert (NULL != ego); 149 GNUNET_assert (NULL != ego);
150 GNUNET_assert (NULL != identifier); 150 GNUNET_assert (NULL != identifier);
151 GNUNET_assert (0 == strcmp (identifier, "test-id")); 151 GNUNET_assert (0 == strcmp (identifier, "test-id"));
152 op = GNUNET_IDENTITY_delete (h, 152 op = GNUNET_IDENTITY_delete (h,
153 "test-id", 153 "test-id",
154 &delete_cont, 154 &delete_cont,
155 NULL); 155 NULL);
156} 156}
157 157
@@ -164,12 +164,12 @@ get_cb (void *cls,
164 * @param peer handle to access more of the peer (not used) 164 * @param peer handle to access more of the peer (not used)
165 */ 165 */
166static void 166static void
167run_get (void *cls, 167run_get (void *cls,
168 const struct GNUNET_CONFIGURATION_Handle *cfg, 168 const struct GNUNET_CONFIGURATION_Handle *cfg,
169 struct GNUNET_TESTING_Peer *peer) 169 struct GNUNET_TESTING_Peer *peer)
170{ 170{
171 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 171 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
172 &endbadly, NULL); 172 &endbadly, NULL);
173 h = GNUNET_IDENTITY_connect (cfg, NULL, NULL); 173 h = GNUNET_IDENTITY_connect (cfg, NULL, NULL);
174 GNUNET_assert (NULL != h); 174 GNUNET_assert (NULL != h);
175 op = GNUNET_IDENTITY_get (h, 175 op = GNUNET_IDENTITY_get (h,
@@ -214,10 +214,10 @@ notification_cb (void *cls,
214{ 214{
215 if (NULL == ego) 215 if (NULL == ego)
216 return; /* skip first call */ 216 return; /* skip first call */
217 op = GNUNET_IDENTITY_set (h, 217 op = GNUNET_IDENTITY_set (h,
218 "test-service", 218 "test-service",
219 ego, 219 ego,
220 &success_set_cont, 220 &success_set_cont,
221 NULL); 221 NULL);
222} 222}
223 223
@@ -231,7 +231,7 @@ notification_cb (void *cls,
231static void 231static void
232create_cb (void *cls, 232create_cb (void *cls,
233 const char *emsg) 233 const char *emsg)
234{ 234{
235 GNUNET_assert (NULL == emsg); 235 GNUNET_assert (NULL == emsg);
236 op = NULL; 236 op = NULL;
237} 237}
@@ -245,19 +245,19 @@ create_cb (void *cls,
245 * @param peer handle to access more of the peer (not used) 245 * @param peer handle to access more of the peer (not used)
246 */ 246 */
247static void 247static void
248run_set (void *cls, 248run_set (void *cls,
249 const struct GNUNET_CONFIGURATION_Handle *cfg, 249 const struct GNUNET_CONFIGURATION_Handle *cfg,
250 struct GNUNET_TESTING_Peer *peer) 250 struct GNUNET_TESTING_Peer *peer)
251{ 251{
252 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 252 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
253 &endbadly, NULL); 253 &endbadly, NULL);
254 h = GNUNET_IDENTITY_connect (cfg, &notification_cb, NULL); 254 h = GNUNET_IDENTITY_connect (cfg, &notification_cb, NULL);
255 GNUNET_assert (NULL != h); 255 GNUNET_assert (NULL != h);
256 op = GNUNET_IDENTITY_create (h, 256 op = GNUNET_IDENTITY_create (h,
257 "test-id", 257 "test-id",
258 &create_cb, 258 &create_cb,
259 NULL); 259 NULL);
260 260
261} 261}
262 262
263 263
@@ -266,14 +266,14 @@ main (int argc, char *argv[])
266{ 266{
267 GNUNET_DISK_directory_remove ("/tmp/test-identity-service"); 267 GNUNET_DISK_directory_remove ("/tmp/test-identity-service");
268 res = 1; 268 res = 1;
269 if (0 != 269 if (0 !=
270 GNUNET_TESTING_service_run ("test-identity-defaults", 270 GNUNET_TESTING_service_run ("test-identity-defaults",
271 "identity", 271 "identity",
272 "test_identity.conf", 272 "test_identity.conf",
273 &run_set, 273 &run_set,
274 NULL)) 274 NULL))
275 return 1; 275 return 1;
276 if (0 != 276 if (0 !=
277 GNUNET_TESTING_service_run ("test-identity-defaults", 277 GNUNET_TESTING_service_run ("test-identity-defaults",
278 "identity", 278 "identity",
279 "test_identity.conf", 279 "test_identity.conf",
diff --git a/src/include/block_regex.h b/src/include/block_regex.h
index 8e43c2377..77f778c95 100644
--- a/src/include/block_regex.h
+++ b/src/include/block_regex.h
@@ -63,7 +63,7 @@ struct RegexAcceptBlock
63 * The key of the state. 63 * The key of the state.
64 */ 64 */
65 struct GNUNET_HashCode key; 65 struct GNUNET_HashCode key;
66 66
67 /** 67 /**
68 * Public key of the peer signing. 68 * Public key of the peer signing.
69 */ 69 */
diff --git a/src/include/gnunet_arm_service.h b/src/include/gnunet_arm_service.h
index 7c35b0b20..e1f44620f 100644
--- a/src/include/gnunet_arm_service.h
+++ b/src/include/gnunet_arm_service.h
@@ -180,7 +180,7 @@ struct GNUNET_ARM_Handle;
180 * @param connected GNUNET_YES if connected, GNUNET_NO if disconnected, 180 * @param connected GNUNET_YES if connected, GNUNET_NO if disconnected,
181 * GNUNET_SYSERR if there was an error. 181 * GNUNET_SYSERR if there was an error.
182 */ 182 */
183typedef void (*GNUNET_ARM_ConnectionStatusCallback) (void *cls, 183typedef void (*GNUNET_ARM_ConnectionStatusCallback) (void *cls,
184 int connected); 184 int connected);
185 185
186 186
@@ -195,9 +195,9 @@ typedef void (*GNUNET_ARM_ConnectionStatusCallback) (void *cls,
195 * @param service service name 195 * @param service service name
196 * @param result result of the operation 196 * @param result result of the operation
197 */ 197 */
198typedef void (*GNUNET_ARM_ResultCallback) (void *cls, 198typedef void (*GNUNET_ARM_ResultCallback) (void *cls,
199 enum GNUNET_ARM_RequestStatus rs, 199 enum GNUNET_ARM_RequestStatus rs,
200 const char *service, 200 const char *service,
201 enum GNUNET_ARM_Result result); 201 enum GNUNET_ARM_Result result);
202 202
203 203
@@ -212,9 +212,9 @@ typedef void (*GNUNET_ARM_ResultCallback) (void *cls,
212 * @param count number of strings in the list 212 * @param count number of strings in the list
213 * @param list list of running services 213 * @param list list of running services
214 */ 214 */
215typedef void (*GNUNET_ARM_ServiceListCallback) (void *cls, 215typedef void (*GNUNET_ARM_ServiceListCallback) (void *cls,
216 enum GNUNET_ARM_RequestStatus rs, 216 enum GNUNET_ARM_RequestStatus rs,
217 unsigned int count, 217 unsigned int count,
218 const char *const*list); 218 const char *const*list);
219 219
220 220
@@ -231,7 +231,7 @@ typedef void (*GNUNET_ARM_ServiceListCallback) (void *cls,
231 */ 231 */
232struct GNUNET_ARM_Handle * 232struct GNUNET_ARM_Handle *
233GNUNET_ARM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, 233GNUNET_ARM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
234 GNUNET_ARM_ConnectionStatusCallback conn_status, 234 GNUNET_ARM_ConnectionStatusCallback conn_status,
235 void *cls); 235 void *cls);
236 236
237 237
@@ -274,7 +274,7 @@ GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h,
274 */ 274 */
275void 275void
276GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h, 276GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h,
277 const char *service_name, 277 const char *service_name,
278 struct GNUNET_TIME_Relative timeout, 278 struct GNUNET_TIME_Relative timeout,
279 GNUNET_ARM_ResultCallback cont, void *cont_cls); 279 GNUNET_ARM_ResultCallback cont, void *cont_cls);
280 280
@@ -291,9 +291,9 @@ GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h,
291 */ 291 */
292void 292void
293GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, 293GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h,
294 const char *service_name, 294 const char *service_name,
295 enum GNUNET_OS_InheritStdioFlags std_inheritance, 295 enum GNUNET_OS_InheritStdioFlags std_inheritance,
296 struct GNUNET_TIME_Relative timeout, 296 struct GNUNET_TIME_Relative timeout,
297 GNUNET_ARM_ResultCallback cont, 297 GNUNET_ARM_ResultCallback cont,
298 void *cont_cls); 298 void *cont_cls);
299 299
@@ -312,8 +312,8 @@ struct GNUNET_ARM_MonitorHandle;
312 * @param service service name 312 * @param service service name
313 * @param status status of the service 313 * @param status status of the service
314 */ 314 */
315typedef void (*GNUNET_ARM_ServiceStatusCallback) (void *cls, 315typedef void (*GNUNET_ARM_ServiceStatusCallback) (void *cls,
316 const char *service, 316 const char *service,
317 enum GNUNET_ARM_ServiceStatus status); 317 enum GNUNET_ARM_ServiceStatus status);
318 318
319 319
@@ -330,7 +330,7 @@ typedef void (*GNUNET_ARM_ServiceStatusCallback) (void *cls,
330 */ 330 */
331struct GNUNET_ARM_MonitorHandle * 331struct GNUNET_ARM_MonitorHandle *
332GNUNET_ARM_monitor (const struct GNUNET_CONFIGURATION_Handle *cfg, 332GNUNET_ARM_monitor (const struct GNUNET_CONFIGURATION_Handle *cfg,
333 GNUNET_ARM_ServiceStatusCallback cont, 333 GNUNET_ARM_ServiceStatusCallback cont,
334 void *cont_cls); 334 void *cont_cls);
335 335
336 336
diff --git a/src/include/gnunet_bio_lib.h b/src/include/gnunet_bio_lib.h
index a9ac0c1cd..261288396 100644
--- a/src/include/gnunet_bio_lib.h
+++ b/src/include/gnunet_bio_lib.h
@@ -93,7 +93,7 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, const char *what,
93 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure 93 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
94 */ 94 */
95int 95int
96GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, 96GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h,
97 const char *file, int line, 97 const char *file, int line,
98 void *result, size_t len); 98 void *result, size_t len);
99 99
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h
index 38ad78686..5f3bbda96 100644
--- a/src/include/gnunet_block_lib.h
+++ b/src/include/gnunet_block_lib.h
@@ -88,7 +88,7 @@ enum GNUNET_BLOCK_Type
88 * Block for testing. 88 * Block for testing.
89 */ 89 */
90 GNUNET_BLOCK_TYPE_TEST = 8, 90 GNUNET_BLOCK_TYPE_TEST = 8,
91 91
92 /** 92 /**
93 * Type of a block representing any type of search result 93 * Type of a block representing any type of search result
94 * (universal). Implemented in the context of #2564, replaces 94 * (universal). Implemented in the context of #2564, replaces
@@ -132,7 +132,7 @@ enum GNUNET_BLOCK_EvaluationResult
132 * Valid result, and there may be more. 132 * Valid result, and there may be more.
133 */ 133 */
134 GNUNET_BLOCK_EVALUATION_OK_MORE = 0, 134 GNUNET_BLOCK_EVALUATION_OK_MORE = 0,
135 135
136 /** 136 /**
137 * Last possible valid result. 137 * Last possible valid result.
138 */ 138 */
diff --git a/src/include/gnunet_block_plugin.h b/src/include/gnunet_block_plugin.h
index aadfdb5a4..91f278d38 100644
--- a/src/include/gnunet_block_plugin.h
+++ b/src/include/gnunet_block_plugin.h
@@ -51,7 +51,7 @@
51 * @param reply_block_size number of bytes in @a reply_block 51 * @param reply_block_size number of bytes in @a reply_block
52 * @return characterization of result 52 * @return characterization of result
53 */ 53 */
54typedef enum GNUNET_BLOCK_EvaluationResult 54typedef enum GNUNET_BLOCK_EvaluationResult
55(*GNUNET_BLOCK_EvaluationFunction) (void *cls, 55(*GNUNET_BLOCK_EvaluationFunction) (void *cls,
56 enum GNUNET_BLOCK_Type type, 56 enum GNUNET_BLOCK_Type type,
57 const struct GNUNET_HashCode *query, 57 const struct GNUNET_HashCode *query,
diff --git a/src/include/gnunet_client_lib.h b/src/include/gnunet_client_lib.h
index 37f152d97..687083ad4 100644
--- a/src/include/gnunet_client_lib.h
+++ b/src/include/gnunet_client_lib.h
@@ -128,7 +128,7 @@ GNUNET_CLIENT_notify_transmit_ready (struct GNUNET_CLIENT_Connection *client,
128 size_t size, 128 size_t size,
129 struct GNUNET_TIME_Relative timeout, 129 struct GNUNET_TIME_Relative timeout,
130 int auto_retry, 130 int auto_retry,
131 GNUNET_CONNECTION_TransmitReadyNotify notify, 131 GNUNET_CONNECTION_TransmitReadyNotify notify,
132 void *notify_cls); 132 void *notify_cls);
133 133
134 134
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index d599b87e9..450a45a7e 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -217,7 +217,7 @@ extern "C"
217/** 217/**
218 * Define as empty, GNUNET_PACKED should suffice, but this won't work on W32 218 * Define as empty, GNUNET_PACKED should suffice, but this won't work on W32
219 */ 219 */
220#define GNUNET_NETWORK_STRUCT_BEGIN 220#define GNUNET_NETWORK_STRUCT_BEGIN
221 221
222/** 222/**
223 * Define as empty, GNUNET_PACKED should suffice, but this won't work on W32; 223 * Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;
@@ -307,9 +307,9 @@ GNUNET_get_log_skip ();
307 307
308#if !defined(GNUNET_CULL_LOGGING) 308#if !defined(GNUNET_CULL_LOGGING)
309int 309int
310GNUNET_get_log_call_status (int caller_level, 310GNUNET_get_log_call_status (int caller_level,
311 const char *comp, 311 const char *comp,
312 const char *file, 312 const char *file,
313 const char *function, int line); 313 const char *function, int line);
314#endif 314#endif
315 315
@@ -403,7 +403,7 @@ GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, const char *comp,
403 * @param option name of missing option 403 * @param option name of missing option
404 */ 404 */
405void 405void
406GNUNET_log_config_missing (enum GNUNET_ErrorType kind, 406GNUNET_log_config_missing (enum GNUNET_ErrorType kind,
407 const char *section, 407 const char *section,
408 const char *option); 408 const char *option);
409 409
@@ -418,7 +418,7 @@ GNUNET_log_config_missing (enum GNUNET_ErrorType kind,
418 * @param required what is required that is invalid about the option 418 * @param required what is required that is invalid about the option
419 */ 419 */
420void 420void
421GNUNET_log_config_invalid (enum GNUNET_ErrorType kind, 421GNUNET_log_config_invalid (enum GNUNET_ErrorType kind,
422 const char *section, 422 const char *section,
423 const char *option, 423 const char *option,
424 const char *required); 424 const char *required);
@@ -651,7 +651,7 @@ GNUNET_htonll (uint64_t n);
651 * @param d the value in network byte order 651 * @param d the value in network byte order
652 * @return the same value in host byte order 652 * @return the same value in host byte order
653 */ 653 */
654double 654double
655GNUNET_hton_double (double d); 655GNUNET_hton_double (double d);
656 656
657/** 657/**
@@ -659,7 +659,7 @@ GNUNET_hton_double (double d);
659 * @param d the value in network byte order 659 * @param d the value in network byte order
660 * @return the same value in host byte order 660 * @return the same value in host byte order
661 */ 661 */
662double 662double
663GNUNET_ntoh_double (double d); 663GNUNET_ntoh_double (double d);
664 664
665/* ************************* allocation functions ****************** */ 665/* ************************* allocation functions ****************** */
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h
index 05ba8a2db..08cf1558a 100644
--- a/src/include/gnunet_configuration_lib.h
+++ b/src/include/gnunet_configuration_lib.h
@@ -22,7 +22,7 @@
22 * @file include/gnunet_configuration_lib.h 22 * @file include/gnunet_configuration_lib.h
23 * @brief configuration API 23 * @brief configuration API
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * @defgroup configuration Configuration management 25 * @defgroup configuration Configuration management
26 * @{ 26 * @{
27 */ 27 */
28#ifndef GNUNET_CONFIGURATION_LIB_H 28#ifndef GNUNET_CONFIGURATION_LIB_H
@@ -324,9 +324,9 @@ GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg,
324 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 324 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
325 */ 325 */
326int 326int
327GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Handle *cfg, 327GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Handle *cfg,
328 const char *section, 328 const char *section,
329 const char *option, 329 const char *option,
330 char **value); 330 char **value);
331 331
332 332
diff --git a/src/include/gnunet_consensus_service.h b/src/include/gnunet_consensus_service.h
index fc1255506..b7085a801 100644
--- a/src/include/gnunet_consensus_service.h
+++ b/src/include/gnunet_consensus_service.h
@@ -95,7 +95,7 @@ GNUNET_CONSENSUS_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
95 * GNUNET_CONSENSUS_destroy instead. 95 * GNUNET_CONSENSUS_destroy instead.
96 * 96 *
97 * @param cls 97 * @param cls
98 * @param success GNUNET_OK on success, GNUNET_SYSERR if 98 * @param success GNUNET_OK on success, GNUNET_SYSERR if
99 * the insertion and thus the consensus failed for good 99 * the insertion and thus the consensus failed for good
100 */ 100 */
101typedef void (*GNUNET_CONSENSUS_InsertDoneCallback) (void *cls, 101typedef void (*GNUNET_CONSENSUS_InsertDoneCallback) (void *cls,
@@ -111,7 +111,7 @@ typedef void (*GNUNET_CONSENSUS_InsertDoneCallback) (void *cls,
111 * 111 *
112 * @param consensus handle for the consensus session 112 * @param consensus handle for the consensus session
113 * @param element the element to be inserted 113 * @param element the element to be inserted
114 * @param idc function called when we are done with this element and it 114 * @param idc function called when we are done with this element and it
115 * is thus allowed to call GNUNET_CONSENSUS_insert again 115 * is thus allowed to call GNUNET_CONSENSUS_insert again
116 * @param idc_cls closure for 'idc' 116 * @param idc_cls closure for 'idc'
117 */ 117 */
diff --git a/src/include/gnunet_constants.h b/src/include/gnunet_constants.h
index 5f37f8922..730a3d6d7 100644
--- a/src/include/gnunet_constants.h
+++ b/src/include/gnunet_constants.h
@@ -119,7 +119,7 @@ extern "C"
119 119
120/** 120/**
121 * Largest block that can be stored in the DHT. 121 * Largest block that can be stored in the DHT.
122 */ 122 */
123#define GNUNET_CONSTANTS_MAX_BLOCK_SIZE (62 * 1024) 123#define GNUNET_CONSTANTS_MAX_BLOCK_SIZE (62 * 1024)
124 124
125 125
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h
index 39176e93b..00540d9ea 100644
--- a/src/include/gnunet_container_lib.h
+++ b/src/include/gnunet_container_lib.h
@@ -612,10 +612,10 @@ typedef int (*GNUNET_CONTAINER_HashMapIterator) (void *cls,
612 * @param len initial size (map will grow as needed) 612 * @param len initial size (map will grow as needed)
613 * @param do_not_copy_keys #GNUNET_NO is always safe and should be used by default; 613 * @param do_not_copy_keys #GNUNET_NO is always safe and should be used by default;
614 * #GNUNET_YES means that on 'put', the 'key' does not have 614 * #GNUNET_YES means that on 'put', the 'key' does not have
615 * to be copied as the destination of the pointer is 615 * to be copied as the destination of the pointer is
616 * guaranteed to be life as long as the value is stored in 616 * guaranteed to be life as long as the value is stored in
617 * the hashmap. This can significantly reduce memory 617 * the hashmap. This can significantly reduce memory
618 * consumption, but of course is also a recipie for 618 * consumption, but of course is also a recipie for
619 * heap corruption if the assumption is not true. Only 619 * heap corruption if the assumption is not true. Only
620 * use this if (1) memory use is important in this case and 620 * use this if (1) memory use is important in this case and
621 * (2) you have triple-checked that the invariant holds 621 * (2) you have triple-checked that the invariant holds
@@ -649,7 +649,7 @@ GNUNET_CONTAINER_multihashmap_destroy (struct GNUNET_CONTAINER_MultiHashMap *map
649 * key-value pairs with value NULL 649 * key-value pairs with value NULL
650 */ 650 */
651void * 651void *
652GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap *map, 652GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap *map,
653 const struct GNUNET_HashCode *key); 653 const struct GNUNET_HashCode *key);
654 654
655 655
@@ -667,7 +667,7 @@ GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap *m
667 */ 667 */
668int 668int
669GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map, 669GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
670 const struct GNUNET_HashCode *key, 670 const struct GNUNET_HashCode *key,
671 const void *value); 671 const void *value);
672 672
673/** 673/**
@@ -680,7 +680,7 @@ GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
680 * @return number of values removed 680 * @return number of values removed
681 */ 681 */
682int 682int
683GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap *map, 683GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap *map,
684 const struct GNUNET_HashCode *key); 684 const struct GNUNET_HashCode *key);
685 685
686 686
@@ -711,7 +711,7 @@ GNUNET_CONTAINER_multihashmap_contains (const struct GNUNET_CONTAINER_MultiHashM
711 * #GNUNET_NO if not 711 * #GNUNET_NO if not
712 */ 712 */
713int 713int
714GNUNET_CONTAINER_multihashmap_contains_value (const struct GNUNET_CONTAINER_MultiHashMap *map, 714GNUNET_CONTAINER_multihashmap_contains_value (const struct GNUNET_CONTAINER_MultiHashMap *map,
715 const struct GNUNET_HashCode *key, 715 const struct GNUNET_HashCode *key,
716 const void *value); 716 const void *value);
717 717
@@ -782,7 +782,7 @@ GNUNET_CONTAINER_multihashmap_iterator_create (const struct GNUNET_CONTAINER_Mul
782 782
783 783
784/** 784/**
785 * @ingroup hashmap 785 * @ingroup hashmap
786 * Retrieve the next element from the hash map at the iterator's 786 * Retrieve the next element from the hash map at the iterator's
787 * position. If there are no elements left, #GNUNET_NO is returned, 787 * position. If there are no elements left, #GNUNET_NO is returned,
788 * and @a key and @a value are not modified. This operation is only 788 * and @a key and @a value are not modified. This operation is only
@@ -798,12 +798,12 @@ GNUNET_CONTAINER_multihashmap_iterator_create (const struct GNUNET_CONTAINER_Mul
798 */ 798 */
799int 799int
800GNUNET_CONTAINER_multihashmap_iterator_next (struct GNUNET_CONTAINER_MultiHashMapIterator *iter, 800GNUNET_CONTAINER_multihashmap_iterator_next (struct GNUNET_CONTAINER_MultiHashMapIterator *iter,
801 struct GNUNET_HashCode *key, 801 struct GNUNET_HashCode *key,
802 const void **value); 802 const void **value);
803 803
804 804
805/** 805/**
806 * @ingroup hashmap 806 * @ingroup hashmap
807 * Destroy a multihashmap iterator. 807 * Destroy a multihashmap iterator.
808 * 808 *
809 * @param iter the iterator to destroy 809 * @param iter the iterator to destroy
@@ -813,7 +813,7 @@ GNUNET_CONTAINER_multihashmap_iterator_destroy (struct GNUNET_CONTAINER_MultiHas
813 813
814 814
815/** 815/**
816 * @ingroup hashmap 816 * @ingroup hashmap
817 * Iterate over all entries in the map that match a particular key. 817 * Iterate over all entries in the map that match a particular key.
818 * 818 *
819 * @param map the map 819 * @param map the map
@@ -856,10 +856,10 @@ typedef int (*GNUNET_CONTAINER_PeerMapIterator) (void *cls,
856 * @param len initial size (map will grow as needed) 856 * @param len initial size (map will grow as needed)
857 * @param do_not_copy_keys #GNUNET_NO is always safe and should be used by default; 857 * @param do_not_copy_keys #GNUNET_NO is always safe and should be used by default;
858 * #GNUNET_YES means that on 'put', the 'key' does not have 858 * #GNUNET_YES means that on 'put', the 'key' does not have
859 * to be copied as the destination of the pointer is 859 * to be copied as the destination of the pointer is
860 * guaranteed to be life as long as the value is stored in 860 * guaranteed to be life as long as the value is stored in
861 * the hashmap. This can significantly reduce memory 861 * the hashmap. This can significantly reduce memory
862 * consumption, but of course is also a recipie for 862 * consumption, but of course is also a recipie for
863 * heap corruption if the assumption is not true. Only 863 * heap corruption if the assumption is not true. Only
864 * use this if (1) memory use is important in this case and 864 * use this if (1) memory use is important in this case and
865 * (2) you have triple-checked that the invariant holds 865 * (2) you have triple-checked that the invariant holds
@@ -893,7 +893,7 @@ GNUNET_CONTAINER_multipeermap_destroy (struct GNUNET_CONTAINER_MultiPeerMap *map
893 * key-value pairs with value NULL 893 * key-value pairs with value NULL
894 */ 894 */
895void * 895void *
896GNUNET_CONTAINER_multipeermap_get (const struct GNUNET_CONTAINER_MultiPeerMap *map, 896GNUNET_CONTAINER_multipeermap_get (const struct GNUNET_CONTAINER_MultiPeerMap *map,
897 const struct GNUNET_PeerIdentity *key); 897 const struct GNUNET_PeerIdentity *key);
898 898
899 899
@@ -911,7 +911,7 @@ GNUNET_CONTAINER_multipeermap_get (const struct GNUNET_CONTAINER_MultiPeerMap *m
911 */ 911 */
912int 912int
913GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map, 913GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map,
914 const struct GNUNET_PeerIdentity * key, 914 const struct GNUNET_PeerIdentity * key,
915 const void *value); 915 const void *value);
916 916
917/** 917/**
@@ -924,7 +924,7 @@ GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map,
924 * @return number of values removed 924 * @return number of values removed
925 */ 925 */
926int 926int
927GNUNET_CONTAINER_multipeermap_remove_all (struct GNUNET_CONTAINER_MultiPeerMap *map, 927GNUNET_CONTAINER_multipeermap_remove_all (struct GNUNET_CONTAINER_MultiPeerMap *map,
928 const struct GNUNET_PeerIdentity *key); 928 const struct GNUNET_PeerIdentity *key);
929 929
930 930
@@ -955,7 +955,7 @@ GNUNET_CONTAINER_multipeermap_contains (const struct GNUNET_CONTAINER_MultiPeerM
955 * #GNUNET_NO if not 955 * #GNUNET_NO if not
956 */ 956 */
957int 957int
958GNUNET_CONTAINER_multipeermap_contains_value (const struct GNUNET_CONTAINER_MultiPeerMap *map, 958GNUNET_CONTAINER_multipeermap_contains_value (const struct GNUNET_CONTAINER_MultiPeerMap *map,
959 const struct GNUNET_PeerIdentity * key, 959 const struct GNUNET_PeerIdentity * key,
960 const void *value); 960 const void *value);
961 961
@@ -975,7 +975,7 @@ GNUNET_CONTAINER_multipeermap_contains_value (const struct GNUNET_CONTAINER_Mult
975 */ 975 */
976int 976int
977GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map, 977GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map,
978 const struct GNUNET_PeerIdentity *key, 978 const struct GNUNET_PeerIdentity *key,
979 void *value, 979 void *value,
980 enum GNUNET_CONTAINER_MultiHashMapOption opt); 980 enum GNUNET_CONTAINER_MultiHashMapOption opt);
981 981
@@ -1025,7 +1025,7 @@ GNUNET_CONTAINER_multipeermap_iterator_create (const struct GNUNET_CONTAINER_Mul
1025 1025
1026 1026
1027/** 1027/**
1028 * @ingroup hashmap 1028 * @ingroup hashmap
1029 * Retrieve the next element from the hash map at the iterator's 1029 * Retrieve the next element from the hash map at the iterator's
1030 * position. If there are no elements left, #GNUNET_NO is returned, 1030 * position. If there are no elements left, #GNUNET_NO is returned,
1031 * and @a key and @a value are not modified. This operation is only 1031 * and @a key and @a value are not modified. This operation is only
@@ -1041,12 +1041,12 @@ GNUNET_CONTAINER_multipeermap_iterator_create (const struct GNUNET_CONTAINER_Mul
1041 */ 1041 */
1042int 1042int
1043GNUNET_CONTAINER_multipeermap_iterator_next (struct GNUNET_CONTAINER_MultiPeerMapIterator *iter, 1043GNUNET_CONTAINER_multipeermap_iterator_next (struct GNUNET_CONTAINER_MultiPeerMapIterator *iter,
1044 struct GNUNET_PeerIdentity *key, 1044 struct GNUNET_PeerIdentity *key,
1045 const void **value); 1045 const void **value);
1046 1046
1047 1047
1048/** 1048/**
1049 * @ingroup hashmap 1049 * @ingroup hashmap
1050 * Destroy a multipeermap iterator. 1050 * Destroy a multipeermap iterator.
1051 * 1051 *
1052 * @param iter the iterator to destroy 1052 * @param iter the iterator to destroy
@@ -1056,7 +1056,7 @@ GNUNET_CONTAINER_multipeermap_iterator_destroy (struct GNUNET_CONTAINER_MultiPee
1056 1056
1057 1057
1058/** 1058/**
1059 * @ingroup hashmap 1059 * @ingroup hashmap
1060 * Iterate over all entries in the map that match a particular key. 1060 * Iterate over all entries in the map that match a particular key.
1061 * 1061 *
1062 * @param map the map 1062 * @param map the map
@@ -1077,14 +1077,14 @@ GNUNET_CONTAINER_multipeermap_get_multiple (const struct GNUNET_CONTAINER_MultiP
1077/* Version of multihashmap with 32 bit keys */ 1077/* Version of multihashmap with 32 bit keys */
1078 1078
1079/** 1079/**
1080 * @ingroup hashmap 1080 * @ingroup hashmap
1081 * Opaque handle for the 32-bit key HashMap. 1081 * Opaque handle for the 32-bit key HashMap.
1082 */ 1082 */
1083struct GNUNET_CONTAINER_MultiHashMap32; 1083struct GNUNET_CONTAINER_MultiHashMap32;
1084 1084
1085 1085
1086/** 1086/**
1087 * @ingroup hashmap 1087 * @ingroup hashmap
1088 * Iterator over hash map entries. 1088 * Iterator over hash map entries.
1089 * 1089 *
1090 * @param cls closure 1090 * @param cls closure
@@ -1100,7 +1100,7 @@ typedef int (*GNUNET_CONTAINER_HashMapIterator32) (void *cls,
1100 1100
1101 1101
1102/** 1102/**
1103 * @ingroup hashmap 1103 * @ingroup hashmap
1104 * Create a 32-bit key multi hash map. 1104 * Create a 32-bit key multi hash map.
1105 * 1105 *
1106 * @param len initial size (map will grow as needed) 1106 * @param len initial size (map will grow as needed)
@@ -1111,7 +1111,7 @@ GNUNET_CONTAINER_multihashmap32_create (unsigned int len);
1111 1111
1112 1112
1113/** 1113/**
1114 * @ingroup hashmap 1114 * @ingroup hashmap
1115 * Destroy a 32-bit key hash map. Will not free any values 1115 * Destroy a 32-bit key hash map. Will not free any values
1116 * stored in the hash map! 1116 * stored in the hash map!
1117 * 1117 *
@@ -1123,7 +1123,7 @@ GNUNET_CONTAINER_multihashmap32_destroy (struct GNUNET_CONTAINER_MultiHashMap32
1123 1123
1124 1124
1125/** 1125/**
1126 * @ingroup hashmap 1126 * @ingroup hashmap
1127 * Get the number of key-value pairs in the map. 1127 * Get the number of key-value pairs in the map.
1128 * 1128 *
1129 * @param map the map 1129 * @param map the map
@@ -1135,7 +1135,7 @@ GNUNET_CONTAINER_multihashmap32_size (const struct
1135 1135
1136 1136
1137/** 1137/**
1138 * @ingroup hashmap 1138 * @ingroup hashmap
1139 * Given a key find a value in the map matching the key. 1139 * Given a key find a value in the map matching the key.
1140 * 1140 *
1141 * @param map the map 1141 * @param map the map
@@ -1146,13 +1146,13 @@ GNUNET_CONTAINER_multihashmap32_size (const struct
1146 * key-value pairs with value NULL 1146 * key-value pairs with value NULL
1147 */ 1147 */
1148void * 1148void *
1149GNUNET_CONTAINER_multihashmap32_get (const struct 1149GNUNET_CONTAINER_multihashmap32_get (const struct
1150 GNUNET_CONTAINER_MultiHashMap32 *map, 1150 GNUNET_CONTAINER_MultiHashMap32 *map,
1151 uint32_t key); 1151 uint32_t key);
1152 1152
1153 1153
1154/** 1154/**
1155 * @ingroup hashmap 1155 * @ingroup hashmap
1156 * Iterate over all entries in the map. 1156 * Iterate over all entries in the map.
1157 * 1157 *
1158 * @param map the map 1158 * @param map the map
@@ -1169,7 +1169,7 @@ GNUNET_CONTAINER_multihashmap32_iterate (const struct
1169 1169
1170 1170
1171/** 1171/**
1172 * @ingroup hashmap 1172 * @ingroup hashmap
1173 * Remove the given key-value pair from the map. Note that if the 1173 * Remove the given key-value pair from the map. Note that if the
1174 * key-value pair is in the map multiple times, only one of the pairs 1174 * key-value pair is in the map multiple times, only one of the pairs
1175 * will be removed. 1175 * will be removed.
@@ -1182,12 +1182,12 @@ GNUNET_CONTAINER_multihashmap32_iterate (const struct
1182 */ 1182 */
1183int 1183int
1184GNUNET_CONTAINER_multihashmap32_remove (struct GNUNET_CONTAINER_MultiHashMap32 *map, 1184GNUNET_CONTAINER_multihashmap32_remove (struct GNUNET_CONTAINER_MultiHashMap32 *map,
1185 uint32_t key, 1185 uint32_t key,
1186 const void *value); 1186 const void *value);
1187 1187
1188 1188
1189/** 1189/**
1190 * @ingroup hashmap 1190 * @ingroup hashmap
1191 * Remove all entries for the given key from the map. 1191 * Remove all entries for the given key from the map.
1192 * Note that the values would not be "freed". 1192 * Note that the values would not be "freed".
1193 * 1193 *
@@ -1201,7 +1201,7 @@ GNUNET_CONTAINER_multihashmap32_remove_all (struct GNUNET_CONTAINER_MultiHashMap
1201 1201
1202 1202
1203/** 1203/**
1204 * @ingroup hashmap 1204 * @ingroup hashmap
1205 * Check if the map contains any value under the given 1205 * Check if the map contains any value under the given
1206 * key (including values that are NULL). 1206 * key (including values that are NULL).
1207 * 1207 *
@@ -1216,7 +1216,7 @@ GNUNET_CONTAINER_multihashmap32_contains (const struct GNUNET_CONTAINER_MultiHas
1216 1216
1217 1217
1218/** 1218/**
1219 * @ingroup hashmap 1219 * @ingroup hashmap
1220 * Check if the map contains the given value under the given 1220 * Check if the map contains the given value under the given
1221 * key. 1221 * key.
1222 * 1222 *
@@ -1227,13 +1227,13 @@ GNUNET_CONTAINER_multihashmap32_contains (const struct GNUNET_CONTAINER_MultiHas
1227 * #GNUNET_NO if not 1227 * #GNUNET_NO if not
1228 */ 1228 */
1229int 1229int
1230GNUNET_CONTAINER_multihashmap32_contains_value (const struct GNUNET_CONTAINER_MultiHashMap32 *map, 1230GNUNET_CONTAINER_multihashmap32_contains_value (const struct GNUNET_CONTAINER_MultiHashMap32 *map,
1231 uint32_t key, 1231 uint32_t key,
1232 const void *value); 1232 const void *value);
1233 1233
1234 1234
1235/** 1235/**
1236 * @ingroup hashmap 1236 * @ingroup hashmap
1237 * Store a key-value pair in the map. 1237 * Store a key-value pair in the map.
1238 * 1238 *
1239 * @param map the map 1239 * @param map the map
@@ -1246,14 +1246,14 @@ GNUNET_CONTAINER_multihashmap32_contains_value (const struct GNUNET_CONTAINER_Mu
1246 * value already exists 1246 * value already exists
1247 */ 1247 */
1248int 1248int
1249GNUNET_CONTAINER_multihashmap32_put (struct GNUNET_CONTAINER_MultiHashMap32 *map, 1249GNUNET_CONTAINER_multihashmap32_put (struct GNUNET_CONTAINER_MultiHashMap32 *map,
1250 uint32_t key, 1250 uint32_t key,
1251 void *value, 1251 void *value,
1252 enum GNUNET_CONTAINER_MultiHashMapOption opt); 1252 enum GNUNET_CONTAINER_MultiHashMapOption opt);
1253 1253
1254 1254
1255/** 1255/**
1256 * @ingroup hashmap 1256 * @ingroup hashmap
1257 * Iterate over all entries in the map that match a particular key. 1257 * Iterate over all entries in the map that match a particular key.
1258 * 1258 *
1259 * @param map the map 1259 * @param map the map
@@ -1264,7 +1264,7 @@ GNUNET_CONTAINER_multihashmap32_put (struct GNUNET_CONTAINER_MultiHashMap32 *map
1264 * #GNUNET_SYSERR if it aborted iteration 1264 * #GNUNET_SYSERR if it aborted iteration
1265 */ 1265 */
1266int 1266int
1267GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_MultiHashMap32 *map, 1267GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_MultiHashMap32 *map,
1268 uint32_t key, 1268 uint32_t key,
1269 GNUNET_CONTAINER_HashMapIterator32 it, 1269 GNUNET_CONTAINER_HashMapIterator32 it,
1270 void *it_cls); 1270 void *it_cls);
@@ -1276,7 +1276,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
1276/* To avoid mistakes: head->prev == tail->next == NULL */ 1276/* To avoid mistakes: head->prev == tail->next == NULL */
1277 1277
1278/** 1278/**
1279 * @ingroup dll 1279 * @ingroup dll
1280 * Insert an element at the head of a DLL. Assumes that head, tail and 1280 * Insert an element at the head of a DLL. Assumes that head, tail and
1281 * element are structs with prev and next fields. 1281 * element are structs with prev and next fields.
1282 * 1282 *
@@ -1297,7 +1297,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
1297 1297
1298 1298
1299/** 1299/**
1300 * @ingroup dll 1300 * @ingroup dll
1301 * Insert an element at the tail of a DLL. Assumes that head, tail and 1301 * Insert an element at the tail of a DLL. Assumes that head, tail and
1302 * element are structs with prev and next fields. 1302 * element are structs with prev and next fields.
1303 * 1303 *
@@ -1318,7 +1318,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
1318 1318
1319 1319
1320/** 1320/**
1321 * @ingroup dll 1321 * @ingroup dll
1322 * Insert an element into a DLL after the given other element. Insert 1322 * Insert an element into a DLL after the given other element. Insert
1323 * at the head if the other element is NULL. 1323 * at the head if the other element is NULL.
1324 * 1324 *
@@ -1348,7 +1348,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
1348 1348
1349 1349
1350/** 1350/**
1351 * @ingroup dll 1351 * @ingroup dll
1352 * Insert an element into a DLL before the given other element. Insert 1352 * Insert an element into a DLL before the given other element. Insert
1353 * at the tail if the other element is NULL. 1353 * at the tail if the other element is NULL.
1354 * 1354 *
@@ -1378,7 +1378,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
1378 1378
1379 1379
1380/** 1380/**
1381 * @ingroup dll 1381 * @ingroup dll
1382 * Remove an element from a DLL. Assumes that head, tail and 1382 * Remove an element from a DLL. Assumes that head, tail and
1383 * element point to structs with prev and next fields. 1383 * element point to structs with prev and next fields.
1384 * 1384 *
@@ -1410,7 +1410,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
1410 in multiple lists at the same time *********************** */ 1410 in multiple lists at the same time *********************** */
1411 1411
1412/** 1412/**
1413 * @ingroup dll 1413 * @ingroup dll
1414 * Insert an element at the head of a MDLL. Assumes that head, tail and 1414 * Insert an element at the head of a MDLL. Assumes that head, tail and
1415 * element are structs with prev and next fields. 1415 * element are structs with prev and next fields.
1416 * 1416 *
@@ -1432,7 +1432,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
1432 1432
1433 1433
1434/** 1434/**
1435 * @ingroup dll 1435 * @ingroup dll
1436 * Insert an element at the tail of a MDLL. Assumes that head, tail and 1436 * Insert an element at the tail of a MDLL. Assumes that head, tail and
1437 * element are structs with prev and next fields. 1437 * element are structs with prev and next fields.
1438 * 1438 *
@@ -1454,7 +1454,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
1454 1454
1455 1455
1456/** 1456/**
1457 * @ingroup dll 1457 * @ingroup dll
1458 * Insert an element into a MDLL after the given other element. Insert 1458 * Insert an element into a MDLL after the given other element. Insert
1459 * at the head if the other element is NULL. 1459 * at the head if the other element is NULL.
1460 * 1460 *
@@ -1485,7 +1485,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
1485 1485
1486 1486
1487/** 1487/**
1488 * @ingroup dll 1488 * @ingroup dll
1489 * Insert an element into a MDLL before the given other element. Insert 1489 * Insert an element into a MDLL before the given other element. Insert
1490 * at the tail if the other element is NULL. 1490 * at the tail if the other element is NULL.
1491 * 1491 *
@@ -1516,7 +1516,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
1516 1516
1517 1517
1518/** 1518/**
1519 * @ingroup dll 1519 * @ingroup dll
1520 * Remove an element from a MDLL. Assumes 1520 * Remove an element from a MDLL. Assumes
1521 * that head, tail and element are structs 1521 * that head, tail and element are structs
1522 * with prev and next fields. 1522 * with prev and next fields.
diff --git a/src/include/gnunet_conversation_service.h b/src/include/gnunet_conversation_service.h
index cb84fcc67..3ef3c2f3d 100644
--- a/src/include/gnunet_conversation_service.h
+++ b/src/include/gnunet_conversation_service.h
@@ -1,17 +1,17 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2013 Christian Grothoff (and other contributing authors) 3 (C) 2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version. 8 option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
@@ -25,7 +25,7 @@
25 * @author Andreas Fuchs 25 * @author Andreas Fuchs
26 * @author Christian Grothoff 26 * @author Christian Grothoff
27 * 27 *
28 * 28 *
29 * NOTE: This API is deliberately deceptively simple; the idea 29 * NOTE: This API is deliberately deceptively simple; the idea
30 * is that advanced features (such as answering machines) will 30 * is that advanced features (such as answering machines) will
31 * be done with a separate service (an answering machine service) 31 * be done with a separate service (an answering machine service)
@@ -109,17 +109,17 @@ struct GNUNET_CONVERSATION_PhoneRecord
109enum GNUNET_CONVERSATION_EventCode 109enum GNUNET_CONVERSATION_EventCode
110{ 110{
111 /** 111 /**
112 * The phone is ringing, caller ID is provided in the varargs as 112 * The phone is ringing, caller ID is provided in the varargs as
113 * a `const char *`. The caller ID will be a GNS name. 113 * a `const char *`. The caller ID will be a GNS name.
114 */ 114 */
115 GNUNET_CONVERSATION_EC_RING, 115 GNUNET_CONVERSATION_EC_RING,
116 116
117 /** 117 /**
118 * We are the caller and are now ringing the other party. 118 * We are the caller and are now ringing the other party.
119 * The varargs will be empty. 119 * The varargs will be empty.
120 */ 120 */
121 GNUNET_CONVERSATION_EC_RINGING, 121 GNUNET_CONVERSATION_EC_RINGING,
122 122
123 /** 123 /**
124 * We are ready to talk, metadata about the call may be supplied 124 * We are ready to talk, metadata about the call may be supplied
125 * as a `const char *` in the varargs. 125 * as a `const char *` in the varargs.
@@ -139,7 +139,7 @@ enum GNUNET_CONVERSATION_EventCode
139 * client must no longer call #GNUNET_CONVERSATION_call_stop. 139 * client must no longer call #GNUNET_CONVERSATION_call_stop.
140 */ 140 */
141 GNUNET_CONVERSATION_EC_BUSY, 141 GNUNET_CONVERSATION_EC_BUSY,
142 142
143 /** 143 /**
144 * The conversation was terminated, a reason may be supplied as a 144 * The conversation was terminated, a reason may be supplied as a
145 * `const char *` in the varargs. After this invocation, the 145 * `const char *` in the varargs. After this invocation, the
@@ -147,7 +147,7 @@ enum GNUNET_CONVERSATION_EventCode
147 * client must no longer call #GNUNET_CONVERSATION_call_stop. 147 * client must no longer call #GNUNET_CONVERSATION_call_stop.
148 */ 148 */
149 GNUNET_CONVERSATION_EC_TERMINATED 149 GNUNET_CONVERSATION_EC_TERMINATED
150 150
151}; 151};
152 152
153 153
@@ -207,7 +207,7 @@ GNUNET_CONVERSATION_phone_get_record (struct GNUNET_CONVERSATION_Phone *phone,
207 207
208 208
209/** 209/**
210 * Picks up a (ringing) phone. This will connect the speaker 210 * Picks up a (ringing) phone. This will connect the speaker
211 * to the microphone of the other party, and vice versa. 211 * to the microphone of the other party, and vice versa.
212 * 212 *
213 * @param phone phone to pick up 213 * @param phone phone to pick up
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h
index 19c2acbdf..64daadcea 100644
--- a/src/include/gnunet_core_service.h
+++ b/src/include/gnunet_core_service.h
@@ -281,7 +281,7 @@ GNUNET_CORE_iterate_peers (const struct GNUNET_CONFIGURATION_Handle *cfg,
281 * expected to track which peers are connected based on the connect/disconnect 281 * expected to track which peers are connected based on the connect/disconnect
282 * callbacks from #GNUNET_CORE_connect. This function is NOT part of the 282 * callbacks from #GNUNET_CORE_connect. This function is NOT part of the
283 * 'versioned', 'official' API. This function returns 283 * 'versioned', 'official' API. This function returns
284 * synchronously after looking in the CORE API cache. 284 * synchronously after looking in the CORE API cache.
285 * 285 *
286 * @param h the core handle 286 * @param h the core handle
287 * @param pid the identity of the peer to check if it has been connected to us 287 * @param pid the identity of the peer to check if it has been connected to us
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index eda23077b..c9cae17a2 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -202,7 +202,7 @@ struct GNUNET_PeerIdentity
202 * Public ECC key (always for NIST P-521) encoded in a format suitable 202 * Public ECC key (always for NIST P-521) encoded in a format suitable
203 * for network transmission and encryption (ECDH). 203 * for network transmission and encryption (ECDH).
204 */ 204 */
205struct GNUNET_CRYPTO_EccPublicEncryptKey 205struct GNUNET_CRYPTO_EccPublicEncryptKey
206{ 206{
207 /** 207 /**
208 * Q consists of an x- and a y-value, each mod p (256 bits), 208 * Q consists of an x- and a y-value, each mod p (256 bits),
@@ -397,7 +397,7 @@ GNUNET_CRYPTO_symmetric_create_session_key (struct GNUNET_CRYPTO_SymmetricSessio
397ssize_t 397ssize_t
398GNUNET_CRYPTO_symmetric_encrypt (const void *block, size_t len, 398GNUNET_CRYPTO_symmetric_encrypt (const void *block, size_t len,
399 const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, 399 const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey,
400 const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, 400 const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
401 void *result); 401 void *result);
402 402
403 403
@@ -415,7 +415,7 @@ GNUNET_CRYPTO_symmetric_encrypt (const void *block, size_t len,
415ssize_t 415ssize_t
416GNUNET_CRYPTO_symmetric_decrypt (const void *block, size_t size, 416GNUNET_CRYPTO_symmetric_decrypt (const void *block, size_t size,
417 const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, 417 const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey,
418 const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, 418 const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
419 void *result); 419 void *result);
420 420
421 421
@@ -446,8 +446,8 @@ GNUNET_CRYPTO_symmetric_derive_iv (struct GNUNET_CRYPTO_SymmetricInitializationV
446void 446void
447GNUNET_CRYPTO_symmetric_derive_iv_v (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, 447GNUNET_CRYPTO_symmetric_derive_iv_v (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
448 const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, 448 const struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
449 const void *salt, 449 const void *salt,
450 size_t salt_len, 450 size_t salt_len,
451 va_list argp); 451 va_list argp);
452 452
453 453
@@ -653,7 +653,7 @@ GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode * hc,
653 * @return Bit \a bit from hashcode \a code, -1 for invalid index 653 * @return Bit \a bit from hashcode \a code, -1 for invalid index
654 */ 654 */
655int 655int
656GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode *code, 656GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode *code,
657 unsigned int bit); 657 unsigned int bit);
658 658
659 659
@@ -865,7 +865,7 @@ GNUNET_CRYPTO_ecc_public_sign_key_to_string (const struct GNUNET_CRYPTO_EccPubli
865 * @return #GNUNET_OK on success 865 * @return #GNUNET_OK on success
866 */ 866 */
867int 867int
868GNUNET_CRYPTO_ecc_public_sign_key_from_string (const char *enc, 868GNUNET_CRYPTO_ecc_public_sign_key_from_string (const char *enc,
869 size_t enclen, 869 size_t enclen,
870 struct GNUNET_CRYPTO_EccPublicSignKey *pub); 870 struct GNUNET_CRYPTO_EccPublicSignKey *pub);
871 871
@@ -890,7 +890,7 @@ GNUNET_CRYPTO_ecc_public_encrypt_key_to_string (const struct GNUNET_CRYPTO_EccPu
890 * @return #GNUNET_OK on success 890 * @return #GNUNET_OK on success
891 */ 891 */
892int 892int
893GNUNET_CRYPTO_ecc_public_encrypt_key_from_string (const char *enc, 893GNUNET_CRYPTO_ecc_public_encrypt_key_from_string (const char *enc,
894 size_t enclen, 894 size_t enclen,
895 struct GNUNET_CRYPTO_EccPublicEncryptKey *pub); 895 struct GNUNET_CRYPTO_EccPublicEncryptKey *pub);
896 896
@@ -939,7 +939,7 @@ GNUNET_CRYPTO_ecc_key_create (void);
939 939
940/** 940/**
941 * @ingroup crypto 941 * @ingroup crypto
942 * Clear memory that was used to store a private key. 942 * Clear memory that was used to store a private key.
943 * 943 *
944 * @param pk location of the key 944 * @param pk location of the key
945 */ 945 */
diff --git a/src/include/gnunet_datastore_plugin.h b/src/include/gnunet_datastore_plugin.h
index 0099666d6..082173fff 100644
--- a/src/include/gnunet_datastore_plugin.h
+++ b/src/include/gnunet_datastore_plugin.h
@@ -140,7 +140,7 @@ typedef int (*PluginPut) (void *cls, const struct GNUNET_HashCode * key, uint32_
140 * @param key key in the data store 140 * @param key key in the data store
141 * @param count how many values are stored under this key in the datastore 141 * @param count how many values are stored under this key in the datastore
142 */ 142 */
143typedef void (*PluginKeyProcessor) (void *cls, 143typedef void (*PluginKeyProcessor) (void *cls,
144 const struct GNUNET_HashCode *key, 144 const struct GNUNET_HashCode *key,
145 unsigned int count); 145 unsigned int count);
146 146
@@ -322,7 +322,7 @@ struct GNUNET_DATASTORE_PluginFunctions
322 * Iterate over all keys in the database. 322 * Iterate over all keys in the database.
323 */ 323 */
324 PluginGetKeys get_keys; 324 PluginGetKeys get_keys;
325 325
326}; 326};
327 327
328 328
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h
index 1370e6bd9..3e59f2b6d 100644
--- a/src/include/gnunet_dht_service.h
+++ b/src/include/gnunet_dht_service.h
@@ -165,7 +165,7 @@ typedef void (*GNUNET_DHT_PutContinuation)(void *cls,
165 * (size too big) 165 * (size too big)
166 */ 166 */
167struct GNUNET_DHT_PutHandle * 167struct GNUNET_DHT_PutHandle *
168GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, 168GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle,
169 const struct GNUNET_HashCode *key, 169 const struct GNUNET_HashCode *key,
170 uint32_t desired_replication_level, 170 uint32_t desired_replication_level,
171 enum GNUNET_DHT_RouteOption options, 171 enum GNUNET_DHT_RouteOption options,
@@ -182,7 +182,7 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle,
182 * go out over the network (we can't stop that); However, if the PUT 182 * go out over the network (we can't stop that); However, if the PUT
183 * has not yet been sent to the service, cancelling the PUT will stop 183 * has not yet been sent to the service, cancelling the PUT will stop
184 * this from happening (but there is no way for the user of this API 184 * this from happening (but there is no way for the user of this API
185 * to tell if that is the case). The only use for this API is to 185 * to tell if that is the case). The only use for this API is to
186 * prevent a later call to 'cont' from #GNUNET_DHT_put (i.e. because 186 * prevent a later call to 'cont' from #GNUNET_DHT_put (i.e. because
187 * the system is shutting down). 187 * the system is shutting down).
188 * 188 *
@@ -212,9 +212,9 @@ GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph);
212typedef void (*GNUNET_DHT_GetIterator) (void *cls, 212typedef void (*GNUNET_DHT_GetIterator) (void *cls,
213 struct GNUNET_TIME_Absolute exp, 213 struct GNUNET_TIME_Absolute exp,
214 const struct GNUNET_HashCode *key, 214 const struct GNUNET_HashCode *key,
215 const struct GNUNET_PeerIdentity *get_path, 215 const struct GNUNET_PeerIdentity *get_path,
216 unsigned int get_path_length, 216 unsigned int get_path_length,
217 const struct GNUNET_PeerIdentity *put_path, 217 const struct GNUNET_PeerIdentity *put_path,
218 unsigned int put_path_length, 218 unsigned int put_path_length,
219 enum GNUNET_BLOCK_Type type, 219 enum GNUNET_BLOCK_Type type,
220 size_t size, const void *data); 220 size_t size, const void *data);
@@ -239,11 +239,11 @@ typedef void (*GNUNET_DHT_GetIterator) (void *cls,
239 */ 239 */
240struct GNUNET_DHT_GetHandle * 240struct GNUNET_DHT_GetHandle *
241GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, 241GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
242 enum GNUNET_BLOCK_Type type, 242 enum GNUNET_BLOCK_Type type,
243 const struct GNUNET_HashCode *key, 243 const struct GNUNET_HashCode *key,
244 uint32_t desired_replication_level, 244 uint32_t desired_replication_level,
245 enum GNUNET_DHT_RouteOption options, 245 enum GNUNET_DHT_RouteOption options,
246 const void *xquery, size_t xquery_size, 246 const void *xquery, size_t xquery_size,
247 GNUNET_DHT_GetIterator iter, void *iter_cls); 247 GNUNET_DHT_GetIterator iter, void *iter_cls);
248 248
249 249
@@ -297,7 +297,7 @@ typedef void (*GNUNET_DHT_MonitorGetCB) (void *cls,
297 enum GNUNET_DHT_RouteOption options, 297 enum GNUNET_DHT_RouteOption options,
298 enum GNUNET_BLOCK_Type type, 298 enum GNUNET_BLOCK_Type type,
299 uint32_t hop_count, 299 uint32_t hop_count,
300 uint32_t desired_replication_level, 300 uint32_t desired_replication_level,
301 unsigned int path_length, 301 unsigned int path_length,
302 const struct GNUNET_PeerIdentity *path, 302 const struct GNUNET_PeerIdentity *path,
303 const struct GNUNET_HashCode * key); 303 const struct GNUNET_HashCode * key);
@@ -346,7 +346,7 @@ typedef void (*GNUNET_DHT_MonitorPutCB) (void *cls,
346 enum GNUNET_DHT_RouteOption options, 346 enum GNUNET_DHT_RouteOption options,
347 enum GNUNET_BLOCK_Type type, 347 enum GNUNET_BLOCK_Type type,
348 uint32_t hop_count, 348 uint32_t hop_count,
349 uint32_t desired_replication_level, 349 uint32_t desired_replication_level,
350 unsigned int path_length, 350 unsigned int path_length,
351 const struct GNUNET_PeerIdentity *path, 351 const struct GNUNET_PeerIdentity *path,
352 struct GNUNET_TIME_Absolute exp, 352 struct GNUNET_TIME_Absolute exp,
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h
index 0a3abce49..369f09492 100644
--- a/src/include/gnunet_disk_lib.h
+++ b/src/include/gnunet_disk_lib.h
@@ -43,8 +43,8 @@ enum GNUNET_FILE_Type
43{ 43{
44 /** 44 /**
45 * Handle represents a file. 45 * Handle represents a file.
46 */ 46 */
47 GNUNET_DISK_HANLDE_TYPE_FILE, 47 GNUNET_DISK_HANLDE_TYPE_FILE,
48 48
49 /** 49 /**
50 * Handle represents a pipe. 50 * Handle represents a pipe.
@@ -157,7 +157,7 @@ enum GNUNET_DISK_MapType
157 * Read-only memory map. 157 * Read-only memory map.
158 */ 158 */
159 GNUNET_DISK_MAP_TYPE_READ = 1, 159 GNUNET_DISK_MAP_TYPE_READ = 1,
160 160
161 /** 161 /**
162 * Write-able memory map. 162 * Write-able memory map.
163 */ 163 */
@@ -328,7 +328,7 @@ GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h, OFF_T offset,
328 */ 328 */
329int 329int
330GNUNET_DISK_file_size (const char *filename, uint64_t *size, 330GNUNET_DISK_file_size (const char *filename, uint64_t *size,
331 int include_symbolic_links, 331 int include_symbolic_links,
332 int single_file_mode); 332 int single_file_mode);
333 333
334 334
@@ -348,7 +348,7 @@ GNUNET_DISK_file_size (const char *filename, uint64_t *size,
348 * @return GNUNET_OK on success 348 * @return GNUNET_OK on success
349 */ 349 */
350int 350int
351GNUNET_DISK_file_get_identifiers (const char *filename, 351GNUNET_DISK_file_get_identifiers (const char *filename,
352 uint64_t *dev, 352 uint64_t *dev,
353 uint64_t *ino); 353 uint64_t *ino);
354 354
@@ -394,7 +394,7 @@ GNUNET_DISK_mkdtemp (const char *t);
394 * @return IO handle on success, NULL on error 394 * @return IO handle on success, NULL on error
395 */ 395 */
396struct GNUNET_DISK_FileHandle * 396struct GNUNET_DISK_FileHandle *
397GNUNET_DISK_file_open (const char *fn, 397GNUNET_DISK_file_open (const char *fn,
398 enum GNUNET_DISK_OpenFlags flags, 398 enum GNUNET_DISK_OpenFlags flags,
399 enum GNUNET_DISK_AccessPermissions perm); 399 enum GNUNET_DISK_AccessPermissions perm);
400 400
@@ -421,9 +421,9 @@ GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh,
421 * @return handle to the new pipe, NULL on error 421 * @return handle to the new pipe, NULL on error
422 */ 422 */
423struct GNUNET_DISK_PipeHandle * 423struct GNUNET_DISK_PipeHandle *
424GNUNET_DISK_pipe (int blocking_read, 424GNUNET_DISK_pipe (int blocking_read,
425 int blocking_write, 425 int blocking_write,
426 int inherit_read, 426 int inherit_read,
427 int inherit_write); 427 int inherit_write);
428 428
429 429
@@ -438,8 +438,8 @@ GNUNET_DISK_pipe (int blocking_read,
438 * @return handle to the new pipe, NULL on error 438 * @return handle to the new pipe, NULL on error
439 */ 439 */
440struct GNUNET_DISK_PipeHandle * 440struct GNUNET_DISK_PipeHandle *
441GNUNET_DISK_pipe_from_fd (int blocking_read, 441GNUNET_DISK_pipe_from_fd (int blocking_read,
442 int blocking_write, 442 int blocking_write,
443 int fd[2]); 443 int fd[2]);
444 444
445 445
@@ -544,7 +544,7 @@ GNUNET_DISK_get_handle_from_native (FILE *fd);
544 * @return the number of bytes read on success, #GNUNET_SYSERR on failure 544 * @return the number of bytes read on success, #GNUNET_SYSERR on failure
545 */ 545 */
546ssize_t 546ssize_t
547GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, 547GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h,
548 void *result, 548 void *result,
549 size_t len); 549 size_t len);
550 550
@@ -575,7 +575,7 @@ GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle * h,
575 */ 575 */
576ssize_t 576ssize_t
577GNUNET_DISK_fn_read (const char *fn, 577GNUNET_DISK_fn_read (const char *fn,
578 void *result, 578 void *result,
579 size_t len); 579 size_t len);
580 580
581 581
@@ -589,7 +589,7 @@ GNUNET_DISK_fn_read (const char *fn,
589 */ 589 */
590ssize_t 590ssize_t
591GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h, 591GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h,
592 const void *buffer, 592 const void *buffer,
593 size_t n); 593 size_t n);
594 594
595 595
@@ -603,7 +603,7 @@ GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h,
603 */ 603 */
604ssize_t 604ssize_t
605GNUNET_DISK_file_write_blocking (const struct GNUNET_DISK_FileHandle *h, 605GNUNET_DISK_file_write_blocking (const struct GNUNET_DISK_FileHandle *h,
606 const void *buffer, 606 const void *buffer,
607 size_t n); 607 size_t n);
608 608
609 609
@@ -619,7 +619,7 @@ GNUNET_DISK_file_write_blocking (const struct GNUNET_DISK_FileHandle *h,
619 */ 619 */
620ssize_t 620ssize_t
621GNUNET_DISK_fn_write (const char *fn, 621GNUNET_DISK_fn_write (const char *fn,
622 const void *buffer, 622 const void *buffer,
623 size_t n, 623 size_t n,
624 enum GNUNET_DISK_AccessPermissions mode); 624 enum GNUNET_DISK_AccessPermissions mode);
625 625
@@ -766,7 +766,7 @@ GNUNET_DISK_directory_create (const char *dir);
766 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 766 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
767 */ 767 */
768int 768int
769GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, 769GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh,
770 OFF_T lock_start, 770 OFF_T lock_start,
771 OFF_T lock_end, int excl); 771 OFF_T lock_end, int excl);
772 772
@@ -780,7 +780,7 @@ GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh,
780 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 780 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
781 */ 781 */
782int 782int
783GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh, 783GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh,
784 OFF_T unlock_start, 784 OFF_T unlock_start,
785 OFF_T unlock_end); 785 OFF_T unlock_end);
786 786
diff --git a/src/include/gnunet_dns_service.h b/src/include/gnunet_dns_service.h
index d9a43ff8b..581d7f044 100644
--- a/src/include/gnunet_dns_service.h
+++ b/src/include/gnunet_dns_service.h
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file include/gnunet_dns_service.h 22 * @file include/gnunet_dns_service.h
23 * @brief API to access the DNS service. 23 * @brief API to access the DNS service.
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#ifndef GNUNET_DNS_SERVICE_H 26#ifndef GNUNET_DNS_SERVICE_H
@@ -41,7 +41,7 @@ struct GNUNET_DNS_RequestHandle;
41 41
42/** 42/**
43 * Flags that specify when to call the client's handler. 43 * Flags that specify when to call the client's handler.
44 */ 44 */
45enum GNUNET_DNS_Flags 45enum GNUNET_DNS_Flags
46{ 46{
47 47
@@ -153,7 +153,7 @@ GNUNET_DNS_request_drop (struct GNUNET_DNS_RequestHandle *rh);
153 * @param reply reply data 153 * @param reply reply data
154 */ 154 */
155void 155void
156GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh, 156GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh,
157 uint16_t reply_length, 157 uint16_t reply_length,
158 const char *reply); 158 const char *reply);
159 159
@@ -165,7 +165,7 @@ GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh,
165 * @param flags when to call rh 165 * @param flags when to call rh
166 * @param rh function to call with DNS requests 166 * @param rh function to call with DNS requests
167 * @param rh_cls closure to pass to rh 167 * @param rh_cls closure to pass to rh
168 * @return DNS handle 168 * @return DNS handle
169 */ 169 */
170struct GNUNET_DNS_Handle * 170struct GNUNET_DNS_Handle *
171GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, 171GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
diff --git a/src/include/gnunet_dnsparser_lib.h b/src/include/gnunet_dnsparser_lib.h
index c4b4546c8..68b6597ff 100644
--- a/src/include/gnunet_dnsparser_lib.h
+++ b/src/include/gnunet_dnsparser_lib.h
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file include/gnunet_dnsparser_lib.h 22 * @file include/gnunet_dnsparser_lib.h
23 * @brief API for helper library to parse DNS packets. 23 * @brief API for helper library to parse DNS packets.
24 * @author Philipp Toelke 24 * @author Philipp Toelke
25 * @author Christian Grothoff 25 * @author Christian Grothoff
26 */ 26 */
@@ -64,7 +64,7 @@ struct GNUNET_DNSPARSER_Query
64 64
65 /** 65 /**
66 * Name of the record that the query is for (0-terminated). 66 * Name of the record that the query is for (0-terminated).
67 * In UTF-8 format. The library will convert from and to DNS-IDNA 67 * In UTF-8 format. The library will convert from and to DNS-IDNA
68 * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an 68 * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an
69 * individual label is well-formed. If a given name is not well-formed, 69 * individual label is well-formed. If a given name is not well-formed,
70 * creating the DNS packet will fail. 70 * creating the DNS packet will fail.
@@ -89,7 +89,7 @@ struct GNUNET_DNSPARSER_Query
89 */ 89 */
90struct GNUNET_DNSPARSER_MxRecord 90struct GNUNET_DNSPARSER_MxRecord
91{ 91{
92 92
93 /** 93 /**
94 * Preference for this entry (lower value is higher preference). 94 * Preference for this entry (lower value is higher preference).
95 */ 95 */
@@ -97,7 +97,7 @@ struct GNUNET_DNSPARSER_MxRecord
97 97
98 /** 98 /**
99 * Name of the mail server. 99 * Name of the mail server.
100 * In UTF-8 format. The library will convert from and to DNS-IDNA 100 * In UTF-8 format. The library will convert from and to DNS-IDNA
101 * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an 101 * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an
102 * individual label is well-formed. If a given name is not well-formed, 102 * individual label is well-formed. If a given name is not well-formed,
103 * creating the DNS packet will fail. 103 * creating the DNS packet will fail.
@@ -120,11 +120,11 @@ struct GNUNET_DNSPARSER_MxRecord
120 */ 120 */
121struct GNUNET_DNSPARSER_SrvRecord 121struct GNUNET_DNSPARSER_SrvRecord
122{ 122{
123 123
124 /** 124 /**
125 * Service name without the underscore (!). Note that RFC 6335 clarifies the 125 * Service name without the underscore (!). Note that RFC 6335 clarifies the
126 * set of legal characters for service names. 126 * set of legal characters for service names.
127 * In UTF-8 format. The library will convert from and to DNS-IDNA 127 * In UTF-8 format. The library will convert from and to DNS-IDNA
128 * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an 128 * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an
129 * individual label is well-formed. If a given name is not well-formed, 129 * individual label is well-formed. If a given name is not well-formed,
130 * creating the DNS packet will fail. 130 * creating the DNS packet will fail.
@@ -139,7 +139,7 @@ struct GNUNET_DNSPARSER_SrvRecord
139 139
140 /** 140 /**
141 * Domain name for which the record is valid 141 * Domain name for which the record is valid
142 * In UTF-8 format. The library will convert from and to DNS-IDNA 142 * In UTF-8 format. The library will convert from and to DNS-IDNA
143 * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an 143 * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an
144 * individual label is well-formed. If a given name is not well-formed, 144 * individual label is well-formed. If a given name is not well-formed,
145 * creating the DNS packet will fail. 145 * creating the DNS packet will fail.
@@ -148,7 +148,7 @@ struct GNUNET_DNSPARSER_SrvRecord
148 148
149 /** 149 /**
150 * Hostname offering the service. 150 * Hostname offering the service.
151 * In UTF-8 format. The library will convert from and to DNS-IDNA 151 * In UTF-8 format. The library will convert from and to DNS-IDNA
152 * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an 152 * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an
153 * individual label is well-formed. If a given name is not well-formed, 153 * individual label is well-formed. If a given name is not well-formed,
154 * creating the DNS packet will fail. 154 * creating the DNS packet will fail.
@@ -176,17 +176,17 @@ struct GNUNET_DNSPARSER_SrvRecord
176 176
177}; 177};
178 178
179 179
180/** 180/**
181 * Information from SOA records (RFC 1035). 181 * Information from SOA records (RFC 1035).
182 */ 182 */
183struct GNUNET_DNSPARSER_SoaRecord 183struct GNUNET_DNSPARSER_SoaRecord
184{ 184{
185 185
186 /** 186 /**
187 * The domainname of the name server that was the 187 * The domainname of the name server that was the
188 * original or primary source of data for this zone. 188 * original or primary source of data for this zone.
189 * In UTF-8 format. The library will convert from and to DNS-IDNA 189 * In UTF-8 format. The library will convert from and to DNS-IDNA
190 * as necessary. Use #GNUNET_DNSPARSER_check_label to test if an 190 * as necessary. Use #GNUNET_DNSPARSER_check_label to test if an
191 * individual label is well-formed. If a given name is not well-formed, 191 * individual label is well-formed. If a given name is not well-formed,
192 * creating the DNS packet will fail. 192 * creating the DNS packet will fail.
@@ -196,7 +196,7 @@ struct GNUNET_DNSPARSER_SoaRecord
196 /** 196 /**
197 * A domainname which specifies the mailbox of the 197 * A domainname which specifies the mailbox of the
198 * person responsible for this zone. 198 * person responsible for this zone.
199 * In UTF-8 format. The library will convert from and to DNS-IDNA 199 * In UTF-8 format. The library will convert from and to DNS-IDNA
200 * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an 200 * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an
201 * individual label is well-formed. If a given name is not well-formed, 201 * individual label is well-formed. If a given name is not well-formed,
202 * creating the DNS packet will fail. 202 * creating the DNS packet will fail.
@@ -204,7 +204,7 @@ struct GNUNET_DNSPARSER_SoaRecord
204 char *rname; 204 char *rname;
205 205
206 /** 206 /**
207 * The version number of the original copy of the zone. 207 * The version number of the original copy of the zone.
208 */ 208 */
209 uint32_t serial; 209 uint32_t serial;
210 210
@@ -230,7 +230,7 @@ struct GNUNET_DNSPARSER_SoaRecord
230 * from this zone. 230 * from this zone.
231 */ 231 */
232 uint32_t minimum_ttl; 232 uint32_t minimum_ttl;
233 233
234}; 234};
235 235
236 236
@@ -260,7 +260,7 @@ struct GNUNET_DNSPARSER_Record
260 260
261 /** 261 /**
262 * Name of the record that the query is for (0-terminated). 262 * Name of the record that the query is for (0-terminated).
263 * In UTF-8 format. The library will convert from and to DNS-IDNA 263 * In UTF-8 format. The library will convert from and to DNS-IDNA
264 * as necessary. Use #GNUNET_DNSPARSER_check_label to test if an 264 * as necessary. Use #GNUNET_DNSPARSER_check_label to test if an
265 * individual label is well-formed. If a given name is not well-formed, 265 * individual label is well-formed. If a given name is not well-formed,
266 * creating the DNS packet will fail. 266 * creating the DNS packet will fail.
@@ -270,23 +270,23 @@ struct GNUNET_DNSPARSER_Record
270 /** 270 /**
271 * Payload of the record (which one of these is valid depends on the 'type'). 271 * Payload of the record (which one of these is valid depends on the 'type').
272 */ 272 */
273 union 273 union
274 { 274 {
275 275
276 /** 276 /**
277 * For NS, CNAME and PTR records, this is the uncompressed 0-terminated hostname. 277 * For NS, CNAME and PTR records, this is the uncompressed 0-terminated hostname.
278 * In UTF-8 format. The library will convert from and to DNS-IDNA 278 * In UTF-8 format. The library will convert from and to DNS-IDNA
279 * as necessary. Use #GNUNET_DNSPARSER_check_label to test if an 279 * as necessary. Use #GNUNET_DNSPARSER_check_label to test if an
280 * individual label is well-formed. If a given name is not well-formed, 280 * individual label is well-formed. If a given name is not well-formed,
281 * creating the DNS packet will fail. 281 * creating the DNS packet will fail.
282 */ 282 */
283 char *hostname; 283 char *hostname;
284 284
285 /** 285 /**
286 * SOA data for SOA records. 286 * SOA data for SOA records.
287 */ 287 */
288 struct GNUNET_DNSPARSER_SoaRecord *soa; 288 struct GNUNET_DNSPARSER_SoaRecord *soa;
289 289
290 /** 290 /**
291 * MX data for MX records. 291 * MX data for MX records.
292 */ 292 */
@@ -370,7 +370,7 @@ struct GNUNET_DNSPARSER_Packet
370 370
371 /** 371 /**
372 * Bitfield of DNS flags. 372 * Bitfield of DNS flags.
373 */ 373 */
374 struct GNUNET_TUN_DnsFlags flags; 374 struct GNUNET_TUN_DnsFlags flags;
375 375
376 /** 376 /**
@@ -411,7 +411,7 @@ GNUNET_DNSPARSER_check_name (const char *name);
411 * processing and manipulation. 411 * processing and manipulation.
412 * 412 *
413 * @param udp_payload wire-format of the DNS packet 413 * @param udp_payload wire-format of the DNS packet
414 * @param udp_payload_length number of bytes in @a udp_payload 414 * @param udp_payload_length number of bytes in @a udp_payload
415 * @return NULL on error, otherwise the parsed packet 415 * @return NULL on error, otherwise the parsed packet
416 */ 416 */
417struct GNUNET_DNSPARSER_Packet * 417struct GNUNET_DNSPARSER_Packet *
@@ -431,7 +431,7 @@ GNUNET_DNSPARSER_free_packet (struct GNUNET_DNSPARSER_Packet *p);
431/** 431/**
432 * Given a DNS packet @a p, generate the corresponding UDP payload. 432 * Given a DNS packet @a p, generate the corresponding UDP payload.
433 * Note that we do not attempt to pack the strings with pointers 433 * Note that we do not attempt to pack the strings with pointers
434 * as this would complicate the code and this is about being 434 * as this would complicate the code and this is about being
435 * simple and secure, not fast, fancy and broken like bind. 435 * simple and secure, not fast, fancy and broken like bind.
436 * 436 *
437 * @param p packet to pack 437 * @param p packet to pack
@@ -645,7 +645,7 @@ GNUNET_DNSPARSER_parse_srv (const char *r_name,
645 645
646/** 646/**
647 * Free the given DNS record. 647 * Free the given DNS record.
648 * 648 *
649 * @param r record to free 649 * @param r record to free
650 */ 650 */
651void 651void
diff --git a/src/include/gnunet_dnsstub_lib.h b/src/include/gnunet_dnsstub_lib.h
index 0269fac17..73db0a49b 100644
--- a/src/include/gnunet_dnsstub_lib.h
+++ b/src/include/gnunet_dnsstub_lib.h
@@ -31,12 +31,12 @@
31 31
32/** 32/**
33 * Opaque handle to the stub resolver. 33 * Opaque handle to the stub resolver.
34 */ 34 */
35struct GNUNET_DNSSTUB_Context; 35struct GNUNET_DNSSTUB_Context;
36 36
37/** 37/**
38 * Opaque handle to a socket doing UDP requests. 38 * Opaque handle to a socket doing UDP requests.
39 */ 39 */
40struct GNUNET_DNSSTUB_RequestSocket; 40struct GNUNET_DNSSTUB_RequestSocket;
41 41
42 42
diff --git a/src/include/gnunet_env_lib.h b/src/include/gnunet_env_lib.h
index 89c41d2c1..857ad45c2 100644
--- a/src/include/gnunet_env_lib.h
+++ b/src/include/gnunet_env_lib.h
@@ -18,7 +18,7 @@
18 * Boston, MA 02111-1307, USA. 18 * Boston, MA 02111-1307, USA.
19 */ 19 */
20 20
21/** 21/**
22 * @file include/gnunet_env_lib.h 22 * @file include/gnunet_env_lib.h
23 * @brief Library providing operations for the @e environment of 23 * @brief Library providing operations for the @e environment of
24 * PSYC and Social messages, and for (de)serializing variable values. 24 * PSYC and Social messages, and for (de)serializing variable values.
@@ -38,38 +38,38 @@ extern "C"
38#endif 38#endif
39 39
40 40
41/** 41/**
42 * Possible operations on PSYC state (persistent) and transient variables (per message). 42 * Possible operations on PSYC state (persistent) and transient variables (per message).
43 */ 43 */
44enum GNUNET_ENV_Operator 44enum GNUNET_ENV_Operator
45{ 45{
46 /** 46 /**
47 * Set value of a transient variable. 47 * Set value of a transient variable.
48 */ 48 */
49 GNUNET_ENV_OP_SET = ':', 49 GNUNET_ENV_OP_SET = ':',
50 50
51 /** 51 /**
52 * Assign value for a persistent state variable. 52 * Assign value for a persistent state variable.
53 * 53 *
54 * If an assigned value is NULL, the variable is deleted. 54 * If an assigned value is NULL, the variable is deleted.
55 */ 55 */
56 GNUNET_ENV_OP_ASSIGN = '=', 56 GNUNET_ENV_OP_ASSIGN = '=',
57 57
58 /** 58 /**
59 * Augment state variable. 59 * Augment state variable.
60 * 60 *
61 * Used for appending strings, adding numbers, and adding new items to a list or dictionary. 61 * Used for appending strings, adding numbers, and adding new items to a list or dictionary.
62 */ 62 */
63 GNUNET_ENV_OP_AUGMENT = '+', 63 GNUNET_ENV_OP_AUGMENT = '+',
64 64
65 /** 65 /**
66 * Diminish state variable. 66 * Diminish state variable.
67 * 67 *
68 * Used for subtracting numbers, and removing items from a list or dictionary. 68 * Used for subtracting numbers, and removing items from a list or dictionary.
69 */ 69 */
70 GNUNET_ENV_OP_DIMINISH = '-', 70 GNUNET_ENV_OP_DIMINISH = '-',
71 71
72 /** 72 /**
73 * Update state variable. 73 * Update state variable.
74 * 74 *
75 * Used for modifying a single item of a list or dictionary. 75 * Used for modifying a single item of a list or dictionary.
@@ -78,7 +78,7 @@ enum GNUNET_ENV_Operator
78}; 78};
79 79
80 80
81/** 81/**
82 * PSYC variable types. 82 * PSYC variable types.
83 */ 83 */
84enum GNUNET_ENV_Type 84enum GNUNET_ENV_Type
@@ -90,26 +90,26 @@ enum GNUNET_ENV_Type
90}; 90};
91 91
92 92
93/** 93/**
94 * PSYC state modifier. 94 * PSYC state modifier.
95 */ 95 */
96struct GNUNET_ENV_Modifier { 96struct GNUNET_ENV_Modifier {
97 /** 97 /**
98 * State operation. 98 * State operation.
99 */ 99 */
100 enum GNUNET_ENV_Operator oper; 100 enum GNUNET_ENV_Operator oper;
101 101
102 /** 102 /**
103 * Variable name. 103 * Variable name.
104 */ 104 */
105 const char *name; 105 const char *name;
106 106
107 /** 107 /**
108 * Size of @a value. 108 * Size of @a value.
109 */ 109 */
110 size_t value_size; 110 size_t value_size;
111 111
112 /** 112 /**
113 * Value of variable. 113 * Value of variable.
114 */ 114 */
115 const void *value; 115 const void *value;
@@ -126,7 +126,7 @@ struct GNUNET_ENV_Modifier {
126}; 126};
127 127
128 128
129/** 129/**
130 * Environment for a message. 130 * Environment for a message.
131 * 131 *
132 * Contains modifiers. 132 * Contains modifiers.
@@ -134,16 +134,16 @@ struct GNUNET_ENV_Modifier {
134struct GNUNET_ENV_Environment; 134struct GNUNET_ENV_Environment;
135 135
136 136
137/** 137/**
138 * Create an environment. 138 * Create an environment.
139 * 139 *
140 * @return A newly allocated environment. 140 * @return A newly allocated environment.
141 */ 141 */
142struct GNUNET_ENV_Environment * 142struct GNUNET_ENV_Environment *
143GNUNET_ENV_environment_create (); 143GNUNET_ENV_environment_create ();
144 144
145 145
146/** 146/**
147 * Add a modifier to the environment. 147 * Add a modifier to the environment.
148 * 148 *
149 * @param env The environment. 149 * @param env The environment.
@@ -158,7 +158,7 @@ GNUNET_ENV_environment_add_mod (struct GNUNET_ENV_Environment *env,
158 const void *value, size_t value_size); 158 const void *value, size_t value_size);
159 159
160 160
161/** 161/**
162 * Iterator for modifiers in the environment. 162 * Iterator for modifiers in the environment.
163 * 163 *
164 * @param cls Closure. 164 * @param cls Closure.
@@ -171,7 +171,7 @@ typedef int
171(*GNUNET_ENV_Iterator) (void *cls, struct GNUNET_ENV_Modifier *mod); 171(*GNUNET_ENV_Iterator) (void *cls, struct GNUNET_ENV_Modifier *mod);
172 172
173 173
174/** 174/**
175 * Iterate through all modifiers in the environment. 175 * Iterate through all modifiers in the environment.
176 * 176 *
177 * @param env The environment. 177 * @param env The environment.
@@ -183,7 +183,7 @@ GNUNET_ENV_environment_iterate (const struct GNUNET_ENV_Environment *env,
183 GNUNET_ENV_Iterator it, void *it_cls); 183 GNUNET_ENV_Iterator it, void *it_cls);
184 184
185 185
186/** 186/**
187 * Get the number of modifiers in the environment. 187 * Get the number of modifiers in the environment.
188 * 188 *
189 * @param env The environment. 189 * @param env The environment.
@@ -194,7 +194,7 @@ size_t
194GNUNET_ENV_environment_get_mod_count (const struct GNUNET_ENV_Environment *env); 194GNUNET_ENV_environment_get_mod_count (const struct GNUNET_ENV_Environment *env);
195 195
196 196
197/** 197/**
198 * Destroy an environment. 198 * Destroy an environment.
199 * 199 *
200 * @param env The environment to destroy. 200 * @param env The environment to destroy.
@@ -203,18 +203,18 @@ void
203GNUNET_ENV_environment_destroy (struct GNUNET_ENV_Environment *env); 203GNUNET_ENV_environment_destroy (struct GNUNET_ENV_Environment *env);
204 204
205 205
206/** 206/**
207 * Get the type of variable. 207 * Get the type of variable.
208 * 208 *
209 * @param name Name of the variable. 209 * @param name Name of the variable.
210 * 210 *
211 * @return Variable type. 211 * @return Variable type.
212 */ 212 */
213enum GNUNET_ENV_Type 213enum GNUNET_ENV_Type
214GNUNET_ENV_var_get_type (char *name); 214GNUNET_ENV_var_get_type (char *name);
215 215
216 216
217/** 217/**
218 * Perform an operation on a variable. 218 * Perform an operation on a variable.
219 * 219 *
220 * @param name Name of variable. 220 * @param name Name of variable.
@@ -225,7 +225,7 @@ GNUNET_ENV_var_get_type (char *name);
225 * @param args_size Size of @a args. 225 * @param args_size Size of @a args.
226 * @param return_value Return value. 226 * @param return_value Return value.
227 * @param return_value_size Size of @a return_value. 227 * @param return_value_size Size of @a return_value.
228 * 228 *
229 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 229 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
230 */ 230 */
231int 231int
@@ -234,7 +234,7 @@ GNUNET_ENV_operation (char *name, void *current_value, size_t current_value_size
234 void **return_value, size_t *return_value_size); 234 void **return_value, size_t *return_value_size);
235 235
236 236
237/** 237/**
238 * Get the variable's value as an integer. 238 * Get the variable's value as an integer.
239 * 239 *
240 * @param size Size of value. 240 * @param size Size of value.
@@ -247,7 +247,7 @@ int
247GNUNET_ENV_value_to_number (size_t size, const void *value, int64_t *number); 247GNUNET_ENV_value_to_number (size_t size, const void *value, int64_t *number);
248 248
249 249
250/** 250/**
251 * Get the variable's value as a list. 251 * Get the variable's value as a list.
252 * 252 *
253 * @param size Size of value. 253 * @param size Size of value.
@@ -260,7 +260,7 @@ int
260GNUNET_ENV_value_to_list (size_t size, const void *value, struct GNUNET_CONTAINER_SList **list); 260GNUNET_ENV_value_to_list (size_t size, const void *value, struct GNUNET_CONTAINER_SList **list);
261 261
262 262
263/** 263/**
264 * Get the variable's value as a dictionary. 264 * Get the variable's value as a dictionary.
265 * 265 *
266 * @param size Size of value. 266 * @param size Size of value.
@@ -273,36 +273,36 @@ int
273GNUNET_ENV_value_to_dict (size_t size, const void *value, struct GNUNET_CONTAINER_MultiHashMap **dict); 273GNUNET_ENV_value_to_dict (size_t size, const void *value, struct GNUNET_CONTAINER_MultiHashMap **dict);
274 274
275 275
276/** 276/**
277 * Create a PSYC variable value from an integer. 277 * Create a PSYC variable value from an integer.
278 * 278 *
279 * @param number The number to convert. 279 * @param number The number to convert.
280 * @param[out] value_size Size of returned value. 280 * @param[out] value_size Size of returned value.
281 * 281 *
282 * @return A newly allocated value or NULL on error. 282 * @return A newly allocated value or NULL on error.
283 */ 283 */
284void * 284void *
285GNUNET_ENV_value_from_number (int64_t number, size_t *value_size); 285GNUNET_ENV_value_from_number (int64_t number, size_t *value_size);
286 286
287 287
288/** 288/**
289 * Create a PSYC variable value from a list. 289 * Create a PSYC variable value from a list.
290 * 290 *
291 * @param list The list to convert. 291 * @param list The list to convert.
292 * @param[out] value_size Size of returned value. 292 * @param[out] value_size Size of returned value.
293 * 293 *
294 * @return A newly allocated value or NULL on error. 294 * @return A newly allocated value or NULL on error.
295 */ 295 */
296void * 296void *
297GNUNET_ENV_value_from_list (struct GNUNET_CONTAINER_SList *list, size_t *value_size); 297GNUNET_ENV_value_from_list (struct GNUNET_CONTAINER_SList *list, size_t *value_size);
298 298
299 299
300/** 300/**
301 * Create a PSYC variable value from a dictionary. 301 * Create a PSYC variable value from a dictionary.
302 * 302 *
303 * @param dict The dict to convert. 303 * @param dict The dict to convert.
304 * @param[out] value_size Size of returned value. 304 * @param[out] value_size Size of returned value.
305 * 305 *
306 * @return A newly allocated value or NULL on error. 306 * @return A newly allocated value or NULL on error.
307 */ 307 */
308void * 308void *
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h
index dbd885353..a13c3b91c 100644
--- a/src/include/gnunet_fs_service.h
+++ b/src/include/gnunet_fs_service.h
@@ -134,7 +134,7 @@ GNUNET_FS_uri_ksk_to_string_fancy (const struct GNUNET_FS_Uri *uri);
134 * @param is_mandatory is this keyword mandatory? 134 * @param is_mandatory is this keyword mandatory?
135 */ 135 */
136void 136void
137GNUNET_FS_uri_ksk_add_keyword (struct GNUNET_FS_Uri *uri, 137GNUNET_FS_uri_ksk_add_keyword (struct GNUNET_FS_Uri *uri,
138 const char *keyword, 138 const char *keyword,
139 int is_mandatory); 139 int is_mandatory);
140 140
@@ -303,7 +303,7 @@ GNUNET_FS_uri_ksk_create (const char *keywords, char **emsg);
303 * if keywords is not legal (i.e. empty). 303 * if keywords is not legal (i.e. empty).
304 */ 304 */
305struct GNUNET_FS_Uri * 305struct GNUNET_FS_Uri *
306GNUNET_FS_uri_ksk_create_from_args (unsigned int argc, 306GNUNET_FS_uri_ksk_create_from_args (unsigned int argc,
307 const char **argv); 307 const char **argv);
308 308
309 309
@@ -337,7 +337,7 @@ GNUNET_FS_uri_test_sks (const struct GNUNET_FS_Uri *uri);
337 * @return an FS URI for the given namespace and identifier 337 * @return an FS URI for the given namespace and identifier
338 */ 338 */
339struct GNUNET_FS_Uri * 339struct GNUNET_FS_Uri *
340GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EccPublicSignKey *ns, 340GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EccPublicSignKey *ns,
341 const char *id); 341 const char *id);
342 342
343 343
@@ -1698,7 +1698,7 @@ typedef int (*GNUNET_FS_FileInformationProcessor) (void *cls,
1698 * file information structures. 1698 * file information structures.
1699 * 1699 *
1700 * @param s structure to get the filename for 1700 * @param s structure to get the filename for
1701 * @return NULL on error, otherwise filename that can be used 1701 * @return NULL on error, otherwise filename that can be used
1702 * to read this fi-struct from disk. 1702 * to read this fi-struct from disk.
1703 */ 1703 */
1704const char * 1704const char *
@@ -2055,7 +2055,7 @@ struct GNUNET_FS_PublishSksContext;
2055struct GNUNET_FS_PublishSksContext * 2055struct GNUNET_FS_PublishSksContext *
2056GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, 2056GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
2057 const struct GNUNET_CRYPTO_EccPrivateKey *ns, 2057 const struct GNUNET_CRYPTO_EccPrivateKey *ns,
2058 const char *identifier, 2058 const char *identifier,
2059 const char *update, 2059 const char *update,
2060 const struct GNUNET_CONTAINER_MetaData *meta, 2060 const struct GNUNET_CONTAINER_MetaData *meta,
2061 const struct GNUNET_FS_Uri *uri, 2061 const struct GNUNET_FS_Uri *uri,
@@ -2146,10 +2146,10 @@ GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc);
2146 * @param last_meta metadata associated with @a last_uri 2146 * @param last_meta metadata associated with @a last_uri
2147 * @param next_id identifier that should be used for updates 2147 * @param next_id identifier that should be used for updates
2148 */ 2148 */
2149typedef void (*GNUNET_FS_IdentifierProcessor) (void *cls, 2149typedef void (*GNUNET_FS_IdentifierProcessor) (void *cls,
2150 const char *last_id, 2150 const char *last_id,
2151 const struct GNUNET_FS_Uri *last_uri, 2151 const struct GNUNET_FS_Uri *last_uri,
2152 const struct GNUNET_CONTAINER_MetaData *last_meta, 2152 const struct GNUNET_CONTAINER_MetaData *last_meta,
2153 const char *next_id); 2153 const char *next_id);
2154 2154
2155 2155
@@ -2283,7 +2283,7 @@ enum GNUNET_FS_DownloadOptions
2283 * No options (use defaults for everything). 2283 * No options (use defaults for everything).
2284 */ 2284 */
2285 GNUNET_FS_DOWNLOAD_OPTION_NONE = 0, 2285 GNUNET_FS_DOWNLOAD_OPTION_NONE = 0,
2286 2286
2287 /** 2287 /**
2288 * Only download from the local host, do not access remote systems (no P2P) 2288 * Only download from the local host, do not access remote systems (no P2P)
2289 */ 2289 */
@@ -2600,9 +2600,9 @@ enum GNUNET_FS_DirScannerProgressUpdateReason
2600 * #GNUNET_SYSERR if it is neither (or unknown) 2600 * #GNUNET_SYSERR if it is neither (or unknown)
2601 * @param reason kind of progress we are making 2601 * @param reason kind of progress we are making
2602 */ 2602 */
2603typedef void (*GNUNET_FS_DirScannerProgressCallback) (void *cls, 2603typedef void (*GNUNET_FS_DirScannerProgressCallback) (void *cls,
2604 const char *filename, 2604 const char *filename,
2605 int is_directory, 2605 int is_directory,
2606 enum GNUNET_FS_DirScannerProgressUpdateReason reason); 2606 enum GNUNET_FS_DirScannerProgressUpdateReason reason);
2607 2607
2608 2608
@@ -2685,9 +2685,9 @@ struct GNUNET_FS_DirScanner;
2685 */ 2685 */
2686struct GNUNET_FS_DirScanner * 2686struct GNUNET_FS_DirScanner *
2687GNUNET_FS_directory_scan_start (const char *filename, 2687GNUNET_FS_directory_scan_start (const char *filename,
2688 int disable_extractor, 2688 int disable_extractor,
2689 const char *ex, 2689 const char *ex,
2690 GNUNET_FS_DirScannerProgressCallback cb, 2690 GNUNET_FS_DirScannerProgressCallback cb,
2691 void *cb_cls); 2691 void *cb_cls);
2692 2692
2693 2693
diff --git a/src/include/gnunet_helper_lib.h b/src/include/gnunet_helper_lib.h
index fde0a69ed..9c4c0c986 100644
--- a/src/include/gnunet_helper_lib.h
+++ b/src/include/gnunet_helper_lib.h
@@ -120,7 +120,7 @@ GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h, int soft_kill);
120 120
121/** 121/**
122 * Continuation function. 122 * Continuation function.
123 * 123 *
124 * @param cls closure 124 * @param cls closure
125 * @param result #GNUNET_OK on success, 125 * @param result #GNUNET_OK on success,
126 * #GNUNET_NO if helper process died 126 * #GNUNET_NO if helper process died
@@ -145,12 +145,12 @@ struct GNUNET_HELPER_SendHandle;
145 * @param cont continuation to run once the message is out (#GNUNET_OK on succees, #GNUNET_NO 145 * @param cont continuation to run once the message is out (#GNUNET_OK on succees, #GNUNET_NO
146 * if the helper process died, #GNUNET_SYSERR during #GNUNET_HELPER_destroy). 146 * if the helper process died, #GNUNET_SYSERR during #GNUNET_HELPER_destroy).
147 * @param cont_cls closure for @a cont 147 * @param cont_cls closure for @a cont
148 * @return NULL if the message was dropped, 148 * @return NULL if the message was dropped,
149 * otherwise handle to cancel @a cont (actual transmission may 149 * otherwise handle to cancel @a cont (actual transmission may
150 * not be abortable) 150 * not be abortable)
151 */ 151 */
152struct GNUNET_HELPER_SendHandle * 152struct GNUNET_HELPER_SendHandle *
153GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h, 153GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h,
154 const struct GNUNET_MessageHeader *msg, 154 const struct GNUNET_MessageHeader *msg,
155 int can_drop, 155 int can_drop,
156 GNUNET_HELPER_Continuation cont, 156 GNUNET_HELPER_Continuation cont,
@@ -166,5 +166,5 @@ GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h,
166void 166void
167GNUNET_HELPER_send_cancel (struct GNUNET_HELPER_SendHandle *sh); 167GNUNET_HELPER_send_cancel (struct GNUNET_HELPER_SendHandle *sh);
168 168
169#endif 169#endif
170/* end of include guard: GNUNET_HELPER_LIB_H */ 170/* end of include guard: GNUNET_HELPER_LIB_H */
diff --git a/src/include/gnunet_identity_service.h b/src/include/gnunet_identity_service.h
index 6c572e737..79d27fa02 100644
--- a/src/include/gnunet_identity_service.h
+++ b/src/include/gnunet_identity_service.h
@@ -18,7 +18,7 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/** 21/**
22 * @file include/gnunet_identity_service.h 22 * @file include/gnunet_identity_service.h
23 * @brief Identity service; implements identity management for GNUnet 23 * @brief Identity service; implements identity management for GNUnet
24 * @author Christian Grothoff 24 * @author Christian Grothoff
@@ -49,22 +49,22 @@ extern "C"
49#include "gnunet_util_lib.h" 49#include "gnunet_util_lib.h"
50 50
51 51
52/** 52/**
53 * Version number of GNUnet Identity API. 53 * Version number of GNUnet Identity API.
54 */ 54 */
55#define GNUNET_IDENTITY_VERSION 0x00000000 55#define GNUNET_IDENTITY_VERSION 0x00000000
56 56
57/** 57/**
58 * Handle to access the identity service. 58 * Handle to access the identity service.
59 */ 59 */
60struct GNUNET_IDENTITY_Handle; 60struct GNUNET_IDENTITY_Handle;
61 61
62/** 62/**
63 * Handle for a ego. 63 * Handle for a ego.
64 */ 64 */
65struct GNUNET_IDENTITY_Ego; 65struct GNUNET_IDENTITY_Ego;
66 66
67/** 67/**
68 * Handle for an operation with the identity service. 68 * Handle for an operation with the identity service.
69 */ 69 */
70struct GNUNET_IDENTITY_Operation; 70struct GNUNET_IDENTITY_Operation;
@@ -100,9 +100,9 @@ GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego,
100 struct GNUNET_CRYPTO_EccPublicSignKey *pk); 100 struct GNUNET_CRYPTO_EccPublicSignKey *pk);
101 101
102 102
103/** 103/**
104 * Method called to inform about the egos of 104 * Method called to inform about the egos of
105 * this peer. 105 * this peer.
106 * 106 *
107 * When used with #GNUNET_IDENTITY_connect, this function is 107 * When used with #GNUNET_IDENTITY_connect, this function is
108 * initially called for all egos and then again whenever a 108 * initially called for all egos and then again whenever a
@@ -116,11 +116,11 @@ GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego,
116 * @a ego does indicate an error (i.e. name is taken or no default 116 * @a ego does indicate an error (i.e. name is taken or no default
117 * value is known). If @a ego is non-NULL and if '*ctx' 117 * value is known). If @a ego is non-NULL and if '*ctx'
118 * is set in those callbacks, the value WILL be passed to a subsequent 118 * is set in those callbacks, the value WILL be passed to a subsequent
119 * call to the identity callback of #GNUNET_IDENTITY_connect (if 119 * call to the identity callback of #GNUNET_IDENTITY_connect (if
120 * that one was not NULL). 120 * that one was not NULL).
121 * 121 *
122 * When an identity is renamed, this function is called with the 122 * When an identity is renamed, this function is called with the
123 * (known) @a ego but the NEW @a name. 123 * (known) @a ego but the NEW @a name.
124 * 124 *
125 * When an identity is deleted, this function is called with the 125 * When an identity is deleted, this function is called with the
126 * (known) ego and "NULL" for the @a name. In this case, 126 * (known) ego and "NULL" for the @a name. In this case,
@@ -141,7 +141,7 @@ typedef void (*GNUNET_IDENTITY_Callback)(void *cls,
141 const char *name); 141 const char *name);
142 142
143 143
144/** 144/**
145 * Connect to the identity service. 145 * Connect to the identity service.
146 * 146 *
147 * @param cfg Configuration to contact the identity service. 147 * @param cfg Configuration to contact the identity service.
@@ -205,12 +205,12 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *id,
205 * Disconnect from identity service. 205 * Disconnect from identity service.
206 * 206 *
207 * @param h identity service to disconnect 207 * @param h identity service to disconnect
208 */ 208 */
209void 209void
210GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h); 210GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h);
211 211
212 212
213/** 213/**
214 * Create a new identity with the given name. 214 * Create a new identity with the given name.
215 * 215 *
216 * @param id identity service to use 216 * @param id identity service to use
@@ -226,7 +226,7 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id,
226 void *cont_cls); 226 void *cont_cls);
227 227
228 228
229/** 229/**
230 * Renames an existing identity. 230 * Renames an existing identity.
231 * 231 *
232 * @param id identity service to use 232 * @param id identity service to use
@@ -244,7 +244,7 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id,
244 void *cb_cls); 244 void *cb_cls);
245 245
246 246
247/** 247/**
248 * Delete an existing identity. 248 * Delete an existing identity.
249 * 249 *
250 * @param id identity service to use 250 * @param id identity service to use
@@ -279,13 +279,13 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op);
279 * 279 *
280 * @param cls closure 280 * @param cls closure
281 * @param ego NULL on error / ego not found 281 * @param ego NULL on error / ego not found
282 */ 282 */
283typedef void (*GNUNET_IDENTITY_EgoCallback)(void *cls, 283typedef void (*GNUNET_IDENTITY_EgoCallback)(void *cls,
284 const struct GNUNET_IDENTITY_Ego *ego); 284 const struct GNUNET_IDENTITY_Ego *ego);
285 285
286/** 286/**
287 * Handle for ego lookup. 287 * Handle for ego lookup.
288 */ 288 */
289struct GNUNET_IDENTITY_EgoLookup; 289struct GNUNET_IDENTITY_EgoLookup;
290 290
291 291
diff --git a/src/include/gnunet_lockmanager_service.h b/src/include/gnunet_lockmanager_service.h
index 7ec262d04..ecc2a8d50 100644
--- a/src/include/gnunet_lockmanager_service.h
+++ b/src/include/gnunet_lockmanager_service.h
@@ -87,7 +87,7 @@ enum GNUNET_LOCKMANAGER_Status
87 * 87 *
88 * @param cls the closure from GNUNET_LOCKMANAGER_lock call 88 * @param cls the closure from GNUNET_LOCKMANAGER_lock call
89 * 89 *
90 * @param domain_name the locking domain of the lock 90 * @param domain_name the locking domain of the lock
91 * 91 *
92 * @param lock the lock for which this status is relevant 92 * @param lock the lock for which this status is relevant
93 * 93 *
@@ -95,11 +95,11 @@ enum GNUNET_LOCKMANAGER_Status
95 * acquired; GNUNET_LOCKMANAGER_RELEASE when the acquired lock is 95 * acquired; GNUNET_LOCKMANAGER_RELEASE when the acquired lock is
96 * lost. 96 * lost.
97 */ 97 */
98typedef void 98typedef void
99(*GNUNET_LOCKMANAGER_StatusCallback) (void *cls, 99(*GNUNET_LOCKMANAGER_StatusCallback) (void *cls,
100 const char *domain_name, 100 const char *domain_name,
101 uint32_t lock, 101 uint32_t lock,
102 enum GNUNET_LOCKMANAGER_Status 102 enum GNUNET_LOCKMANAGER_Status
103 status); 103 status);
104 104
105 105
diff --git a/src/include/gnunet_mesh_service.h b/src/include/gnunet_mesh_service.h
index 9d2562de8..08748d87b 100644
--- a/src/include/gnunet_mesh_service.h
+++ b/src/include/gnunet_mesh_service.h
@@ -95,7 +95,7 @@ enum MeshTunnelOption
95/** 95/**
96 * Functions with this signature are called whenever a message is 96 * Functions with this signature are called whenever a message is
97 * received. 97 * received.
98 * 98 *
99 * Each time the function must call #GNUNET_MESH_receive_done on the tunnel 99 * Each time the function must call #GNUNET_MESH_receive_done on the tunnel
100 * in order to receive the next message. This doesn't need to be immediate: 100 * in order to receive the next message. This doesn't need to be immediate:
101 * can be delayed if some processing is done on the message. 101 * can be delayed if some processing is done on the message.
@@ -104,7 +104,7 @@ enum MeshTunnelOption
104 * @param tunnel Connection to the other end. 104 * @param tunnel Connection to the other end.
105 * @param tunnel_ctx Place to store local state associated with the tunnel. 105 * @param tunnel_ctx Place to store local state associated with the tunnel.
106 * @param message The actual message. 106 * @param message The actual message.
107 * 107 *
108 * @return #GNUNET_OK to keep the tunnel open, 108 * @return #GNUNET_OK to keep the tunnel open,
109 * #GNUNET_SYSERR to close it (signal serious error). 109 * #GNUNET_SYSERR to close it (signal serious error).
110 */ 110 */
@@ -164,8 +164,8 @@ typedef void *(GNUNET_MESH_InboundTunnelNotificationHandler) (void *cls,
164 164
165/** 165/**
166 * Function called whenever a tunnel is destroyed. Should clean up 166 * Function called whenever a tunnel is destroyed. Should clean up
167 * any associated state. 167 * any associated state.
168 * 168 *
169 * It must NOT call #GNUNET_MESH_tunnel_destroy on the tunnel. 169 * It must NOT call #GNUNET_MESH_tunnel_destroy on the tunnel.
170 * 170 *
171 * @param cls closure (set from #GNUNET_MESH_connect) 171 * @param cls closure (set from #GNUNET_MESH_connect)
@@ -182,7 +182,7 @@ typedef void (GNUNET_MESH_TunnelEndHandler) (void *cls,
182 * Connect to the mesh service. 182 * Connect to the mesh service.
183 * 183 *
184 * @param cfg Configuration to use. 184 * @param cfg Configuration to use.
185 * @param cls Closure for the various callbacks that follow (including 185 * @param cls Closure for the various callbacks that follow (including
186 * handlers in the handlers array). 186 * handlers in the handlers array).
187 * @param new_tunnel Function called when an *incoming* tunnel is created. 187 * @param new_tunnel Function called when an *incoming* tunnel is created.
188 * Can be NULL if no inbound tunnels are desired. 188 * Can be NULL if no inbound tunnels are desired.
@@ -193,15 +193,15 @@ typedef void (GNUNET_MESH_TunnelEndHandler) (void *cls,
193 * @param handlers Callbacks for messages we care about, NULL-terminated. Each 193 * @param handlers Callbacks for messages we care about, NULL-terminated. Each
194 * one must call #GNUNET_MESH_receive_done on the tunnel to 194 * one must call #GNUNET_MESH_receive_done on the tunnel to
195 * receive the next message. Messages of a type that is not 195 * receive the next message. Messages of a type that is not
196 * in the handlers array are ignored if received. 196 * in the handlers array are ignored if received.
197 * @param ports NULL or 0-terminated array of port numbers for incoming tunnels. 197 * @param ports NULL or 0-terminated array of port numbers for incoming tunnels.
198 * See @c new_tunnel. 198 * See @c new_tunnel.
199 * 199 *
200 * @return handle to the mesh service NULL on error 200 * @return handle to the mesh service NULL on error
201 * (in this case, init is never called) 201 * (in this case, init is never called)
202 */ 202 */
203struct GNUNET_MESH_Handle * 203struct GNUNET_MESH_Handle *
204GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, 204GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
205 void *cls, 205 void *cls,
206 GNUNET_MESH_InboundTunnelNotificationHandler new_tunnel, 206 GNUNET_MESH_InboundTunnelNotificationHandler new_tunnel,
207 GNUNET_MESH_TunnelEndHandler cleaner, 207 GNUNET_MESH_TunnelEndHandler cleaner,
@@ -234,7 +234,7 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle);
234 * @return handle to the tunnel 234 * @return handle to the tunnel
235 */ 235 */
236struct GNUNET_MESH_Tunnel * 236struct GNUNET_MESH_Tunnel *
237GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle *h, 237GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle *h,
238 void *tunnel_ctx, 238 void *tunnel_ctx,
239 const struct GNUNET_PeerIdentity *peer, 239 const struct GNUNET_PeerIdentity *peer,
240 uint32_t port, 240 uint32_t port,
@@ -244,7 +244,7 @@ GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle *h,
244 244
245/** 245/**
246 * Destroy an existing tunnel. 246 * Destroy an existing tunnel.
247 * 247 *
248 * The existing end callback for the tunnel will be called immediately. 248 * The existing end callback for the tunnel will be called immediately.
249 * Any pending outgoing messages will be sent but no incoming messages will be 249 * Any pending outgoing messages will be sent but no incoming messages will be
250 * accepted and no data callbacks will be called. 250 * accepted and no data callbacks will be called.
@@ -258,7 +258,7 @@ GNUNET_MESH_tunnel_destroy (struct GNUNET_MESH_Tunnel *tunnel);
258/** 258/**
259 * Struct to retrieve info about a tunnel. 259 * Struct to retrieve info about a tunnel.
260 */ 260 */
261union GNUNET_MESH_TunnelInfo 261union GNUNET_MESH_TunnelInfo
262{ 262{
263 263
264 /** 264 /**
@@ -332,7 +332,7 @@ GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle
332 332
333/** 333/**
334 * Indicate readiness to receive the next message on a tunnel. 334 * Indicate readiness to receive the next message on a tunnel.
335 * 335 *
336 * Should only be called once per handler called. 336 * Should only be called once per handler called.
337 * 337 *
338 * @param tunnel Tunnel that will be allowed to call another handler. 338 * @param tunnel Tunnel that will be allowed to call another handler.
diff --git a/src/include/gnunet_mesh_service_enc.h b/src/include/gnunet_mesh_service_enc.h
index b495d0754..af4eeaa5d 100644
--- a/src/include/gnunet_mesh_service_enc.h
+++ b/src/include/gnunet_mesh_service_enc.h
@@ -91,7 +91,7 @@ enum MeshOption
91/** 91/**
92 * Functions with this signature are called whenever a message is 92 * Functions with this signature are called whenever a message is
93 * received. 93 * received.
94 * 94 *
95 * Each time the function must call #GNUNET_MESH_receive_done on the channel 95 * Each time the function must call #GNUNET_MESH_receive_done on the channel
96 * in order to receive the next message. This doesn't need to be immediate: 96 * in order to receive the next message. This doesn't need to be immediate:
97 * can be delayed if some processing is done on the message. 97 * can be delayed if some processing is done on the message.
@@ -161,8 +161,8 @@ typedef void *(GNUNET_MESH_InboundChannelNotificationHandler) (void *cls,
161 161
162/** 162/**
163 * Function called whenever a channel is destroyed. Should clean up 163 * Function called whenever a channel is destroyed. Should clean up
164 * any associated state. 164 * any associated state.
165 * 165 *
166 * It must NOT call #GNUNET_MESH_channel_destroy on the channel. 166 * It must NOT call #GNUNET_MESH_channel_destroy on the channel.
167 * 167 *
168 * @param cls closure (set from #GNUNET_MESH_connect) 168 * @param cls closure (set from #GNUNET_MESH_connect)
@@ -180,7 +180,7 @@ typedef void (GNUNET_MESH_ChannelEndHandler) (void *cls,
180 * Connect to the mesh service. 180 * Connect to the mesh service.
181 * 181 *
182 * @param cfg Configuration to use. 182 * @param cfg Configuration to use.
183 * @param cls Closure for the various callbacks that follow (including 183 * @param cls Closure for the various callbacks that follow (including
184 * handlers in the handlers array). 184 * handlers in the handlers array).
185 * @param new_channel Function called when an *incoming* channel is created. 185 * @param new_channel Function called when an *incoming* channel is created.
186 * Can be NULL if no inbound channels are desired. 186 * Can be NULL if no inbound channels are desired.
@@ -191,10 +191,10 @@ typedef void (GNUNET_MESH_ChannelEndHandler) (void *cls,
191 * @param handlers Callbacks for messages we care about, NULL-terminated. Each 191 * @param handlers Callbacks for messages we care about, NULL-terminated. Each
192 * one must call #GNUNET_MESH_receive_done on the channel to 192 * one must call #GNUNET_MESH_receive_done on the channel to
193 * receive the next message. Messages of a type that is not 193 * receive the next message. Messages of a type that is not
194 * in the handlers array are ignored if received. 194 * in the handlers array are ignored if received.
195 * @param ports NULL or 0-terminated array of port numbers for incoming channels. 195 * @param ports NULL or 0-terminated array of port numbers for incoming channels.
196 * See @a new_channel. 196 * See @a new_channel.
197 * 197 *
198 * @return handle to the mesh service NULL on error 198 * @return handle to the mesh service NULL on error
199 * (in this case, init is never called) 199 * (in this case, init is never called)
200 */ 200 */
@@ -231,7 +231,7 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle);
231 * @return handle to the channel 231 * @return handle to the channel
232 */ 232 */
233struct GNUNET_MESH_Channel * 233struct GNUNET_MESH_Channel *
234GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, 234GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h,
235 void *channel_ctx, 235 void *channel_ctx,
236 const struct GNUNET_PeerIdentity *peer, 236 const struct GNUNET_PeerIdentity *peer,
237 uint32_t port, 237 uint32_t port,
@@ -241,7 +241,7 @@ GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h,
241 241
242/** 242/**
243 * Destroy an existing channel. 243 * Destroy an existing channel.
244 * 244 *
245 * The existing end callback for the channel will be called immediately. 245 * The existing end callback for the channel will be called immediately.
246 * Any pending outgoing messages will be sent but no incoming messages will be 246 * Any pending outgoing messages will be sent but no incoming messages will be
247 * accepted and no data callbacks will be called. 247 * accepted and no data callbacks will be called.
@@ -255,7 +255,7 @@ GNUNET_MESH_channel_destroy (struct GNUNET_MESH_Channel *channel);
255/** 255/**
256 * Struct to retrieve info about a channel. 256 * Struct to retrieve info about a channel.
257 */ 257 */
258union GNUNET_MESH_ChannelInfo 258union GNUNET_MESH_ChannelInfo
259{ 259{
260 260
261 /** 261 /**
@@ -329,7 +329,7 @@ GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle
329 329
330/** 330/**
331 * Indicate readiness to receive the next message on a channel. 331 * Indicate readiness to receive the next message on a channel.
332 * 332 *
333 * Should only be called once per handler called. 333 * Should only be called once per handler called.
334 * 334 *
335 * @param channel Channel that will be allowed to call another handler. 335 * @param channel Channel that will be allowed to call another handler.
diff --git a/src/include/gnunet_microphone_lib.h b/src/include/gnunet_microphone_lib.h
index 241d58a6c..def8418b7 100644
--- a/src/include/gnunet_microphone_lib.h
+++ b/src/include/gnunet_microphone_lib.h
@@ -1,17 +1,17 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2013 Christian Grothoff (and other contributing authors) 3 (C) 2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version. 8 option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
diff --git a/src/include/gnunet_mq_lib.h b/src/include/gnunet_mq_lib.h
index fd28f3de6..17d8e8e56 100644
--- a/src/include/gnunet_mq_lib.h
+++ b/src/include/gnunet_mq_lib.h
@@ -143,22 +143,22 @@ struct GNUNET_MQ_Envelope;
143 143
144/** 144/**
145 * Error codes for the queue. 145 * Error codes for the queue.
146 */ 146 */
147enum GNUNET_MQ_Error 147enum GNUNET_MQ_Error
148{ 148{
149 /** 149 /**
150 * FIXME: document! 150 * FIXME: document!
151 */ 151 */
152 GNUNET_MQ_ERROR_READ = 1, 152 GNUNET_MQ_ERROR_READ = 1,
153 153
154 /** 154 /**
155 * FIXME: document! 155 * FIXME: document!
156 */ 156 */
157 GNUNET_MQ_ERROR_WRITE = 2, 157 GNUNET_MQ_ERROR_WRITE = 2,
158 158
159 /** 159 /**
160 * FIXME: document! 160 * FIXME: document!
161 */ 161 */
162 GNUNET_MQ_ERROR_TIMEOUT = 4 162 GNUNET_MQ_ERROR_TIMEOUT = 4
163}; 163};
164 164
@@ -193,7 +193,7 @@ typedef void
193 * destruction of a message queue. 193 * destruction of a message queue.
194 * Implementations must not free @a mq, but should 194 * Implementations must not free @a mq, but should
195 * take care of @a impl_state. 195 * take care of @a impl_state.
196 * 196 *
197 * @param mq the message queue to destroy 197 * @param mq the message queue to destroy
198 * @param impl_state state of the implementation 198 * @param impl_state state of the implementation
199 */ 199 */
@@ -203,7 +203,7 @@ typedef void
203 203
204/** 204/**
205 * Implementation function that cancels the currently sent message. 205 * Implementation function that cancels the currently sent message.
206 * 206 *
207 * @param mq message queue 207 * @param mq message queue
208 * @param impl_state state specific to the implementation 208 * @param impl_state state specific to the implementation
209 */ 209 */
@@ -239,7 +239,7 @@ typedef void
239struct GNUNET_MQ_MessageHandler 239struct GNUNET_MQ_MessageHandler
240{ 240{
241 /** 241 /**
242 * Callback, called every time a new message of 242 * Callback, called every time a new message of
243 * the specified type has been receied. 243 * the specified type has been receied.
244 */ 244 */
245 GNUNET_MQ_MessageCallback cb; 245 GNUNET_MQ_MessageCallback cb;
@@ -262,7 +262,7 @@ struct GNUNET_MQ_MessageHandler
262 262
263/** 263/**
264 * Create a new envelope. 264 * Create a new envelope.
265 * 265 *
266 * @param mhp message header to store the allocated message header in, can be NULL 266 * @param mhp message header to store the allocated message header in, can be NULL
267 * @param size size of the message to allocate 267 * @param size size of the message to allocate
268 * @param type type of the message, will be set in the allocated message 268 * @param type type of the message, will be set in the allocated message
@@ -286,12 +286,12 @@ GNUNET_MQ_discard (struct GNUNET_MQ_Envelope *mqm);
286/** 286/**
287 * Send a message with the give message queue. 287 * Send a message with the give message queue.
288 * May only be called once per message. 288 * May only be called once per message.
289 * 289 *
290 * @param mq message queue 290 * @param mq message queue
291 * @param ev the envelope with the message to send. 291 * @param ev the envelope with the message to send.
292 */ 292 */
293void 293void
294GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, 294GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq,
295 struct GNUNET_MQ_Envelope *ev); 295 struct GNUNET_MQ_Envelope *ev);
296 296
297 297
@@ -385,7 +385,7 @@ GNUNET_MQ_queue_for_callbacks (GNUNET_MQ_SendImpl send,
385 const struct GNUNET_MQ_MessageHandler *handlers, 385 const struct GNUNET_MQ_MessageHandler *handlers,
386 GNUNET_MQ_ErrorHandler error_handler, 386 GNUNET_MQ_ErrorHandler error_handler,
387 void *cls); 387 void *cls);
388 388
389 389
390 390
391/** 391/**
diff --git a/src/include/gnunet_multicast_service.h b/src/include/gnunet_multicast_service.h
index ec446a906..7a2421b4b 100644
--- a/src/include/gnunet_multicast_service.h
+++ b/src/include/gnunet_multicast_service.h
@@ -18,7 +18,7 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/** 21/**
22 * @file include/gnunet_multicast_service.h 22 * @file include/gnunet_multicast_service.h
23 * @brief multicast service; establish tunnels to distant peers 23 * @brief multicast service; establish tunnels to distant peers
24 * @author Christian Grothoff 24 * @author Christian Grothoff
@@ -39,7 +39,7 @@ extern "C"
39#include "gnunet_util_lib.h" 39#include "gnunet_util_lib.h"
40#include "gnunet_transport_service.h" 40#include "gnunet_transport_service.h"
41 41
42/** 42/**
43 * Version number of GNUnet-multicast API. 43 * Version number of GNUnet-multicast API.
44 */ 44 */
45#define GNUNET_MULTICAST_VERSION 0x00000000 45#define GNUNET_MULTICAST_VERSION 0x00000000
@@ -49,12 +49,12 @@ extern "C"
49 */ 49 */
50#define GNUNET_MULTICAST_FRAGMENT_MAX_SIZE 63 * 1024 50#define GNUNET_MULTICAST_FRAGMENT_MAX_SIZE 63 * 1024
51 51
52/** 52/**
53 * Opaque handle for a multicast group member. 53 * Opaque handle for a multicast group member.
54 */ 54 */
55struct GNUNET_MULTICAST_Member; 55struct GNUNET_MULTICAST_Member;
56 56
57/** 57/**
58 * Handle for the origin of a multicast group. 58 * Handle for the origin of a multicast group.
59 */ 59 */
60struct GNUNET_MULTICAST_Origin; 60struct GNUNET_MULTICAST_Origin;
@@ -72,7 +72,7 @@ enum GNUNET_MULTICAST_MessageFlags
72 */ 72 */
73 GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT = 1 << 1, 73 GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT = 1 << 1,
74 74
75 /** 75 /**
76 * OR'ed flags if message is not fragmented. 76 * OR'ed flags if message is not fragmented.
77 */ 77 */
78 GNUNET_MULTICAST_MESSAGE_NOT_FRAGMENTED 78 GNUNET_MULTICAST_MESSAGE_NOT_FRAGMENTED
@@ -83,7 +83,7 @@ enum GNUNET_MULTICAST_MessageFlags
83 83
84GNUNET_NETWORK_STRUCT_BEGIN 84GNUNET_NETWORK_STRUCT_BEGIN
85 85
86/** 86/**
87 * Header of a multicast message fragment. 87 * Header of a multicast message fragment.
88 * 88 *
89 * This format is public as the replay mechanism must replay message fragments using the 89 * This format is public as the replay mechanism must replay message fragments using the
@@ -93,12 +93,12 @@ GNUNET_NETWORK_STRUCT_BEGIN
93struct GNUNET_MULTICAST_MessageHeader 93struct GNUNET_MULTICAST_MessageHeader
94{ 94{
95 95
96 /** 96 /**
97 * Header for all multicast message fragments from the origin. 97 * Header for all multicast message fragments from the origin.
98 */ 98 */
99 struct GNUNET_MessageHeader header; 99 struct GNUNET_MessageHeader header;
100 100
101 /** 101 /**
102 * Number of hops this message fragment has taken since the origin. 102 * Number of hops this message fragment has taken since the origin.
103 * 103 *
104 * Helpful to determine shortest paths to the origin among honest peers for 104 * Helpful to determine shortest paths to the origin among honest peers for
@@ -107,36 +107,36 @@ struct GNUNET_MULTICAST_MessageHeader
107 */ 107 */
108 uint32_t hop_counter GNUNET_PACKED; 108 uint32_t hop_counter GNUNET_PACKED;
109 109
110 /** 110 /**
111 * ECC signature of the message fragment. 111 * ECC signature of the message fragment.
112 * 112 *
113 * Signature must match the public key of the multicast group. 113 * Signature must match the public key of the multicast group.
114 */ 114 */
115 struct GNUNET_CRYPTO_EccSignature signature; 115 struct GNUNET_CRYPTO_EccSignature signature;
116 116
117 /** 117 /**
118 * Purpose for the signature and size of the signed data. 118 * Purpose for the signature and size of the signed data.
119 */ 119 */
120 struct GNUNET_CRYPTO_EccSignaturePurpose purpose; 120 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
121 121
122 /** 122 /**
123 * Number of the message fragment, monotonically increasing. 123 * Number of the message fragment, monotonically increasing.
124 */ 124 */
125 uint64_t fragment_id GNUNET_PACKED; 125 uint64_t fragment_id GNUNET_PACKED;
126 126
127 /** 127 /**
128 * Byte offset of this @e fragment of the @e message. 128 * Byte offset of this @e fragment of the @e message.
129 */ 129 */
130 uint64_t fragment_offset GNUNET_PACKED; 130 uint64_t fragment_offset GNUNET_PACKED;
131 131
132 /** 132 /**
133 * Number of the message this fragment belongs to. 133 * Number of the message this fragment belongs to.
134 * 134 *
135 * Set in GNUNET_MULTICAST_origin_to_all(). 135 * Set in GNUNET_MULTICAST_origin_to_all().
136 */ 136 */
137 uint64_t message_id GNUNET_PACKED; 137 uint64_t message_id GNUNET_PACKED;
138 138
139 /** 139 /**
140 * Counter that monotonically increases whenever a member parts the group. 140 * Counter that monotonically increases whenever a member parts the group.
141 * 141 *
142 * Set in GNUNET_MULTICAST_origin_to_all(). 142 * Set in GNUNET_MULTICAST_origin_to_all().
@@ -159,7 +159,7 @@ struct GNUNET_MULTICAST_MessageHeader
159GNUNET_NETWORK_STRUCT_END 159GNUNET_NETWORK_STRUCT_END
160 160
161 161
162/** 162/**
163 * Handle that identifies a join request. 163 * Handle that identifies a join request.
164 * 164 *
165 * Used to match calls to #GNUNET_MULTICAST_JoinCallback to the 165 * Used to match calls to #GNUNET_MULTICAST_JoinCallback to the
@@ -168,7 +168,7 @@ GNUNET_NETWORK_STRUCT_END
168struct GNUNET_MULTICAST_JoinHandle; 168struct GNUNET_MULTICAST_JoinHandle;
169 169
170 170
171/** 171/**
172 * Function to call with the decision made for a join request. 172 * Function to call with the decision made for a join request.
173 * 173 *
174 * Must be called once and only once in response to an invocation of the 174 * Must be called once and only once in response to an invocation of the
@@ -198,7 +198,7 @@ GNUNET_MULTICAST_join_decision (struct GNUNET_MULTICAST_JoinHandle *jh,
198 const struct GNUNET_MessageHeader *join_response); 198 const struct GNUNET_MessageHeader *join_response);
199 199
200 200
201/** 201/**
202 * Method called whenever another peer wants to join the multicast group. 202 * Method called whenever another peer wants to join the multicast group.
203 * 203 *
204 * Implementations of this function must call GNUNET_MULTICAST_join_decision() 204 * Implementations of this function must call GNUNET_MULTICAST_join_decision()
@@ -219,13 +219,13 @@ typedef void
219 struct GNUNET_MULTICAST_JoinHandle *jh); 219 struct GNUNET_MULTICAST_JoinHandle *jh);
220 220
221 221
222/** 222/**
223 * Handle to pass back for the answer of a membership test. 223 * Handle to pass back for the answer of a membership test.
224 */ 224 */
225struct GNUNET_MULTICAST_MembershipTestHandle; 225struct GNUNET_MULTICAST_MembershipTestHandle;
226 226
227 227
228/** 228/**
229 * Call informing multicast about the decision taken for a membership test. 229 * Call informing multicast about the decision taken for a membership test.
230 * 230 *
231 * @param mth Handle that was given for the query. 231 * @param mth Handle that was given for the query.
@@ -237,7 +237,7 @@ GNUNET_MULTICAST_membership_test_result (struct GNUNET_MULTICAST_MembershipTestH
237 int result); 237 int result);
238 238
239 239
240/** 240/**
241 * Method called to test if a member was in the group at a particular time. 241 * Method called to test if a member was in the group at a particular time.
242 * 242 *
243 * It is called when a replay request is received to determine if the requested 243 * It is called when a replay request is received to determine if the requested
@@ -259,14 +259,14 @@ typedef void
259 struct GNUNET_MULTICAST_MembershipTestHandle *mth); 259 struct GNUNET_MULTICAST_MembershipTestHandle *mth);
260 260
261 261
262/** 262/**
263 * Function called whenever a group member has transmitted a request 263 * Function called whenever a group member has transmitted a request
264 * to the origin (other than joining or leaving). 264 * to the origin (other than joining or leaving).
265 * 265 *
266 * FIXME: need to distinguish between origin cancelling a message (some fragments 266 * FIXME: need to distinguish between origin cancelling a message (some fragments
267 * were sent, then the rest 'discarded') and the case where we got disconnected; 267 * were sent, then the rest 'discarded') and the case where we got disconnected;
268 * right now, both would mean 'msg' is NULL, but they could be quite different... 268 * right now, both would mean 'msg' is NULL, but they could be quite different...
269 * So the semantics from the receiver side of 269 * So the semantics from the receiver side of
270 * GNUNET_MULTICAST_member_to_origin_cancel() are not clear here. Maybe we 270 * GNUNET_MULTICAST_member_to_origin_cancel() are not clear here. Maybe we
271 * should do something with the flags in this case? 271 * should do something with the flags in this case?
272 * 272 *
@@ -282,7 +282,7 @@ typedef void
282 enum GNUNET_MULTICAST_MessageFlags flags); 282 enum GNUNET_MULTICAST_MessageFlags flags);
283 283
284 284
285/** 285/**
286 * Function called whenever a group member is receiving a message fragment from 286 * Function called whenever a group member is receiving a message fragment from
287 * the origin. 287 * the origin.
288 * 288 *
@@ -293,7 +293,7 @@ typedef void
293 * FIXME: need to distinguish between origin cancelling a message (some fragments 293 * FIXME: need to distinguish between origin cancelling a message (some fragments
294 * were sent, then the rest 'discarded') and the case where we got disconnected; 294 * were sent, then the rest 'discarded') and the case where we got disconnected;
295 * right now, both would mean 'msg' is NULL, but they could be quite different... 295 * right now, both would mean 'msg' is NULL, but they could be quite different...
296 * So the semantics from the receiver side of 296 * So the semantics from the receiver side of
297 * GNUNET_MULTICAST_origin_to_all_cancel() are not clear here. 297 * GNUNET_MULTICAST_origin_to_all_cancel() are not clear here.
298 * 298 *
299 * @param cls Closure (set from GNUNET_MULTICAST_member_join()) 299 * @param cls Closure (set from GNUNET_MULTICAST_member_join())
@@ -306,11 +306,11 @@ typedef void
306 const struct GNUNET_MessageHeader *msg); 306 const struct GNUNET_MessageHeader *msg);
307 307
308 308
309/** 309/**
310 * Function called with the result of an asynchronous operation. 310 * Function called with the result of an asynchronous operation.
311 * 311 *
312 * @see GNUNET_MULTICAST_replay_fragment() 312 * @see GNUNET_MULTICAST_replay_fragment()
313 * 313 *
314 * @param result Result of the operation. 314 * @param result Result of the operation.
315 */ 315 */
316typedef void 316typedef void
@@ -318,13 +318,13 @@ typedef void
318 int result); 318 int result);
319 319
320 320
321/** 321/**
322 * Opaque handle to a replay request from the multicast service. 322 * Opaque handle to a replay request from the multicast service.
323 */ 323 */
324struct GNUNET_MULTICAST_ReplayHandle; 324struct GNUNET_MULTICAST_ReplayHandle;
325 325
326 326
327/** 327/**
328 * Functions with this signature are called whenever the multicast service needs 328 * Functions with this signature are called whenever the multicast service needs
329 * a message fragment to be replayed by fragment_id. 329 * a message fragment to be replayed by fragment_id.
330 * 330 *
@@ -346,7 +346,7 @@ typedef void
346 uint64_t flags, 346 uint64_t flags,
347 struct GNUNET_MULTICAST_ReplayHandle *rh); 347 struct GNUNET_MULTICAST_ReplayHandle *rh);
348 348
349/** 349/**
350 * Functions with this signature are called whenever the multicast service needs 350 * Functions with this signature are called whenever the multicast service needs
351 * a message fragment to be replayed by message_id and fragment_offset. 351 * a message fragment to be replayed by message_id and fragment_offset.
352 * 352 *
@@ -371,18 +371,18 @@ typedef void
371 struct GNUNET_MULTICAST_ReplayHandle *rh); 371 struct GNUNET_MULTICAST_ReplayHandle *rh);
372 372
373 373
374/** 374/**
375 * Possible error codes during replay. 375 * Possible error codes during replay.
376 */ 376 */
377enum GNUNET_MULTICAST_ReplayErrorCode 377enum GNUNET_MULTICAST_ReplayErrorCode
378{ 378{
379 379
380 /** 380 /**
381 * Everything is fine. 381 * Everything is fine.
382 */ 382 */
383 GNUNET_MULTICAST_REC_OK = 0, 383 GNUNET_MULTICAST_REC_OK = 0,
384 384
385 /** 385 /**
386 * Message fragment not found in the message store. 386 * Message fragment not found in the message store.
387 * 387 *
388 * Either discarded if it is too old, or not arrived yet if this member has 388 * Either discarded if it is too old, or not arrived yet if this member has
@@ -390,7 +390,7 @@ enum GNUNET_MULTICAST_ReplayErrorCode
390 */ 390 */
391 GNUNET_MULTICAST_REC_NOT_FOUND = 1, 391 GNUNET_MULTICAST_REC_NOT_FOUND = 1,
392 392
393 /** 393 /**
394 * Fragment ID counter was larger than the highest counter this 394 * Fragment ID counter was larger than the highest counter this
395 * replay function has ever encountered; thus it is likely the 395 * replay function has ever encountered; thus it is likely the
396 * origin never sent it and we're at the HEAD of the multicast 396 * origin never sent it and we're at the HEAD of the multicast
@@ -400,12 +400,12 @@ enum GNUNET_MULTICAST_ReplayErrorCode
400 */ 400 */
401 GNUNET_MULTICAST_REC_PAST_HEAD = 2, 401 GNUNET_MULTICAST_REC_PAST_HEAD = 2,
402 402
403 /** 403 /**
404 * Access is denied to the requested fragment, membership test did not pass. 404 * Access is denied to the requested fragment, membership test did not pass.
405 */ 405 */
406 GNUNET_MULTICAST_REC_ACCESS_DENIED = 3, 406 GNUNET_MULTICAST_REC_ACCESS_DENIED = 3,
407 407
408 /** 408 /**
409 * Internal error (i.e. database error). Try some other peer. 409 * Internal error (i.e. database error). Try some other peer.
410 */ 410 */
411 GNUNET_MULTICAST_REC_INTERNAL_ERROR = 4 411 GNUNET_MULTICAST_REC_INTERNAL_ERROR = 4
@@ -413,7 +413,7 @@ enum GNUNET_MULTICAST_ReplayErrorCode
413}; 413};
414 414
415 415
416/** 416/**
417 * Replay a message fragment for the multicast group. 417 * Replay a message fragment for the multicast group.
418 * 418 *
419 * @param rh Replay handle identifying which replay operation was requested. 419 * @param rh Replay handle identifying which replay operation was requested.
@@ -426,7 +426,7 @@ GNUNET_MULTICAST_replay_response (struct GNUNET_MULTICAST_ReplayHandle *rh,
426 enum GNUNET_MULTICAST_ReplayErrorCode ec); 426 enum GNUNET_MULTICAST_ReplayErrorCode ec);
427 427
428 428
429/** 429/**
430 * Indicate the end of the replay session. 430 * Indicate the end of the replay session.
431 * 431 *
432 * Invalidates the replay handle. 432 * Invalidates the replay handle.
@@ -448,7 +448,7 @@ typedef int
448 void *data); 448 void *data);
449 449
450 450
451/** 451/**
452 * Replay a message for the multicast group. 452 * Replay a message for the multicast group.
453 * 453 *
454 * @param rh Replay handle identifying which replay operation was requested. 454 * @param rh Replay handle identifying which replay operation was requested.
@@ -461,7 +461,7 @@ GNUNET_MULTICAST_replay_response2 (struct GNUNET_MULTICAST_ReplayHandle *rh,
461 void *notify_cls); 461 void *notify_cls);
462 462
463 463
464/** 464/**
465 * Start a multicast group. 465 * Start a multicast group.
466 * 466 *
467 * Will advertise the origin in the P2P overlay network under the respective 467 * Will advertise the origin in the P2P overlay network under the respective
@@ -501,7 +501,7 @@ GNUNET_MULTICAST_origin_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
501 GNUNET_MULTICAST_MessageCallback message_cb, 501 GNUNET_MULTICAST_MessageCallback message_cb,
502 void *cls); 502 void *cls);
503 503
504/** 504/**
505 * Function called to provide data for a transmission from the origin to all 505 * Function called to provide data for a transmission from the origin to all
506 * members. 506 * members.
507 * 507 *
@@ -526,14 +526,14 @@ typedef int
526 void *data); 526 void *data);
527 527
528 528
529/** 529/**
530 * Handle for a request to send a message to all multicast group members 530 * Handle for a request to send a message to all multicast group members
531 * (from the origin). 531 * (from the origin).
532 */ 532 */
533struct GNUNET_MULTICAST_OriginMessageHandle; 533struct GNUNET_MULTICAST_OriginMessageHandle;
534 534
535 535
536/** 536/**
537 * Send a message to the multicast group. 537 * Send a message to the multicast group.
538 * 538 *
539 * @param origin Handle to the multicast group. 539 * @param origin Handle to the multicast group.
@@ -553,7 +553,7 @@ GNUNET_MULTICAST_origin_to_all (struct GNUNET_MULTICAST_Origin *origin,
553 553
554 554
555 555
556/** 556/**
557 * Resume message transmission to multicast group. 557 * Resume message transmission to multicast group.
558 * 558 *
559 * @param mh Request to cancel. 559 * @param mh Request to cancel.
@@ -562,7 +562,7 @@ void
562GNUNET_MULTICAST_origin_to_all_resume (struct GNUNET_MULTICAST_OriginMessageHandle *mh); 562GNUNET_MULTICAST_origin_to_all_resume (struct GNUNET_MULTICAST_OriginMessageHandle *mh);
563 563
564 564
565/** 565/**
566 * Cancel request for message transmission to multicast group. 566 * Cancel request for message transmission to multicast group.
567 * 567 *
568 * @param mh Request to cancel. 568 * @param mh Request to cancel.
@@ -571,7 +571,7 @@ void
571GNUNET_MULTICAST_origin_to_all_cancel (struct GNUNET_MULTICAST_OriginMessageHandle *mh); 571GNUNET_MULTICAST_origin_to_all_cancel (struct GNUNET_MULTICAST_OriginMessageHandle *mh);
572 572
573 573
574/** 574/**
575 * Stop a multicast group. 575 * Stop a multicast group.
576 * 576 *
577 * @param origin Multicast group to stop. 577 * @param origin Multicast group to stop.
@@ -580,7 +580,7 @@ void
580GNUNET_MULTICAST_origin_stop (struct GNUNET_MULTICAST_Origin *origin); 580GNUNET_MULTICAST_origin_stop (struct GNUNET_MULTICAST_Origin *origin);
581 581
582 582
583/** 583/**
584 * Join a multicast group. 584 * Join a multicast group.
585 * 585 *
586 * The entity joining is always the local peer. Further information about the 586 * The entity joining is always the local peer. Further information about the
@@ -636,13 +636,13 @@ GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
636 GNUNET_MULTICAST_MessageCallback message_cb, 636 GNUNET_MULTICAST_MessageCallback message_cb,
637 void *cls); 637 void *cls);
638 638
639/** 639/**
640 * Handle for a replay request. 640 * Handle for a replay request.
641 */ 641 */
642struct GNUNET_MULTICAST_MemberReplayHandle; 642struct GNUNET_MULTICAST_MemberReplayHandle;
643 643
644 644
645/** 645/**
646 * Request a fragment to be replayed by fragment ID. 646 * Request a fragment to be replayed by fragment ID.
647 * 647 *
648 * Useful if messages below the @e max_known_fragment_id given when joining are 648 * Useful if messages below the @e max_known_fragment_id given when joining are
@@ -662,7 +662,7 @@ GNUNET_MULTICAST_member_replay_fragment (struct GNUNET_MULTICAST_Member *member,
662 uint64_t flags); 662 uint64_t flags);
663 663
664 664
665/** 665/**
666 * Request a message fr to be replayed. 666 * Request a message fr to be replayed.
667 * 667 *
668 * Useful if messages below the @e max_known_fragment_id given when joining are 668 * Useful if messages below the @e max_known_fragment_id given when joining are
@@ -686,7 +686,7 @@ GNUNET_MULTICAST_member_replay_message (struct GNUNET_MULTICAST_Member *member,
686 void *result_cb_cls); 686 void *result_cb_cls);
687 687
688 688
689/** 689/**
690 * Cancel a replay request. 690 * Cancel a replay request.
691 * 691 *
692 * @param rh Request to cancel. 692 * @param rh Request to cancel.
@@ -695,7 +695,7 @@ void
695GNUNET_MULTICAST_member_replay_cancel (struct GNUNET_MULTICAST_MemberReplayHandle *rh); 695GNUNET_MULTICAST_member_replay_cancel (struct GNUNET_MULTICAST_MemberReplayHandle *rh);
696 696
697 697
698/** 698/**
699 * Part a multicast group. 699 * Part a multicast group.
700 * 700 *
701 * Disconnects from all group members and invalidates the @a member handle. 701 * Disconnects from all group members and invalidates the @a member handle.
@@ -709,7 +709,7 @@ void
709GNUNET_MULTICAST_member_part (struct GNUNET_MULTICAST_Member *member); 709GNUNET_MULTICAST_member_part (struct GNUNET_MULTICAST_Member *member);
710 710
711 711
712/** 712/**
713 * Function called to provide data for a transmission from a member to the origin. 713 * Function called to provide data for a transmission from a member to the origin.
714 * 714 *
715 * Note that returning #GNUNET_OK or #GNUNET_SYSERR (but not #GNUNET_NO) 715 * Note that returning #GNUNET_OK or #GNUNET_SYSERR (but not #GNUNET_NO)
@@ -733,15 +733,15 @@ typedef int
733 void *data); 733 void *data);
734 734
735 735
736/** 736/**
737 * Handle for a message to be delivered from a member to the origin. 737 * Handle for a message to be delivered from a member to the origin.
738 */ 738 */
739struct GNUNET_MULTICAST_MemberRequestHandle; 739struct GNUNET_MULTICAST_MemberRequestHandle;
740 740
741 741
742/** 742/**
743 * Send a message to the origin of the multicast group. 743 * Send a message to the origin of the multicast group.
744 * 744 *
745 * @param member Membership handle. 745 * @param member Membership handle.
746 * @param message_id Application layer ID for the message. Opaque to multicast. 746 * @param message_id Application layer ID for the message. Opaque to multicast.
747 * @param notify Callback to call to get the message. 747 * @param notify Callback to call to get the message.
@@ -755,7 +755,7 @@ GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member,
755 void *notify_cls); 755 void *notify_cls);
756 756
757 757
758/** 758/**
759 * Resume message transmission to origin. 759 * Resume message transmission to origin.
760 * 760 *
761 * @param rh Request to cancel. 761 * @param rh Request to cancel.
@@ -764,7 +764,7 @@ void
764GNUNET_MULTICAST_member_to_origin_resume (struct GNUNET_MULTICAST_MemberRequestHandle *rh); 764GNUNET_MULTICAST_member_to_origin_resume (struct GNUNET_MULTICAST_MemberRequestHandle *rh);
765 765
766 766
767/** 767/**
768 * Cancel request for message transmission to origin. 768 * Cancel request for message transmission to origin.
769 * 769 *
770 * @param rh Request to cancel. 770 * @param rh Request to cancel.
diff --git a/src/include/gnunet_mysql_lib.h b/src/include/gnunet_mysql_lib.h
index c61bdcab1..260de5982 100644
--- a/src/include/gnunet_mysql_lib.h
+++ b/src/include/gnunet_mysql_lib.h
@@ -76,7 +76,7 @@ GNUNET_MYSQL_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
76 76
77/** 77/**
78 * Destroy a mysql context. Also frees all associated prepared statements. 78 * Destroy a mysql context. Also frees all associated prepared statements.
79 * 79 *
80 * @param mc context to destroy 80 * @param mc context to destroy
81 */ 81 */
82void 82void
diff --git a/src/include/gnunet_namestore_plugin.h b/src/include/gnunet_namestore_plugin.h
index 32d13e200..4d4821bcb 100644
--- a/src/include/gnunet_namestore_plugin.h
+++ b/src/include/gnunet_namestore_plugin.h
@@ -83,7 +83,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
83 * @param block block to cache 83 * @param block block to cache
84 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 84 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
85 */ 85 */
86 int (*cache_block) (void *cls, 86 int (*cache_block) (void *cls,
87 const struct GNUNET_NAMESTORE_Block *block); 87 const struct GNUNET_NAMESTORE_Block *block);
88 88
89 89
@@ -97,7 +97,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
97 * @param iter_cls closure for @a iter 97 * @param iter_cls closure for @a iter
98 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error 98 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error
99 */ 99 */
100 int (*lookup_block) (void *cls, 100 int (*lookup_block) (void *cls,
101 const struct GNUNET_HashCode *query, 101 const struct GNUNET_HashCode *query,
102 GNUNET_NAMESTORE_BlockCallback iter, void *iter_cls); 102 GNUNET_NAMESTORE_BlockCallback iter, void *iter_cls);
103 103
@@ -114,7 +114,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
114 * @param rd array of records with data to store 114 * @param rd array of records with data to store
115 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 115 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
116 */ 116 */
117 int (*store_records) (void *cls, 117 int (*store_records) (void *cls,
118 const struct GNUNET_CRYPTO_EccPrivateKey *zone, 118 const struct GNUNET_CRYPTO_EccPrivateKey *zone,
119 const char *label, 119 const char *label,
120 unsigned int rd_count, 120 unsigned int rd_count,
@@ -132,7 +132,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
132 * @param iter_cls closure for @a iter 132 * @param iter_cls closure for @a iter
133 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error 133 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error
134 */ 134 */
135 int (*iterate_records) (void *cls, 135 int (*iterate_records) (void *cls,
136 const struct GNUNET_CRYPTO_EccPrivateKey *zone, 136 const struct GNUNET_CRYPTO_EccPrivateKey *zone,
137 uint64_t offset, 137 uint64_t offset,
138 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls); 138 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls);
@@ -149,7 +149,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
149 * @param iter_cls closure for @a iter 149 * @param iter_cls closure for @a iter
150 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error 150 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error
151 */ 151 */
152 int (*zone_to_name) (void *cls, 152 int (*zone_to_name) (void *cls,
153 const struct GNUNET_CRYPTO_EccPrivateKey *zone, 153 const struct GNUNET_CRYPTO_EccPrivateKey *zone,
154 const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, 154 const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone,
155 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls); 155 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls);
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h
index adc1a7e1d..7e39adc49 100644
--- a/src/include/gnunet_namestore_service.h
+++ b/src/include/gnunet_namestore_service.h
@@ -144,7 +144,7 @@ typedef void (*GNUNET_NAMESTORE_ContinuationWithStatus) (void *cls,
144 */ 144 */
145enum GNUNET_NAMESTORE_RecordFlags 145enum GNUNET_NAMESTORE_RecordFlags
146{ 146{
147 147
148 /** 148 /**
149 * No special options. 149 * No special options.
150 */ 150 */
@@ -251,7 +251,7 @@ struct GNUNET_NAMESTORE_Block
251 * of encrypted data that follow. 251 * of encrypted data that follow.
252 */ 252 */
253 struct GNUNET_CRYPTO_EccSignaturePurpose purpose; 253 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
254 254
255 /** 255 /**
256 * Expiration time of the block. 256 * Expiration time of the block.
257 */ 257 */
@@ -266,7 +266,7 @@ GNUNET_NETWORK_STRUCT_END
266 266
267/** 267/**
268 * Store an item in the namestore. If the item is already present, 268 * Store an item in the namestore. If the item is already present,
269 * it is replaced with the new record. 269 * it is replaced with the new record.
270 * 270 *
271 * @param h handle to the namestore 271 * @param h handle to the namestore
272 * @param block block to store 272 * @param block block to store
@@ -317,7 +317,7 @@ typedef void (*GNUNET_NAMESTORE_BlockProcessor) (void *cls,
317 317
318/** 318/**
319 * Get a result for a particular key from the namestore. The processor 319 * Get a result for a particular key from the namestore. The processor
320 * will only be called once. 320 * will only be called once.
321 * 321 *
322 * @param h handle to the namestore 322 * @param h handle to the namestore
323 * @param derived_hash hash of zone key combined with name to lookup 323 * @param derived_hash hash of zone key combined with name to lookup
@@ -328,7 +328,7 @@ typedef void (*GNUNET_NAMESTORE_BlockProcessor) (void *cls,
328 * @return a handle that can be used to cancel 328 * @return a handle that can be used to cancel
329 */ 329 */
330struct GNUNET_NAMESTORE_QueueEntry * 330struct GNUNET_NAMESTORE_QueueEntry *
331GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h, 331GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h,
332 const struct GNUNET_HashCode *derived_hash, 332 const struct GNUNET_HashCode *derived_hash,
333 GNUNET_NAMESTORE_BlockProcessor proc, void *proc_cls); 333 GNUNET_NAMESTORE_BlockProcessor proc, void *proc_cls);
334 334
@@ -363,7 +363,7 @@ typedef void (*GNUNET_NAMESTORE_RecordMonitor) (void *cls,
363 * cancel 363 * cancel
364 */ 364 */
365struct GNUNET_NAMESTORE_QueueEntry * 365struct GNUNET_NAMESTORE_QueueEntry *
366GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, 366GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h,
367 const struct GNUNET_CRYPTO_EccPrivateKey *zone, 367 const struct GNUNET_CRYPTO_EccPrivateKey *zone,
368 const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, 368 const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone,
369 GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls); 369 GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls);
@@ -444,7 +444,7 @@ struct GNUNET_NAMESTORE_ZoneMonitor;
444 444
445 445
446/** 446/**
447 * Function called once the monitor has caught up with the current 447 * Function called once the monitor has caught up with the current
448 * state of the database. Will be called AGAIN after each disconnect 448 * state of the database. Will be called AGAIN after each disconnect
449 * (record monitor called with 'NULL' for zone_key) once we're again 449 * (record monitor called with 'NULL' for zone_key) once we're again
450 * in sync. 450 * in sync.
@@ -534,7 +534,7 @@ GNUNET_NAMESTORE_records_deserialize (size_t len,
534 534
535 535
536/** 536/**
537 * Convert the binary value @a data of a record of 537 * Convert the binary value @a data of a record of
538 * type @a type to a human-readable string. 538 * type @a type to a human-readable string.
539 * 539 *
540 * @param type type of the record 540 * @param type type of the record
@@ -587,7 +587,7 @@ GNUNET_NAMESTORE_number_to_typename (uint32_t type);
587 587
588/** 588/**
589 * Test if a given record is expired. 589 * Test if a given record is expired.
590 * 590 *
591 * @param rd record to test 591 * @param rd record to test
592 * @return #GNUNET_YES if the record is expired, 592 * @return #GNUNET_YES if the record is expired,
593 * #GNUNET_NO if not 593 * #GNUNET_NO if not
@@ -619,11 +619,11 @@ GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicSignKey *z);
619 619
620/** 620/**
621 * Convert public key to the respective absolute domain name in the 621 * Convert public key to the respective absolute domain name in the
622 * ".zkey" pTLD. 622 * ".zkey" pTLD.
623 * This is one of the very few calls in the entire API that is 623 * This is one of the very few calls in the entire API that is
624 * NOT reentrant! 624 * NOT reentrant!
625 * 625 *
626 * @param pkey a public key with a point on the eliptic curve 626 * @param pkey a public key with a point on the eliptic curve
627 * @return string "X.zkey" where X is the coordinates of the public 627 * @return string "X.zkey" where X is the coordinates of the public
628 * key in an encoding suitable for DNS labels. 628 * key in an encoding suitable for DNS labels.
629 */ 629 */
@@ -634,10 +634,10 @@ GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey
634/** 634/**
635 * Convert an absolute domain name in the ".zkey" pTLD to the 635 * Convert an absolute domain name in the ".zkey" pTLD to the
636 * respective public key. 636 * respective public key.
637 * 637 *
638 * @param zkey string "X.zkey" where X is the public 638 * @param zkey string "X.zkey" where X is the public
639 * key in an encoding suitable for DNS labels. 639 * key in an encoding suitable for DNS labels.
640 * @param pkey set to a public key on the eliptic curve 640 * @param pkey set to a public key on the eliptic curve
641 * @return #GNUNET_SYSERR if @a zkey has the wrong syntax 641 * @return #GNUNET_SYSERR if @a zkey has the wrong syntax
642 */ 642 */
643int 643int
@@ -647,7 +647,7 @@ GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey,
647 647
648/** 648/**
649 * Calculate the DHT query for a given @a label in a given @a zone. 649 * Calculate the DHT query for a given @a label in a given @a zone.
650 * 650 *
651 * @param zone private key of the zone 651 * @param zone private key of the zone
652 * @param label label of the record 652 * @param label label of the record
653 * @param query hash to use for the query 653 * @param query hash to use for the query
@@ -660,7 +660,7 @@ GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EccPrivateKe
660 660
661/** 661/**
662 * Calculate the DHT query for a given @a label in a given @a zone. 662 * Calculate the DHT query for a given @a label in a given @a zone.
663 * 663 *
664 * @param pub public key of the zone 664 * @param pub public key of the zone
665 * @param label label of the record 665 * @param label label of the record
666 * @param query hash to use for the query 666 * @param query hash to use for the query
@@ -707,7 +707,7 @@ GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block);
707 * @param label the name for the records 707 * @param label the name for the records
708 * @param proc function to call with the result 708 * @param proc function to call with the result
709 * @param proc_cls closure for @a proc 709 * @param proc_cls closure for @a proc
710 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was 710 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was
711 * not well-formed 711 * not well-formed
712 */ 712 */
713int 713int
@@ -722,7 +722,7 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block,
722 * Compares if two records are equal 722 * Compares if two records are equal
723 * 723 *
724 * @param a a record 724 * @param a a record
725 * @param b another record 725 * @param b another record
726 * @return #GNUNET_YES if the records are equal, or #GNUNET_NO if not. 726 * @return #GNUNET_YES if the records are equal, or #GNUNET_NO if not.
727 */ 727 */
728int 728int
@@ -736,11 +736,11 @@ GNUNET_NAMESTORE_records_cmp (const struct GNUNET_NAMESTORE_RecordData *a,
736 * expiration time. 736 * expiration time.
737 * 737 *
738 * @param rd_count number of records given in @a rd 738 * @param rd_count number of records given in @a rd
739 * @param rd array of records 739 * @param rd array of records
740 * @return absolute expiration time 740 * @return absolute expiration time
741 */ 741 */
742struct GNUNET_TIME_Absolute 742struct GNUNET_TIME_Absolute
743GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count, 743GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count,
744 const struct GNUNET_NAMESTORE_RecordData *rd); 744 const struct GNUNET_NAMESTORE_RecordData *rd);
745 745
746 746
diff --git a/src/include/gnunet_nat_lib.h b/src/include/gnunet_nat_lib.h
index 701fc56ae..e3a4749c6 100644
--- a/src/include/gnunet_nat_lib.h
+++ b/src/include/gnunet_nat_lib.h
@@ -284,7 +284,7 @@ struct GNUNET_NAT_AutoHandle *
284GNUNET_NAT_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg, 284GNUNET_NAT_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
285 GNUNET_NAT_AutoResultCallback cb, 285 GNUNET_NAT_AutoResultCallback cb,
286 void *cb_cls); 286 void *cb_cls);
287 287
288 288
289/** 289/**
290 * Abort autoconfiguration. 290 * Abort autoconfiguration.
diff --git a/src/include/gnunet_network_lib.h b/src/include/gnunet_network_lib.h
index 910be8c72..d24019f1a 100644
--- a/src/include/gnunet_network_lib.h
+++ b/src/include/gnunet_network_lib.h
@@ -126,7 +126,7 @@ GNUNET_NETWORK_socket_box_native (SOCKTYPE fd);
126 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 126 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
127 */ 127 */
128int 128int
129GNUNET_NETWORK_socket_set_blocking (struct GNUNET_NETWORK_Handle *fd, 129GNUNET_NETWORK_socket_set_blocking (struct GNUNET_NETWORK_Handle *fd,
130 int doBlock); 130 int doBlock);
131 131
132 132
diff --git a/src/include/gnunet_os_lib.h b/src/include/gnunet_os_lib.h
index 9cf68df58..04fc1a406 100644
--- a/src/include/gnunet_os_lib.h
+++ b/src/include/gnunet_os_lib.h
@@ -32,7 +32,7 @@
32 * processes using signals. Because signals are not supported on W32 32 * processes using signals. Because signals are not supported on W32
33 * and Java (at least not nicely), we can alternatively use a pipe 33 * and Java (at least not nicely), we can alternatively use a pipe
34 * to send signals to the child processes (if the child process is 34 * to send signals to the child processes (if the child process is
35 * a full-blown GNUnet process that supports reading signals from 35 * a full-blown GNUnet process that supports reading signals from
36 * a pipe, of course). Naturally, this also only works for 'normal' 36 * a pipe, of course). Naturally, this also only works for 'normal'
37 * termination via signals, and not as a replacement for SIGKILL. 37 * termination via signals, and not as a replacement for SIGKILL.
38 * Thus using pipes to communicate signals should only be enabled if 38 * Thus using pipes to communicate signals should only be enabled if
@@ -72,7 +72,7 @@ enum GNUNET_OS_InheritStdioFlags
72 * inherit stdin of the parent. 72 * inherit stdin of the parent.
73 */ 73 */
74 GNUNET_OS_INHERIT_STD_IN = 1, 74 GNUNET_OS_INHERIT_STD_IN = 1,
75 75
76 /** 76 /**
77 * When this flag is set, the child process will 77 * When this flag is set, the child process will
78 * inherit stdout of the parent. 78 * inherit stdout of the parent.
@@ -319,7 +319,7 @@ GNUNET_OS_start_process_vap (int pipe_control,
319 enum GNUNET_OS_InheritStdioFlags std_inheritance, 319 enum GNUNET_OS_InheritStdioFlags std_inheritance,
320 struct GNUNET_DISK_PipeHandle *pipe_stdin, 320 struct GNUNET_DISK_PipeHandle *pipe_stdin,
321 struct GNUNET_DISK_PipeHandle *pipe_stdout, 321 struct GNUNET_DISK_PipeHandle *pipe_stdout,
322 const char *filename, 322 const char *filename,
323 char *const argv[]); 323 char *const argv[]);
324 324
325 325
@@ -375,7 +375,7 @@ GNUNET_OS_start_process_va (int pipe_control,
375struct GNUNET_OS_Process * 375struct GNUNET_OS_Process *
376GNUNET_OS_start_process_v (int pipe_control, 376GNUNET_OS_start_process_v (int pipe_control,
377 enum GNUNET_OS_InheritStdioFlags std_inheritance, 377 enum GNUNET_OS_InheritStdioFlags std_inheritance,
378 const SOCKTYPE *lsocks, 378 const SOCKTYPE *lsocks,
379 const char *filename, 379 const char *filename,
380 char *const argv[]); 380 char *const argv[]);
381 381
@@ -482,7 +482,7 @@ GNUNET_OS_install_parent_control_handler (void *cls,
482 * GNUNET_NO if not SUID (but binary exists), 482 * GNUNET_NO if not SUID (but binary exists),
483 * GNUNET_SYSERR on error (no such binary or not executable) 483 * GNUNET_SYSERR on error (no such binary or not executable)
484 */ 484 */
485int 485int
486GNUNET_OS_check_helper_binary (const char *binary, int check_suid, const char * params); 486GNUNET_OS_check_helper_binary (const char *binary, int check_suid, const char * params);
487 487
488 488
diff --git a/src/include/gnunet_peerinfo_service.h b/src/include/gnunet_peerinfo_service.h
index b428f49a4..9608d3702 100644
--- a/src/include/gnunet_peerinfo_service.h
+++ b/src/include/gnunet_peerinfo_service.h
@@ -73,7 +73,7 @@ GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h);
73 73
74/** 74/**
75 * Continuation called with a status result. 75 * Continuation called with a status result.
76 * 76 *
77 * @param cls closure 77 * @param cls closure
78 * @param emsg error message, NULL on success 78 * @param emsg error message, NULL on success
79 */ 79 */
diff --git a/src/include/gnunet_postgres_lib.h b/src/include/gnunet_postgres_lib.h
index 8f7204748..183105cd7 100644
--- a/src/include/gnunet_postgres_lib.h
+++ b/src/include/gnunet_postgres_lib.h
@@ -46,7 +46,7 @@ extern "C"
46 * @param ret return value from database operation to check 46 * @param ret return value from database operation to check
47 * @param expected_status desired status 47 * @param expected_status desired status
48 * @param command description of the command that was run 48 * @param command description of the command that was run
49 * @param args arguments given to the command 49 * @param args arguments given to the command
50 * @param filename name of the source file where the command was run 50 * @param filename name of the source file where the command was run
51 * @param line line number in the source file 51 * @param line line number in the source file
52 * @return GNUNET_OK if the result is acceptable 52 * @return GNUNET_OK if the result is acceptable
@@ -66,7 +66,7 @@ GNUNET_POSTGRES_check_result_ (PGconn *dbh, PGresult * ret, int expected_status,
66 * @param ret return value from database operation to check 66 * @param ret return value from database operation to check
67 * @param expected_status desired status 67 * @param expected_status desired status
68 * @param command description of the command that was run 68 * @param command description of the command that was run
69 * @param args arguments given to the command 69 * @param args arguments given to the command
70 * @return GNUNET_OK if the result is acceptable 70 * @return GNUNET_OK if the result is acceptable
71 */ 71 */
72#define GNUNET_POSTGRES_check_result(dbh,ret,expected_status,command,args) GNUNET_POSTGRES_check_result_(dbh,ret,expected_status,command,args,__FILE__,__LINE__) 72#define GNUNET_POSTGRES_check_result(dbh,ret,expected_status,command,args) GNUNET_POSTGRES_check_result_(dbh,ret,expected_status,command,args,__FILE__,__LINE__)
@@ -78,7 +78,7 @@ GNUNET_POSTGRES_check_result_ (PGconn *dbh, PGresult * ret, int expected_status,
78 * @param dbh database handle 78 * @param dbh database handle
79 * @param sql statement to run 79 * @param sql statement to run
80 * @param filename filename for error reporting 80 * @param filename filename for error reporting
81 * @param line code line for error reporting 81 * @param line code line for error reporting
82 * @return GNUNET_OK on success 82 * @return GNUNET_OK on success
83 */ 83 */
84int 84int
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 5380e0987..068fb2f81 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -23,7 +23,7 @@
23 * @brief constants for network protocols 23 * @brief constants for network protocols
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * @defgroup protocols Types of messages used in GNUnet 25 * @defgroup protocols Types of messages used in GNUnet
26 * @{ 26 * @{
27 */ 27 */
28 28
29/******************************************************************************* 29/*******************************************************************************
@@ -149,7 +149,7 @@ extern "C"
149 ******************************************************************************/ 149 ******************************************************************************/
150 150
151/** 151/**
152 * Type of data messages from the plugin to the gnunet-wlan-helper 152 * Type of data messages from the plugin to the gnunet-wlan-helper
153 */ 153 */
154#define GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER 39 154#define GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER 39
155 155
@@ -843,7 +843,7 @@ extern "C"
843#define GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY 266 843#define GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY 266
844 844
845/** 845/**
846 * Request the destruction of a whole tunnel 846 * Request the destruction of a whole tunnel
847 */ 847 */
848#define GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY 267 848#define GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY 267
849 849
@@ -1888,7 +1888,7 @@ extern "C"
1888 1888
1889/** 1889/**
1890 * Result in response to regex search. 1890 * Result in response to regex search.
1891 */ 1891 */
1892#define GNUNET_MESSAGE_TYPE_REGEX_RESULT 622 1892#define GNUNET_MESSAGE_TYPE_REGEX_RESULT 622
1893 1893
1894/******************************************************************************* 1894/*******************************************************************************
@@ -2187,7 +2187,7 @@ extern "C"
2187#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_BUSY 741 2187#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_BUSY 741
2188 2188
2189/** 2189/**
2190 * Mesh: audio data 2190 * Mesh: audio data
2191 */ 2191 */
2192#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO 742 2192#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO 742
2193 2193
diff --git a/src/include/gnunet_psyc_service.h b/src/include/gnunet_psyc_service.h
index 4addfa4d9..e9f935de7 100644
--- a/src/include/gnunet_psyc_service.h
+++ b/src/include/gnunet_psyc_service.h
@@ -18,7 +18,7 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/** 21/**
22 * @file include/gnunet_psyc_service.h 22 * @file include/gnunet_psyc_service.h
23 * @brief PSYC service; high-level access to the PSYC protocol 23 * @brief PSYC service; high-level access to the PSYC protocol
24 * note that clients of this API are NOT expected to 24 * note that clients of this API are NOT expected to
@@ -90,13 +90,13 @@ extern "C"
90#include "gnunet_multicast_service.h" 90#include "gnunet_multicast_service.h"
91 91
92 92
93/** 93/**
94 * Version number of GNUnet-PSYC API. 94 * Version number of GNUnet-PSYC API.
95 */ 95 */
96#define GNUNET_PSYC_VERSION 0x00000000 96#define GNUNET_PSYC_VERSION 0x00000000
97 97
98 98
99/** 99/**
100 * Policy flags for a channel. 100 * Policy flags for a channel.
101 */ 101 */
102enum GNUNET_PSYC_ChannelFlags 102enum GNUNET_PSYC_ChannelFlags
@@ -113,7 +113,7 @@ enum GNUNET_PSYC_ChannelFlags
113 GNUNET_PSYC_CHANNEL_RESTRICTED_HISTORY = 1 << 1, 113 GNUNET_PSYC_CHANNEL_RESTRICTED_HISTORY = 1 << 1,
114}; 114};
115 115
116/** 116/**
117 * PSYC channel policies. 117 * PSYC channel policies.
118 */ 118 */
119enum GNUNET_PSYC_Policy 119enum GNUNET_PSYC_Policy
@@ -125,7 +125,7 @@ enum GNUNET_PSYC_Policy
125 */ 125 */
126 GNUNET_PSYC_CHANNEL_ANONYMOUS = 0, 126 GNUNET_PSYC_CHANNEL_ANONYMOUS = 0,
127 127
128 /** 128 /**
129 * The master must approve membership to the channel, messages must only be 129 * The master must approve membership to the channel, messages must only be
130 * distributed to current channel slaves. This includes the channel 130 * distributed to current channel slaves. This includes the channel
131 * state as well as transient messages. 131 * state as well as transient messages.
@@ -135,7 +135,7 @@ enum GNUNET_PSYC_Policy
135 | GNUNET_PSYC_CHANNEL_RESTRICTED_HISTORY, 135 | GNUNET_PSYC_CHANNEL_RESTRICTED_HISTORY,
136 136
137#if IDEAS_FOR_FUTURE 137#if IDEAS_FOR_FUTURE
138 /** 138 /**
139 * Anyone can freely join the channel (no approval required); 139 * Anyone can freely join the channel (no approval required);
140 * however, messages must only be distributed to current channel 140 * however, messages must only be distributed to current channel
141 * slaves, so the master must still acknowledge that the slave 141 * slaves, so the master must still acknowledge that the slave
@@ -170,7 +170,7 @@ enum GNUNET_PSYC_MessageFlags
170 */ 170 */
171 GNUNET_PSYC_MESSAGE_LAST_FRAGMENT = 1 << 1, 171 GNUNET_PSYC_MESSAGE_LAST_FRAGMENT = 1 << 1,
172 172
173 /** 173 /**
174 * OR'ed flags if message is not fragmented. 174 * OR'ed flags if message is not fragmented.
175 */ 175 */
176 GNUNET_PSYC_MESSAGE_NOT_FRAGMENTED 176 GNUNET_PSYC_MESSAGE_NOT_FRAGMENTED
@@ -274,7 +274,7 @@ struct GNUNET_PSYC_MessageData
274 uint8_t status; 274 uint8_t status;
275}; 275};
276 276
277/** 277/**
278 * Handle that identifies a join request. 278 * Handle that identifies a join request.
279 * 279 *
280 * Used to match calls to #GNUNET_PSYC_JoinCallback to the 280 * Used to match calls to #GNUNET_PSYC_JoinCallback to the
@@ -283,7 +283,7 @@ struct GNUNET_PSYC_MessageData
283struct GNUNET_PSYC_JoinHandle; 283struct GNUNET_PSYC_JoinHandle;
284 284
285 285
286/** 286/**
287 * Method called from PSYC upon receiving a message indicating a call to a 287 * Method called from PSYC upon receiving a message indicating a call to a
288 * @e method. 288 * @e method.
289 * 289 *
@@ -316,7 +316,7 @@ typedef int
316 enum GNUNET_PSYC_MessageFlags flags); 316 enum GNUNET_PSYC_MessageFlags flags);
317 317
318 318
319/** 319/**
320 * Method called from PSYC upon receiving a join request. 320 * Method called from PSYC upon receiving a join request.
321 * 321 *
322 * @param cls Closure. 322 * @param cls Closure.
@@ -341,7 +341,7 @@ typedef int
341 struct GNUNET_PSYC_JoinHandle *jh); 341 struct GNUNET_PSYC_JoinHandle *jh);
342 342
343 343
344/** 344/**
345 * Function to call with the decision made for a join request. 345 * Function to call with the decision made for a join request.
346 * 346 *
347 * Must be called once and only once in response to an invocation of the 347 * Must be called once and only once in response to an invocation of the
@@ -375,13 +375,13 @@ GNUNET_PSYC_join_decision (struct GNUNET_PSYC_JoinHandle *jh,
375 size_t data_size); 375 size_t data_size);
376 376
377 377
378/** 378/**
379 * Handle for the master of a PSYC channel. 379 * Handle for the master of a PSYC channel.
380 */ 380 */
381struct GNUNET_PSYC_Master; 381struct GNUNET_PSYC_Master;
382 382
383 383
384/** 384/**
385 * Function called after the channel master started. 385 * Function called after the channel master started.
386 * 386 *
387 * @param cls Closure. 387 * @param cls Closure.
@@ -391,7 +391,7 @@ typedef void
391(*GNUNET_PSYC_MasterStartCallback) (void *cls, uint64_t max_message_id); 391(*GNUNET_PSYC_MasterStartCallback) (void *cls, uint64_t max_message_id);
392 392
393 393
394/** 394/**
395 * Start a PSYC master channel. 395 * Start a PSYC master channel.
396 * 396 *
397 * Will start a multicast group identified by the given ECC key. Messages 397 * Will start a multicast group identified by the given ECC key. Messages
@@ -429,7 +429,7 @@ GNUNET_PSYC_master_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
429 void *cls); 429 void *cls);
430 430
431 431
432/** 432/**
433 * Function called to provide data for a transmission via PSYC. 433 * Function called to provide data for a transmission via PSYC.
434 * 434 *
435 * Note that returning #GNUNET_OK or #GNUNET_SYSERR (but not #GNUNET_NO) 435 * Note that returning #GNUNET_OK or #GNUNET_SYSERR (but not #GNUNET_NO)
@@ -459,13 +459,13 @@ typedef int
459enum GNUNET_PSYC_MasterTransmitFlags 459enum GNUNET_PSYC_MasterTransmitFlags
460{ 460{
461 GNUNET_PSYC_MASTER_TRANSMIT_NONE = 0, 461 GNUNET_PSYC_MASTER_TRANSMIT_NONE = 0,
462 /** 462 /**
463 * Whether this message should reset the channel state, 463 * Whether this message should reset the channel state,
464 * i.e. remove all previously stored state variables. 464 * i.e. remove all previously stored state variables.
465 */ 465 */
466 GNUNET_PSYC_MASTER_TRANSMIT_RESET_STATE = 1 << 0, 466 GNUNET_PSYC_MASTER_TRANSMIT_RESET_STATE = 1 << 0,
467 467
468 /** 468 /**
469 * Whether we need to increment the group generation counter after 469 * Whether we need to increment the group generation counter after
470 * transmitting this message. 470 * transmitting this message.
471 */ 471 */
@@ -478,13 +478,13 @@ enum GNUNET_PSYC_MasterTransmitFlags
478}; 478};
479 479
480 480
481/** 481/**
482 * Handle for a pending PSYC transmission operation. 482 * Handle for a pending PSYC transmission operation.
483 */ 483 */
484struct GNUNET_PSYC_MasterTransmitHandle; 484struct GNUNET_PSYC_MasterTransmitHandle;
485 485
486 486
487/** 487/**
488 * Send a message to call a method to all members in the PSYC channel. 488 * Send a message to call a method to all members in the PSYC channel.
489 * 489 *
490 * @param master Handle to the PSYC channel. 490 * @param master Handle to the PSYC channel.
@@ -505,7 +505,7 @@ GNUNET_PSYC_master_transmit (struct GNUNET_PSYC_Master *master,
505 enum GNUNET_PSYC_MasterTransmitFlags flags); 505 enum GNUNET_PSYC_MasterTransmitFlags flags);
506 506
507 507
508/** 508/**
509 * Resume transmission to the channel. 509 * Resume transmission to the channel.
510 * 510 *
511 * @param th Handle of the request that is being resumed. 511 * @param th Handle of the request that is being resumed.
@@ -514,7 +514,7 @@ void
514GNUNET_PSYC_master_transmit_resume (struct GNUNET_PSYC_MasterTransmitHandle *th); 514GNUNET_PSYC_master_transmit_resume (struct GNUNET_PSYC_MasterTransmitHandle *th);
515 515
516 516
517/** 517/**
518 * Abort transmission request to channel. 518 * Abort transmission request to channel.
519 * 519 *
520 * @param th Handle of the request that is being aborted. 520 * @param th Handle of the request that is being aborted.
@@ -523,7 +523,7 @@ void
523GNUNET_PSYC_master_transmit_cancel (struct GNUNET_PSYC_MasterTransmitHandle *th); 523GNUNET_PSYC_master_transmit_cancel (struct GNUNET_PSYC_MasterTransmitHandle *th);
524 524
525 525
526/** 526/**
527 * Stop a PSYC master channel. 527 * Stop a PSYC master channel.
528 * 528 *
529 * @param master PSYC channel master to stop. 529 * @param master PSYC channel master to stop.
@@ -532,13 +532,13 @@ void
532GNUNET_PSYC_master_stop (struct GNUNET_PSYC_Master *master); 532GNUNET_PSYC_master_stop (struct GNUNET_PSYC_Master *master);
533 533
534 534
535/** 535/**
536 * Handle for a PSYC channel slave. 536 * Handle for a PSYC channel slave.
537 */ 537 */
538struct GNUNET_PSYC_Slave; 538struct GNUNET_PSYC_Slave;
539 539
540 540
541/** 541/**
542 * Function called after the slave joined. 542 * Function called after the slave joined.
543 * 543 *
544 * @param cls Closure. 544 * @param cls Closure.
@@ -548,7 +548,7 @@ typedef void
548(*GNUNET_PSYC_SlaveJoinCallback) (void *cls, uint64_t max_message_id); 548(*GNUNET_PSYC_SlaveJoinCallback) (void *cls, uint64_t max_message_id);
549 549
550 550
551/** 551/**
552 * Join a PSYC channel. 552 * Join a PSYC channel.
553 * 553 *
554 * The entity joining is always the local peer. The user must immediately use 554 * The entity joining is always the local peer. The user must immediately use
@@ -594,7 +594,7 @@ GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
594 size_t data_size); 594 size_t data_size);
595 595
596 596
597/** 597/**
598 * Part a PSYC channel. 598 * Part a PSYC channel.
599 * 599 *
600 * Will terminate the connection to the PSYC service. Polite clients should 600 * Will terminate the connection to the PSYC service. Polite clients should
@@ -606,7 +606,7 @@ void
606GNUNET_PSYC_slave_part (struct GNUNET_PSYC_Slave *slave); 606GNUNET_PSYC_slave_part (struct GNUNET_PSYC_Slave *slave);
607 607
608 608
609/** 609/**
610 * Function called to provide data for a transmission to the channel master 610 * Function called to provide data for a transmission to the channel master
611 * (a.k.a. the @e host of the channel). 611 * (a.k.a. the @e host of the channel).
612 * 612 *
@@ -638,13 +638,13 @@ enum GNUNET_PSYC_SlaveTransmitFlags
638}; 638};
639 639
640 640
641/** 641/**
642 * Handle for a pending PSYC transmission operation. 642 * Handle for a pending PSYC transmission operation.
643 */ 643 */
644struct GNUNET_PSYC_SlaveTransmitHandle; 644struct GNUNET_PSYC_SlaveTransmitHandle;
645 645
646 646
647/** 647/**
648 * Request a message to be sent to the channel master. 648 * Request a message to be sent to the channel master.
649 * 649 *
650 * @param slave Slave handle. 650 * @param slave Slave handle.
@@ -664,7 +664,7 @@ GNUNET_PSYC_slave_transmit (struct GNUNET_PSYC_Slave *slave,
664 enum GNUNET_PSYC_SlaveTransmitFlags flags); 664 enum GNUNET_PSYC_SlaveTransmitFlags flags);
665 665
666 666
667/** 667/**
668 * Resume transmission to the master. 668 * Resume transmission to the master.
669 * 669 *
670 * @param th Handle of the request that is being resumed. 670 * @param th Handle of the request that is being resumed.
@@ -673,7 +673,7 @@ void
673GNUNET_PSYC_slave_transmit_resume (struct GNUNET_PSYC_MasterTransmitHandle *th); 673GNUNET_PSYC_slave_transmit_resume (struct GNUNET_PSYC_MasterTransmitHandle *th);
674 674
675 675
676/** 676/**
677 * Abort transmission request to master. 677 * Abort transmission request to master.
678 * 678 *
679 * @param th Handle of the request that is being aborted. 679 * @param th Handle of the request that is being aborted.
@@ -682,13 +682,13 @@ void
682GNUNET_PSYC_slave_transmit_cancel (struct GNUNET_PSYC_SlaveTransmitHandle *th); 682GNUNET_PSYC_slave_transmit_cancel (struct GNUNET_PSYC_SlaveTransmitHandle *th);
683 683
684 684
685/** 685/**
686 * Handle to access PSYC channel operations for both the master and slaves. 686 * Handle to access PSYC channel operations for both the master and slaves.
687 */ 687 */
688struct GNUNET_PSYC_Channel; 688struct GNUNET_PSYC_Channel;
689 689
690 690
691/** 691/**
692 * Convert a channel @a master to a @e channel handle to access the @e channel 692 * Convert a channel @a master to a @e channel handle to access the @e channel
693 * APIs. 693 * APIs.
694 * 694 *
@@ -699,7 +699,7 @@ struct GNUNET_PSYC_Channel *
699GNUNET_PSYC_master_get_channel (struct GNUNET_PSYC_Master *master); 699GNUNET_PSYC_master_get_channel (struct GNUNET_PSYC_Master *master);
700 700
701 701
702/** 702/**
703 * Convert @a slave to a @e channel handle to access the @e channel APIs. 703 * Convert @a slave to a @e channel handle to access the @e channel APIs.
704 * 704 *
705 * @param slave Slave handle. 705 * @param slave Slave handle.
@@ -709,7 +709,7 @@ struct GNUNET_PSYC_Channel *
709GNUNET_PSYC_slave_get_channel (struct GNUNET_PSYC_Slave *slave); 709GNUNET_PSYC_slave_get_channel (struct GNUNET_PSYC_Slave *slave);
710 710
711 711
712/** 712/**
713 * Add a slave to the channel's membership list. 713 * Add a slave to the channel's membership list.
714 * 714 *
715 * Note that this will NOT generate any PSYC traffic, it will merely update the 715 * Note that this will NOT generate any PSYC traffic, it will merely update the
@@ -738,7 +738,7 @@ GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *channel,
738 uint64_t effective_since); 738 uint64_t effective_since);
739 739
740 740
741/** 741/**
742 * Remove a slave from the channel's membership list. 742 * Remove a slave from the channel's membership list.
743 * 743 *
744 * Note that this will NOT generate any PSYC traffic, it will merely update the 744 * Note that this will NOT generate any PSYC traffic, it will merely update the
@@ -766,7 +766,7 @@ GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *channel,
766 uint64_t announced_at); 766 uint64_t announced_at);
767 767
768 768
769/** 769/**
770 * Function called to inform a member about stored state values for a channel. 770 * Function called to inform a member about stored state values for a channel.
771 * 771 *
772 * @param cls Closure. 772 * @param cls Closure.
@@ -791,13 +791,13 @@ typedef void
791(*GNUNET_PSYC_FinishCallback) (void *cls); 791(*GNUNET_PSYC_FinishCallback) (void *cls);
792 792
793 793
794/** 794/**
795 * Handle to a story telling operation. 795 * Handle to a story telling operation.
796 */ 796 */
797struct GNUNET_PSYC_Story; 797struct GNUNET_PSYC_Story;
798 798
799 799
800/** 800/**
801 * Request to be told the message history of the channel. 801 * Request to be told the message history of the channel.
802 * 802 *
803 * Historic messages (but NOT the state at the time) will be replayed (given to 803 * Historic messages (but NOT the state at the time) will be replayed (given to
@@ -827,7 +827,7 @@ GNUNET_PSYC_channel_story_tell (struct GNUNET_PSYC_Channel *channel,
827 void *cls); 827 void *cls);
828 828
829 829
830/** 830/**
831 * Abort story telling. 831 * Abort story telling.
832 * 832 *
833 * This function must not be called from within method handlers (as given to 833 * This function must not be called from within method handlers (as given to
@@ -845,7 +845,7 @@ GNUNET_PSYC_channel_story_tell_cancel (struct GNUNET_PSYC_Story *story);
845struct GNUNET_PSYC_StateQuery; 845struct GNUNET_PSYC_StateQuery;
846 846
847 847
848/** 848/**
849 * Retrieve the best matching channel state variable. 849 * Retrieve the best matching channel state variable.
850 * 850 *
851 * If the requested variable name is not present in the state, the nearest 851 * If the requested variable name is not present in the state, the nearest
@@ -867,7 +867,7 @@ GNUNET_PSYC_channel_state_get (struct GNUNET_PSYC_Channel *channel,
867 void *cb_cls); 867 void *cb_cls);
868 868
869 869
870/** 870/**
871 * Return all channel state variables whose name matches a given prefix. 871 * Return all channel state variables whose name matches a given prefix.
872 * 872 *
873 * A name matches if it starts with the given @a name_prefix, thus requesting 873 * A name matches if it starts with the given @a name_prefix, thus requesting
@@ -890,7 +890,7 @@ GNUNET_PSYC_channel_state_get_prefix (struct GNUNET_PSYC_Channel *channel,
890 void *cb_cls); 890 void *cb_cls);
891 891
892 892
893/** 893/**
894 * Cancel a state query operation. 894 * Cancel a state query operation.
895 * 895 *
896 * @param query Handle for the operation to cancel. 896 * @param query Handle for the operation to cancel.
diff --git a/src/include/gnunet_psycstore_plugin.h b/src/include/gnunet_psycstore_plugin.h
index 5d5014fb3..8f8668043 100644
--- a/src/include/gnunet_psycstore_plugin.h
+++ b/src/include/gnunet_psycstore_plugin.h
@@ -49,7 +49,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
49 */ 49 */
50 void *cls; 50 void *cls;
51 51
52 /** 52 /**
53 * Store join/leave events for a PSYC channel in order to be able to answer 53 * Store join/leave events for a PSYC channel in order to be able to answer
54 * membership test queries later. 54 * membership test queries later.
55 * 55 *
@@ -66,7 +66,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
66 uint64_t effective_since, 66 uint64_t effective_since,
67 uint64_t group_generation); 67 uint64_t group_generation);
68 68
69 /** 69 /**
70 * Test if a member was admitted to the channel at the given message ID. 70 * Test if a member was admitted to the channel at the given message ID.
71 * 71 *
72 * @see GNUNET_PSYCSTORE_membership_test() 72 * @see GNUNET_PSYCSTORE_membership_test()
@@ -80,7 +80,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
80 const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key, 80 const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key,
81 uint64_t message_id); 81 uint64_t message_id);
82 82
83 /** 83 /**
84 * Store a message fragment sent to a channel. 84 * Store a message fragment sent to a channel.
85 * 85 *
86 * @see GNUNET_PSYCSTORE_fragment_store() 86 * @see GNUNET_PSYCSTORE_fragment_store()
@@ -93,7 +93,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
93 const struct GNUNET_MULTICAST_MessageHeader *message, 93 const struct GNUNET_MULTICAST_MessageHeader *message,
94 uint32_t psycstore_flags); 94 uint32_t psycstore_flags);
95 95
96 /** 96 /**
97 * Set additional flags for a given message. 97 * Set additional flags for a given message.
98 * 98 *
99 * They are OR'd with any existing flags set. 99 * They are OR'd with any existing flags set.
@@ -111,7 +111,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
111 uint64_t message_id, 111 uint64_t message_id,
112 uint64_t psycstore_flags); 112 uint64_t psycstore_flags);
113 113
114 /** 114 /**
115 * Retrieve a message fragment by fragment ID. 115 * Retrieve a message fragment by fragment ID.
116 * 116 *
117 * @see GNUNET_PSYCSTORE_fragment_get() 117 * @see GNUNET_PSYCSTORE_fragment_get()
@@ -125,7 +125,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
125 GNUNET_PSYCSTORE_FragmentCallback cb, 125 GNUNET_PSYCSTORE_FragmentCallback cb,
126 void *cb_cls); 126 void *cb_cls);
127 127
128 /** 128 /**
129 * Retrieve all fragments of a message. 129 * Retrieve all fragments of a message.
130 * 130 *
131 * @see GNUNET_PSYCSTORE_message_get() 131 * @see GNUNET_PSYCSTORE_message_get()
@@ -140,7 +140,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
140 GNUNET_PSYCSTORE_FragmentCallback cb, 140 GNUNET_PSYCSTORE_FragmentCallback cb,
141 void *cb_cls); 141 void *cb_cls);
142 142
143 /** 143 /**
144 * Retrieve a fragment of message specified by its message ID and fragment 144 * Retrieve a fragment of message specified by its message ID and fragment
145 * offset. 145 * offset.
146 * 146 *
@@ -156,7 +156,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
156 GNUNET_PSYCSTORE_FragmentCallback cb, 156 GNUNET_PSYCSTORE_FragmentCallback cb,
157 void *cb_cls); 157 void *cb_cls);
158 158
159 /** 159 /**
160 * Retrieve the max. values of message counters for a channel. 160 * Retrieve the max. values of message counters for a channel.
161 * 161 *
162 * @see GNUNET_PSYCSTORE_counters_get() 162 * @see GNUNET_PSYCSTORE_counters_get()
@@ -170,7 +170,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
170 uint64_t *max_message_id, 170 uint64_t *max_message_id,
171 uint64_t *max_group_generation); 171 uint64_t *max_group_generation);
172 172
173 /** 173 /**
174 * Retrieve the max. values of state counters for a channel. 174 * Retrieve the max. values of state counters for a channel.
175 * 175 *
176 * @see GNUNET_PSYCSTORE_counters_get() 176 * @see GNUNET_PSYCSTORE_counters_get()
@@ -183,7 +183,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
183 uint64_t *max_state_message_id); 183 uint64_t *max_state_message_id);
184 184
185 185
186 /** 186 /**
187 * Begin modifying current state. 187 * Begin modifying current state.
188 * 188 *
189 * @see GNUNET_PSYCSTORE_state_modify() 189 * @see GNUNET_PSYCSTORE_state_modify()
@@ -195,7 +195,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
195 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, 195 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
196 uint64_t message_id, uint64_t state_delta); 196 uint64_t message_id, uint64_t state_delta);
197 197
198 /** 198 /**
199 * Set the current value of a state variable. 199 * Set the current value of a state variable.
200 * 200 *
201 * The state modification process is started with state_modify_begin(), 201 * The state modification process is started with state_modify_begin(),
@@ -212,7 +212,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
212 const char *name, const void *value, size_t value_size); 212 const char *name, const void *value, size_t value_size);
213 213
214 214
215 /** 215 /**
216 * End modifying current state. 216 * End modifying current state.
217 * 217 *
218 * @see GNUNET_PSYCSTORE_state_modify() 218 * @see GNUNET_PSYCSTORE_state_modify()
@@ -225,7 +225,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
225 uint64_t message_id); 225 uint64_t message_id);
226 226
227 227
228 /** 228 /**
229 * Begin synchronizing state. 229 * Begin synchronizing state.
230 * 230 *
231 * @see GNUNET_PSYCSTORE_state_sync() 231 * @see GNUNET_PSYCSTORE_state_sync()
@@ -236,7 +236,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
236 (*state_sync_begin) (void *cls, 236 (*state_sync_begin) (void *cls,
237 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key); 237 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key);
238 238
239 /** 239 /**
240 * Set the value of a state variable while synchronizing state. 240 * Set the value of a state variable while synchronizing state.
241 * 241 *
242 * The state synchronization process is started with state_sync_begin(), 242 * The state synchronization process is started with state_sync_begin(),
@@ -253,7 +253,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
253 const char *name, const void *value, size_t value_size); 253 const char *name, const void *value, size_t value_size);
254 254
255 255
256 /** 256 /**
257 * End synchronizing state. 257 * End synchronizing state.
258 * 258 *
259 * @see GNUNET_PSYCSTORE_state_sync() 259 * @see GNUNET_PSYCSTORE_state_sync()
@@ -266,7 +266,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
266 uint64_t message_id); 266 uint64_t message_id);
267 267
268 268
269 /** 269 /**
270 * Reset the state of a channel. 270 * Reset the state of a channel.
271 * 271 *
272 * Delete all state variables stored for the given channel. 272 * Delete all state variables stored for the given channel.
@@ -289,7 +289,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
289 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key); 289 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key);
290 290
291 291
292 /** 292 /**
293 * Retrieve a state variable by name (exact match). 293 * Retrieve a state variable by name (exact match).
294 * 294 *
295 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 295 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
@@ -301,7 +301,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
301 GNUNET_PSYCSTORE_StateCallback cb, 301 GNUNET_PSYCSTORE_StateCallback cb,
302 void *cb_cls); 302 void *cb_cls);
303 303
304 /** 304 /**
305 * Retrieve all state variables for a channel with the given prefix. 305 * Retrieve all state variables for a channel with the given prefix.
306 * 306 *
307 * @see GNUNET_PSYCSTORE_state_get_prefix() 307 * @see GNUNET_PSYCSTORE_state_get_prefix()
@@ -316,7 +316,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
316 void *cb_cls); 316 void *cb_cls);
317 317
318 318
319 /** 319 /**
320 * Retrieve all signed state variables for a channel. 320 * Retrieve all signed state variables for a channel.
321 * 321 *
322 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 322 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
diff --git a/src/include/gnunet_psycstore_service.h b/src/include/gnunet_psycstore_service.h
index 8032223c8..25d4339a3 100644
--- a/src/include/gnunet_psycstore_service.h
+++ b/src/include/gnunet_psycstore_service.h
@@ -18,7 +18,7 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/** 21/**
22 * @file include/gnunet_psycstore_service.h 22 * @file include/gnunet_psycstore_service.h
23 * @brief PSYCstore service; implements persistent storage for the PSYC service 23 * @brief PSYCstore service; implements persistent storage for the PSYC service
24 * @author Gabor X Toth 24 * @author Gabor X Toth
@@ -40,7 +40,7 @@ extern "C"
40#include "gnunet_multicast_service.h" 40#include "gnunet_multicast_service.h"
41#include "gnunet_psyc_service.h" 41#include "gnunet_psyc_service.h"
42 42
43/** 43/**
44 * Version number of GNUnet PSYCstore API. 44 * Version number of GNUnet PSYCstore API.
45 */ 45 */
46#define GNUNET_PSYCSTORE_VERSION 0x00000000 46#define GNUNET_PSYCSTORE_VERSION 0x00000000
@@ -67,13 +67,13 @@ enum GNUNET_PSYCSTORE_MessageFlags
67}; 67};
68 68
69 69
70/** 70/**
71 * Handle for a PSYCstore 71 * Handle for a PSYCstore
72 */ 72 */
73struct GNUNET_PSYCSTORE_Handle; 73struct GNUNET_PSYCSTORE_Handle;
74 74
75 75
76/** 76/**
77 * Connect to the PSYCstore service. 77 * Connect to the PSYCstore service.
78 * 78 *
79 * @param cfg Configuration to use. 79 * @param cfg Configuration to use.
@@ -84,7 +84,7 @@ struct GNUNET_PSYCSTORE_Handle *
84GNUNET_PSYCSTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); 84GNUNET_PSYCSTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
85 85
86 86
87/** 87/**
88 * Disconnect from the PSYCstore service. 88 * Disconnect from the PSYCstore service.
89 * 89 *
90 * @param h Handle for the connection. 90 * @param h Handle for the connection.
@@ -93,15 +93,15 @@ void
93GNUNET_PSYCSTORE_disconnect (struct GNUNET_PSYCSTORE_Handle *h); 93GNUNET_PSYCSTORE_disconnect (struct GNUNET_PSYCSTORE_Handle *h);
94 94
95 95
96/** 96/**
97 * Handle for an operation on the PSYCSTORE (useful to cancel the operation). 97 * Handle for an operation on the PSYCSTORE (useful to cancel the operation).
98 */ 98 */
99struct GNUNET_PSYCSTORE_OperationHandle; 99struct GNUNET_PSYCSTORE_OperationHandle;
100 100
101 101
102/** 102/**
103 * Function called with the result of an asynchronous operation. 103 * Function called with the result of an asynchronous operation.
104 * 104 *
105 * @param result #GNUNET_SYSERR on error, 105 * @param result #GNUNET_SYSERR on error,
106 * #GNUNET_YES on success or if the peer was a member, 106 * #GNUNET_YES on success or if the peer was a member,
107 * #GNUNET_NO if the peer was not a member 107 * #GNUNET_NO if the peer was not a member
@@ -112,7 +112,7 @@ typedef void
112 const char *err_msg); 112 const char *err_msg);
113 113
114 114
115/** 115/**
116 * Store join/leave events for a PSYC channel in order to be able to answer 116 * Store join/leave events for a PSYC channel in order to be able to answer
117 * membership test queries later. 117 * membership test queries later.
118 * 118 *
@@ -143,7 +143,7 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h,
143 void *rcb_cls); 143 void *rcb_cls);
144 144
145 145
146/** 146/**
147 * Test if a member was admitted to the channel at the given message ID. 147 * Test if a member was admitted to the channel at the given message ID.
148 * 148 *
149 * This is useful when relaying and replaying messages to check if a particular 149 * This is useful when relaying and replaying messages to check if a particular
@@ -173,7 +173,7 @@ GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h,
173 void *rcb_cls); 173 void *rcb_cls);
174 174
175 175
176/** 176/**
177 * Store a message fragment sent to a channel. 177 * Store a message fragment sent to a channel.
178 * 178 *
179 * @param h Handle for the PSYCstore. 179 * @param h Handle for the PSYCstore.
@@ -183,7 +183,7 @@ GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h,
183 * state modifiers. 183 * state modifiers.
184 * @param rcb Callback to call with the result of the operation. 184 * @param rcb Callback to call with the result of the operation.
185 * @param rcb_cls Closure for the callback. 185 * @param rcb_cls Closure for the callback.
186 * 186 *
187 * @return Handle that can be used to cancel the operation. 187 * @return Handle that can be used to cancel the operation.
188 */ 188 */
189struct GNUNET_PSYCSTORE_OperationHandle * 189struct GNUNET_PSYCSTORE_OperationHandle *
@@ -195,7 +195,7 @@ GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h,
195 void *rcb_cls); 195 void *rcb_cls);
196 196
197 197
198/** 198/**
199 * Function called with one message fragment, as the result of a 199 * Function called with one message fragment, as the result of a
200 * GNUNET_PSYCSTORE_fragment_get() or GNUNET_PSYCSTORE_message_get() call. 200 * GNUNET_PSYCSTORE_fragment_get() or GNUNET_PSYCSTORE_message_get() call.
201 * 201 *
@@ -213,7 +213,7 @@ typedef int
213 enum GNUNET_PSYCSTORE_MessageFlags psycstore_flags); 213 enum GNUNET_PSYCSTORE_MessageFlags psycstore_flags);
214 214
215 215
216/** 216/**
217 * Retrieve a message fragment by fragment ID. 217 * Retrieve a message fragment by fragment ID.
218 * 218 *
219 * @param h Handle for the PSYCstore. 219 * @param h Handle for the PSYCstore.
@@ -222,7 +222,7 @@ typedef int
222 * @param fcb Callback to call with the retrieved fragment. 222 * @param fcb Callback to call with the retrieved fragment.
223 * @param rcb Callback to call with the result of the operation. 223 * @param rcb Callback to call with the result of the operation.
224 * @param cls Closure for the callbacks. 224 * @param cls Closure for the callbacks.
225 * 225 *
226 * @return Handle that can be used to cancel the operation. 226 * @return Handle that can be used to cancel the operation.
227 */ 227 */
228struct GNUNET_PSYCSTORE_OperationHandle * 228struct GNUNET_PSYCSTORE_OperationHandle *
@@ -234,7 +234,7 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h,
234 void *cls); 234 void *cls);
235 235
236 236
237/** 237/**
238 * Retrieve all fragments of a message. 238 * Retrieve all fragments of a message.
239 * 239 *
240 * @param h Handle for the PSYCstore. 240 * @param h Handle for the PSYCstore.
@@ -243,7 +243,7 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h,
243 * @param fcb Callback to call with the retrieved fragments. 243 * @param fcb Callback to call with the retrieved fragments.
244 * @param rcb Callback to call with the result of the operation. 244 * @param rcb Callback to call with the result of the operation.
245 * @param cls Closure for the callbacks. 245 * @param cls Closure for the callbacks.
246 * 246 *
247 * @return Handle that can be used to cancel the operation. 247 * @return Handle that can be used to cancel the operation.
248 */ 248 */
249struct GNUNET_PSYCSTORE_OperationHandle * 249struct GNUNET_PSYCSTORE_OperationHandle *
@@ -255,7 +255,7 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
255 void *cls); 255 void *cls);
256 256
257 257
258/** 258/**
259 * Retrieve a fragment of message specified by its message ID and fragment 259 * Retrieve a fragment of message specified by its message ID and fragment
260 * offset. 260 * offset.
261 * 261 *
@@ -266,7 +266,7 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
266 * @param fcb Callback to call with the retrieved fragments. 266 * @param fcb Callback to call with the retrieved fragments.
267 * @param rcb Callback to call with the result of the operation. 267 * @param rcb Callback to call with the result of the operation.
268 * @param cls Closure for the callbacks. 268 * @param cls Closure for the callbacks.
269 * 269 *
270 * @return Handle that can be used to cancel the operation. 270 * @return Handle that can be used to cancel the operation.
271 */ 271 */
272struct GNUNET_PSYCSTORE_OperationHandle * 272struct GNUNET_PSYCSTORE_OperationHandle *
@@ -279,7 +279,7 @@ GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h,
279 void *cls); 279 void *cls);
280 280
281 281
282/** 282/**
283 * Callback used to return the latest value of counters for the channel master. 283 * Callback used to return the latest value of counters for the channel master.
284 * 284 *
285 * @see GNUNET_PSYCSTORE_counters_get() 285 * @see GNUNET_PSYCSTORE_counters_get()
@@ -299,7 +299,7 @@ typedef void
299 uint64_t max_state_message_id); 299 uint64_t max_state_message_id);
300 300
301 301
302/** 302/**
303 * Retrieve latest values of counters for a channel. 303 * Retrieve latest values of counters for a channel.
304 * 304 *
305 * The current value of counters are needed 305 * The current value of counters are needed
@@ -311,7 +311,7 @@ typedef void
311 * @param channel_key Public key that identifies the channel. 311 * @param channel_key Public key that identifies the channel.
312 * @param ccb Callback to call with the result. 312 * @param ccb Callback to call with the result.
313 * @param ccb_cls Closure for the callback. 313 * @param ccb_cls Closure for the callback.
314 * 314 *
315 * @return Handle that can be used to cancel the operation. 315 * @return Handle that can be used to cancel the operation.
316 */ 316 */
317struct GNUNET_PSYCSTORE_OperationHandle * 317struct GNUNET_PSYCSTORE_OperationHandle *
@@ -321,7 +321,7 @@ GNUNET_PSYCSTORE_counters_get (struct GNUNET_PSYCSTORE_Handle *h,
321 void *ccb_cls); 321 void *ccb_cls);
322 322
323 323
324/** 324/**
325 * Apply modifiers of a message to the current channel state. 325 * Apply modifiers of a message to the current channel state.
326 * 326 *
327 * An error is returned if there are missing messages containing state 327 * An error is returned if there are missing messages containing state
@@ -335,7 +335,7 @@ GNUNET_PSYCSTORE_counters_get (struct GNUNET_PSYCSTORE_Handle *h,
335 * @param modifiers List of modifiers to apply. 335 * @param modifiers List of modifiers to apply.
336 * @param rcb Callback to call with the result of the operation. 336 * @param rcb Callback to call with the result of the operation.
337 * @param rcb_cls Closure for the callback. 337 * @param rcb_cls Closure for the callback.
338 * 338 *
339 * @return Handle that can be used to cancel the operation. 339 * @return Handle that can be used to cancel the operation.
340 */ 340 */
341struct GNUNET_PSYCSTORE_OperationHandle * 341struct GNUNET_PSYCSTORE_OperationHandle *
@@ -349,7 +349,7 @@ GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h,
349 void *rcb_cls); 349 void *rcb_cls);
350 350
351 351
352/** 352/**
353 * Store synchronized state. 353 * Store synchronized state.
354 * 354 *
355 * @param h Handle for the PSYCstore. 355 * @param h Handle for the PSYCstore.
@@ -359,7 +359,7 @@ GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h,
359 * @param modifiers Full state to store. 359 * @param modifiers Full state to store.
360 * @param rcb Callback to call with the result of the operation. 360 * @param rcb Callback to call with the result of the operation.
361 * @param rcb_cls Closure for the callback. 361 * @param rcb_cls Closure for the callback.
362 * 362 *
363 * @return Handle that can be used to cancel the operation. 363 * @return Handle that can be used to cancel the operation.
364 */ 364 */
365struct GNUNET_PSYCSTORE_OperationHandle * 365struct GNUNET_PSYCSTORE_OperationHandle *
@@ -373,7 +373,7 @@ GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h,
373 373
374 374
375 375
376/** 376/**
377 * Reset the state of a channel. 377 * Reset the state of a channel.
378 * 378 *
379 * Delete all state variables stored for the given channel. 379 * Delete all state variables stored for the given channel.
@@ -382,7 +382,7 @@ GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h,
382 * @param channel_key The channel we are interested in. 382 * @param channel_key The channel we are interested in.
383 * @param rcb Callback to call with the result of the operation. 383 * @param rcb Callback to call with the result of the operation.
384 * @param rcb_cls Closure for the callback. 384 * @param rcb_cls Closure for the callback.
385 * 385 *
386 * @return Handle that can be used to cancel the operation. 386 * @return Handle that can be used to cancel the operation.
387 */ 387 */
388struct GNUNET_PSYCSTORE_OperationHandle * 388struct GNUNET_PSYCSTORE_OperationHandle *
@@ -393,7 +393,7 @@ GNUNET_PSYCSTORE_state_reset (struct GNUNET_PSYCSTORE_Handle *h,
393 void *rcb_cls); 393 void *rcb_cls);
394 394
395 395
396/** 396/**
397 * Update signed values of state variables in the state store. 397 * Update signed values of state variables in the state store.
398 * 398 *
399 * @param h Handle for the PSYCstore. 399 * @param h Handle for the PSYCstore.
@@ -413,7 +413,7 @@ GNUNET_PSYCSTORE_state_hash_update (struct GNUNET_PSYCSTORE_Handle *h,
413 void *rcb_cls); 413 void *rcb_cls);
414 414
415 415
416/** 416/**
417 * Function called with the value of a state variable. 417 * Function called with the value of a state variable.
418 * 418 *
419 * @param cls Closure. 419 * @param cls Closure.
@@ -430,7 +430,7 @@ typedef int
430 const void *value, size_t value_size); 430 const void *value, size_t value_size);
431 431
432 432
433/** 433/**
434 * Retrieve the best matching state variable. 434 * Retrieve the best matching state variable.
435 * 435 *
436 * @param h Handle for the PSYCstore. 436 * @param h Handle for the PSYCstore.
@@ -439,7 +439,7 @@ typedef int
439 * @param scb Callback to return the matching state variable. 439 * @param scb Callback to return the matching state variable.
440 * @param rcb Callback to call with the result of the operation. 440 * @param rcb Callback to call with the result of the operation.
441 * @param cls Closure for the callbacks. 441 * @param cls Closure for the callbacks.
442 * 442 *
443 * @return Handle that can be used to cancel the operation. 443 * @return Handle that can be used to cancel the operation.
444 */ 444 */
445struct GNUNET_PSYCSTORE_OperationHandle * 445struct GNUNET_PSYCSTORE_OperationHandle *
@@ -451,7 +451,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h,
451 void *cls); 451 void *cls);
452 452
453 453
454/** 454/**
455 * Retrieve all state variables for a channel with the given prefix. 455 * Retrieve all state variables for a channel with the given prefix.
456 * 456 *
457 * @param h Handle for the PSYCstore. 457 * @param h Handle for the PSYCstore.
@@ -460,7 +460,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h,
460 * @param scb Callback to return matching state variables. 460 * @param scb Callback to return matching state variables.
461 * @param rcb Callback to call with the result of the operation. 461 * @param rcb Callback to call with the result of the operation.
462 * @param cls Closure for the callbacks. 462 * @param cls Closure for the callbacks.
463 * 463 *
464 * @return Handle that can be used to cancel the operation. 464 * @return Handle that can be used to cancel the operation.
465 */ 465 */
466struct GNUNET_PSYCSTORE_OperationHandle * 466struct GNUNET_PSYCSTORE_OperationHandle *
@@ -472,7 +472,7 @@ GNUNET_PSYCSTORE_state_get_prefix (struct GNUNET_PSYCSTORE_Handle *h,
472 void *cls); 472 void *cls);
473 473
474 474
475/** 475/**
476 * Cancel an operation. 476 * Cancel an operation.
477 * 477 *
478 * @param op Handle for the operation to cancel. 478 * @param op Handle for the operation to cancel.
diff --git a/src/include/gnunet_regex_service.h b/src/include/gnunet_regex_service.h
index a3652be50..cd46979cb 100644
--- a/src/include/gnunet_regex_service.h
+++ b/src/include/gnunet_regex_service.h
@@ -59,7 +59,7 @@ struct GNUNET_REGEX_Search;
59 * Announce this peer under the given regular expression. Does 59 * Announce this peer under the given regular expression. Does
60 * not free resources, must call #GNUNET_REGEX_announce_cancel for 60 * not free resources, must call #GNUNET_REGEX_announce_cancel for
61 * that. 61 * that.
62 * 62 *
63 * @param cfg configuration to use 63 * @param cfg configuration to use
64 * @param regex Regular expression to announce. 64 * @param regex Regular expression to announce.
65 * @param refresh_delay after what delay should the announcement be repeated? 65 * @param refresh_delay after what delay should the announcement be repeated?
@@ -76,7 +76,7 @@ GNUNET_REGEX_announce (const struct GNUNET_CONFIGURATION_Handle *cfg,
76 76
77/** 77/**
78 * Stop announcing the regex specified by the given handle. 78 * Stop announcing the regex specified by the given handle.
79 * 79 *
80 * @param a handle returned by a previous #GNUNET_REGEX_announce call. 80 * @param a handle returned by a previous #GNUNET_REGEX_announce call.
81 */ 81 */
82void 82void
@@ -122,7 +122,7 @@ GNUNET_REGEX_search (const struct GNUNET_CONFIGURATION_Handle *cfg,
122 122
123/** 123/**
124 * Stop search and free all data used by a #GNUNET_REGEX_search call. 124 * Stop search and free all data used by a #GNUNET_REGEX_search call.
125 * 125 *
126 * @param s Handle returned by a previous #GNUNET_REGEX_search call. 126 * @param s Handle returned by a previous #GNUNET_REGEX_search call.
127 */ 127 */
128void 128void
diff --git a/src/include/gnunet_resolver_service.h b/src/include/gnunet_resolver_service.h
index 31fd178ca..0a51e41ca 100644
--- a/src/include/gnunet_resolver_service.h
+++ b/src/include/gnunet_resolver_service.h
@@ -132,7 +132,7 @@ GNUNET_RESOLVER_local_fqdn_get (void);
132 * Perform a reverse DNS lookup. 132 * Perform a reverse DNS lookup.
133 * 133 *
134 * @param sa host address 134 * @param sa host address
135 * @param salen length of @a sa 135 * @param salen length of @a sa
136 * @param do_resolve use #GNUNET_NO to return numeric hostname 136 * @param do_resolve use #GNUNET_NO to return numeric hostname
137 * @param timeout how long to try resolving 137 * @param timeout how long to try resolving
138 * @param callback function to call with hostnames 138 * @param callback function to call with hostnames
diff --git a/src/include/gnunet_revocation_service.h b/src/include/gnunet_revocation_service.h
index 7758ec97e..8809f9ece 100644
--- a/src/include/gnunet_revocation_service.h
+++ b/src/include/gnunet_revocation_service.h
@@ -53,7 +53,7 @@ struct GNUNET_REVOCATION_Query;
53 * Callback to call with the result of a key revocation query. 53 * Callback to call with the result of a key revocation query.
54 * 54 *
55 * @param cls closure 55 * @param cls closure
56 * @param is_valid #GNUNET_NO of the key is/was revoked, 56 * @param is_valid #GNUNET_NO of the key is/was revoked,
57 * #GNUNET_YES if the key is still valid, 57 * #GNUNET_YES if the key is still valid,
58 * #GNUNET_SYSERR if we had trouble querying the service 58 * #GNUNET_SYSERR if we had trouble querying the service
59 * 59 *
diff --git a/src/include/gnunet_scalarproduct_service.h b/src/include/gnunet_scalarproduct_service.h
index a398a3198..5f09f6a8a 100644
--- a/src/include/gnunet_scalarproduct_service.h
+++ b/src/include/gnunet_scalarproduct_service.h
@@ -66,7 +66,7 @@ typedef void (*GNUNET_SCALARPRODUCT_ContinuationWithStatus) (void *cls,
66 enum GNUNET_SCALARPRODUCT_ResponseStatus status); 66 enum GNUNET_SCALARPRODUCT_ResponseStatus status);
67/** 67/**
68 * Process a datum that was stored in the scalarproduct. 68 * Process a datum that was stored in the scalarproduct.
69 * 69 *
70 * @param cls closure 70 * @param cls closure
71 * @param status Status of the request 71 * @param status Status of the request
72 * @param type result of the computation 72 * @param type result of the computation
@@ -77,7 +77,7 @@ typedef void (*GNUNET_SCALARPRODUCT_DatumProcessor) (void *cls,
77 77
78/** 78/**
79 * Request by Alice's client for computing a scalar product 79 * Request by Alice's client for computing a scalar product
80 * 80 *
81 * @param h handle to the master context 81 * @param h handle to the master context
82 * @param key Session key - unique to the requesting client 82 * @param key Session key - unique to the requesting client
83 * @param peer PeerID of the other peer 83 * @param peer PeerID of the other peer
@@ -100,8 +100,8 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg,
100 void *cont_cls); 100 void *cont_cls);
101 101
102/** 102/**
103 * Used by Bob's client to cooperate with Alice, 103 * Used by Bob's client to cooperate with Alice,
104 * 104 *
105 * @param h handle to our configuration 105 * @param h handle to our configuration
106 * @param key Session key - unique to the requesting client 106 * @param key Session key - unique to the requesting client
107 * @param elements Array of elements of the vector 107 * @param elements Array of elements of the vector
@@ -119,7 +119,7 @@ GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle *cfg,
119/** 119/**
120 * Cancel an ongoing computation or revoke our collaboration offer. 120 * Cancel an ongoing computation or revoke our collaboration offer.
121 * Closes the connection to the service 121 * Closes the connection to the service
122 * 122 *
123 * @param h handel to terminate 123 * @param h handel to terminate
124 */ 124 */
125void 125void
@@ -128,7 +128,7 @@ GNUNET_SCALARPRODUCT_cancel (struct GNUNET_SCALARPRODUCT_ComputationHandle * h);
128/** 128/**
129 * Cancel ALL ongoing computation or revoke our collaboration offer. 129 * Cancel ALL ongoing computation or revoke our collaboration offer.
130 * Closes ALL connections to the service 130 * Closes ALL connections to the service
131 * 131 *
132 */ 132 */
133void 133void
134GNUNET_SCALARPRODUCT_disconnect (); 134GNUNET_SCALARPRODUCT_disconnect ();
diff --git a/src/include/gnunet_scheduler_lib.h b/src/include/gnunet_scheduler_lib.h
index dee6eab27..83d9d261a 100644
--- a/src/include/gnunet_scheduler_lib.h
+++ b/src/include/gnunet_scheduler_lib.h
@@ -536,7 +536,7 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay,
536 * only valid until "task" is started! 536 * only valid until "task" is started!
537 */ 537 */
538GNUNET_SCHEDULER_TaskIdentifier 538GNUNET_SCHEDULER_TaskIdentifier
539GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, 539GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
540 struct GNUNET_TIME_Relative delay, 540 struct GNUNET_TIME_Relative delay,
541 const struct GNUNET_NETWORK_FDSet *rs, 541 const struct GNUNET_NETWORK_FDSet *rs,
542 const struct GNUNET_NETWORK_FDSet *ws, 542 const struct GNUNET_NETWORK_FDSet *ws,
diff --git a/src/include/gnunet_server_lib.h b/src/include/gnunet_server_lib.h
index 0195a2898..d1097450f 100644
--- a/src/include/gnunet_server_lib.h
+++ b/src/include/gnunet_server_lib.h
@@ -288,7 +288,7 @@ GNUNET_SERVER_client_persist_ (struct GNUNET_SERVER_Client *client);
288 * serious error) 288 * serious error)
289 */ 289 */
290void 290void
291GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, 291GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client,
292 int success); 292 int success);
293 293
294 294
@@ -326,7 +326,7 @@ GNUNET_SERVER_client_get_user_context_ (struct GNUNET_SERVER_Client *client,
326 * @param ptr pointer to user context 326 * @param ptr pointer to user context
327 * @param size number of bytes in user context struct (for verification only) 327 * @param size number of bytes in user context struct (for verification only)
328 */ 328 */
329void 329void
330GNUNET_SERVER_client_set_user_context_ (struct GNUNET_SERVER_Client *client, 330GNUNET_SERVER_client_set_user_context_ (struct GNUNET_SERVER_Client *client,
331 void *ptr, 331 void *ptr,
332 size_t size); 332 size_t size);
@@ -500,7 +500,7 @@ GNUNET_SERVER_connect_notify (struct GNUNET_SERVER_Handle *server,
500 500
501/** 501/**
502 * Ask the server to stop notifying us whenever a client disconnects. 502 * Ask the server to stop notifying us whenever a client disconnects.
503 * Arguments must match exactly those given to 503 * Arguments must match exactly those given to
504 * #GNUNET_SERVER_disconnect_notify. It is not necessary to call this 504 * #GNUNET_SERVER_disconnect_notify. It is not necessary to call this
505 * function during shutdown of the server; in fact, most applications 505 * function during shutdown of the server; in fact, most applications
506 * will never use this function. 506 * will never use this function.
@@ -517,7 +517,7 @@ GNUNET_SERVER_disconnect_notify_cancel (struct GNUNET_SERVER_Handle *server,
517 517
518/** 518/**
519 * Ask the server to stop notifying us whenever a client connects. 519 * Ask the server to stop notifying us whenever a client connects.
520 * Arguments must match exactly those given to 520 * Arguments must match exactly those given to
521 * #GNUNET_SERVER_connect_notify. It is not necessary to call this 521 * #GNUNET_SERVER_connect_notify. It is not necessary to call this
522 * function during shutdown of the server; in fact, most applications 522 * function during shutdown of the server; in fact, most applications
523 * will never use this function. 523 * will never use this function.
@@ -693,7 +693,7 @@ GNUNET_SERVER_notification_context_add (struct GNUNET_SERVER_NotificationContext
693void 693void
694GNUNET_SERVER_notification_context_unicast (struct GNUNET_SERVER_NotificationContext *nc, 694GNUNET_SERVER_notification_context_unicast (struct GNUNET_SERVER_NotificationContext *nc,
695 struct GNUNET_SERVER_Client *client, 695 struct GNUNET_SERVER_Client *client,
696 const struct GNUNET_MessageHeader *msg, 696 const struct GNUNET_MessageHeader *msg,
697 int can_drop); 697 int can_drop);
698 698
699 699
@@ -706,7 +706,7 @@ GNUNET_SERVER_notification_context_unicast (struct GNUNET_SERVER_NotificationCon
706 */ 706 */
707void 707void
708GNUNET_SERVER_notification_context_broadcast (struct GNUNET_SERVER_NotificationContext *nc, 708GNUNET_SERVER_notification_context_broadcast (struct GNUNET_SERVER_NotificationContext *nc,
709 const struct GNUNET_MessageHeader *msg, 709 const struct GNUNET_MessageHeader *msg,
710 int can_drop); 710 int can_drop);
711 711
712 712
@@ -811,7 +811,7 @@ typedef void (*GNUNET_SERVER_MstDestroyCallback) (void *cls, void *mst);
811 * @param one_shot only call callback once, keep rest of message in buffer 811 * @param one_shot only call callback once, keep rest of message in buffer
812 * @return #GNUNET_OK if we are done processing (need more data) 812 * @return #GNUNET_OK if we are done processing (need more data)
813 * #GNUNET_NO if one_shot was set and we have another message ready 813 * #GNUNET_NO if one_shot was set and we have another message ready
814 * #GNUNET_SYSERR if the data stream is corrupt 814 * #GNUNET_SYSERR if the data stream is corrupt
815 */ 815 */
816typedef int (*GNUNET_SERVER_MstReceiveCallback) (void *cls, void *mst, 816typedef int (*GNUNET_SERVER_MstReceiveCallback) (void *cls, void *mst,
817 struct GNUNET_SERVER_Client *client, 817 struct GNUNET_SERVER_Client *client,
diff --git a/src/include/gnunet_service_lib.h b/src/include/gnunet_service_lib.h
index 2d7b3064f..11dcff35e 100644
--- a/src/include/gnunet_service_lib.h
+++ b/src/include/gnunet_service_lib.h
@@ -119,10 +119,10 @@ enum GNUNET_SERVICE_Options
119 * if we shutdown nicely 119 * if we shutdown nicely
120 */ 120 */
121int 121int
122GNUNET_SERVICE_run (int argc, char *const *argv, 122GNUNET_SERVICE_run (int argc, char *const *argv,
123 const char *service_name, 123 const char *service_name,
124 enum GNUNET_SERVICE_Options options, 124 enum GNUNET_SERVICE_Options options,
125 GNUNET_SERVICE_Main task, 125 GNUNET_SERVICE_Main task,
126 void *task_cls); 126 void *task_cls);
127 127
128 128
diff --git a/src/include/gnunet_set_service.h b/src/include/gnunet_set_service.h
index dbec108c2..920424b80 100644
--- a/src/include/gnunet_set_service.h
+++ b/src/include/gnunet_set_service.h
@@ -317,7 +317,7 @@ GNUNET_SET_prepare (const struct GNUNET_PeerIdentity *other_peer,
317 * Wait for set operation requests for the given application ID. 317 * Wait for set operation requests for the given application ID.
318 * If the connection to the set service is lost, the listener is 318 * If the connection to the set service is lost, the listener is
319 * re-created transparently with exponential backoff. 319 * re-created transparently with exponential backoff.
320 * 320 *
321 * @param cfg configuration to use for connecting to 321 * @param cfg configuration to use for connecting to
322 * the set service 322 * the set service
323 * @param operation operation we want to listen for 323 * @param operation operation we want to listen for
@@ -351,7 +351,7 @@ GNUNET_SET_listen_cancel (struct GNUNET_SET_ListenHandle *lh);
351 * GNUNET_SET_listen, as the 'struct GNUNET_SET_Request' becomes invalid 351 * GNUNET_SET_listen, as the 'struct GNUNET_SET_Request' becomes invalid
352 * afterwards. 352 * afterwards.
353 * Call GNUNET_SET_commit to provide the local set to use for the operation, 353 * Call GNUNET_SET_commit to provide the local set to use for the operation,
354 * and to begin the exchange with the remote peer. 354 * and to begin the exchange with the remote peer.
355 * 355 *
356 * @param request request to accept 356 * @param request request to accept
357 * @param result_mode specified how results will be returned, 357 * @param result_mode specified how results will be returned,
@@ -375,7 +375,7 @@ GNUNET_SET_accept (struct GNUNET_SET_Request *request,
375 * set information and call the result callback with the 375 * set information and call the result callback with the
376 * result information. 376 * result information.
377 * 377 *
378 * @param oh handle to the set operation 378 * @param oh handle to the set operation
379 * @param set the set to use for the operation 379 * @param set the set to use for the operation
380 * @return GNUNET_OK on success, GNUNET_SYSERR if the 380 * @return GNUNET_OK on success, GNUNET_SYSERR if the
381 * set is invalid (e.g. the set service crashed) 381 * set is invalid (e.g. the set service crashed)
diff --git a/src/include/gnunet_social_service.h b/src/include/gnunet_social_service.h
index f53a2c28b..88a52b709 100644
--- a/src/include/gnunet_social_service.h
+++ b/src/include/gnunet_social_service.h
@@ -18,7 +18,7 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/** 21/**
22 * @file include/gnunet_social_service.h 22 * @file include/gnunet_social_service.h
23 * @brief Social service; implements social functionality using the PSYC service. 23 * @brief Social service; implements social functionality using the PSYC service.
24 * @author Gabor X Toth 24 * @author Gabor X Toth
@@ -41,34 +41,34 @@ extern "C"
41#include "gnunet_multicast_service.h" 41#include "gnunet_multicast_service.h"
42 42
43 43
44/** 44/**
45 * Version number of GNUnet Social API. 45 * Version number of GNUnet Social API.
46 */ 46 */
47#define GNUNET_SOCIAL_VERSION 0x00000000 47#define GNUNET_SOCIAL_VERSION 0x00000000
48 48
49 49
50/** 50/**
51 * Handle for another user (who is likely pseudonymous) in the network. 51 * Handle for another user (who is likely pseudonymous) in the network.
52 */ 52 */
53struct GNUNET_SOCIAL_Nym; 53struct GNUNET_SOCIAL_Nym;
54 54
55/** 55/**
56 * Handle for a place where social interactions happen. 56 * Handle for a place where social interactions happen.
57 */ 57 */
58struct GNUNET_SOCIAL_Place; 58struct GNUNET_SOCIAL_Place;
59 59
60/** 60/**
61 * Handle for a place that one of our egos hosts. 61 * Handle for a place that one of our egos hosts.
62 */ 62 */
63struct GNUNET_SOCIAL_Home; 63struct GNUNET_SOCIAL_Home;
64 64
65/** 65/**
66 * Handle to an implementation of try-and-slice. 66 * Handle to an implementation of try-and-slice.
67 */ 67 */
68struct GNUNET_SOCIAL_Slicer; 68struct GNUNET_SOCIAL_Slicer;
69 69
70 70
71/** 71/**
72 * Method called from SOCIAL upon receiving a message indicating a call 72 * Method called from SOCIAL upon receiving a message indicating a call
73 * to a @e method. 73 * to a @e method.
74 * 74 *
@@ -101,7 +101,7 @@ typedef int
101 enum GNUNET_PSYC_MessageFlags flags); 101 enum GNUNET_PSYC_MessageFlags flags);
102 102
103 103
104/** 104/**
105 * Create a try-and-slice instance. 105 * Create a try-and-slice instance.
106 * 106 *
107 * @return A new try-and-slice construct. 107 * @return A new try-and-slice construct.
@@ -110,7 +110,7 @@ struct GNUNET_SOCIAL_Slicer *
110GNUNET_SOCIAL_slicer_create (void); 110GNUNET_SOCIAL_slicer_create (void);
111 111
112 112
113/** 113/**
114 * Add a method to the try-and-slice instance. 114 * Add a method to the try-and-slice instance.
115 * 115 *
116 * A slicer processes messages and calls methods that match a message. A match 116 * A slicer processes messages and calls methods that match a message. A match
@@ -129,7 +129,7 @@ GNUNET_SOCIAL_slicer_add (struct GNUNET_SOCIAL_Slicer *slicer,
129 void *method_cls); 129 void *method_cls);
130 130
131 131
132/** 132/**
133 * Remove a registered method from the try-and-slice instance. 133 * Remove a registered method from the try-and-slice instance.
134 * 134 *
135 * @param slicer The try-and-slice instance. 135 * @param slicer The try-and-slice instance.
@@ -141,7 +141,7 @@ GNUNET_SOCIAL_slicer_remove (struct GNUNET_SOCIAL_Slicer *slicer,
141 const char *method_name, 141 const char *method_name,
142 GNUNET_SOCIAL_Method method); 142 GNUNET_SOCIAL_Method method);
143 143
144/** 144/**
145 * Destroy a given try-and-slice instance. 145 * Destroy a given try-and-slice instance.
146 * 146 *
147 * @param slicer slicer to destroy 147 * @param slicer slicer to destroy
@@ -150,7 +150,7 @@ void
150GNUNET_SOCIAL_slicer_destroy (struct GNUNET_SOCIAL_Slicer *slicer); 150GNUNET_SOCIAL_slicer_destroy (struct GNUNET_SOCIAL_Slicer *slicer);
151 151
152 152
153/** 153/**
154 * Function called asking for nym to be admitted to the place. 154 * Function called asking for nym to be admitted to the place.
155 * 155 *
156 * Should call either GNUNET_SOCIAL_home_admit() or 156 * Should call either GNUNET_SOCIAL_home_admit() or
@@ -178,9 +178,9 @@ typedef void
178 size_t data_size); 178 size_t data_size);
179 179
180 180
181/** 181/**
182 * Function called when a @a nym leaves the place. 182 * Function called when a @a nym leaves the place.
183 * 183 *
184 * This is also called if the @a nym was never given permission to enter 184 * This is also called if the @a nym was never given permission to enter
185 * (i.e. the @a nym stopped asking to get in). 185 * (i.e. the @a nym stopped asking to get in).
186 * 186 *
@@ -196,7 +196,7 @@ typedef void
196 GNUNET_PSYC_Modifier *variables); 196 GNUNET_PSYC_Modifier *variables);
197 197
198 198
199/** 199/**
200 * Enter a home where guests (nyms) can be hosted. 200 * Enter a home where guests (nyms) can be hosted.
201 * 201 *
202 * A home is created upon first entering, and exists until 202 * A home is created upon first entering, and exists until
@@ -225,7 +225,7 @@ GNUNET_SOCIAL_home_enter (const struct GNUNET_CONFIGURATION_Handle *cfg,
225 void *cls); 225 void *cls);
226 226
227 227
228/** 228/**
229 * Admit @a nym to the @a home. 229 * Admit @a nym to the @a home.
230 * 230 *
231 * The @a nym reference will remain valid until either the home is destroyed or 231 * The @a nym reference will remain valid until either the home is destroyed or
@@ -239,7 +239,7 @@ GNUNET_SOCIAL_home_admit (struct GNUNET_SOCIAL_Home *home,
239 struct GNUNET_SOCIAL_Nym *nym); 239 struct GNUNET_SOCIAL_Nym *nym);
240 240
241 241
242/** 242/**
243 * Throw @a nym out of the @a home. 243 * Throw @a nym out of the @a home.
244 * 244 *
245 * The @a nym reference will remain valid until the 245 * The @a nym reference will remain valid until the
@@ -254,7 +254,7 @@ GNUNET_SOCIAL_home_eject (struct GNUNET_SOCIAL_Home *home,
254 struct GNUNET_SOCIAL_Nym *nym); 254 struct GNUNET_SOCIAL_Nym *nym);
255 255
256 256
257/** 257/**
258 * Refuse @a nym entry into the @a home. 258 * Refuse @a nym entry into the @a home.
259 * 259 *
260 * @param home Home to disallow @a nym to enter. 260 * @param home Home to disallow @a nym to enter.
@@ -273,7 +273,7 @@ GNUNET_SOCIAL_home_reject_entry (struct GNUNET_SOCIAL_Home *home,
273 size_t data_size); 273 size_t data_size);
274 274
275 275
276/** 276/**
277 * Get the public key of a nym. 277 * Get the public key of a nym.
278 * 278 *
279 * Suitable, for example, to be used with GNUNET_NAMESTORE_zone_to_name(). 279 * Suitable, for example, to be used with GNUNET_NAMESTORE_zone_to_name().
@@ -286,9 +286,9 @@ GNUNET_SOCIAL_nym_get_key (struct GNUNET_SOCIAL_Nym *nym,
286 struct GNUNET_CRYPTO_EccPublicSignKey *nym_key); 286 struct GNUNET_CRYPTO_EccPublicSignKey *nym_key);
287 287
288 288
289/** 289/**
290 * Obtain the private-public key pair of the home. 290 * Obtain the private-public key pair of the home.
291 * 291 *
292 * @param home Home to get the key of. 292 * @param home Home to get the key of.
293 * @param[out] home_key Set to the private-public key pair of the home. The public part is suitable for storing in GNS within a "PLACE" record, along with peer IDs to join at. 293 * @param[out] home_key Set to the private-public key pair of the home. The public part is suitable for storing in GNS within a "PLACE" record, along with peer IDs to join at.
294 */ 294 */
@@ -297,7 +297,7 @@ GNUNET_SOCIAL_home_get_key (struct GNUNET_SOCIAL_Home *home,
297 struct GNUNET_CRYPTO_EccPrivateKey *home_key); 297 struct GNUNET_CRYPTO_EccPrivateKey *home_key);
298 298
299 299
300/** 300/**
301 * Advertise @a home under @a name in the GNS zone of the @e ego. 301 * Advertise @a home under @a name in the GNS zone of the @e ego.
302 * 302 *
303 * @param home The home to advertise. 303 * @param home The home to advertise.
@@ -322,9 +322,9 @@ GNUNET_SOCIAL_home_advertise (struct GNUNET_SOCIAL_Home *home,
322 */ 322 */
323enum GNUNET_PSYC_AnnouncementFlags 323enum GNUNET_PSYC_AnnouncementFlags
324{ 324{
325 /** 325 /**
326 * Whether this announcement removes all objects from the home. 326 * Whether this announcement removes all objects from the home.
327 * 327 *
328 * New objects can be still added to the now empty home using the @e env 328 * New objects can be still added to the now empty home using the @e env
329 * parameter of the same announcement. 329 * parameter of the same announcement.
330 */ 330 */
@@ -332,13 +332,13 @@ enum GNUNET_PSYC_AnnouncementFlags
332}; 332};
333 333
334 334
335/** 335/**
336 * Handle for an announcement request. 336 * Handle for an announcement request.
337 */ 337 */
338struct GNUNET_SOCIAL_Announcement; 338struct GNUNET_SOCIAL_Announcement;
339 339
340 340
341/** 341/**
342 * Send a message to all nyms that are present in the home. 342 * Send a message to all nyms that are present in the home.
343 * 343 *
344 * This function is restricted to the home owner. Nyms can only send requests 344 * This function is restricted to the home owner. Nyms can only send requests
@@ -362,7 +362,7 @@ GNUNET_SOCIAL_home_announce (struct GNUNET_SOCIAL_Home *home,
362 GNUNET_SOCIAL_AnnouncementFlags flags); 362 GNUNET_SOCIAL_AnnouncementFlags flags);
363 363
364 364
365/** 365/**
366 * Cancel announcement. 366 * Cancel announcement.
367 * 367 *
368 * @param a The announcement to cancel. 368 * @param a The announcement to cancel.
@@ -371,7 +371,7 @@ void
371GNUNET_SOCIAL_home_announce_cancel (struct GNUNET_SOCIAL_Announcement *a); 371GNUNET_SOCIAL_home_announce_cancel (struct GNUNET_SOCIAL_Announcement *a);
372 372
373 373
374/** 374/**
375 * Convert our home to a place so we can access it via the place API. 375 * Convert our home to a place so we can access it via the place API.
376 * 376 *
377 * @param home Handle for the home. 377 * @param home Handle for the home.
@@ -383,7 +383,7 @@ struct GNUNET_SOCIAL_Place *
383GNUNET_SOCIAL_home_get_place (struct GNUNET_SOCIAL_Home *home, int keep_active); 383GNUNET_SOCIAL_home_get_place (struct GNUNET_SOCIAL_Home *home, int keep_active);
384 384
385 385
386/** 386/**
387 * Leave a home. 387 * Leave a home.
388 388
389 * Invalidates home handle. 389 * Invalidates home handle.
@@ -394,7 +394,7 @@ GNUNET_SOCIAL_home_get_place (struct GNUNET_SOCIAL_Home *home, int keep_active);
394void 394void
395GNUNET_SOCIAL_home_leave (struct GNUNET_SOCIAL_Home *home); 395GNUNET_SOCIAL_home_leave (struct GNUNET_SOCIAL_Home *home);
396 396
397/** 397/**
398 * Request entry to a place (home hosted by someone else). 398 * Request entry to a place (home hosted by someone else).
399 * 399 *
400 * @param cfg Configuration to contact the social service. 400 * @param cfg Configuration to contact the social service.
@@ -421,7 +421,7 @@ GNUNET_SOCIAL_place_enter (const struct GNUNET_CONFIGURATION_Handle *cfg,
421 size_t data_size, 421 size_t data_size,
422 struct GNUNET_SOCIAL_Slicer *slicer); 422 struct GNUNET_SOCIAL_Slicer *slicer);
423 423
424/** 424/**
425 * Request entry to a place (home hosted by someone else). 425 * Request entry to a place (home hosted by someone else).
426 * 426 *
427 * @param cfg Configuration to contact the social service. 427 * @param cfg Configuration to contact the social service.
@@ -453,14 +453,14 @@ GNUNET_SOCIAL_place_enter2 (const struct GNUNET_CONFIGURATION_Handle *cfg,
453 453
454struct GNUNET_SOCIAL_WatchHandle; 454struct GNUNET_SOCIAL_WatchHandle;
455 455
456/** 456/**
457 * Watch a place for changed objects. 457 * Watch a place for changed objects.
458 * 458 *
459 * @param place Place to watch. 459 * @param place Place to watch.
460 * @param object_filter Object prefix to match. 460 * @param object_filter Object prefix to match.
461 * @param state_cb Function to call when an object/state changes. 461 * @param state_cb Function to call when an object/state changes.
462 * @param state_cb_cls Closure for callback. 462 * @param state_cb_cls Closure for callback.
463 * 463 *
464 * @return Handle that can be used to cancel watching. 464 * @return Handle that can be used to cancel watching.
465 */ 465 */
466struct GNUNET_SOCIAL_WatchHandle * 466struct GNUNET_SOCIAL_WatchHandle *
@@ -470,7 +470,7 @@ GNUNET_SOCIAL_place_watch (struct GNUNET_SOCIAL_Place *place,
470 void *state_cb_cls); 470 void *state_cb_cls);
471 471
472 472
473/** 473/**
474 * Cancel watching a place for changed objects. 474 * Cancel watching a place for changed objects.
475 * 475 *
476 * @param wh Watch handle to cancel. 476 * @param wh Watch handle to cancel.
@@ -482,14 +482,14 @@ GNUNET_SOCIAL_place_watch_cancel (struct GNUNET_SOCIAL_WatchHandle *wh);
482struct GNUNET_SOCIAL_LookHandle; 482struct GNUNET_SOCIAL_LookHandle;
483 483
484 484
485/** 485/**
486 * Look at objects in the place with a matching name prefix. 486 * Look at objects in the place with a matching name prefix.
487 * 487 *
488 * @param place The place to look its objects at. 488 * @param place The place to look its objects at.
489 * @param name_prefix Look at objects with names beginning with this value. 489 * @param name_prefix Look at objects with names beginning with this value.
490 * @param state_cb Function to call for each object found. 490 * @param state_cb Function to call for each object found.
491 * @param state_cb_cls Closure for callback function. 491 * @param state_cb_cls Closure for callback function.
492 * 492 *
493 * @return Handle that can be used to stop looking at objects. 493 * @return Handle that can be used to stop looking at objects.
494 */ 494 */
495struct GNUNET_SOCIAL_LookHandle * 495struct GNUNET_SOCIAL_LookHandle *
@@ -499,7 +499,7 @@ GNUNET_SOCIAL_place_look (struct GNUNET_SOCIAL_Place *place,
499 void *state_cb_cls); 499 void *state_cb_cls);
500 500
501 501
502/** 502/**
503 * Stop looking at objects. 503 * Stop looking at objects.
504 * 504 *
505 * @param lh Look handle to stop. 505 * @param lh Look handle to stop.
@@ -509,7 +509,7 @@ GNUNET_SOCIAL_place_look_cancel (struct GNUNET_SOCIAL_LookHandle *lh);
509 509
510 510
511 511
512/** 512/**
513 * Look at a particular object in the place. 513 * Look at a particular object in the place.
514 * 514 *
515 * The best matching object is returned (its name might be less specific than 515 * The best matching object is returned (its name might be less specific than
@@ -532,12 +532,12 @@ GNUNET_SOCIAL_place_look_at (struct GNUNET_SOCIAL_Place *place,
532enum GNUNET_SOCIAL_TalkFlags; 532enum GNUNET_SOCIAL_TalkFlags;
533 533
534 534
535/** 535/**
536 * A talk request. 536 * A talk request.
537 */ 537 */
538struct GNUNET_SOCIAL_TalkRequest; 538struct GNUNET_SOCIAL_TalkRequest;
539 539
540/** 540/**
541 * Talk to the host of the place. 541 * Talk to the host of the place.
542 * 542 *
543 * @param place Place where we want to talk to the host. 543 * @param place Place where we want to talk to the host.
@@ -558,7 +558,7 @@ GNUNET_SOCIAL_place_talk (struct GNUNET_SOCIAL_Place *place,
558 GNUNET_SOCIAL_TalkFlags flags); 558 GNUNET_SOCIAL_TalkFlags flags);
559 559
560 560
561/** 561/**
562 * Cancel talking to the host of the place. 562 * Cancel talking to the host of the place.
563 * 563 *
564 * @param tr Talk request to cancel. 564 * @param tr Talk request to cancel.
@@ -567,12 +567,12 @@ void
567GNUNET_SOCIAL_place_talk_cancel (struct GNUNET_SOCIAL_TalkRequest *tr); 567GNUNET_SOCIAL_place_talk_cancel (struct GNUNET_SOCIAL_TalkRequest *tr);
568 568
569 569
570/** 570/**
571 * A history lesson. 571 * A history lesson.
572 */ 572 */
573struct GNUNET_SOCIAL_HistoryLesson; 573struct GNUNET_SOCIAL_HistoryLesson;
574 574
575/** 575/**
576 * Learn about the history of a place. 576 * Learn about the history of a place.
577 * 577 *
578 * Sends messages through the slicer function of the place where 578 * Sends messages through the slicer function of the place where
@@ -580,7 +580,7 @@ struct GNUNET_SOCIAL_HistoryLesson;
580 * The messages will have the #GNUNET_PSYC_MESSAGE_HISTORIC flag set. 580 * The messages will have the #GNUNET_PSYC_MESSAGE_HISTORIC flag set.
581 * 581 *
582 * To get the latest message, use 0 for both the start and end message ID. 582 * To get the latest message, use 0 for both the start and end message ID.
583 * 583 *
584 * @param place Place we want to learn more about. 584 * @param place Place we want to learn more about.
585 * @param start_message_id First historic message we are interested in. 585 * @param start_message_id First historic message we are interested in.
586 * @param end_message_id Last historic message we are interested in (inclusive). 586 * @param end_message_id Last historic message we are interested in (inclusive).
@@ -602,7 +602,7 @@ GNUNET_SOCIAL_place_get_history (struct GNUNET_SOCIAL_Place *place,
602 void *finish_cb_cls); 602 void *finish_cb_cls);
603 603
604 604
605/** 605/**
606 * Stop processing messages from the history lesson. 606 * Stop processing messages from the history lesson.
607 * 607 *
608 * Must not be called after the finish callback of the history lesson is called. 608 * Must not be called after the finish callback of the history lesson is called.
@@ -613,11 +613,11 @@ void
613GNUNET_SOCIAL_place_get_history_cancel (struct GNUNET_SOCIAL_HistoryLesson *hist); 613GNUNET_SOCIAL_place_get_history_cancel (struct GNUNET_SOCIAL_HistoryLesson *hist);
614 614
615 615
616/** 616/**
617 * Leave a place permanently. 617 * Leave a place permanently.
618 * 618 *
619 * Notifies the owner of the place about leaving, and destroys the place handle. 619 * Notifies the owner of the place about leaving, and destroys the place handle.
620 * 620 *
621 * @param place Place to leave permanently. 621 * @param place Place to leave permanently.
622 * @param keep_active Keep place active after last application disconnected. 622 * @param keep_active Keep place active after last application disconnected.
623 */ 623 */
diff --git a/src/include/gnunet_speaker_lib.h b/src/include/gnunet_speaker_lib.h
index bdb91d6a1..136b11e55 100644
--- a/src/include/gnunet_speaker_lib.h
+++ b/src/include/gnunet_speaker_lib.h
@@ -1,17 +1,17 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2013 Christian Grothoff (and other contributing authors) 3 (C) 2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version. 8 option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
diff --git a/src/include/gnunet_strings_lib.h b/src/include/gnunet_strings_lib.h
index 1fe04da6b..cf56b2cce 100644
--- a/src/include/gnunet_strings_lib.h
+++ b/src/include/gnunet_strings_lib.h
@@ -123,8 +123,8 @@ GNUNET_STRINGS_conv (const char *input, size_t len,
123 * @return the converted string (0-terminated) 123 * @return the converted string (0-terminated)
124 */ 124 */
125char * 125char *
126GNUNET_STRINGS_to_utf8 (const char *input, 126GNUNET_STRINGS_to_utf8 (const char *input,
127 size_t len, 127 size_t len,
128 const char *charset); 128 const char *charset);
129 129
130 130
@@ -137,8 +137,8 @@ GNUNET_STRINGS_to_utf8 (const char *input,
137 * string is returned. 137 * string is returned.
138 */ 138 */
139char * 139char *
140GNUNET_STRINGS_from_utf8 (const char *input, 140GNUNET_STRINGS_from_utf8 (const char *input,
141 size_t len, 141 size_t len,
142 const char *charset); 142 const char *charset);
143 143
144 144
@@ -150,7 +150,7 @@ GNUNET_STRINGS_from_utf8 (const char *input,
150 * @param output output buffer 150 * @param output output buffer
151 */ 151 */
152void 152void
153GNUNET_STRINGS_utf8_tolower (const char* input, 153GNUNET_STRINGS_utf8_tolower (const char* input,
154 char** output); 154 char** output);
155 155
156 156
@@ -198,9 +198,9 @@ GNUNET_STRINGS_filename_expand (const char *fil);
198 * (or number of bytes that would have been written) 198 * (or number of bytes that would have been written)
199 */ 199 */
200size_t 200size_t
201GNUNET_STRINGS_buffer_fill (char *buffer, 201GNUNET_STRINGS_buffer_fill (char *buffer,
202 size_t size, 202 size_t size,
203 unsigned int count, 203 unsigned int count,
204 ...); 204 ...);
205 205
206 206
@@ -237,7 +237,7 @@ GNUNET_STRINGS_absolute_time_to_string (struct GNUNET_TIME_Absolute t);
237/** 237/**
238 * Give relative time in human-readable fancy format. 238 * Give relative time in human-readable fancy format.
239 * This is one of the very few calls in the entire API that is 239 * This is one of the very few calls in the entire API that is
240 * NOT reentrant! 240 * NOT reentrant!
241 * 241 *
242 * @param delta time in milli seconds 242 * @param delta time in milli seconds
243 * @param do_round are we allowed to round a bit? 243 * @param do_round are we allowed to round a bit?
@@ -279,9 +279,9 @@ GNUNET_STRINGS_get_short_name (const char *filename);
279 * @return pointer to the next byte in 'out' or NULL on error. 279 * @return pointer to the next byte in 'out' or NULL on error.
280 */ 280 */
281char * 281char *
282GNUNET_STRINGS_data_to_string (const void *data, 282GNUNET_STRINGS_data_to_string (const void *data,
283 size_t size, 283 size_t size,
284 char *out, 284 char *out,
285 size_t out_size); 285 size_t out_size);
286 286
287 287
@@ -296,9 +296,9 @@ GNUNET_STRINGS_data_to_string (const void *data,
296 * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong encoding 296 * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong encoding
297 */ 297 */
298int 298int
299GNUNET_STRINGS_string_to_data (const char *enc, 299GNUNET_STRINGS_string_to_data (const char *enc,
300 size_t enclen, 300 size_t enclen,
301 void *out, 301 void *out,
302 size_t out_size); 302 size_t out_size);
303 303
304 304
@@ -319,7 +319,7 @@ GNUNET_STRINGS_string_to_data (const char *enc,
319 * (if they weren't NULL). 319 * (if they weren't NULL).
320 */ 320 */
321int 321int
322GNUNET_STRINGS_parse_uri (const char *path, 322GNUNET_STRINGS_parse_uri (const char *path,
323 char **scheme_part, 323 char **scheme_part,
324 const char **path_part); 324 const char **path_part);
325 325
@@ -339,9 +339,9 @@ GNUNET_STRINGS_parse_uri (const char *path,
339 * @return GNUNET_YES if 'filename' is absolute, GNUNET_NO otherwise. 339 * @return GNUNET_YES if 'filename' is absolute, GNUNET_NO otherwise.
340 */ 340 */
341int 341int
342GNUNET_STRINGS_path_is_absolute (const char *filename, 342GNUNET_STRINGS_path_is_absolute (const char *filename,
343 int can_be_uri, 343 int can_be_uri,
344 int *r_is_uri, 344 int *r_is_uri,
345 char **r_uri_scheme); 345 char **r_uri_scheme);
346 346
347 347
@@ -367,7 +367,7 @@ enum GNUNET_STRINGS_FilenameCheck
367 367
368 /** 368 /**
369 * Check that the path is an absolute path. 369 * Check that the path is an absolute path.
370 */ 370 */
371 GNUNET_STRINGS_CHECK_IS_ABSOLUTE = 0x00000008 371 GNUNET_STRINGS_CHECK_IS_ABSOLUTE = 0x00000008
372}; 372};
373 373
@@ -375,7 +375,7 @@ enum GNUNET_STRINGS_FilenameCheck
375/** 375/**
376 * Perform checks on 'filename'. FIXME: some duplication with 376 * Perform checks on 'filename'. FIXME: some duplication with
377 * "GNUNET_DISK_"-APIs. We should unify those. 377 * "GNUNET_DISK_"-APIs. We should unify those.
378 * 378 *
379 * @param filename file to check 379 * @param filename file to check
380 * @param checks checks to perform 380 * @param checks checks to perform
381 * @return GNUNET_YES if all checks pass, GNUNET_NO if at least one of them 381 * @return GNUNET_YES if all checks pass, GNUNET_NO if at least one of them
@@ -389,7 +389,7 @@ GNUNET_STRINGS_check_filename (const char *filename,
389/** 389/**
390 * Tries to convert 'zt_addr' string to an IPv6 address. 390 * Tries to convert 'zt_addr' string to an IPv6 address.
391 * The string is expected to have the format "[ABCD::01]:80". 391 * The string is expected to have the format "[ABCD::01]:80".
392 * 392 *
393 * @param zt_addr 0-terminated string. May be mangled by the function. 393 * @param zt_addr 0-terminated string. May be mangled by the function.
394 * @param addrlen length of zt_addr (not counting 0-terminator). 394 * @param addrlen length of zt_addr (not counting 0-terminator).
395 * @param r_buf a buffer to fill. Initially gets filled with zeroes, 395 * @param r_buf a buffer to fill. Initially gets filled with zeroes,
@@ -398,7 +398,7 @@ GNUNET_STRINGS_check_filename (const char *filename,
398 * case the contents of r_buf are undefined. 398 * case the contents of r_buf are undefined.
399 */ 399 */
400int 400int
401GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, 401GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr,
402 uint16_t addrlen, 402 uint16_t addrlen,
403 struct sockaddr_in6 *r_buf); 403 struct sockaddr_in6 *r_buf);
404 404
@@ -406,7 +406,7 @@ GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr,
406/** 406/**
407 * Tries to convert 'zt_addr' string to an IPv4 address. 407 * Tries to convert 'zt_addr' string to an IPv4 address.
408 * The string is expected to have the format "1.2.3.4:80". 408 * The string is expected to have the format "1.2.3.4:80".
409 * 409 *
410 * @param zt_addr 0-terminated string. May be mangled by the function. 410 * @param zt_addr 0-terminated string. May be mangled by the function.
411 * @param addrlen length of zt_addr (not counting 0-terminator). 411 * @param addrlen length of zt_addr (not counting 0-terminator).
412 * @param r_buf a buffer to fill. 412 * @param r_buf a buffer to fill.
@@ -414,7 +414,7 @@ GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr,
414 * the contents of r_buf are undefined. 414 * the contents of r_buf are undefined.
415 */ 415 */
416int 416int
417GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr, 417GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr,
418 uint16_t addrlen, 418 uint16_t addrlen,
419 struct sockaddr_in *r_buf); 419 struct sockaddr_in *r_buf);
420 420
@@ -422,7 +422,7 @@ GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr,
422/** 422/**
423 * Tries to convert 'addr' string to an IP (v4 or v6) address. 423 * Tries to convert 'addr' string to an IP (v4 or v6) address.
424 * Will automatically decide whether to treat 'addr' as v4 or v6 address. 424 * Will automatically decide whether to treat 'addr' as v4 or v6 address.
425 * 425 *
426 * @param addr a string, may not be 0-terminated. 426 * @param addr a string, may not be 0-terminated.
427 * @param addrlen number of bytes in addr (if addr is 0-terminated, 427 * @param addrlen number of bytes in addr (if addr is 0-terminated,
428 * 0-terminator should not be counted towards addrlen). 428 * 0-terminator should not be counted towards addrlen).
@@ -451,8 +451,8 @@ GNUNET_STRINGS_to_address_ip (const char *addr,
451 * @return GNUNET_OK on success, GNUNET_SYSERR on failure 451 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
452 */ 452 */
453int 453int
454GNUNET_STRINGS_get_utf8_args (int argc, 454GNUNET_STRINGS_get_utf8_args (int argc,
455 char *const *argv, 455 char *const *argv,
456 int *u8argc, 456 int *u8argc,
457 char *const **u8argv); 457 char *const **u8argv);
458 458
diff --git a/src/include/gnunet_testbed_logger_service.h b/src/include/gnunet_testbed_logger_service.h
index 95783ea37..7e668ca1a 100644
--- a/src/include/gnunet_testbed_logger_service.h
+++ b/src/include/gnunet_testbed_logger_service.h
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file include/gnunet_testbed_logger_service.h 22 * @file include/gnunet_testbed_logger_service.h
23 * @brief API for submitting data to the testbed logger service 23 * @brief API for submitting data to the testbed logger service
24 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 24 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 */ 25 */
26 26
27#ifndef GNUNET_TESTBED_LOGGER_SERVICE_H 27#ifndef GNUNET_TESTBED_LOGGER_SERVICE_H
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h
index fa07cc63e..73dc88498 100644
--- a/src/include/gnunet_testbed_service.h
+++ b/src/include/gnunet_testbed_service.h
@@ -1108,7 +1108,7 @@ GNUNET_TESTBED_overlay_connect (void *op_cls,
1108 * @param nsuccess the number of successful overlay connects 1108 * @param nsuccess the number of successful overlay connects
1109 * @param nfailures the number of overlay connects which failed 1109 * @param nfailures the number of overlay connects which failed
1110 */ 1110 */
1111typedef void (*GNUNET_TESTBED_TopologyCompletionCallback) (void *cls, 1111typedef void (*GNUNET_TESTBED_TopologyCompletionCallback) (void *cls,
1112 unsigned int nsuccess, 1112 unsigned int nsuccess,
1113 unsigned int nfailures); 1113 unsigned int nfailures);
1114 1114
@@ -1277,7 +1277,7 @@ GNUNET_TESTBED_service_connect (void *op_cls,
1277 * cancels the operation, frees its resources and ensures the no event is 1277 * cancels the operation, frees its resources and ensures the no event is
1278 * generated with respect to this operation. Note that however cancelling an 1278 * generated with respect to this operation. Note that however cancelling an
1279 * operation does NOT guarantee that the operation will be fully undone (or that 1279 * operation does NOT guarantee that the operation will be fully undone (or that
1280 * nothing ever happened). 1280 * nothing ever happened).
1281 * 1281 *
1282 * This function MUST be called for every operation to fully remove the 1282 * This function MUST be called for every operation to fully remove the
1283 * operation from the operation queue. After calling this function, if 1283 * operation from the operation queue. After calling this function, if
@@ -1491,7 +1491,7 @@ enum GNUNET_TESTBED_BarrierStatus
1491 * Error status 1491 * Error status
1492 */ 1492 */
1493 GNUNET_TESTBED_BARRIERSTATUS_ERROR, 1493 GNUNET_TESTBED_BARRIERSTATUS_ERROR,
1494 1494
1495}; 1495};
1496 1496
1497 1497
@@ -1518,7 +1518,7 @@ typedef void (*GNUNET_TESTBED_barrier_status_cb) (void *cls,
1518 1518
1519/** 1519/**
1520 * Initialise a barrier and call the given callback when the required percentage 1520 * Initialise a barrier and call the given callback when the required percentage
1521 * of peers (quorum) reach the barrier. 1521 * of peers (quorum) reach the barrier.
1522 * 1522 *
1523 * @param controller the handle to the controller 1523 * @param controller the handle to the controller
1524 * @param name identification name of the barrier 1524 * @param name identification name of the barrier
diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h
index f182d8df5..3f5b260eb 100644
--- a/src/include/gnunet_testing_lib.h
+++ b/src/include/gnunet_testing_lib.h
@@ -46,7 +46,7 @@ extern "C"
46#endif 46#endif
47 47
48/** 48/**
49 * Size of each hostkey in the hostkey file (in BYTES). 49 * Size of each hostkey in the hostkey file (in BYTES).
50 */ 50 */
51#define GNUNET_TESTING_HOSTKEYFILESIZE sizeof (struct GNUNET_CRYPTO_EccPrivateKey) 51#define GNUNET_TESTING_HOSTKEYFILESIZE sizeof (struct GNUNET_CRYPTO_EccPrivateKey)
52 52
@@ -138,7 +138,7 @@ struct GNUNET_TESTING_System *
138GNUNET_TESTING_system_create_with_portrange (const char *testdir, 138GNUNET_TESTING_system_create_with_portrange (const char *testdir,
139 const char *trusted_ip, 139 const char *trusted_ip,
140 const char *hostname, 140 const char *hostname,
141 const struct 141 const struct
142 GNUNET_TESTING_SharedService * 142 GNUNET_TESTING_SharedService *
143 shared_services, 143 shared_services,
144 uint16_t lowport, 144 uint16_t lowport,
@@ -162,7 +162,7 @@ GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system,
162 * faster peer startup. This function can be used to 162 * faster peer startup. This function can be used to
163 * access the n-th key of those pre-created hostkeys; note 163 * access the n-th key of those pre-created hostkeys; note
164 * that these keys are ONLY useful for testing and not 164 * that these keys are ONLY useful for testing and not
165 * secure as the private keys are part of the public 165 * secure as the private keys are part of the public
166 * GNUnet source code. 166 * GNUnet source code.
167 * 167 *
168 * This is primarily a helper function used internally 168 * This is primarily a helper function used internally
@@ -186,7 +186,7 @@ GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
186 * @param system system to use for reservation tracking 186 * @param system system to use for reservation tracking
187 * @return 0 if no free port was available 187 * @return 0 if no free port was available
188 */ 188 */
189uint16_t 189uint16_t
190GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system); 190GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system);
191 191
192 192
@@ -226,14 +226,14 @@ GNUNET_TESTING_configuration_create (struct GNUNET_TESTING_System *system,
226 226
227/** 227/**
228 * Configure a GNUnet peer. GNUnet must be installed on the local 228 * Configure a GNUnet peer. GNUnet must be installed on the local
229 * system and available in the PATH. 229 * system and available in the PATH.
230 * 230 *
231 * @param system system to use to coordinate resource usage 231 * @param system system to use to coordinate resource usage
232 * @param cfg configuration to use; will be UPDATED (to reflect needed 232 * @param cfg configuration to use; will be UPDATED (to reflect needed
233 * changes in port numbers and paths) 233 * changes in port numbers and paths)
234 * @param key_number number of the hostkey to use for the peer 234 * @param key_number number of the hostkey to use for the peer
235 * @param id identifier for the daemon, will be set, can be NULL 235 * @param id identifier for the daemon, will be set, can be NULL
236 * @param emsg set to freshly allocated error message (set to NULL on success), 236 * @param emsg set to freshly allocated error message (set to NULL on success),
237 * can be NULL 237 * can be NULL
238 * @return handle to the peer, NULL on error 238 * @return handle to the peer, NULL on error
239 */ 239 */
@@ -257,7 +257,7 @@ GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer,
257 257
258 258
259/** 259/**
260 * Start the peer. 260 * Start the peer.
261 * 261 *
262 * @param peer peer to start 262 * @param peer peer to start
263 * @return GNUNET_OK on success, GNUNET_SYSERR on error (i.e. peer already running) 263 * @return GNUNET_OK on success, GNUNET_SYSERR on error (i.e. peer already running)
@@ -319,7 +319,7 @@ GNUNET_TESTING_peer_wait (struct GNUNET_TESTING_Peer *peer);
319 * @param success GNUNET_YES if the peer is stopped; GNUNET_SYSERR upon any 319 * @param success GNUNET_YES if the peer is stopped; GNUNET_SYSERR upon any
320 * error 320 * error
321 */ 321 */
322typedef void (*GNUNET_TESTING_PeerStopCallback) (void *cls, 322typedef void (*GNUNET_TESTING_PeerStopCallback) (void *cls,
323 struct GNUNET_TESTING_Peer * 323 struct GNUNET_TESTING_Peer *
324 peer, 324 peer,
325 int success); 325 int success);
@@ -358,7 +358,7 @@ GNUNET_TESTING_peer_stop_async_cancel (struct GNUNET_TESTING_Peer *peer);
358/** 358/**
359 * Signature of the 'main' function for a (single-peer) testcase that 359 * Signature of the 'main' function for a (single-peer) testcase that
360 * is run using 'GNUNET_TESTING_peer_run'. 360 * is run using 'GNUNET_TESTING_peer_run'.
361 * 361 *
362 * @param cls closure 362 * @param cls closure
363 * @param cfg configuration of the peer that was started 363 * @param cfg configuration of the peer that was started
364 * @param peer identity of the peer that was created 364 * @param peer identity of the peer that was created
@@ -424,14 +424,14 @@ GNUNET_TESTING_service_run (const char *testdir,
424 * Sometimes we use the binary name to determine which specific 424 * Sometimes we use the binary name to determine which specific
425 * test to run. In those cases, the string after the last "_" 425 * test to run. In those cases, the string after the last "_"
426 * in 'argv[0]' specifies a string that determines the configuration 426 * in 'argv[0]' specifies a string that determines the configuration
427 * file or plugin to use. 427 * file or plugin to use.
428 * 428 *
429 * This function returns the respective substring, taking care 429 * This function returns the respective substring, taking care
430 * of issues such as binaries ending in '.exe' on W32. 430 * of issues such as binaries ending in '.exe' on W32.
431 * 431 *
432 * @param argv0 the name of the binary 432 * @param argv0 the name of the binary
433 * @return string between the last '_' and the '.exe' (or the end of the string), 433 * @return string between the last '_' and the '.exe' (or the end of the string),
434 * NULL if argv0 has no '_' 434 * NULL if argv0 has no '_'
435 */ 435 */
436char * 436char *
437GNUNET_TESTING_get_testname_from_underscore (const char *argv0); 437GNUNET_TESTING_get_testname_from_underscore (const char *argv0);
diff --git a/src/include/gnunet_time_lib.h b/src/include/gnunet_time_lib.h
index 3e87309c6..4db73966c 100644
--- a/src/include/gnunet_time_lib.h
+++ b/src/include/gnunet_time_lib.h
@@ -483,7 +483,7 @@ GNUNET_TIME_set_offset (long long offset);
483 * 483 *
484 * @return the offset we currently skew the locale time by 484 * @return the offset we currently skew the locale time by
485 */ 485 */
486long long 486long long
487GNUNET_TIME_get_offset (void); 487GNUNET_TIME_get_offset (void);
488 488
489 489
@@ -507,10 +507,10 @@ GNUNET_TIME_year_to_time (unsigned int year);
507/** 507/**
508 * Convert an expiration time to the respective year (rounds) 508 * Convert an expiration time to the respective year (rounds)
509 * 509 *
510 * @param at absolute time 510 * @param at absolute time
511 * @return year a year (after 1970), 0 on error 511 * @return year a year (after 1970), 0 on error
512 */ 512 */
513unsigned int 513unsigned int
514GNUNET_TIME_time_to_year (struct GNUNET_TIME_Absolute at); 514GNUNET_TIME_time_to_year (struct GNUNET_TIME_Absolute at);
515 515
516 516
diff --git a/src/include/gnunet_transport_plugin.h b/src/include/gnunet_transport_plugin.h
index c42c360d9..f835bdcd8 100644
--- a/src/include/gnunet_transport_plugin.h
+++ b/src/include/gnunet_transport_plugin.h
@@ -247,7 +247,7 @@ struct GNUNET_TRANSPORT_PluginEnvironment
247 * Function that should be called by the transport plugin 247 * Function that should be called by the transport plugin
248 * whenever a message is received. If this field is "NULL", 248 * whenever a message is received. If this field is "NULL",
249 * the plugin should load in 'stub' mode and NOT fully 249 * the plugin should load in 'stub' mode and NOT fully
250 * initialize and instead only return an API with the 250 * initialize and instead only return an API with the
251 * 'address_pretty_printer', 'address_to_string' and 251 * 'address_pretty_printer', 'address_to_string' and
252 * 'string_to_address' functions. 252 * 'string_to_address' functions.
253 */ 253 */
diff --git a/src/include/gnunet_tun_lib.h b/src/include/gnunet_tun_lib.h
index ff24cb542..17cec8d12 100644
--- a/src/include/gnunet_tun_lib.h
+++ b/src/include/gnunet_tun_lib.h
@@ -62,12 +62,12 @@ GNUNET_NETWORK_STRUCT_BEGIN
62 62
63/** 63/**
64 * Header from Linux TUN interface. 64 * Header from Linux TUN interface.
65 */ 65 */
66struct GNUNET_TUN_Layer2PacketHeader 66struct GNUNET_TUN_Layer2PacketHeader
67{ 67{
68 /** 68 /**
69 * Some flags (unused). 69 * Some flags (unused).
70 */ 70 */
71 uint16_t flags GNUNET_PACKED; 71 uint16_t flags GNUNET_PACKED;
72 72
73 /** 73 /**
@@ -97,7 +97,7 @@ struct GNUNET_TUN_IPv4Header
97 * Length of the packet, including this header. 97 * Length of the packet, including this header.
98 */ 98 */
99 uint16_t total_length GNUNET_PACKED; 99 uint16_t total_length GNUNET_PACKED;
100 100
101 /** 101 /**
102 * Unique random ID for matching up fragments. 102 * Unique random ID for matching up fragments.
103 */ 103 */
@@ -124,12 +124,12 @@ struct GNUNET_TUN_IPv4Header
124 124
125 /** 125 /**
126 * Origin of the packet. 126 * Origin of the packet.
127 */ 127 */
128 struct in_addr source_address GNUNET_PACKED; 128 struct in_addr source_address GNUNET_PACKED;
129 129
130 /** 130 /**
131 * Destination of the packet. 131 * Destination of the packet.
132 */ 132 */
133 struct in_addr destination_address GNUNET_PACKED; 133 struct in_addr destination_address GNUNET_PACKED;
134} GNUNET_GCC_STRUCT_LAYOUT; 134} GNUNET_GCC_STRUCT_LAYOUT;
135 135
@@ -168,12 +168,12 @@ struct GNUNET_TUN_IPv6Header
168 168
169 /** 169 /**
170 * Origin of the packet. 170 * Origin of the packet.
171 */ 171 */
172 struct in6_addr source_address GNUNET_PACKED; 172 struct in6_addr source_address GNUNET_PACKED;
173 173
174 /** 174 /**
175 * Destination of the packet. 175 * Destination of the packet.
176 */ 176 */
177 struct in6_addr destination_address GNUNET_PACKED; 177 struct in6_addr destination_address GNUNET_PACKED;
178} GNUNET_GCC_STRUCT_LAYOUT; 178} GNUNET_GCC_STRUCT_LAYOUT;
179 179
@@ -222,7 +222,7 @@ struct GNUNET_TUN_TcpHeader
222 unsigned int reserved : 4 GNUNET_PACKED; 222 unsigned int reserved : 4 GNUNET_PACKED;
223#else 223#else
224 #error byteorder undefined 224 #error byteorder undefined
225#endif 225#endif
226 226
227 /** 227 /**
228 * Flags (SYN, FIN, ACK, etc.) 228 * Flags (SYN, FIN, ACK, etc.)
@@ -316,108 +316,108 @@ struct GNUNET_TUN_DnsFlags
316 /** 316 /**
317 * Set to 1 if recursion is desired (client -> server) 317 * Set to 1 if recursion is desired (client -> server)
318 */ 318 */
319 unsigned int recursion_desired : 1 GNUNET_PACKED; 319 unsigned int recursion_desired : 1 GNUNET_PACKED;
320 320
321 /** 321 /**
322 * Set to 1 if message is truncated 322 * Set to 1 if message is truncated
323 */ 323 */
324 unsigned int message_truncated : 1 GNUNET_PACKED; 324 unsigned int message_truncated : 1 GNUNET_PACKED;
325 325
326 /** 326 /**
327 * Set to 1 if this is an authoritative answer 327 * Set to 1 if this is an authoritative answer
328 */ 328 */
329 unsigned int authoritative_answer : 1 GNUNET_PACKED; 329 unsigned int authoritative_answer : 1 GNUNET_PACKED;
330 330
331 /** 331 /**
332 * See GNUNET_TUN_DNS_OPCODE_ defines. 332 * See GNUNET_TUN_DNS_OPCODE_ defines.
333 */ 333 */
334 unsigned int opcode : 4 GNUNET_PACKED; 334 unsigned int opcode : 4 GNUNET_PACKED;
335 335
336 /** 336 /**
337 * query:0, response:1 337 * query:0, response:1
338 */ 338 */
339 unsigned int query_or_response : 1 GNUNET_PACKED; 339 unsigned int query_or_response : 1 GNUNET_PACKED;
340 340
341 /** 341 /**
342 * See GNUNET_TUN_DNS_RETURN_CODE_ defines. 342 * See GNUNET_TUN_DNS_RETURN_CODE_ defines.
343 */ 343 */
344 unsigned int return_code : 4 GNUNET_PACKED; 344 unsigned int return_code : 4 GNUNET_PACKED;
345 345
346 /** 346 /**
347 * See RFC 4035. 347 * See RFC 4035.
348 */ 348 */
349 unsigned int checking_disabled : 1 GNUNET_PACKED; 349 unsigned int checking_disabled : 1 GNUNET_PACKED;
350 350
351 /** 351 /**
352 * Response has been cryptographically verified, RFC 4035. 352 * Response has been cryptographically verified, RFC 4035.
353 */ 353 */
354 unsigned int authenticated_data : 1 GNUNET_PACKED; 354 unsigned int authenticated_data : 1 GNUNET_PACKED;
355 355
356 /** 356 /**
357 * Always zero. 357 * Always zero.
358 */ 358 */
359 unsigned int zero : 1 GNUNET_PACKED; 359 unsigned int zero : 1 GNUNET_PACKED;
360 360
361 /** 361 /**
362 * Set to 1 if recursion is available (server -> client) 362 * Set to 1 if recursion is available (server -> client)
363 */ 363 */
364 unsigned int recursion_available : 1 GNUNET_PACKED; 364 unsigned int recursion_available : 1 GNUNET_PACKED;
365#elif __BYTE_ORDER == __BIG_ENDIAN 365#elif __BYTE_ORDER == __BIG_ENDIAN
366 366
367 /** 367 /**
368 * query:0, response:1 368 * query:0, response:1
369 */ 369 */
370 unsigned int query_or_response : 1 GNUNET_PACKED; 370 unsigned int query_or_response : 1 GNUNET_PACKED;
371 371
372 /** 372 /**
373 * See GNUNET_TUN_DNS_OPCODE_ defines. 373 * See GNUNET_TUN_DNS_OPCODE_ defines.
374 */ 374 */
375 unsigned int opcode : 4 GNUNET_PACKED; 375 unsigned int opcode : 4 GNUNET_PACKED;
376 376
377 /** 377 /**
378 * Set to 1 if this is an authoritative answer 378 * Set to 1 if this is an authoritative answer
379 */ 379 */
380 unsigned int authoritative_answer : 1 GNUNET_PACKED; 380 unsigned int authoritative_answer : 1 GNUNET_PACKED;
381 381
382 /** 382 /**
383 * Set to 1 if message is truncated 383 * Set to 1 if message is truncated
384 */ 384 */
385 unsigned int message_truncated : 1 GNUNET_PACKED; 385 unsigned int message_truncated : 1 GNUNET_PACKED;
386 386
387 /** 387 /**
388 * Set to 1 if recursion is desired (client -> server) 388 * Set to 1 if recursion is desired (client -> server)
389 */ 389 */
390 unsigned int recursion_desired : 1 GNUNET_PACKED; 390 unsigned int recursion_desired : 1 GNUNET_PACKED;
391
391 392
392
393 /** 393 /**
394 * Set to 1 if recursion is available (server -> client) 394 * Set to 1 if recursion is available (server -> client)
395 */ 395 */
396 unsigned int recursion_available : 1 GNUNET_PACKED; 396 unsigned int recursion_available : 1 GNUNET_PACKED;
397 397
398 /** 398 /**
399 * Always zero. 399 * Always zero.
400 */ 400 */
401 unsigned int zero : 1 GNUNET_PACKED; 401 unsigned int zero : 1 GNUNET_PACKED;
402 402
403 /** 403 /**
404 * Response has been cryptographically verified, RFC 4035. 404 * Response has been cryptographically verified, RFC 4035.
405 */ 405 */
406 unsigned int authenticated_data : 1 GNUNET_PACKED; 406 unsigned int authenticated_data : 1 GNUNET_PACKED;
407 407
408 /** 408 /**
409 * See RFC 4035. 409 * See RFC 4035.
410 */ 410 */
411 unsigned int checking_disabled : 1 GNUNET_PACKED; 411 unsigned int checking_disabled : 1 GNUNET_PACKED;
412 412
413 /** 413 /**
414 * See GNUNET_TUN_DNS_RETURN_CODE_ defines. 414 * See GNUNET_TUN_DNS_RETURN_CODE_ defines.
415 */ 415 */
416 unsigned int return_code : 4 GNUNET_PACKED; 416 unsigned int return_code : 4 GNUNET_PACKED;
417#else 417#else
418 #error byteorder undefined 418 #error byteorder undefined
419#endif 419#endif
420 420
421} GNUNET_GCC_STRUCT_LAYOUT; 421} GNUNET_GCC_STRUCT_LAYOUT;
422 422
423 423
@@ -468,18 +468,18 @@ struct GNUNET_TUN_DnsSoaRecord
468 * The version number of the original copy of the zone. (NBO) 468 * The version number of the original copy of the zone. (NBO)
469 */ 469 */
470 uint32_t serial GNUNET_PACKED; 470 uint32_t serial GNUNET_PACKED;
471 471
472 /** 472 /**
473 * Time interval before the zone should be refreshed. (NBO) 473 * Time interval before the zone should be refreshed. (NBO)
474 */ 474 */
475 uint32_t refresh GNUNET_PACKED; 475 uint32_t refresh GNUNET_PACKED;
476 476
477 /** 477 /**
478 * Time interval that should elapse before a failed refresh should 478 * Time interval that should elapse before a failed refresh should
479 * be retried. (NBO) 479 * be retried. (NBO)
480 */ 480 */
481 uint32_t retry GNUNET_PACKED; 481 uint32_t retry GNUNET_PACKED;
482 482
483 /** 483 /**
484 * Time value that specifies the upper limit on the time interval 484 * Time value that specifies the upper limit on the time interval
485 * that can elapse before the zone is no longer authoritative. (NBO) 485 * that can elapse before the zone is no longer authoritative. (NBO)
@@ -654,12 +654,12 @@ struct GNUNET_TUN_DnsRecordLine
654 */ 654 */
655struct GNUNET_TUN_IcmpHeader { 655struct GNUNET_TUN_IcmpHeader {
656 uint8_t type; 656 uint8_t type;
657 uint8_t code; 657 uint8_t code;
658 uint16_t crc GNUNET_PACKED; 658 uint16_t crc GNUNET_PACKED;
659 659
660 union { 660 union {
661 /** 661 /**
662 * ICMP Echo (request/reply) 662 * ICMP Echo (request/reply)
663 */ 663 */
664 struct { 664 struct {
665 uint16_t identifier GNUNET_PACKED; 665 uint16_t identifier GNUNET_PACKED;
@@ -667,7 +667,7 @@ struct GNUNET_TUN_IcmpHeader {
667 } echo; 667 } echo;
668 668
669 /** 669 /**
670 * ICMP Destination Unreachable (RFC 1191) 670 * ICMP Destination Unreachable (RFC 1191)
671 */ 671 */
672 struct ih_pmtu { 672 struct ih_pmtu {
673 uint16_t empty GNUNET_PACKED; 673 uint16_t empty GNUNET_PACKED;
@@ -676,7 +676,7 @@ struct GNUNET_TUN_IcmpHeader {
676 } destination_unreachable; 676 } destination_unreachable;
677 677
678 /** 678 /**
679 * ICMP Redirect 679 * ICMP Redirect
680 */ 680 */
681 struct in_addr redirect_gateway_address GNUNET_PACKED; 681 struct in_addr redirect_gateway_address GNUNET_PACKED;
682 682
diff --git a/src/include/gnunet_vpn_service.h b/src/include/gnunet_vpn_service.h
index fe21cff9b..c3f27fdce 100644
--- a/src/include/gnunet_vpn_service.h
+++ b/src/include/gnunet_vpn_service.h
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file include/gnunet_vpn_service.h 22 * @file include/gnunet_vpn_service.h
23 * @brief API to access the VPN service. 23 * @brief API to access the VPN service.
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#ifndef GNUNET_VPN_SERVICE_H 26#ifndef GNUNET_VPN_SERVICE_H
@@ -50,7 +50,7 @@ struct GNUNET_VPN_RedirectionRequest;
50 * will match 'result_af' from the request 50 * will match 'result_af' from the request
51 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af') 51 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af')
52 * that the VPN allocated for the redirection; 52 * that the VPN allocated for the redirection;
53 * traffic to this IP will now be redirected to the 53 * traffic to this IP will now be redirected to the
54 * specified target peer; NULL on error 54 * specified target peer; NULL on error
55 */ 55 */
56typedef void (*GNUNET_VPN_AllocationCallback)(void *cls, 56typedef void (*GNUNET_VPN_AllocationCallback)(void *cls,
@@ -124,7 +124,7 @@ GNUNET_VPN_redirect_to_peer (struct GNUNET_VPN_Handle *vh,
124 * anyway) 124 * anyway)
125 */ 125 */
126struct GNUNET_VPN_RedirectionRequest * 126struct GNUNET_VPN_RedirectionRequest *
127GNUNET_VPN_redirect_to_ip (struct GNUNET_VPN_Handle *vh, 127GNUNET_VPN_redirect_to_ip (struct GNUNET_VPN_Handle *vh,
128 int result_af, 128 int result_af,
129 int addr_af, 129 int addr_af,
130 const void *addr, 130 const void *addr,
@@ -137,7 +137,7 @@ GNUNET_VPN_redirect_to_ip (struct GNUNET_VPN_Handle *vh,
137 * Connect to the VPN service 137 * Connect to the VPN service
138 * 138 *
139 * @param cfg configuration to use 139 * @param cfg configuration to use
140 * @return VPN handle 140 * @return VPN handle
141 */ 141 */
142struct GNUNET_VPN_Handle * 142struct GNUNET_VPN_Handle *
143GNUNET_VPN_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); 143GNUNET_VPN_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
diff --git a/src/include/tap-windows.h b/src/include/tap-windows.h
index b97e22e26..4df4034a3 100644
--- a/src/include/tap-windows.h
+++ b/src/include/tap-windows.h
@@ -1,80 +1,80 @@
1/* 1/*
2 * TAP-Windows -- A kernel driver to provide virtual tap 2 * TAP-Windows -- A kernel driver to provide virtual tap
3 * device functionality on Windows. 3 * device functionality on Windows.
4 * 4 *
5 * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. 5 * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
6 * 6 *
7 * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., 7 * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
8 * and is released under the GPL version 2 (see below). 8 * and is released under the GPL version 2 (see below).
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation. 12 * as published by the Free Software Foundation.
13 * 13 *
14 * This program is distributed in the hope that it will be useful, 14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details. 17 * GNU General Public License for more details.
18 * 18 *
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program (see the file COPYING included with this 20 * along with this program (see the file COPYING included with this
21 * distribution); if not, write to the Free Software Foundation, Inc., 21 * distribution); if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */ 23 */
24/** 24/**
25 * @file include/tap-windows.h 25 * @file include/tap-windows.h
26 * @brief TAP32 virtual network driver defines 26 * @brief TAP32 virtual network driver defines
27 * @attention This file is part of openvpn and for kept 27 * @attention This file is part of openvpn and for kept
28 * as a separate file to allow easier upgrading. 28 * as a separate file to allow easier upgrading.
29 */ 29 */
30#ifndef __TAP_WIN_H 30#ifndef __TAP_WIN_H
31#define __TAP_WIN_H 31#define __TAP_WIN_H
32 32
33/* 33/*
34 * ============= 34 * =============
35 * TAP IOCTLs 35 * TAP IOCTLs
36 * ============= 36 * =============
37 */ 37 */
38 38
39#define TAP_WIN_CONTROL_CODE(request,method) \ 39#define TAP_WIN_CONTROL_CODE(request,method) \
40 CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) 40 CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS)
41 41
42/* Present in 8.1 */ 42/* Present in 8.1 */
43 43
44#define TAP_WIN_IOCTL_GET_MAC TAP_WIN_CONTROL_CODE (1, METHOD_BUFFERED) 44#define TAP_WIN_IOCTL_GET_MAC TAP_WIN_CONTROL_CODE (1, METHOD_BUFFERED)
45#define TAP_WIN_IOCTL_GET_VERSION TAP_WIN_CONTROL_CODE (2, METHOD_BUFFERED) 45#define TAP_WIN_IOCTL_GET_VERSION TAP_WIN_CONTROL_CODE (2, METHOD_BUFFERED)
46#define TAP_WIN_IOCTL_GET_MTU TAP_WIN_CONTROL_CODE (3, METHOD_BUFFERED) 46#define TAP_WIN_IOCTL_GET_MTU TAP_WIN_CONTROL_CODE (3, METHOD_BUFFERED)
47#define TAP_WIN_IOCTL_GET_INFO TAP_WIN_CONTROL_CODE (4, METHOD_BUFFERED) 47#define TAP_WIN_IOCTL_GET_INFO TAP_WIN_CONTROL_CODE (4, METHOD_BUFFERED)
48#define TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT TAP_WIN_CONTROL_CODE (5, METHOD_BUFFERED) 48#define TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT TAP_WIN_CONTROL_CODE (5, METHOD_BUFFERED)
49#define TAP_WIN_IOCTL_SET_MEDIA_STATUS TAP_WIN_CONTROL_CODE (6, METHOD_BUFFERED) 49#define TAP_WIN_IOCTL_SET_MEDIA_STATUS TAP_WIN_CONTROL_CODE (6, METHOD_BUFFERED)
50#define TAP_WIN_IOCTL_CONFIG_DHCP_MASQ TAP_WIN_CONTROL_CODE (7, METHOD_BUFFERED) 50#define TAP_WIN_IOCTL_CONFIG_DHCP_MASQ TAP_WIN_CONTROL_CODE (7, METHOD_BUFFERED)
51#define TAP_WIN_IOCTL_GET_LOG_LINE TAP_WIN_CONTROL_CODE (8, METHOD_BUFFERED) 51#define TAP_WIN_IOCTL_GET_LOG_LINE TAP_WIN_CONTROL_CODE (8, METHOD_BUFFERED)
52#define TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT TAP_WIN_CONTROL_CODE (9, METHOD_BUFFERED) 52#define TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT TAP_WIN_CONTROL_CODE (9, METHOD_BUFFERED)
53 53
54/* Added in 8.2 */ 54/* Added in 8.2 */
55 55
56/* obsoletes TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT */ 56/* obsoletes TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT */
57#define TAP_WIN_IOCTL_CONFIG_TUN TAP_WIN_CONTROL_CODE (10, METHOD_BUFFERED) 57#define TAP_WIN_IOCTL_CONFIG_TUN TAP_WIN_CONTROL_CODE (10, METHOD_BUFFERED)
58 58
59/* 59/*
60 * ================= 60 * =================
61 * Registry keys 61 * Registry keys
62 * ================= 62 * =================
63 */ 63 */
64 64
65#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" 65#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
66 66
67#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}" 67#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
68 68
69/* 69/*
70 * ====================== 70 * ======================
71 * Filesystem prefixes 71 * Filesystem prefixes
72 * ====================== 72 * ======================
73 */ 73 */
74 74
75#define USERMODEDEVICEDIR "\\\\.\\Global\\" 75#define USERMODEDEVICEDIR "\\\\.\\Global\\"
76#define SYSDEVICEDIR "\\Device\\" 76#define SYSDEVICEDIR "\\Device\\"
77#define USERDEVICEDIR "\\DosDevices\\Global\\" 77#define USERDEVICEDIR "\\DosDevices\\Global\\"
78#define TAP_WIN_SUFFIX ".tap" 78#define TAP_WIN_SUFFIX ".tap"
79 79
80#endif 80#endif
diff --git a/src/integration-tests/connection_watchdog.c b/src/integration-tests/connection_watchdog.c
index a012c0f22..888f38ef5 100644
--- a/src/integration-tests/connection_watchdog.c
+++ b/src/integration-tests/connection_watchdog.c
@@ -117,7 +117,7 @@ static struct TransportPlugin *phead;
117static struct TransportPlugin *ptail; 117static struct TransportPlugin *ptail;
118 118
119 119
120static int 120static int
121map_check_it (void *cls, 121map_check_it (void *cls,
122 const struct GNUNET_PeerIdentity * key, 122 const struct GNUNET_PeerIdentity * key,
123 void *value) 123 void *value)
@@ -138,7 +138,7 @@ map_check_it (void *cls,
138} 138}
139 139
140 140
141static int 141static int
142map_cleanup_it (void *cls, 142map_cleanup_it (void *cls,
143 const struct GNUNET_PeerIdentity * key, 143 const struct GNUNET_PeerIdentity * key,
144 void *value) 144 void *value)
@@ -216,7 +216,7 @@ check_lowlevel_connections (int port, int protocol)
216 char line[1024]; 216 char line[1024];
217 int count = -1; 217 int count = -1;
218 218
219 switch (protocol) 219 switch (protocol)
220 { 220 {
221 case tcp: 221 case tcp:
222#ifdef MINGW 222#ifdef MINGW
@@ -292,7 +292,7 @@ find_plugin (char * name)
292 return cur; 292 return cur;
293} 293}
294 294
295static int 295static int
296stats_check_cb (void *cls, const char *subsystem, 296stats_check_cb (void *cls, const char *subsystem,
297 const char *name, uint64_t value, 297 const char *name, uint64_t value,
298 int is_persistent) 298 int is_persistent)
@@ -412,33 +412,33 @@ struct PONG
412GNUNET_NETWORK_STRUCT_END 412GNUNET_NETWORK_STRUCT_END
413 413
414 414
415static size_t 415static size_t
416send_transport_ping_cb (void *cls, size_t size, void *buf) 416send_transport_ping_cb (void *cls, size_t size, void *buf)
417{ 417{
418 struct PeerContainer * pc = cls; 418 struct PeerContainer * pc = cls;
419 struct PING ping; 419 struct PING ping;
420 size_t mlen = sizeof (struct PING); 420 size_t mlen = sizeof (struct PING);
421 421
422 if (size < mlen) 422 if (size < mlen)
423 { 423 {
424 GNUNET_break (0); 424 GNUNET_break (0);
425 return 0; 425 return 0;
426 } 426 }
427 427
428 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 428 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
429 "Sending transport ping to `%s'\n", GNUNET_i2s (&pc->id)); 429 "Sending transport ping to `%s'\n", GNUNET_i2s (&pc->id));
430 ping.header.size = htons (mlen); 430 ping.header.size = htons (mlen);
431 ping.header.type = htons (1234); 431 ping.header.type = htons (1234);
432 ping.src = htons (0); 432 ping.src = htons (0);
433 433
434 pc->th_ping = NULL; 434 pc->th_ping = NULL;
435 435
436 memcpy (buf, &ping, mlen); 436 memcpy (buf, &ping, mlen);
437 return mlen; 437 return mlen;
438} 438}
439 439
440 440
441static size_t 441static size_t
442send_core_ping_cb (void *cls, size_t size, void *buf) 442send_core_ping_cb (void *cls, size_t size, void *buf)
443{ 443{
444 struct PeerContainer * pc = cls; 444 struct PeerContainer * pc = cls;
@@ -450,21 +450,21 @@ send_core_ping_cb (void *cls, size_t size, void *buf)
450 GNUNET_break (0); 450 GNUNET_break (0);
451 return 0; 451 return 0;
452 } 452 }
453 453
454 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 454 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
455 "Sending core ping to `%s'\n", GNUNET_i2s (&pc->id)); 455 "Sending core ping to `%s'\n", GNUNET_i2s (&pc->id));
456 ping.header.size = htons (mlen); 456 ping.header.size = htons (mlen);
457 ping.header.type = htons (1234); 457 ping.header.type = htons (1234);
458 ping.src = htons (1); 458 ping.src = htons (1);
459 459
460 pc->ch_ping = NULL; 460 pc->ch_ping = NULL;
461 461
462 memcpy (buf, &ping, mlen); 462 memcpy (buf, &ping, mlen);
463 return mlen; 463 return mlen;
464} 464}
465 465
466 466
467static int 467static int
468map_ping_it (void *cls, 468map_ping_it (void *cls,
469 const struct GNUNET_PeerIdentity * key, 469 const struct GNUNET_PeerIdentity * key,
470 void *value) 470 void *value)
@@ -522,7 +522,7 @@ stats_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
522} 522}
523 523
524 524
525static size_t 525static size_t
526send_transport_pong_cb (void *cls, size_t size, void *buf) 526send_transport_pong_cb (void *cls, size_t size, void *buf)
527{ 527{
528 struct PeerContainer * pc = cls; 528 struct PeerContainer * pc = cls;
@@ -548,27 +548,27 @@ send_transport_pong_cb (void *cls, size_t size, void *buf)
548} 548}
549 549
550 550
551static size_t 551static size_t
552send_core_pong_cb (void *cls, size_t size, void *buf) 552send_core_pong_cb (void *cls, size_t size, void *buf)
553{ 553{
554 struct PeerContainer * pc = cls; 554 struct PeerContainer * pc = cls;
555 struct PING ping; 555 struct PING ping;
556 size_t mlen = sizeof (struct PING); 556 size_t mlen = sizeof (struct PING);
557 557
558 if (size < mlen) 558 if (size < mlen)
559 { 559 {
560 GNUNET_break (0); 560 GNUNET_break (0);
561 return 0; 561 return 0;
562 } 562 }
563 563
564 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 564 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
565 "Sending core pong to `%s'\n", GNUNET_i2s (&pc->id)); 565 "Sending core pong to `%s'\n", GNUNET_i2s (&pc->id));
566 ping.header.size = htons (mlen); 566 ping.header.size = htons (mlen);
567 ping.header.type = htons (4321); 567 ping.header.type = htons (4321);
568 ping.src = htons (1); 568 ping.src = htons (1);
569 569
570 pc->ch_pong = NULL; 570 pc->ch_pong = NULL;
571 571
572 memcpy (buf, &ping, mlen); 572 memcpy (buf, &ping, mlen);
573 return mlen; 573 return mlen;
574} 574}
@@ -768,7 +768,7 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
768 768
769 if (NULL != ch) 769 if (NULL != ch)
770 { 770 {
771 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 771 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
772 "Disconnecting from core service\n"); 772 "Disconnecting from core service\n");
773 GNUNET_CORE_disconnect (ch); 773 GNUNET_CORE_disconnect (ch);
774 ch = NULL; 774 ch = NULL;
@@ -822,9 +822,9 @@ transport_notify_disconnect_cb (void *cls,
822 const struct GNUNET_PeerIdentity *peer) 822 const struct GNUNET_PeerIdentity *peer)
823{ 823{
824 GNUNET_assert (transport_connections > 0); 824 GNUNET_assert (transport_connections > 0);
825 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 825 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
826 "TRANSPORT disconnect for peer `%s' (%u total)\n", 826 "TRANSPORT disconnect for peer `%s' (%u total)\n",
827 GNUNET_i2s (peer), 827 GNUNET_i2s (peer),
828 transport_connections); 828 transport_connections);
829 map_disconnect (peer, th); 829 map_disconnect (peer, th);
830 transport_connections --; 830 transport_connections --;
@@ -851,7 +851,7 @@ transport_notify_receive_cb (void *cls,
851 if ((message->size == ntohs (sizeof (struct PING))) && 851 if ((message->size == ntohs (sizeof (struct PING))) &&
852 (message->type == ntohs (1234))) 852 (message->type == ntohs (1234)))
853 { 853 {
854 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 854 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
855 "Received %s %s from peer `%s'\n", 855 "Received %s %s from peer `%s'\n",
856 "TRANSPORT", 856 "TRANSPORT",
857 "PING", 857 "PING",
@@ -877,7 +877,7 @@ transport_notify_receive_cb (void *cls,
877 } 877 }
878} 878}
879 879
880static int 880static int
881core_notify_receive_cb (void *cls, 881core_notify_receive_cb (void *cls,
882 const struct GNUNET_PeerIdentity * peer, 882 const struct GNUNET_PeerIdentity * peer,
883 const struct GNUNET_MessageHeader * message) 883 const struct GNUNET_MessageHeader * message)
@@ -970,7 +970,7 @@ core_disconnect_cb (void *cls,
970 970
971 971
972static void 972static void
973core_init_cb (void *cls, 973core_init_cb (void *cls,
974 const struct GNUNET_PeerIdentity *my_identity) 974 const struct GNUNET_PeerIdentity *my_identity)
975{ 975{
976 my_peer_id = *my_identity; 976 my_peer_id = *my_identity;
diff --git a/src/mesh/gnunet-mesh.c b/src/mesh/gnunet-mesh.c
index aaa099774..440dc272d 100644
--- a/src/mesh/gnunet-mesh.c
+++ b/src/mesh/gnunet-mesh.c
@@ -95,7 +95,7 @@ tunnels_callback (void *cls,
95 * @param cls Closure. 95 * @param cls Closure.
96 * @param peer Peer in the tunnel's tree. 96 * @param peer Peer in the tunnel's tree.
97 * @param parent Parent of the current peer. All 0 when peer is root. 97 * @param parent Parent of the current peer. All 0 when peer is root.
98 * 98 *
99 */ 99 */
100static void 100static void
101tunnel_callback (void *cls, 101tunnel_callback (void *cls,
diff --git a/src/mesh/gnunet-service-mesh-enc.c b/src/mesh/gnunet-service-mesh-enc.c
index 18b6460b7..be72963c3 100644
--- a/src/mesh/gnunet-service-mesh-enc.c
+++ b/src/mesh/gnunet-service-mesh-enc.c
@@ -33,7 +33,7 @@
33 * - relay corking down to core 33 * - relay corking down to core
34 * - set ttl relative to path length 34 * - set ttl relative to path length
35 * TODO END 35 * TODO END
36 * 36 *
37 * Dictionary: 37 * Dictionary:
38 * - peer: other mesh instance. If there is direct connection it's a neighbor. 38 * - peer: other mesh instance. If there is direct connection it's a neighbor.
39 * - tunnel: encrypted connection to a peer, neighbor or not. 39 * - tunnel: encrypted connection to a peer, neighbor or not.
@@ -409,7 +409,7 @@ tunnel_notify_connection_broken (struct MeshTunnel2 *t,
409 * @brief Use the given path for the tunnel. 409 * @brief Use the given path for the tunnel.
410 * Update the next and prev hops (and RCs). 410 * Update the next and prev hops (and RCs).
411 * (Re)start the path refresh in case the tunnel is locally owned. 411 * (Re)start the path refresh in case the tunnel is locally owned.
412 * 412 *
413 * @param t Tunnel to update. 413 * @param t Tunnel to update.
414 * @param p Path to use. 414 * @param p Path to use.
415 * 415 *
@@ -420,10 +420,10 @@ tunnel_use_path (struct MeshTunnel2 *t, struct MeshPeerPath *p);
420 420
421/** 421/**
422 * Tunnel is empty: destroy it. 422 * Tunnel is empty: destroy it.
423 * 423 *
424 * Notifies all participants (peers, cleints) about the destruction. 424 * Notifies all participants (peers, cleints) about the destruction.
425 * 425 *
426 * @param t Tunnel to destroy. 426 * @param t Tunnel to destroy.
427 */ 427 */
428static void 428static void
429tunnel_destroy_empty (struct MeshTunnel2 *t); 429tunnel_destroy_empty (struct MeshTunnel2 *t);
@@ -469,7 +469,7 @@ __mesh_divider______________________________________________________________();
469 * 469 *
470 * @param s Tunnel state. 470 * @param s Tunnel state.
471 * 471 *
472 * @return String representation. 472 * @return String representation.
473 */ 473 */
474static const char * 474static const char *
475GNUNET_MESH_DEBUG_TS2S (enum MeshTunnelState s) 475GNUNET_MESH_DEBUG_TS2S (enum MeshTunnelState s)
@@ -640,7 +640,7 @@ tunnel_get_buffer (struct MeshTunnel2 *t, int fwd)
640 640
641 641
642/** 642/**
643 * FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME 643 * FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME
644 * Encrypt data with the tunnel key. 644 * Encrypt data with the tunnel key.
645 * 645 *
646 * @param t Tunnel whose key to use. 646 * @param t Tunnel whose key to use.
@@ -660,7 +660,7 @@ tunnel_encrypt (struct MeshTunnel2 *t,
660 660
661 661
662/** 662/**
663 * FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME 663 * FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME
664 * Decrypt data with the tunnel key. 664 * Decrypt data with the tunnel key.
665 * 665 *
666 * @param t Tunnel whose key to use. 666 * @param t Tunnel whose key to use.
@@ -763,7 +763,7 @@ send_connection_create (struct MeshConnection *connection)
763 * @param fwd Is this a fwd ACK? (First is bck (SYNACK), second is fwd (ACK)) 763 * @param fwd Is this a fwd ACK? (First is bck (SYNACK), second is fwd (ACK))
764 */ 764 */
765static void 765static void
766send_connection_ack (struct MeshConnection *connection, int fwd) 766send_connection_ack (struct MeshConnection *connection, int fwd)
767{ 767{
768 struct MeshTunnel2 *t; 768 struct MeshTunnel2 *t;
769 769
@@ -938,7 +938,7 @@ connection_debug (struct MeshConnection *c)
938 } 938 }
939 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connection %s:%X\n", 939 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connection %s:%X\n",
940 peer2s (c->t->peer), GNUNET_h2s (&c->id)); 940 peer2s (c->t->peer), GNUNET_h2s (&c->id));
941 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " state: %u, pending msgs: %u\n", 941 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " state: %u, pending msgs: %u\n",
942 c->state, c->pending_messages); 942 c->state, c->pending_messages);
943 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " FWD FC\n"); 943 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " FWD FC\n");
944 fc_debug (&c->fwd_fc); 944 fc_debug (&c->fwd_fc);
@@ -1099,8 +1099,8 @@ tunnel_use_path (struct MeshTunnel2 *t, struct MeshPeerPath *p)
1099 * some of its peers. Sends a notification towards the root of the tree. 1099 * some of its peers. Sends a notification towards the root of the tree.
1100 * In case the peer is the owner of the tree, notifies the client that owns 1100 * In case the peer is the owner of the tree, notifies the client that owns
1101 * the tunnel and tries to reconnect. 1101 * the tunnel and tries to reconnect.
1102 * 1102 *
1103 * FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME 1103 * FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME
1104 * 1104 *
1105 * @param t Tunnel affected. 1105 * @param t Tunnel affected.
1106 * @param p1 Peer that got disconnected from p2. 1106 * @param p1 Peer that got disconnected from p2.
@@ -1117,13 +1117,13 @@ tunnel_notify_connection_broken (struct MeshTunnel2* t,
1117// { 1117// {
1118// return; 1118// return;
1119// } 1119// }
1120// 1120//
1121// if (tree_get_predecessor (t->tree) != 0) 1121// if (tree_get_predecessor (t->tree) != 0)
1122// { 1122// {
1123// /* We are the peer still connected, notify owner of the disconnection. */ 1123// /* We are the peer still connected, notify owner of the disconnection. */
1124// struct GNUNET_MESH_PathBroken msg; 1124// struct GNUNET_MESH_PathBroken msg;
1125// struct GNUNET_PeerIdentity neighbor; 1125// struct GNUNET_PeerIdentity neighbor;
1126// 1126//
1127// msg.header.size = htons (sizeof (msg)); 1127// msg.header.size = htons (sizeof (msg));
1128// msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_BROKEN); 1128// msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_BROKEN);
1129// GNUNET_PEER_resolve (t->id.oid, &msg.oid); 1129// GNUNET_PEER_resolve (t->id.oid, &msg.oid);
@@ -1184,7 +1184,7 @@ send_ack (struct MeshConnection *c, struct MeshChannel *ch, int fwd)
1184 GNUNET_assert (NULL != ch); 1184 GNUNET_assert (NULL != ch);
1185 channel_send_connections_ack (ch, buffer, fwd); 1185 channel_send_connections_ack (ch, buffer, fwd);
1186 } 1186 }
1187 else 1187 else
1188 { 1188 {
1189 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending on connection\n"); 1189 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending on connection\n");
1190 connection_send_ack (c, buffer, fwd); 1190 connection_send_ack (c, buffer, fwd);
@@ -1358,7 +1358,7 @@ tunnel_destroy (struct MeshTunnel2 *t)
1358 * 1358 *
1359 * Notifies all connections about the destruction. 1359 * Notifies all connections about the destruction.
1360 * 1360 *
1361 * @param t Tunnel to destroy. 1361 * @param t Tunnel to destroy.
1362 */ 1362 */
1363static void 1363static void
1364tunnel_destroy_empty (struct MeshTunnel2 *t) 1364tunnel_destroy_empty (struct MeshTunnel2 *t)
@@ -1910,7 +1910,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1910 pk = GNUNET_CRYPTO_ecc_key_create_from_configuration (c); 1910 pk = GNUNET_CRYPTO_ecc_key_create_from_configuration (c);
1911 GNUNET_assert (NULL != pk); 1911 GNUNET_assert (NULL != pk);
1912 my_private_key = pk; 1912 my_private_key = pk;
1913 GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, 1913 GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key,
1914 &my_full_id.public_key); 1914 &my_full_id.public_key);
1915 myid = GNUNET_PEER_intern (&my_full_id); 1915 myid = GNUNET_PEER_intern (&my_full_id);
1916 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1916 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 422e5af1f..afa64f1fd 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -511,7 +511,7 @@ struct MeshTunnel
511 511
512/** 512/**
513 * Struct containing information about a client of the service 513 * Struct containing information about a client of the service
514 * 514 *
515 * TODO: add a list of 'waiting' ports 515 * TODO: add a list of 'waiting' ports
516 */ 516 */
517struct MeshClient 517struct MeshClient
@@ -626,7 +626,7 @@ static unsigned long long dht_replication_level;
626static unsigned long long max_tunnels; 626static unsigned long long max_tunnels;
627 627
628/** 628/**
629 * How many messages *in total* are we willing to queue, divided by number of 629 * How many messages *in total* are we willing to queue, divided by number of
630 * tunnels to get tunnel queue size. 630 * tunnels to get tunnel queue size.
631 */ 631 */
632static unsigned long long max_msgs_queue; 632static unsigned long long max_msgs_queue;
@@ -879,7 +879,7 @@ tunnel_bck_keepalive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
879 * @brief Use the given path for the tunnel. 879 * @brief Use the given path for the tunnel.
880 * Update the next and prev hops (and RCs). 880 * Update the next and prev hops (and RCs).
881 * (Re)start the path refresh in case the tunnel is locally owned. 881 * (Re)start the path refresh in case the tunnel is locally owned.
882 * 882 *
883 * @param t Tunnel to update. 883 * @param t Tunnel to update.
884 * @param p Path to use. 884 * @param p Path to use.
885 */ 885 */
@@ -888,10 +888,10 @@ tunnel_use_path (struct MeshTunnel *t, struct MeshPeerPath *p);
888 888
889/** 889/**
890 * Tunnel is empty: destroy it. 890 * Tunnel is empty: destroy it.
891 * 891 *
892 * Notifies all participants (peers, cleints) about the destruction. 892 * Notifies all participants (peers, cleints) about the destruction.
893 * 893 *
894 * @param t Tunnel to destroy. 894 * @param t Tunnel to destroy.
895 */ 895 */
896static void 896static void
897tunnel_destroy_empty (struct MeshTunnel *t); 897tunnel_destroy_empty (struct MeshTunnel *t);
@@ -915,12 +915,12 @@ tunnel_destroy (struct MeshTunnel *t);
915 915
916/** 916/**
917 * @brief Queue and pass message to core when possible. 917 * @brief Queue and pass message to core when possible.
918 * 918 *
919 * If type is payload (UNICAST, TO_ORIGIN, MULTICAST) checks for queue status 919 * If type is payload (UNICAST, TO_ORIGIN, MULTICAST) checks for queue status
920 * and accounts for it. In case the queue is full, the message is dropped and 920 * and accounts for it. In case the queue is full, the message is dropped and
921 * a break issued. 921 * a break issued.
922 * 922 *
923 * Otherwise, message is treated as internal and allowed to go regardless of 923 * Otherwise, message is treated as internal and allowed to go regardless of
924 * queue status. 924 * queue status.
925 * 925 *
926 * @param cls Closure (@c type dependant). It will be used by queue_send to 926 * @param cls Closure (@c type dependant). It will be used by queue_send to
@@ -1169,7 +1169,7 @@ send_local_tunnel_destroy (struct MeshTunnel *t, int fwd)
1169 1169
1170/** 1170/**
1171 * Build a local ACK message and send it to a local client. 1171 * Build a local ACK message and send it to a local client.
1172 * 1172 *
1173 * @param t Tunnel on which to send the ACK. 1173 * @param t Tunnel on which to send the ACK.
1174 * @param c Client to whom send the ACK. 1174 * @param c Client to whom send the ACK.
1175 * @param is_fwd Set to GNUNET_YES for FWD ACK (dest->owner) 1175 * @param is_fwd Set to GNUNET_YES for FWD ACK (dest->owner)
@@ -1310,7 +1310,7 @@ send_path_create (struct MeshTunnel *t)
1310 * @param t Tunnel which to confirm. 1310 * @param t Tunnel which to confirm.
1311 */ 1311 */
1312static void 1312static void
1313send_path_ack (struct MeshTunnel *t) 1313send_path_ack (struct MeshTunnel *t)
1314{ 1314{
1315 struct MeshPeer *neighbor; 1315 struct MeshPeer *neighbor;
1316 1316
@@ -1327,7 +1327,7 @@ send_path_ack (struct MeshTunnel *t)
1327 1327
1328/** 1328/**
1329 * Build an ACK message and queue it to send to the given peer. 1329 * Build an ACK message and queue it to send to the given peer.
1330 * 1330 *
1331 * @param t Tunnel on which to send the ACK. 1331 * @param t Tunnel on which to send the ACK.
1332 * @param peer Peer to whom send the ACK. 1332 * @param peer Peer to whom send the ACK.
1333 * @param ack Value of the ACK. 1333 * @param ack Value of the ACK.
@@ -1536,7 +1536,7 @@ peer_get_short (const GNUNET_PEER_Id peer)
1536 * 1536 *
1537 * @param pi Peer we want to poll. 1537 * @param pi Peer we want to poll.
1538 * @param t Tunnel about which we want to poll. 1538 * @param t Tunnel about which we want to poll.
1539 * 1539 *
1540 * @return PID to use, either last sent or first_in_queue - 1 1540 * @return PID to use, either last sent or first_in_queue - 1
1541 */ 1541 */
1542static uint32_t 1542static uint32_t
@@ -1571,7 +1571,7 @@ peer_get_first_payload_pid (struct MeshPeer *p, struct MeshTunnel *t)
1571 1571
1572/** 1572/**
1573 * Choose the best path towards a peer considering the tunnel properties. 1573 * Choose the best path towards a peer considering the tunnel properties.
1574 * 1574 *
1575 * @param peer The destination peer. 1575 * @param peer The destination peer.
1576 * @param t The tunnel the path is for. 1576 * @param t The tunnel the path is for.
1577 * 1577 *
@@ -1626,7 +1626,7 @@ peer_connect (struct MeshPeer *peer, struct MeshTunnel *t)
1626 1626
1627 GNUNET_PEER_resolve (peer->id, &id); 1627 GNUNET_PEER_resolve (peer->id, &id);
1628 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1628 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1629 "Starting DHT GET for peer %s\n", 1629 "Starting DHT GET for peer %s\n",
1630 GNUNET_i2s (&id)); 1630 GNUNET_i2s (&id));
1631 GNUNET_CRYPTO_hash (&id, sizeof (my_full_id), &phash); 1631 GNUNET_CRYPTO_hash (&id, sizeof (my_full_id), &phash);
1632 peer->dhtget = GNUNET_DHT_get_start (dht_handle, /* handle */ 1632 peer->dhtget = GNUNET_DHT_get_start (dht_handle, /* handle */
@@ -1947,7 +1947,7 @@ peer_add_path_to_origin (struct MeshPeer *peer_info,
1947/** 1947/**
1948 * Add a tunnel to the list of tunnels a peer participates in. 1948 * Add a tunnel to the list of tunnels a peer participates in.
1949 * Update the tunnel's destination. 1949 * Update the tunnel's destination.
1950 * 1950 *
1951 * @param p Peer to add to. 1951 * @param p Peer to add to.
1952 * @param t Tunnel to add. 1952 * @param t Tunnel to add.
1953 */ 1953 */
@@ -1968,7 +1968,7 @@ peer_add_tunnel (struct MeshPeer *p, struct MeshTunnel *t)
1968/** 1968/**
1969 * Remove a tunnel from the list of tunnels a peer participates in. 1969 * Remove a tunnel from the list of tunnels a peer participates in.
1970 * Free the tunnel's destination. 1970 * Free the tunnel's destination.
1971 * 1971 *
1972 * @param p Peer to clean. 1972 * @param p Peer to clean.
1973 * @param t Tunnel to remove. 1973 * @param t Tunnel to remove.
1974 */ 1974 */
@@ -2034,7 +2034,7 @@ tunnel_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2034 GNUNET_break (0); 2034 GNUNET_break (0);
2035 return; 2035 return;
2036 } 2036 }
2037 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** peer: %s!\n", 2037 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** peer: %s!\n",
2038 GNUNET_i2s(GNUNET_PEER_resolve2 (peer))); 2038 GNUNET_i2s(GNUNET_PEER_resolve2 (peer)));
2039 if (0 == peer) 2039 if (0 == peer)
2040 { 2040 {
@@ -2274,7 +2274,7 @@ tunnel_change_state (struct MeshTunnel *t, enum MeshTunnelState state)
2274 2274
2275/** 2275/**
2276 * Add a client to a tunnel, initializing all needed data structures. 2276 * Add a client to a tunnel, initializing all needed data structures.
2277 * 2277 *
2278 * @param t Tunnel to which add the client. 2278 * @param t Tunnel to which add the client.
2279 * @param c Client which to add to the tunnel. 2279 * @param c Client which to add to the tunnel.
2280 */ 2280 */
@@ -2368,13 +2368,13 @@ tunnel_notify_connection_broken (struct MeshTunnel *t, GNUNET_PEER_Id p1,
2368// { 2368// {
2369// return; 2369// return;
2370// } 2370// }
2371// 2371//
2372// if (tree_get_predecessor (t->tree) != 0) 2372// if (tree_get_predecessor (t->tree) != 0)
2373// { 2373// {
2374// /* We are the peer still connected, notify owner of the disconnection. */ 2374// /* We are the peer still connected, notify owner of the disconnection. */
2375// struct GNUNET_MESH_PathBroken msg; 2375// struct GNUNET_MESH_PathBroken msg;
2376// struct GNUNET_PeerIdentity neighbor; 2376// struct GNUNET_PeerIdentity neighbor;
2377// 2377//
2378// msg.header.size = htons (sizeof (msg)); 2378// msg.header.size = htons (sizeof (msg));
2379// msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_BROKEN); 2379// msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_BROKEN);
2380// GNUNET_PEER_resolve (t->id.oid, &msg.oid); 2380// GNUNET_PEER_resolve (t->id.oid, &msg.oid);
@@ -2390,7 +2390,7 @@ tunnel_notify_connection_broken (struct MeshTunnel *t, GNUNET_PEER_Id p1,
2390 2390
2391/** 2391/**
2392 * Send an end-to-end FWD ACK message for the most recent in-sequence payload. 2392 * Send an end-to-end FWD ACK message for the most recent in-sequence payload.
2393 * 2393 *
2394 * @param t Tunnel this is about. 2394 * @param t Tunnel this is about.
2395 * @param fwd Is for FWD traffic? (ACK dest->owner) 2395 * @param fwd Is for FWD traffic? (ACK dest->owner)
2396 */ 2396 */
@@ -2447,7 +2447,7 @@ tunnel_send_data_ack (struct MeshTunnel *t, int fwd)
2447 * If buffering is on, send when sent to children and buffer space is free. 2447 * If buffering is on, send when sent to children and buffer space is free.
2448 * Note that although the name is fwd_ack, the FWD mean forward *traffic*, 2448 * Note that although the name is fwd_ack, the FWD mean forward *traffic*,
2449 * the ACK itself goes "back" (towards root). 2449 * the ACK itself goes "back" (towards root).
2450 * 2450 *
2451 * @param t Tunnel on which to send the ACK. 2451 * @param t Tunnel on which to send the ACK.
2452 * @param type Type of message that triggered the ACK transmission. 2452 * @param type Type of message that triggered the ACK transmission.
2453 * @param fwd Is this FWD ACK? (Going dest->owner) 2453 * @param fwd Is this FWD ACK? (Going dest->owner)
@@ -2518,7 +2518,7 @@ tunnel_send_ack (struct MeshTunnel *t, uint16_t type, int fwd)
2518 delta_mid = rel->mid_sent - rel->head_sent->mid; 2518 delta_mid = rel->mid_sent - rel->head_sent->mid;
2519 else 2519 else
2520 delta_mid = 0; 2520 delta_mid = 0;
2521 if (0 > delta || (GNUNET_YES == t->reliable && 2521 if (0 > delta || (GNUNET_YES == t->reliable &&
2522 NULL != o && 2522 NULL != o &&
2523 (10 < rel->n_sent || 64 <= delta_mid))) 2523 (10 < rel->n_sent || 64 <= delta_mid)))
2524 delta = 0; 2524 delta = 0;
@@ -2549,7 +2549,7 @@ tunnel_send_ack (struct MeshTunnel *t, uint16_t type, int fwd)
2549 2549
2550/** 2550/**
2551 * Modify the mesh message TID from global to local and send to client. 2551 * Modify the mesh message TID from global to local and send to client.
2552 * 2552 *
2553 * @param t Tunnel on which to send the message. 2553 * @param t Tunnel on which to send the message.
2554 * @param msg Message to modify and send. 2554 * @param msg Message to modify and send.
2555 * @param c Client to send to. 2555 * @param c Client to send to.
@@ -2585,7 +2585,7 @@ tunnel_send_client_to_tid (struct MeshTunnel *t,
2585 2585
2586/** 2586/**
2587 * Modify the unicast message TID from global to local and send to client. 2587 * Modify the unicast message TID from global to local and send to client.
2588 * 2588 *
2589 * @param t Tunnel on which to send the message. 2589 * @param t Tunnel on which to send the message.
2590 * @param msg Message to modify and send. 2590 * @param msg Message to modify and send.
2591 * @param fwd Forward? 2591 * @param fwd Forward?
@@ -2604,7 +2604,7 @@ tunnel_send_client_data (struct MeshTunnel *t,
2604 2604
2605/** 2605/**
2606 * Send up to 64 buffered messages to the client for in order delivery. 2606 * Send up to 64 buffered messages to the client for in order delivery.
2607 * 2607 *
2608 * @param t Tunnel on which to empty the message buffer. 2608 * @param t Tunnel on which to empty the message buffer.
2609 * @param c Client to send to. 2609 * @param c Client to send to.
2610 * @param rel Reliability structure to corresponding peer. 2610 * @param rel Reliability structure to corresponding peer.
@@ -2650,7 +2650,7 @@ tunnel_send_client_buffered_data (struct MeshTunnel *t, struct MeshClient *c,
2650/** 2650/**
2651 * We have received a message out of order, buffer it until we receive 2651 * We have received a message out of order, buffer it until we receive
2652 * the missing one and we can feed the rest to the client. 2652 * the missing one and we can feed the rest to the client.
2653 * 2653 *
2654 * @param t Tunnel to add to. 2654 * @param t Tunnel to add to.
2655 * @param msg Message to buffer. 2655 * @param msg Message to buffer.
2656 * @param rel Reliability data to the corresponding direction. 2656 * @param rel Reliability data to the corresponding direction.
@@ -2697,7 +2697,7 @@ tunnel_add_buffered_data (struct MeshTunnel *t,
2697 * Destroy a reliable message after it has been acknowledged, either by 2697 * Destroy a reliable message after it has been acknowledged, either by
2698 * direct mid ACK or bitfield. Updates the appropriate data structures and 2698 * direct mid ACK or bitfield. Updates the appropriate data structures and
2699 * timers and frees all memory. 2699 * timers and frees all memory.
2700 * 2700 *
2701 * @param copy Message that is no longer needed: remote peer got it. 2701 * @param copy Message that is no longer needed: remote peer got it.
2702 */ 2702 */
2703static void 2703static void
@@ -3111,7 +3111,7 @@ tunnel_destroy (struct MeshTunnel *t)
3111 GNUNET_break (0); 3111 GNUNET_break (0);
3112 r = GNUNET_SYSERR; 3112 r = GNUNET_SYSERR;
3113 } 3113 }
3114 if (GNUNET_YES != 3114 if (GNUNET_YES !=
3115 GNUNET_CONTAINER_multihashmap32_remove (incoming_tunnels, 3115 GNUNET_CONTAINER_multihashmap32_remove (incoming_tunnels,
3116 t->local_tid_dest, t)) 3116 t->local_tid_dest, t))
3117 { 3117 {
@@ -3163,10 +3163,10 @@ tunnel_destroy (struct MeshTunnel *t)
3163 3163
3164/** 3164/**
3165 * Tunnel is empty: destroy it. 3165 * Tunnel is empty: destroy it.
3166 * 3166 *
3167 * Notifies all participants (peers, cleints) about the destruction. 3167 * Notifies all participants (peers, cleints) about the destruction.
3168 * 3168 *
3169 * @param t Tunnel to destroy. 3169 * @param t Tunnel to destroy.
3170 */ 3170 */
3171static void 3171static void
3172tunnel_destroy_empty (struct MeshTunnel *t) 3172tunnel_destroy_empty (struct MeshTunnel *t)
@@ -3192,7 +3192,7 @@ tunnel_destroy_empty (struct MeshTunnel *t)
3192 3192
3193/** 3193/**
3194 * Initialize a Flow Control structure to the initial state. 3194 * Initialize a Flow Control structure to the initial state.
3195 * 3195 *
3196 * @param fc Flow Control structure to initialize. 3196 * @param fc Flow Control structure to initialize.
3197 */ 3197 */
3198static void 3198static void
@@ -3209,12 +3209,12 @@ fc_init (struct MeshFlowControl *fc)
3209 3209
3210/** 3210/**
3211 * Create a new tunnel 3211 * Create a new tunnel
3212 * 3212 *
3213 * @param owner Who is the owner of the tunnel (short ID). 3213 * @param owner Who is the owner of the tunnel (short ID).
3214 * @param tid Tunnel Number of the tunnel. 3214 * @param tid Tunnel Number of the tunnel.
3215 * @param client Clients that owns the tunnel, NULL for foreign tunnels. 3215 * @param client Clients that owns the tunnel, NULL for foreign tunnels.
3216 * @param local Tunnel Number for the tunnel, for the client point of view. 3216 * @param local Tunnel Number for the tunnel, for the client point of view.
3217 * 3217 *
3218 * @return A new initialized tunnel. NULL on error. 3218 * @return A new initialized tunnel. NULL on error.
3219 */ 3219 */
3220static struct MeshTunnel * 3220static struct MeshTunnel *
@@ -3277,7 +3277,7 @@ tunnel_new (GNUNET_PEER_Id owner,
3277 3277
3278/** 3278/**
3279 * Set options in a tunnel, extracted from a bit flag field 3279 * Set options in a tunnel, extracted from a bit flag field
3280 * 3280 *
3281 * @param t Tunnel to set options to. 3281 * @param t Tunnel to set options to.
3282 * @param options Bit array in host byte order. 3282 * @param options Bit array in host byte order.
3283 */ 3283 */
@@ -3789,12 +3789,12 @@ queue_send (void *cls, size_t size, void *buf)
3789 3789
3790/** 3790/**
3791 * @brief Queue and pass message to core when possible. 3791 * @brief Queue and pass message to core when possible.
3792 * 3792 *
3793 * If type is payload (UNICAST, TO_ORIGIN) checks for queue status and 3793 * If type is payload (UNICAST, TO_ORIGIN) checks for queue status and
3794 * accounts for it. In case the queue is full, the message is dropped and 3794 * accounts for it. In case the queue is full, the message is dropped and
3795 * a break issued. 3795 * a break issued.
3796 * 3796 *
3797 * Otherwise, message is treated as internal and allowed to go regardless of 3797 * Otherwise, message is treated as internal and allowed to go regardless of
3798 * queue status. 3798 * queue status.
3799 * 3799 *
3800 * @param cls Closure (@c type dependant). It will be used by queue_send to 3800 * @param cls Closure (@c type dependant). It will be used by queue_send to
@@ -4065,7 +4065,7 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
4065 /* Eliminate tunnel when origin dies */ 4065 /* Eliminate tunnel when origin dies */
4066 tunnel_reset_timeout (t, GNUNET_YES); 4066 tunnel_reset_timeout (t, GNUNET_YES);
4067 /* Keep tunnel alive in direction dest->owner*/ 4067 /* Keep tunnel alive in direction dest->owner*/
4068 tunnel_reset_timeout (t, GNUNET_NO); 4068 tunnel_reset_timeout (t, GNUNET_NO);
4069 } 4069 }
4070 else 4070 else
4071 { 4071 {
@@ -4753,7 +4753,7 @@ handle_mesh_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer,
4753 return GNUNET_OK; 4753 return GNUNET_OK;
4754 } 4754 }
4755 4755
4756 fwd = GNUNET_MESSAGE_TYPE_MESH_FWD_KEEPALIVE == ntohs (message->type) ? 4756 fwd = GNUNET_MESSAGE_TYPE_MESH_FWD_KEEPALIVE == ntohs (message->type) ?
4757 GNUNET_YES : GNUNET_NO; 4757 GNUNET_YES : GNUNET_NO;
4758 c = fwd ? t->client : t->owner; 4758 c = fwd ? t->client : t->owner;
4759 hop = fwd ? t->next_hop : t->prev_hop; 4759 hop = fwd ? t->next_hop : t->prev_hop;
@@ -4845,7 +4845,7 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
4845 GNUNET_PEER_resolve (peer->tunnels[i]->id.oid, &id); 4845 GNUNET_PEER_resolve (peer->tunnels[i]->id.oid, &id);
4846 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ... tunnel %s:%X (%X / %X)\n", 4846 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ... tunnel %s:%X (%X / %X)\n",
4847 GNUNET_i2s (&id), peer->tunnels[i]->id.tid, 4847 GNUNET_i2s (&id), peer->tunnels[i]->id.tid,
4848 peer->tunnels[i]->local_tid, 4848 peer->tunnels[i]->local_tid,
4849 peer->tunnels[i]->local_tid_dest); 4849 peer->tunnels[i]->local_tid_dest);
4850 if (peer->tunnels[i]->state == MESH_TUNNEL_SEARCHING) 4850 if (peer->tunnels[i]->state == MESH_TUNNEL_SEARCHING)
4851 { 4851 {
@@ -5152,7 +5152,7 @@ handle_local_tunnel_destroy (void *cls, struct GNUNET_SERVER_Client *client,
5152 peer_remove_tunnel (peer_get_short (t->dest), t); 5152 peer_remove_tunnel (peer_get_short (t->dest), t);
5153 t->owner = NULL; 5153 t->owner = NULL;
5154 } 5154 }
5155 else 5155 else
5156 { 5156 {
5157 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 5157 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
5158 " tunnel %X client %p (%p, %p)\n", 5158 " tunnel %X client %p (%p, %p)\n",
@@ -5225,7 +5225,7 @@ handle_local_data (void *cls, struct GNUNET_SERVER_Client *client,
5225 t->owner->handle == client) 5225 t->owner->handle == client)
5226 || 5226 ||
5227 (tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV && 5227 (tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV &&
5228 t->client && 5228 t->client &&
5229 t->client->handle == client) ) ) 5229 t->client->handle == client) ) )
5230 { 5230 {
5231 GNUNET_break (0); 5231 GNUNET_break (0);
@@ -5621,7 +5621,7 @@ server_init (void)
5621 * @param identity the public identity of this peer 5621 * @param identity the public identity of this peer
5622 */ 5622 */
5623static void 5623static void
5624core_init (void *cls, 5624core_init (void *cls,
5625 const struct GNUNET_PeerIdentity *identity) 5625 const struct GNUNET_PeerIdentity *identity)
5626{ 5626{
5627 const struct GNUNET_CONFIGURATION_Handle *c = cls; 5627 const struct GNUNET_CONFIGURATION_Handle *c = cls;
@@ -5901,7 +5901,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
5901 GNUNET_free (keyfile); 5901 GNUNET_free (keyfile);
5902 GNUNET_assert (NULL != pk); 5902 GNUNET_assert (NULL != pk);
5903 my_private_key = pk; 5903 my_private_key = pk;
5904 GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, 5904 GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key,
5905 &my_full_id.public_key); 5905 &my_full_id.public_key);
5906 myid = GNUNET_PEER_intern (&my_full_id); 5906 myid = GNUNET_PEER_intern (&my_full_id);
5907 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 5907 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c
index 971b8279f..822e7e5fe 100644
--- a/src/mesh/gnunet-service-mesh_channel.c
+++ b/src/mesh/gnunet-service-mesh_channel.c
@@ -294,7 +294,7 @@ add_buffered_data (const struct GNUNET_MESH_Data *msg,
294 294
295/** 295/**
296 * Send data to a client. 296 * Send data to a client.
297 * 297 *
298 * If the client is ready, send directly, otherwise buffer while listening 298 * If the client is ready, send directly, otherwise buffer while listening
299 * for a local ACK. 299 * for a local ACK.
300 * 300 *
@@ -377,7 +377,7 @@ channel_get (struct MeshTunnel2 *t, MESH_ChannelNumber chid)
377 377
378/** 378/**
379 * Add a client to a channel, initializing all needed data structures. 379 * Add a client to a channel, initializing all needed data structures.
380 * 380 *
381 * @param ch Channel to which add the client. 381 * @param ch Channel to which add the client.
382 * @param c Client which to add to the channel. 382 * @param c Client which to add to the channel.
383 */ 383 */
@@ -466,7 +466,7 @@ static unsigned int
466channel_get_buffer (struct MeshChannel *ch, int fwd) 466channel_get_buffer (struct MeshChannel *ch, int fwd)
467{ 467{
468 struct MeshChannelReliability *rel; 468 struct MeshChannelReliability *rel;
469 469
470 rel = fwd ? ch->dest_rel : ch->root_rel; 470 rel = fwd ? ch->dest_rel : ch->root_rel;
471 471
472 /* If rel is NULL it means that the end is not yet created, 472 /* If rel is NULL it means that the end is not yet created,
@@ -735,7 +735,7 @@ channel_send_connections_ack (struct MeshChannel *ch,
735 * Destroy a reliable message after it has been acknowledged, either by 735 * Destroy a reliable message after it has been acknowledged, either by
736 * direct mid ACK or bitfield. Updates the appropriate data structures and 736 * direct mid ACK or bitfield. Updates the appropriate data structures and
737 * timers and frees all memory. 737 * timers and frees all memory.
738 * 738 *
739 * @param copy Message that is no longer needed: remote peer got it. 739 * @param copy Message that is no longer needed: remote peer got it.
740 */ 740 */
741static void 741static void
@@ -907,7 +907,7 @@ send_client_buffered_data (struct MeshChannel *ch,
907 907
908/** 908/**
909 * Destroy a channel and free all resources. 909 * Destroy a channel and free all resources.
910 * 910 *
911 * @param ch Channel to destroy. 911 * @param ch Channel to destroy.
912 */ 912 */
913static void 913static void
@@ -1004,7 +1004,7 @@ channel_new (struct MeshTunnel2 *t,
1004 1004
1005/** 1005/**
1006 * Set options in a channel, extracted from a bit flag field 1006 * Set options in a channel, extracted from a bit flag field
1007 * 1007 *
1008 * @param ch Channel to set options to. 1008 * @param ch Channel to set options to.
1009 * @param options Bit array in host byte order. 1009 * @param options Bit array in host byte order.
1010 */ 1010 */
@@ -1145,7 +1145,7 @@ GMCH_send_channel_destroy (struct MeshChannel *ch, int fwd)
1145 1145
1146/** 1146/**
1147 * Send data on a channel. 1147 * Send data on a channel.
1148 * 1148 *
1149 * If the destination is local, send it to client, otherwise encrypt and 1149 * If the destination is local, send it to client, otherwise encrypt and
1150 * send to next hop. 1150 * send to next hop.
1151 * 1151 *
diff --git a/src/mesh/gnunet-service-mesh_channel.h b/src/mesh/gnunet-service-mesh_channel.h
index 4886e4a09..75136b4de 100644
--- a/src/mesh/gnunet-service-mesh_channel.h
+++ b/src/mesh/gnunet-service-mesh_channel.h
@@ -57,7 +57,7 @@ GMCH_send_ack (struct MeshChannel *ch, int fwd);
57 57
58/** 58/**
59 * Send data on a channel. 59 * Send data on a channel.
60 * 60 *
61 * If the destination is local, send it to client, otherwise encrypt and 61 * If the destination is local, send it to client, otherwise encrypt and
62 * send to next hop. 62 * send to next hop.
63 * 63 *
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c
index dfe4fa953..3f407f418 100644
--- a/src/mesh/gnunet-service-mesh_connection.c
+++ b/src/mesh/gnunet-service-mesh_connection.c
@@ -271,7 +271,7 @@ static struct GNUNET_CONTAINER_MultiHashMap *connections;
271static unsigned long long max_connections; 271static unsigned long long max_connections;
272 272
273/** 273/**
274 * How many messages *in total* are we willing to queue, divide by number of 274 * How many messages *in total* are we willing to queue, divide by number of
275 * connections to get connection queue size. 275 * connections to get connection queue size.
276 */ 276 */
277static unsigned long long max_msgs_queue; 277static unsigned long long max_msgs_queue;
@@ -293,7 +293,7 @@ static struct GNUNET_CORE_Handle *core_handle;
293 * 293 *
294 * @param s Tunnel state. 294 * @param s Tunnel state.
295 * 295 *
296 * @return String representation. 296 * @return String representation.
297 */ 297 */
298static const char * 298static const char *
299GMC_DEBUG_state2s (enum MeshTunnelState s) 299GMC_DEBUG_state2s (enum MeshTunnelState s)
@@ -317,7 +317,7 @@ GMC_DEBUG_state2s (enum MeshTunnelState s)
317 317
318/** 318/**
319 * Initialize a Flow Control structure to the initial state. 319 * Initialize a Flow Control structure to the initial state.
320 * 320 *
321 * @param fc Flow Control structure to initialize. 321 * @param fc Flow Control structure to initialize.
322 */ 322 */
323static void 323static void
@@ -680,7 +680,7 @@ queue_add (void *cls, uint16_t type, size_t size,
680 GNUNET_break (0); 680 GNUNET_break (0);
681 return; 681 return;
682 } 682 }
683 683
684 if (NULL == peer->connections) 684 if (NULL == peer->connections)
685 { 685 {
686 /* We are not connected to this peer, ignore request. */ 686 /* We are not connected to this peer, ignore request. */
@@ -1172,9 +1172,9 @@ static unsigned int
1172connection_get_buffer (struct MeshConnection *c, int fwd) 1172connection_get_buffer (struct MeshConnection *c, int fwd)
1173{ 1173{
1174 struct MeshFlowControl *fc; 1174 struct MeshFlowControl *fc;
1175 1175
1176 fc = fwd ? &c->fwd_fc : &c->bck_fc; 1176 fc = fwd ? &c->fwd_fc : &c->bck_fc;
1177 1177
1178 return (fc->queue_max - fc->queue_n); 1178 return (fc->queue_max - fc->queue_n);
1179} 1179}
1180 1180
@@ -1337,7 +1337,7 @@ connection_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1337 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** Polling!\n"); 1337 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** Polling!\n");
1338 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** connection [%X]\n", 1338 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** connection [%X]\n",
1339 GNUNET_h2s (&c->id)); 1339 GNUNET_h2s (&c->id));
1340 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** %s\n", 1340 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** %s\n",
1341 fc == &c->fwd_fc ? "FWD" : "BCK"); 1341 fc == &c->fwd_fc ? "FWD" : "BCK");
1342 1342
1343 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_POLL); 1343 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_POLL);
@@ -1378,7 +1378,7 @@ connection_get_prev_hop (struct MeshConnection *c)
1378 * 1378 *
1379 * @param c Connection. 1379 * @param c Connection.
1380 * 1380 *
1381 * @return Next peer in the connection. 1381 * @return Next peer in the connection.
1382 */ 1382 */
1383static struct MeshPeer * 1383static struct MeshPeer *
1384connection_get_next_hop (struct MeshConnection *c) 1384connection_get_next_hop (struct MeshConnection *c)
@@ -1400,7 +1400,7 @@ connection_get_next_hop (struct MeshConnection *c)
1400 * @param c Connection. 1400 * @param c Connection.
1401 * @param fwd Next hop? 1401 * @param fwd Next hop?
1402 * 1402 *
1403 * @return Next peer in the connection. 1403 * @return Next peer in the connection.
1404 */ 1404 */
1405static struct MeshPeer * 1405static struct MeshPeer *
1406connection_get_hop (struct MeshConnection *c, int fwd) 1406connection_get_hop (struct MeshConnection *c, int fwd)
@@ -1598,7 +1598,7 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
1598 * @param identity the public identity of this peer 1598 * @param identity the public identity of this peer
1599 */ 1599 */
1600static void 1600static void
1601core_init (void *cls, 1601core_init (void *cls,
1602 const struct GNUNET_PeerIdentity *identity) 1602 const struct GNUNET_PeerIdentity *identity)
1603{ 1603{
1604 const struct GNUNET_CONFIGURATION_Handle *c = cls; 1604 const struct GNUNET_CONFIGURATION_Handle *c = cls;
@@ -2310,7 +2310,7 @@ handle_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer,
2310 return GNUNET_OK; 2310 return GNUNET_OK;
2311 } 2311 }
2312 2312
2313 fwd = GNUNET_MESSAGE_TYPE_MESH_FWD_KEEPALIVE == ntohs (message->type) ? 2313 fwd = GNUNET_MESSAGE_TYPE_MESH_FWD_KEEPALIVE == ntohs (message->type) ?
2314 GNUNET_YES : GNUNET_NO; 2314 GNUNET_YES : GNUNET_NO;
2315 2315
2316 /* Check if origin is as expected */ 2316 /* Check if origin is as expected */
diff --git a/src/mesh/gnunet-service-mesh_connection.h b/src/mesh/gnunet-service-mesh_connection.h
index 5db12f2fb..4e423e7ee 100644
--- a/src/mesh/gnunet-service-mesh_connection.h
+++ b/src/mesh/gnunet-service-mesh_connection.h
@@ -78,7 +78,7 @@ GMC_destroy (struct MeshConnection *c);
78 * Count connections in a DLL. 78 * Count connections in a DLL.
79 */ 79 */
80unsigned int 80unsigned int
81GMC_count (const struct MeshConnection *head); 81GMC_count (const struct MeshConnection *head);
82 82
83/** 83/**
84 * Send FWD keepalive packets for a connection. 84 * Send FWD keepalive packets for a connection.
diff --git a/src/mesh/gnunet-service-mesh_local.c b/src/mesh/gnunet-service-mesh_local.c
index 764ebd68f..7b58f0854 100644
--- a/src/mesh/gnunet-service-mesh_local.c
+++ b/src/mesh/gnunet-service-mesh_local.c
@@ -30,7 +30,7 @@
30 30
31/** 31/**
32 * Struct containing information about a client of the service 32 * Struct containing information about a client of the service
33 * 33 *
34 * TODO: add a list of 'waiting' ports 34 * TODO: add a list of 'waiting' ports
35 */ 35 */
36struct MeshClient 36struct MeshClient
@@ -462,7 +462,7 @@ handle_channel_destroy (void *cls, struct GNUNET_SERVER_Client *client,
462 { 462 {
463 ch->root = NULL; 463 ch->root = NULL;
464 } 464 }
465 else 465 else
466 { 466 {
467 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 467 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
468 " channel %X client %p (%p, %p)\n", 468 " channel %X client %p (%p, %p)\n",
@@ -538,7 +538,7 @@ handle_data (void *cls, struct GNUNET_SERVER_Client *client,
538 ch->root->handle == client) 538 ch->root->handle == client)
539 || 539 ||
540 (!fwd && 540 (!fwd &&
541 ch->dest && 541 ch->dest &&
542 ch->dest->handle == client) ) ) 542 ch->dest->handle == client) ) )
543 { 543 {
544 GNUNET_break (0); 544 GNUNET_break (0);
@@ -654,16 +654,16 @@ handle_ack (void *cls, struct GNUNET_SERVER_Client *client,
654// struct GNUNET_SERVER_Client *client = cls; 654// struct GNUNET_SERVER_Client *client = cls;
655// struct MeshChannel *ch = value; 655// struct MeshChannel *ch = value;
656// struct GNUNET_MESH_LocalMonitor *msg; 656// struct GNUNET_MESH_LocalMonitor *msg;
657// 657//
658// msg = GNUNET_malloc (sizeof(struct GNUNET_MESH_LocalMonitor)); 658// msg = GNUNET_malloc (sizeof(struct GNUNET_MESH_LocalMonitor));
659// msg->channel_id = htonl (ch->gid); 659// msg->channel_id = htonl (ch->gid);
660// msg->header.size = htons (sizeof (struct GNUNET_MESH_LocalMonitor)); 660// msg->header.size = htons (sizeof (struct GNUNET_MESH_LocalMonitor));
661// msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS); 661// msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS);
662// 662//
663// GNUNET_log (GNUNET_ERROR_TYPE_INFO, 663// GNUNET_log (GNUNET_ERROR_TYPE_INFO,
664// "* sending info about tunnel %s\n", 664// "* sending info about tunnel %s\n",
665// GNUNET_i2s (&msg->owner)); 665// GNUNET_i2s (&msg->owner));
666// 666//
667// GNUNET_SERVER_notification_context_unicast (nc, client, 667// GNUNET_SERVER_notification_context_unicast (nc, client,
668// &msg->header, GNUNET_NO); 668// &msg->header, GNUNET_NO);
669// return GNUNET_YES; 669// return GNUNET_YES;
diff --git a/src/mesh/gnunet-service-mesh_local.h b/src/mesh/gnunet-service-mesh_local.h
index b3a7ad621..5a22c66ab 100644
--- a/src/mesh/gnunet-service-mesh_local.h
+++ b/src/mesh/gnunet-service-mesh_local.h
@@ -53,7 +53,7 @@ struct MeshClient;
53 53
54/** 54/**
55 * Initialize server subsystem. 55 * Initialize server subsystem.
56 * 56 *
57 * @param handle Server handle. 57 * @param handle Server handle.
58 */ 58 */
59void 59void
@@ -123,7 +123,7 @@ GML_send_channel_destroy (struct MeshClient *c, uint32_t id);
123 123
124/** 124/**
125 * Modify the mesh message TID from global to local and send to client. 125 * Modify the mesh message TID from global to local and send to client.
126 * 126 *
127 * @param ch Channel on which to send the message. 127 * @param ch Channel on which to send the message.
128 * @param msg Message to modify and send. 128 * @param msg Message to modify and send.
129 * @param c Client to send to. 129 * @param c Client to send to.
diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c
index 75decd3bb..ece4470e2 100644
--- a/src/mesh/gnunet-service-mesh_peer.c
+++ b/src/mesh/gnunet-service-mesh_peer.c
@@ -79,7 +79,7 @@ struct MeshPeer
79 * Transmission queue to core DLL head 79 * Transmission queue to core DLL head
80 */ 80 */
81 struct MeshPeerQueue *queue_head; 81 struct MeshPeerQueue *queue_head;
82 82
83 /** 83 /**
84 * Transmission queue to core DLL tail 84 * Transmission queue to core DLL tail
85 */ 85 */
@@ -121,8 +121,8 @@ static unsigned long long max_peers;
121 * #GNUNET_NO if not. 121 * #GNUNET_NO if not.
122 */ 122 */
123static int 123static int
124shutdown_tunnel (void *cls, 124shutdown_tunnel (void *cls,
125 const struct GNUNET_PeerIdentity *key, 125 const struct GNUNET_PeerIdentity *key,
126 void *value) 126 void *value)
127{ 127{
128 struct MeshPeer *p = value; 128 struct MeshPeer *p = value;
@@ -148,10 +148,10 @@ peer_destroy (struct MeshPeer *peer)
148 struct GNUNET_PeerIdentity id; 148 struct GNUNET_PeerIdentity id;
149 struct MeshPeerPath *p; 149 struct MeshPeerPath *p;
150 struct MeshPeerPath *nextp; 150 struct MeshPeerPath *nextp;
151 151
152 GNUNET_PEER_resolve (peer->id, &id); 152 GNUNET_PEER_resolve (peer->id, &id);
153 GNUNET_PEER_change_rc (peer->id, -1); 153 GNUNET_PEER_change_rc (peer->id, -1);
154 154
155 if (GNUNET_YES != 155 if (GNUNET_YES !=
156 GNUNET_CONTAINER_multipeermap_remove (peers, &id, peer)) 156 GNUNET_CONTAINER_multipeermap_remove (peers, &id, peer))
157 { 157 {
@@ -188,10 +188,10 @@ static int
188peer_is_used (struct MeshPeer *peer) 188peer_is_used (struct MeshPeer *peer)
189{ 189{
190 struct MeshPeerPath *p; 190 struct MeshPeerPath *p;
191 191
192 if (NULL != peer->tunnel) 192 if (NULL != peer->tunnel)
193 return GNUNET_YES; 193 return GNUNET_YES;
194 194
195 for (p = peer->path_head; NULL != p; p = p->next) 195 for (p = peer->path_head; NULL != p; p = p->next)
196 { 196 {
197 if (p->length < 3) 197 if (p->length < 3)
@@ -215,14 +215,14 @@ peer_get_oldest (void *cls,
215{ 215{
216 struct MeshPeer *p = value; 216 struct MeshPeer *p = value;
217 struct GNUNET_TIME_Absolute *abs = cls; 217 struct GNUNET_TIME_Absolute *abs = cls;
218 218
219 /* Don't count active peers */ 219 /* Don't count active peers */
220 if (GNUNET_YES == peer_is_used (p)) 220 if (GNUNET_YES == peer_is_used (p))
221 return GNUNET_YES; 221 return GNUNET_YES;
222 222
223 if (abs->abs_value_us < p->last_contact.abs_value_us) 223 if (abs->abs_value_us < p->last_contact.abs_value_us)
224 abs->abs_value_us = p->last_contact.abs_value_us; 224 abs->abs_value_us = p->last_contact.abs_value_us;
225 225
226 return GNUNET_YES; 226 return GNUNET_YES;
227} 227}
228 228
@@ -241,7 +241,7 @@ peer_timeout (void *cls,
241{ 241{
242 struct MeshPeer *p = value; 242 struct MeshPeer *p = value;
243 struct GNUNET_TIME_Absolute *abs = cls; 243 struct GNUNET_TIME_Absolute *abs = cls;
244 244
245 if (p->last_contact.abs_value_us == abs->abs_value_us && 245 if (p->last_contact.abs_value_us == abs->abs_value_us &&
246 GNUNET_NO == peer_is_used (p)) 246 GNUNET_NO == peer_is_used (p))
247 { 247 {
@@ -259,9 +259,9 @@ static void
259peer_delete_oldest (void) 259peer_delete_oldest (void)
260{ 260{
261 struct GNUNET_TIME_Absolute abs; 261 struct GNUNET_TIME_Absolute abs;
262 262
263 abs = GNUNET_TIME_UNIT_FOREVER_ABS; 263 abs = GNUNET_TIME_UNIT_FOREVER_ABS;
264 264
265 GNUNET_CONTAINER_multipeermap_iterate (peers, 265 GNUNET_CONTAINER_multipeermap_iterate (peers,
266 &peer_get_oldest, 266 &peer_get_oldest,
267 &abs); 267 &abs);
@@ -283,7 +283,7 @@ static struct MeshPeer *
283peer_get (const struct GNUNET_PeerIdentity *peer_id) 283peer_get (const struct GNUNET_PeerIdentity *peer_id)
284{ 284{
285 struct MeshPeer *peer; 285 struct MeshPeer *peer;
286 286
287 peer = GNUNET_CONTAINER_multipeermap_get (peers, peer_id); 287 peer = GNUNET_CONTAINER_multipeermap_get (peers, peer_id);
288 if (NULL == peer) 288 if (NULL == peer)
289 { 289 {
@@ -297,7 +297,7 @@ peer_get (const struct GNUNET_PeerIdentity *peer_id)
297 peer->id = GNUNET_PEER_intern (peer_id); 297 peer->id = GNUNET_PEER_intern (peer_id);
298 } 298 }
299 peer->last_contact = GNUNET_TIME_absolute_get(); 299 peer->last_contact = GNUNET_TIME_absolute_get();
300 300
301 return peer; 301 return peer;
302} 302}
303 303
@@ -333,13 +333,13 @@ peer_get_path_cost (const struct MeshPeer *peer,
333 unsigned int overlap; 333 unsigned int overlap;
334 unsigned int i; 334 unsigned int i;
335 unsigned int j; 335 unsigned int j;
336 336
337 if (NULL == path) 337 if (NULL == path)
338 return 0; 338 return 0;
339 339
340 overlap = 0; 340 overlap = 0;
341 GNUNET_assert (NULL != peer->tunnel); 341 GNUNET_assert (NULL != peer->tunnel);
342 342
343 for (i = 0; i < path->length; i++) 343 for (i = 0; i < path->length; i++)
344 { 344 {
345 for (c = peer->tunnel->connection_head; NULL != c; c = c->next) 345 for (c = peer->tunnel->connection_head; NULL != c; c = c->next)
@@ -373,7 +373,7 @@ peer_get_best_path (const struct MeshPeer *peer)
373 struct MeshConnection *c; 373 struct MeshConnection *c;
374 unsigned int best_cost; 374 unsigned int best_cost;
375 unsigned int cost; 375 unsigned int cost;
376 376
377 best_cost = UINT_MAX; 377 best_cost = UINT_MAX;
378 best_p = NULL; 378 best_p = NULL;
379 for (p = peer->path_head; NULL != p; p = p->next) 379 for (p = peer->path_head; NULL != p; p = p->next)
@@ -383,7 +383,7 @@ peer_get_best_path (const struct MeshPeer *peer)
383 break; 383 break;
384 if (NULL != c) 384 if (NULL != c)
385 continue; /* If path is in use in a connection, skip it. */ 385 continue; /* If path is in use in a connection, skip it. */
386 386
387 if ((cost = peer_get_path_cost (peer, p)) < best_cost) 387 if ((cost = peer_get_path_cost (peer, p)) < best_cost)
388 { 388 {
389 best_cost = cost; 389 best_cost = cost;
@@ -410,7 +410,7 @@ peer_add_path (struct MeshPeer *peer_info, struct MeshPeerPath *path,
410 struct MeshPeerPath *aux; 410 struct MeshPeerPath *aux;
411 unsigned int l; 411 unsigned int l;
412 unsigned int l2; 412 unsigned int l2;
413 413
414 if ((NULL == peer_info) || (NULL == path)) 414 if ((NULL == peer_info) || (NULL == path))
415 { 415 {
416 GNUNET_break (0); 416 GNUNET_break (0);
@@ -444,17 +444,17 @@ peer_add_path (struct MeshPeer *peer_info, struct MeshPeerPath *path,
444 GNUNET_realloc (path->peers, path->length * sizeof (GNUNET_PEER_Id)); 444 GNUNET_realloc (path->peers, path->length * sizeof (GNUNET_PEER_Id));
445 } 445 }
446 } 446 }
447 447
448 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "adding path [%u] to peer %s\n", 448 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "adding path [%u] to peer %s\n",
449 path->length, peer2s (peer_info)); 449 path->length, peer2s (peer_info));
450 450
451 l = path_get_length (path); 451 l = path_get_length (path);
452 if (0 == l) 452 if (0 == l)
453 { 453 {
454 path_destroy (path); 454 path_destroy (path);
455 return; 455 return;
456 } 456 }
457 457
458 GNUNET_assert (peer_info->id == path->peers[path->length - 1]); 458 GNUNET_assert (peer_info->id == path->peers[path->length - 1]);
459 for (aux = peer_info->path_head; aux != NULL; aux = aux->next) 459 for (aux = peer_info->path_head; aux != NULL; aux = aux->next)
460 { 460 {
@@ -569,7 +569,7 @@ GMP_connect (struct MeshPeer *peer)
569 { 569 {
570 /* This case can happen when the path includes a first hop that is 570 /* This case can happen when the path includes a first hop that is
571 * not yet known to be connected. 571 * not yet known to be connected.
572 * 572 *
573 * This happens quite often during testing when running mesh 573 * This happens quite often during testing when running mesh
574 * under valgrind: core connect notifications come very late and the 574 * under valgrind: core connect notifications come very late and the
575 * DHT result has already come and created a valid path. 575 * DHT result has already come and created a valid path.
diff --git a/src/mesh/mesh.h b/src/mesh/mesh.h
index de0d270a2..dc515b473 100644
--- a/src/mesh/mesh.h
+++ b/src/mesh/mesh.h
@@ -63,14 +63,14 @@ extern "C"
63 * notify_transmit_ready None (queue / GNUNET_CLIENT_ntf_tmt_rdy) 63 * notify_transmit_ready None (queue / GNUNET_CLIENT_ntf_tmt_rdy)
64 * notify_transmit_ready_cancel None (clear of internal data structures) 64 * notify_transmit_ready_cancel None (clear of internal data structures)
65 * 65 *
66 * 66 *
67 * EVENT MESSAGE USED 67 * EVENT MESSAGE USED
68 * ----- ------------ 68 * ----- ------------
69 * data GNUNET_MESH_Unicast OR 69 * data GNUNET_MESH_Unicast OR
70 * GNUNET_MESH_Multicast OR 70 * GNUNET_MESH_Multicast OR
71 * GNUNET_MESH_ToOrigin 71 * GNUNET_MESH_ToOrigin
72 * data ack GNUNET_MESH_LocalAck 72 * data ack GNUNET_MESH_LocalAck
73 * 73 *
74 * new incoming tunnel GNUNET_MESH_PeerControl 74 * new incoming tunnel GNUNET_MESH_PeerControl
75 * peer connects to a tunnel FIXME 75 * peer connects to a tunnel FIXME
76 * peer disconnects from a tunnel FIXME 76 * peer disconnects from a tunnel FIXME
@@ -305,9 +305,9 @@ GMC_min_pid (uint32_t a, uint32_t b);
305 * Generated with: 305 * Generated with:
306 * FIND: "#define ([^ ]+)[ ]*([0-9]+)" 306 * FIND: "#define ([^ ]+)[ ]*([0-9]+)"
307 * REPLACE: " case \2: return "\1"; break;" 307 * REPLACE: " case \2: return "\1"; break;"
308 * 308 *
309 * @param m Message type. 309 * @param m Message type.
310 * 310 *
311 * @return Human readable string description. 311 * @return Human readable string description.
312 */ 312 */
313const char * 313const char *
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c
index d3dad49a4..2db89fc6e 100644
--- a/src/mesh/mesh_api.c
+++ b/src/mesh/mesh_api.c
@@ -188,7 +188,7 @@ struct GNUNET_MESH_Handle
188 * Time to the next reconnect in case one reconnect fails 188 * Time to the next reconnect in case one reconnect fails
189 */ 189 */
190 struct GNUNET_TIME_Relative reconnect_time; 190 struct GNUNET_TIME_Relative reconnect_time;
191 191
192 /** 192 /**
193 * Task for trying to reconnect. 193 * Task for trying to reconnect.
194 */ 194 */
@@ -373,9 +373,9 @@ th_is_payload (struct GNUNET_MESH_TransmitHandle *th)
373 373
374/** 374/**
375 * Check whether there is any message ready in the queue and find the size. 375 * Check whether there is any message ready in the queue and find the size.
376 * 376 *
377 * @param h Mesh handle. 377 * @param h Mesh handle.
378 * 378 *
379 * @return The size of the first ready message in the queue, 379 * @return The size of the first ready message in the queue,
380 * 0 if there is none. 380 * 0 if there is none.
381 */ 381 */
@@ -483,8 +483,8 @@ destroy_tunnel (struct GNUNET_MESH_Tunnel *t, int call_cleaner)
483 GNUNET_break (0); 483 GNUNET_break (0);
484 return; 484 return;
485 } 485 }
486 LOG (GNUNET_ERROR_TYPE_DEBUG, 486 LOG (GNUNET_ERROR_TYPE_DEBUG,
487 "destroy_tunnel %X\n", 487 "destroy_tunnel %X\n",
488 t->tid); 488 t->tid);
489 h = t->mesh; 489 h = t->mesh;
490 490
@@ -508,7 +508,7 @@ destroy_tunnel (struct GNUNET_MESH_Tunnel *t, int call_cleaner)
508 /* clean up request */ 508 /* clean up request */
509 if (GNUNET_SCHEDULER_NO_TASK != th->timeout_task) 509 if (GNUNET_SCHEDULER_NO_TASK != th->timeout_task)
510 GNUNET_SCHEDULER_cancel (th->timeout_task); 510 GNUNET_SCHEDULER_cancel (th->timeout_task);
511 GNUNET_free (th); 511 GNUNET_free (th);
512 } 512 }
513 513
514 /* if there are no more pending requests with mesh service, cancel active request */ 514 /* if there are no more pending requests with mesh service, cancel active request */
@@ -528,7 +528,7 @@ destroy_tunnel (struct GNUNET_MESH_Tunnel *t, int call_cleaner)
528 528
529/** 529/**
530 * Notify client that the transmission has timed out 530 * Notify client that the transmission has timed out
531 * 531 *
532 * @param cls closure 532 * @param cls closure
533 * @param tc task context 533 * @param tc task context
534 */ 534 */
@@ -590,7 +590,7 @@ send_packet (struct GNUNET_MESH_Handle *h,
590 590
591/** 591/**
592 * Send an ack on the tunnel to confirm the processing of a message. 592 * Send an ack on the tunnel to confirm the processing of a message.
593 * 593 *
594 * @param t Tunnel on which to send the ACK. 594 * @param t Tunnel on which to send the ACK.
595 */ 595 */
596static void 596static void
@@ -702,7 +702,7 @@ do_reconnect (struct GNUNET_MESH_Handle *h)
702 GNUNET_TIME_relative_min (GNUNET_TIME_UNIT_SECONDS, 702 GNUNET_TIME_relative_min (GNUNET_TIME_UNIT_SECONDS,
703 GNUNET_TIME_relative_multiply 703 GNUNET_TIME_relative_multiply
704 (h->reconnect_time, 2)); 704 (h->reconnect_time, 2));
705 LOG (GNUNET_ERROR_TYPE_DEBUG, 705 LOG (GNUNET_ERROR_TYPE_DEBUG,
706 "Next retry in %s\n", 706 "Next retry in %s\n",
707 GNUNET_STRINGS_relative_time_to_string (h->reconnect_time, 707 GNUNET_STRINGS_relative_time_to_string (h->reconnect_time,
708 GNUNET_NO)); 708 GNUNET_NO));
@@ -916,7 +916,7 @@ process_incoming_data (struct GNUNET_MESH_Handle *h,
916 LOG (GNUNET_ERROR_TYPE_DEBUG, 916 LOG (GNUNET_ERROR_TYPE_DEBUG,
917 " %s data on tunnel %s [%X]\n", 917 " %s data on tunnel %s [%X]\n",
918 t->tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV ? "fwd" : "bck", 918 t->tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV ? "fwd" : "bck",
919 GNUNET_i2s (GNUNET_PEER_resolve2(t->peer)), 919 GNUNET_i2s (GNUNET_PEER_resolve2(t->peer)),
920 ntohl (dmsg->tid)); 920 ntohl (dmsg->tid));
921 type = ntohs (payload->type); 921 type = ntohs (payload->type);
922 LOG (GNUNET_ERROR_TYPE_DEBUG, " payload type %u\n", type); 922 LOG (GNUNET_ERROR_TYPE_DEBUG, " payload type %u\n", type);
@@ -948,7 +948,7 @@ process_incoming_data (struct GNUNET_MESH_Handle *h,
948/** 948/**
949 * Process a local ACK message, enabling the client to send 949 * Process a local ACK message, enabling the client to send
950 * more data to the service. 950 * more data to the service.
951 * 951 *
952 * @param h Mesh handle. 952 * @param h Mesh handle.
953 * @param message Message itself. 953 * @param message Message itself.
954 */ 954 */
@@ -1082,7 +1082,7 @@ msg_received (void *cls, const struct GNUNET_MessageHeader *msg)
1082 1082
1083 if (msg == NULL) 1083 if (msg == NULL)
1084 { 1084 {
1085 LOG (GNUNET_ERROR_TYPE_DEBUG, 1085 LOG (GNUNET_ERROR_TYPE_DEBUG,
1086 "Mesh service disconnected, reconnecting\n", h); 1086 "Mesh service disconnected, reconnecting\n", h);
1087 reconnect (h); 1087 reconnect (h);
1088 return; 1088 return;
@@ -1265,7 +1265,7 @@ send_callback (void *cls, size_t size, void *buf)
1265 * Auxiliary function to send an already constructed packet to the service. 1265 * Auxiliary function to send an already constructed packet to the service.
1266 * Takes care of creating a new queue element, copying the message and 1266 * Takes care of creating a new queue element, copying the message and
1267 * calling the tmt_rdy function if necessary. 1267 * calling the tmt_rdy function if necessary.
1268 * 1268 *
1269 * @param h mesh handle 1269 * @param h mesh handle
1270 * @param msg message to transmit 1270 * @param msg message to transmit
1271 * @param tunnel tunnel this send is related to (NULL if N/A) 1271 * @param tunnel tunnel this send is related to (NULL if N/A)
@@ -1441,7 +1441,7 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle)
1441 * @return handle to the tunnel 1441 * @return handle to the tunnel
1442 */ 1442 */
1443struct GNUNET_MESH_Tunnel * 1443struct GNUNET_MESH_Tunnel *
1444GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle *h, 1444GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle *h,
1445 void *tunnel_ctx, 1445 void *tunnel_ctx,
1446 const struct GNUNET_PeerIdentity *peer, 1446 const struct GNUNET_PeerIdentity *peer,
1447 uint32_t port, 1447 uint32_t port,
@@ -1723,7 +1723,7 @@ static size_t
1723mesh_mq_ntr (void *cls, size_t size, 1723mesh_mq_ntr (void *cls, size_t size,
1724 void *buf) 1724 void *buf)
1725{ 1725{
1726 struct GNUNET_MQ_Handle *mq = cls; 1726 struct GNUNET_MQ_Handle *mq = cls;
1727 struct MeshMQState *state = GNUNET_MQ_impl_state (mq); 1727 struct MeshMQState *state = GNUNET_MQ_impl_state (mq);
1728 const struct GNUNET_MessageHeader *msg = GNUNET_MQ_impl_current (mq); 1728 const struct GNUNET_MessageHeader *msg = GNUNET_MQ_impl_current (mq);
1729 uint16_t msize; 1729 uint16_t msize;
@@ -1769,7 +1769,7 @@ mesh_mq_send_impl (struct GNUNET_MQ_Handle *mq,
1769 GNUNET_MESH_notify_transmit_ready (state->tunnel, 1769 GNUNET_MESH_notify_transmit_ready (state->tunnel,
1770 /* FIXME: add option for corking */ 1770 /* FIXME: add option for corking */
1771 GNUNET_NO, 1771 GNUNET_NO,
1772 GNUNET_TIME_UNIT_FOREVER_REL, 1772 GNUNET_TIME_UNIT_FOREVER_REL,
1773 ntohs (msg->size), 1773 ntohs (msg->size),
1774 mesh_mq_ntr, mq); 1774 mesh_mq_ntr, mq);
1775 1775
@@ -1781,7 +1781,7 @@ mesh_mq_send_impl (struct GNUNET_MQ_Handle *mq,
1781 * destruction of a message queue. 1781 * destruction of a message queue.
1782 * Implementations must not free 'mq', but should 1782 * Implementations must not free 'mq', but should
1783 * take care of 'impl_state'. 1783 * take care of 'impl_state'.
1784 * 1784 *
1785 * @param mq the message queue to destroy 1785 * @param mq the message queue to destroy
1786 * @param impl_state state of the implementation 1786 * @param impl_state state of the implementation
1787 */ 1787 */
diff --git a/src/mesh/mesh_api_enc.c b/src/mesh/mesh_api_enc.c
index 75adb6544..93099abdb 100644
--- a/src/mesh/mesh_api_enc.c
+++ b/src/mesh/mesh_api_enc.c
@@ -178,7 +178,7 @@ struct GNUNET_MESH_Handle
178 * Time to the next reconnect in case one reconnect fails 178 * Time to the next reconnect in case one reconnect fails
179 */ 179 */
180 struct GNUNET_TIME_Relative reconnect_time; 180 struct GNUNET_TIME_Relative reconnect_time;
181 181
182 /** 182 /**
183 * Task for trying to reconnect. 183 * Task for trying to reconnect.
184 */ 184 */
@@ -356,9 +356,9 @@ th_is_payload (struct GNUNET_MESH_TransmitHandle *th)
356 356
357/** 357/**
358 * Check whether there is any message ready in the queue and find the size. 358 * Check whether there is any message ready in the queue and find the size.
359 * 359 *
360 * @param h Mesh handle. 360 * @param h Mesh handle.
361 * 361 *
362 * @return The size of the first ready message in the queue, 362 * @return The size of the first ready message in the queue,
363 * 0 if there is none. 363 * 0 if there is none.
364 */ 364 */
@@ -492,7 +492,7 @@ destroy_channel (struct GNUNET_MESH_Channel *ch, int call_cleaner)
492 /* clean up request */ 492 /* clean up request */
493 if (GNUNET_SCHEDULER_NO_TASK != th->timeout_task) 493 if (GNUNET_SCHEDULER_NO_TASK != th->timeout_task)
494 GNUNET_SCHEDULER_cancel (th->timeout_task); 494 GNUNET_SCHEDULER_cancel (th->timeout_task);
495 GNUNET_free (th); 495 GNUNET_free (th);
496 } 496 }
497 497
498 /* if there are no more pending requests with mesh service, cancel active request */ 498 /* if there are no more pending requests with mesh service, cancel active request */
@@ -512,7 +512,7 @@ destroy_channel (struct GNUNET_MESH_Channel *ch, int call_cleaner)
512 512
513/** 513/**
514 * Notify client that the transmission has timed out 514 * Notify client that the transmission has timed out
515 * 515 *
516 * @param cls closure 516 * @param cls closure
517 * @param tc task context 517 * @param tc task context
518 */ 518 */
@@ -574,7 +574,7 @@ send_packet (struct GNUNET_MESH_Handle *h,
574 574
575/** 575/**
576 * Send an ack on the channel to confirm the processing of a message. 576 * Send an ack on the channel to confirm the processing of a message.
577 * 577 *
578 * @param ch Channel on which to send the ACK. 578 * @param ch Channel on which to send the ACK.
579 */ 579 */
580static void 580static void
@@ -926,7 +926,7 @@ process_incoming_data (struct GNUNET_MESH_Handle *h,
926/** 926/**
927 * Process a local ACK message, enabling the client to send 927 * Process a local ACK message, enabling the client to send
928 * more data to the service. 928 * more data to the service.
929 * 929 *
930 * @param h Mesh handle. 930 * @param h Mesh handle.
931 * @param message Message itself. 931 * @param message Message itself.
932 */ 932 */
@@ -1059,7 +1059,7 @@ msg_received (void *cls, const struct GNUNET_MessageHeader *msg)
1059 1059
1060 if (msg == NULL) 1060 if (msg == NULL)
1061 { 1061 {
1062 LOG (GNUNET_ERROR_TYPE_DEBUG, 1062 LOG (GNUNET_ERROR_TYPE_DEBUG,
1063 "Mesh service disconnected, reconnecting\n", h); 1063 "Mesh service disconnected, reconnecting\n", h);
1064 reconnect (h); 1064 reconnect (h);
1065 return; 1065 return;
@@ -1242,7 +1242,7 @@ send_callback (void *cls, size_t size, void *buf)
1242 * Auxiliary function to send an already constructed packet to the service. 1242 * Auxiliary function to send an already constructed packet to the service.
1243 * Takes care of creating a new queue element, copying the message and 1243 * Takes care of creating a new queue element, copying the message and
1244 * calling the tmt_rdy function if necessary. 1244 * calling the tmt_rdy function if necessary.
1245 * 1245 *
1246 * @param h mesh handle 1246 * @param h mesh handle
1247 * @param msg message to transmit 1247 * @param msg message to transmit
1248 * @param channel channel this send is related to (NULL if N/A) 1248 * @param channel channel this send is related to (NULL if N/A)
@@ -1414,7 +1414,7 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle)
1414 * @return handle to the channel 1414 * @return handle to the channel
1415 */ 1415 */
1416struct GNUNET_MESH_Channel * 1416struct GNUNET_MESH_Channel *
1417GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, 1417GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h,
1418 void *channel_ctx, 1418 void *channel_ctx,
1419 const struct GNUNET_PeerIdentity *peer, 1419 const struct GNUNET_PeerIdentity *peer,
1420 uint32_t port, 1420 uint32_t port,
@@ -1695,7 +1695,7 @@ static size_t
1695mesh_mq_ntr (void *cls, size_t size, 1695mesh_mq_ntr (void *cls, size_t size,
1696 void *buf) 1696 void *buf)
1697{ 1697{
1698 struct GNUNET_MQ_Handle *mq = cls; 1698 struct GNUNET_MQ_Handle *mq = cls;
1699 struct MeshMQState *state = GNUNET_MQ_impl_state (mq); 1699 struct MeshMQState *state = GNUNET_MQ_impl_state (mq);
1700 const struct GNUNET_MessageHeader *msg = GNUNET_MQ_impl_current (mq); 1700 const struct GNUNET_MessageHeader *msg = GNUNET_MQ_impl_current (mq);
1701 uint16_t msize; 1701 uint16_t msize;
@@ -1734,7 +1734,7 @@ mesh_mq_send_impl (struct GNUNET_MQ_Handle *mq,
1734 GNUNET_MESH_notify_transmit_ready (state->channel, 1734 GNUNET_MESH_notify_transmit_ready (state->channel,
1735 /* FIXME: add option for corking */ 1735 /* FIXME: add option for corking */
1736 GNUNET_NO, 1736 GNUNET_NO,
1737 GNUNET_TIME_UNIT_FOREVER_REL, 1737 GNUNET_TIME_UNIT_FOREVER_REL,
1738 ntohs (msg->size), 1738 ntohs (msg->size),
1739 mesh_mq_ntr, mq); 1739 mesh_mq_ntr, mq);
1740 1740
@@ -1746,7 +1746,7 @@ mesh_mq_send_impl (struct GNUNET_MQ_Handle *mq,
1746 * destruction of a message queue. 1746 * destruction of a message queue.
1747 * Implementations must not free 'mq', but should 1747 * Implementations must not free 'mq', but should
1748 * take care of 'impl_state'. 1748 * take care of 'impl_state'.
1749 * 1749 *
1750 * @param mq the message queue to destroy 1750 * @param mq the message queue to destroy
1751 * @param impl_state state of the implementation 1751 * @param impl_state state of the implementation
1752 */ 1752 */
diff --git a/src/mesh/mesh_enc.h b/src/mesh/mesh_enc.h
index 42cd22890..93a3a2e9e 100644
--- a/src/mesh/mesh_enc.h
+++ b/src/mesh/mesh_enc.h
@@ -241,9 +241,9 @@ GMC_min_pid (uint32_t a, uint32_t b);
241 * Generated with: 241 * Generated with:
242 * FIND: "#define ([^ ]+)[ ]*([0-9]+)" 242 * FIND: "#define ([^ ]+)[ ]*([0-9]+)"
243 * REPLACE: " case \2: return "\1"; break;" 243 * REPLACE: " case \2: return "\1"; break;"
244 * 244 *
245 * @param m Message type. 245 * @param m Message type.
246 * 246 *
247 * @return Human readable string description. 247 * @return Human readable string description.
248 */ 248 */
249const char * 249const char *
diff --git a/src/mesh/mesh_protocol.h b/src/mesh/mesh_protocol.h
index 37d3676f0..2d708eb62 100644
--- a/src/mesh/mesh_protocol.h
+++ b/src/mesh/mesh_protocol.h
@@ -309,12 +309,12 @@ struct GNUNET_MESH_TunnelKeepAlive
309 * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_(FWD|BCK)_KEEPALIVE 309 * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_(FWD|BCK)_KEEPALIVE
310 */ 310 */
311 struct GNUNET_MessageHeader header; 311 struct GNUNET_MessageHeader header;
312 312
313 /** 313 /**
314 * TID of the tunnel 314 * TID of the tunnel
315 */ 315 */
316 uint32_t tid GNUNET_PACKED; 316 uint32_t tid GNUNET_PACKED;
317 317
318 /** 318 /**
319 * OID of the tunnel 319 * OID of the tunnel
320 */ 320 */
diff --git a/src/mesh/mesh_protocol_enc.h b/src/mesh/mesh_protocol_enc.h
index f088cd057..78c3666b1 100644
--- a/src/mesh/mesh_protocol_enc.h
+++ b/src/mesh/mesh_protocol_enc.h
@@ -125,7 +125,7 @@ struct GNUNET_MESH_Encrypted
125 * Number of hops to live. 125 * Number of hops to live.
126 */ 126 */
127 uint32_t ttl GNUNET_PACKED; 127 uint32_t ttl GNUNET_PACKED;
128 128
129 /** 129 /**
130 * Always 0. 130 * Always 0.
131 */ 131 */
diff --git a/src/mesh/mesh_test_lib.c b/src/mesh/mesh_test_lib.c
index 353edb494..022cee2f3 100644
--- a/src/mesh/mesh_test_lib.c
+++ b/src/mesh/mesh_test_lib.c
@@ -51,7 +51,7 @@ struct GNUNET_MESH_TEST_Context
51 * Main function of the test to run once all MESHs are available. 51 * Main function of the test to run once all MESHs are available.
52 */ 52 */
53 GNUNET_MESH_TEST_AppMain app_main; 53 GNUNET_MESH_TEST_AppMain app_main;
54 54
55 /** 55 /**
56 * Closure for 'app_main'. 56 * Closure for 'app_main'.
57 */ 57 */
@@ -137,7 +137,7 @@ mesh_connect_adapter (void *cls,
137 * @param cls closure 137 * @param cls closure
138 * @param op_result service handle returned from the connect adapter 138 * @param op_result service handle returned from the connect adapter
139 */ 139 */
140static void 140static void
141mesh_disconnect_adapter (void *cls, 141mesh_disconnect_adapter (void *cls,
142 void *op_result) 142 void *op_result)
143{ 143{
@@ -154,12 +154,12 @@ mesh_disconnect_adapter (void *cls,
154 * 154 *
155 * @param cls The callback closure from functions generating an operation. 155 * @param cls The callback closure from functions generating an operation.
156 * @param op The operation that has been finished. 156 * @param op The operation that has been finished.
157 * @param ca_result The service handle returned from 157 * @param ca_result The service handle returned from
158 * GNUNET_TESTBED_ConnectAdapter() (mesh handle). 158 * GNUNET_TESTBED_ConnectAdapter() (mesh handle).
159 * @param emsg Error message in case the operation has failed. 159 * @param emsg Error message in case the operation has failed.
160 * NULL if operation has executed successfully. 160 * NULL if operation has executed successfully.
161 */ 161 */
162static void 162static void
163mesh_connect_cb (void *cls, 163mesh_connect_cb (void *cls,
164 struct GNUNET_TESTBED_Operation *op, 164 struct GNUNET_TESTBED_Operation *op,
165 void *ca_result, 165 void *ca_result,
@@ -167,7 +167,7 @@ mesh_connect_cb (void *cls,
167{ 167{
168 struct GNUNET_MESH_TEST_Context *ctx = cls; 168 struct GNUNET_MESH_TEST_Context *ctx = cls;
169 unsigned int i; 169 unsigned int i;
170 170
171 if (NULL != emsg) 171 if (NULL != emsg)
172 { 172 {
173 fprintf (stderr, "Failed to connect to MESH service: %s\n", 173 fprintf (stderr, "Failed to connect to MESH service: %s\n",
@@ -211,7 +211,7 @@ GNUNET_MESH_TEST_cleanup (struct GNUNET_MESH_TEST_Context *ctx)
211/** 211/**
212 * Callback run when the testbed is ready (peers running and connected to 212 * Callback run when the testbed is ready (peers running and connected to
213 * each other) 213 * each other)
214 * 214 *
215 * @param cls Closure (context). 215 * @param cls Closure (context).
216 * @param h the run handle 216 * @param h the run handle
217 * @param num_peers Number of peers that are running. 217 * @param num_peers Number of peers that are running.
@@ -252,7 +252,7 @@ mesh_test_run (void *cls,
252} 252}
253 253
254 254
255void 255void
256GNUNET_MESH_TEST_run (const char *testname, 256GNUNET_MESH_TEST_run (const char *testname,
257 const char *cfgname, 257 const char *cfgname,
258 unsigned int num_peers, 258 unsigned int num_peers,
diff --git a/src/mesh/mesh_test_lib.h b/src/mesh/mesh_test_lib.h
index c560d50c0..5732338f7 100644
--- a/src/mesh/mesh_test_lib.h
+++ b/src/mesh/mesh_test_lib.h
@@ -73,7 +73,7 @@ typedef void (*GNUNET_MESH_TEST_AppMain) (void *cls,
73 * @param handlers Message handlers. 73 * @param handlers Message handlers.
74 * @param ports Ports the peers offer. 74 * @param ports Ports the peers offer.
75 */ 75 */
76void 76void
77GNUNET_MESH_TEST_run (const char *testname, 77GNUNET_MESH_TEST_run (const char *testname,
78 const char *cfgname, 78 const char *cfgname,
79 unsigned int num_peers, 79 unsigned int num_peers,
diff --git a/src/mesh/mesh_tunnel_tree.c b/src/mesh/mesh_tunnel_tree.c
index 41b25c3a4..c2fe6c3d9 100644
--- a/src/mesh/mesh_tunnel_tree.c
+++ b/src/mesh/mesh_tunnel_tree.c
@@ -496,7 +496,7 @@ tree_get_predecessor (struct MeshTunnelTree *tree)
496 * 496 *
497 * @return peerinfo of the peer who is the first hop in the tunnel 497 * @return peerinfo of the peer who is the first hop in the tunnel
498 * NULL on error 498 * NULL on error
499 * 499 *
500 * FIXME use PEER_Id 500 * FIXME use PEER_Id
501 */ 501 */
502struct GNUNET_PeerIdentity * 502struct GNUNET_PeerIdentity *
diff --git a/src/mesh/test_mesh_local.c b/src/mesh/test_mesh_local.c
index c76c93f8e..4ecef81e2 100644
--- a/src/mesh/test_mesh_local.c
+++ b/src/mesh/test_mesh_local.c
@@ -98,7 +98,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
98 * @param channel connection to the other end 98 * @param channel connection to the other end
99 * @param channel_ctx place to store local state associated with the channel 99 * @param channel_ctx place to store local state associated with the channel
100 * @param message the actual message 100 * @param message the actual message
101 * 101 *
102 * @return GNUNET_OK to keep the connection open, 102 * @return GNUNET_OK to keep the connection open,
103 * GNUNET_SYSERR to close it (signal serious error) 103 * GNUNET_SYSERR to close it (signal serious error)
104 */ 104 */
@@ -190,11 +190,11 @@ static struct GNUNET_MESH_MessageHandler handlers2[] = {
190 190
191/** 191/**
192 * Data send callback: fillbuffer with test packet. 192 * Data send callback: fillbuffer with test packet.
193 * 193 *
194 * @param cls Closure (unused). 194 * @param cls Closure (unused).
195 * @param size Buffer size. 195 * @param size Buffer size.
196 * @param buf Buffer to fill. 196 * @param buf Buffer to fill.
197 * 197 *
198 * @return size of test packet. 198 * @return size of test packet.
199 */ 199 */
200static size_t 200static size_t
@@ -216,7 +216,7 @@ do_send (void *cls, size_t size, void *buf)
216 216
217/** 217/**
218 * Connect to other client and send data 218 * Connect to other client and send data
219 * 219 *
220 * @param cls Closue (unused). 220 * @param cls Closue (unused).
221 * @param tc TaskContext. 221 * @param tc TaskContext.
222 */ 222 */
@@ -238,13 +238,13 @@ do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
238 238
239/** 239/**
240 * Initialize framework and start test 240 * Initialize framework and start test
241 * 241 *
242 * @param cls Closure (unused). 242 * @param cls Closure (unused).
243 * @param cfg Configuration handle. 243 * @param cfg Configuration handle.
244 * @param peer Testing peer handle. 244 * @param peer Testing peer handle.
245 */ 245 */
246static void 246static void
247run (void *cls, 247run (void *cls,
248 const struct GNUNET_CONFIGURATION_Handle *cfg, 248 const struct GNUNET_CONFIGURATION_Handle *cfg,
249 struct GNUNET_TESTING_Peer *peer) 249 struct GNUNET_TESTING_Peer *peer)
250{ 250{
diff --git a/src/mesh/test_mesh_single.c b/src/mesh/test_mesh_single.c
index 196bda6e7..9e850079f 100644
--- a/src/mesh/test_mesh_single.c
+++ b/src/mesh/test_mesh_single.c
@@ -104,7 +104,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
104 * @param channel connection to the other end 104 * @param channel connection to the other end
105 * @param channel_ctx place to store local state associated with the channel 105 * @param channel_ctx place to store local state associated with the channel
106 * @param message the actual message 106 * @param message the actual message
107 * 107 *
108 * @return GNUNET_OK to keep the connection open, 108 * @return GNUNET_OK to keep the connection open,
109 * GNUNET_SYSERR to close it (signal serious error) 109 * GNUNET_SYSERR to close it (signal serious error)
110 */ 110 */
@@ -196,11 +196,11 @@ static struct GNUNET_MESH_MessageHandler handlers1[] = {
196 196
197/** 197/**
198 * Data send callback: fillbuffer with test packet. 198 * Data send callback: fillbuffer with test packet.
199 * 199 *
200 * @param cls Closure (unused). 200 * @param cls Closure (unused).
201 * @param size Buffer size. 201 * @param size Buffer size.
202 * @param buf Buffer to fill. 202 * @param buf Buffer to fill.
203 * 203 *
204 * @return size of test packet. 204 * @return size of test packet.
205 */ 205 */
206static size_t 206static size_t
@@ -223,7 +223,7 @@ do_send (void *cls, size_t size, void *buf)
223 223
224/** 224/**
225 * Connect to other client and send data 225 * Connect to other client and send data
226 * 226 *
227 * @param cls Closue (unused). 227 * @param cls Closue (unused).
228 * @param tc TaskContext. 228 * @param tc TaskContext.
229 */ 229 */
@@ -244,13 +244,13 @@ do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
244 244
245/** 245/**
246 * Initialize framework and start test 246 * Initialize framework and start test
247 * 247 *
248 * @param cls Closure (unused). 248 * @param cls Closure (unused).
249 * @param cfg Configuration handle. 249 * @param cfg Configuration handle.
250 * @param peer Testing peer handle. 250 * @param peer Testing peer handle.
251 */ 251 */
252static void 252static void
253run (void *cls, 253run (void *cls,
254 const struct GNUNET_CONFIGURATION_Handle *cfg, 254 const struct GNUNET_CONFIGURATION_Handle *cfg,
255 struct GNUNET_TESTING_Peer *peer) 255 struct GNUNET_TESTING_Peer *peer)
256{ 256{
diff --git a/src/mesh/test_mesh_small.c b/src/mesh/test_mesh_small.c
index 970283c1a..439f6ec5c 100644
--- a/src/mesh/test_mesh_small.c
+++ b/src/mesh/test_mesh_small.c
@@ -207,7 +207,7 @@ show_end_data (void)
207 207
208/** 208/**
209 * Shut down peergroup, clean up. 209 * Shut down peergroup, clean up.
210 * 210 *
211 * @param cls Closure (unused). 211 * @param cls Closure (unused).
212 * @param tc Task Context. 212 * @param tc Task Context.
213 */ 213 */
@@ -221,7 +221,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
221 221
222/** 222/**
223 * Disconnect from mesh services af all peers, call shutdown. 223 * Disconnect from mesh services af all peers, call shutdown.
224 * 224 *
225 * @param cls Closure (unused). 225 * @param cls Closure (unused).
226 * @param tc Task Context. 226 * @param tc Task Context.
227 */ 227 */
@@ -260,7 +260,7 @@ disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
260 260
261/** 261/**
262 * Abort test: schedule disconnect and shutdown immediately 262 * Abort test: schedule disconnect and shutdown immediately
263 * 263 *
264 * @param line Line in the code the abort is requested from (__LINE__). 264 * @param line Line in the code the abort is requested from (__LINE__).
265 */ 265 */
266static void 266static void
@@ -276,11 +276,11 @@ abort_test (long line)
276 276
277/** 277/**
278 * Transmit ready callback. 278 * Transmit ready callback.
279 * 279 *
280 * @param cls Closure (message type). 280 * @param cls Closure (message type).
281 * @param size Size of the tranmist buffer. 281 * @param size Size of the tranmist buffer.
282 * @param buf Pointer to the beginning of the buffer. 282 * @param buf Pointer to the beginning of the buffer.
283 * 283 *
284 * @return Number of bytes written to buf. 284 * @return Number of bytes written to buf.
285 */ 285 */
286static size_t 286static size_t
@@ -289,7 +289,7 @@ tmt_rdy (void *cls, size_t size, void *buf);
289 289
290/** 290/**
291 * Task to schedule a new data transmission. 291 * Task to schedule a new data transmission.
292 * 292 *
293 * @param cls Closure (peer #). 293 * @param cls Closure (peer #).
294 * @param tc Task Context. 294 * @param tc Task Context.
295 */ 295 */
@@ -385,7 +385,7 @@ tmt_rdy (void *cls, size_t size, void *buf)
385 GNUNET_SCHEDULER_add_now (&data_task, NULL); 385 GNUNET_SCHEDULER_add_now (&data_task, NULL);
386 } 386 }
387 } 387 }
388 388
389 return size_payload; 389 return size_payload;
390} 390}
391 391
@@ -615,10 +615,10 @@ channel_cleaner (void *cls, const struct GNUNET_MESH_Channel *channel,
615 615
616/** 616/**
617 * START THE TESTCASE ITSELF, AS WE ARE CONNECTED TO THE MESH SERVICES. 617 * START THE TESTCASE ITSELF, AS WE ARE CONNECTED TO THE MESH SERVICES.
618 * 618 *
619 * Testcase continues when the root receives confirmation of connected peers, 619 * Testcase continues when the root receives confirmation of connected peers,
620 * on callback funtion ch. 620 * on callback funtion ch.
621 * 621 *
622 * @param cls Closure (unsued). 622 * @param cls Closure (unsued).
623 * @param tc Task Context. 623 * @param tc Task Context.
624 */ 624 */
@@ -663,7 +663,7 @@ do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
663 data_received = 0; 663 data_received = 0;
664 data_sent = 0; 664 data_sent = 0;
665 GNUNET_MESH_notify_transmit_ready (ch, GNUNET_NO, 665 GNUNET_MESH_notify_transmit_ready (ch, GNUNET_NO,
666 GNUNET_TIME_UNIT_FOREVER_REL, 666 GNUNET_TIME_UNIT_FOREVER_REL,
667 size_payload, &tmt_rdy, (void *) 1L); 667 size_payload, &tmt_rdy, (void *) 1L);
668} 668}
669 669
diff --git a/src/multicast/multicast.h b/src/multicast/multicast.h
index 95c989707..3257af1a4 100644
--- a/src/multicast/multicast.h
+++ b/src/multicast/multicast.h
@@ -18,7 +18,7 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/** 21/**
22 * @file multicast/multicast.h 22 * @file multicast/multicast.h
23 * @brief multicast IPC messages 23 * @brief multicast IPC messages
24 * @author Christian Grothoff 24 * @author Christian Grothoff
@@ -57,7 +57,7 @@ struct MulticastJoinDecisionMessage
57 uint32_t relay_count; 57 uint32_t relay_count;
58 58
59 /* followed by 'relay_count' peer identities */ 59 /* followed by 'relay_count' peer identities */
60 60
61 /* followed by the join response message */ 61 /* followed by the join response message */
62 62
63}; 63};
@@ -243,7 +243,7 @@ struct MulticastReplayRequestMessage
243{ 243{
244 244
245 /** 245 /**
246 * The message type can be either 246 * The message type can be either
247 * #GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST or 247 * #GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST or
248 * #GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST_CANCEL. 248 * #GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST_CANCEL.
249 */ 249 */
diff --git a/src/multicast/multicast_api.c b/src/multicast/multicast_api.c
index 6a7cf98eb..3dbc07f5d 100644
--- a/src/multicast/multicast_api.c
+++ b/src/multicast/multicast_api.c
@@ -18,7 +18,7 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/** 21/**
22 * @file multicast/multicast_api.c 22 * @file multicast/multicast_api.c
23 * @brief multicast service; establish tunnels to distant peers 23 * @brief multicast service; establish tunnels to distant peers
24 * @author Christian Grothoff 24 * @author Christian Grothoff
@@ -30,7 +30,7 @@
30#include "gnunet_multicast_service.h" 30#include "gnunet_multicast_service.h"
31#include "multicast.h" 31#include "multicast.h"
32 32
33/** 33/**
34 * Handle for a request to send a message to all multicast group members 34 * Handle for a request to send a message to all multicast group members
35 * (from the origin). 35 * (from the origin).
36 */ 36 */
@@ -45,7 +45,7 @@ struct GNUNET_MULTICAST_OriginMessageHandle
45}; 45};
46 46
47 47
48/** 48/**
49 * Handle for the origin of a multicast group. 49 * Handle for the origin of a multicast group.
50 */ 50 */
51struct GNUNET_MULTICAST_Origin 51struct GNUNET_MULTICAST_Origin
@@ -65,7 +65,7 @@ struct GNUNET_MULTICAST_Origin
65}; 65};
66 66
67 67
68/** 68/**
69 * Handle for a message to be delivered from a member to the origin. 69 * Handle for a message to be delivered from a member to the origin.
70 */ 70 */
71struct GNUNET_MULTICAST_MemberRequestHandle 71struct GNUNET_MULTICAST_MemberRequestHandle
@@ -73,7 +73,7 @@ struct GNUNET_MULTICAST_MemberRequestHandle
73}; 73};
74 74
75 75
76/** 76/**
77 * Opaque handle for a multicast group member. 77 * Opaque handle for a multicast group member.
78 */ 78 */
79struct GNUNET_MULTICAST_Member 79struct GNUNET_MULTICAST_Member
@@ -83,12 +83,12 @@ struct GNUNET_MULTICAST_Member
83 83
84GNUNET_NETWORK_STRUCT_BEGIN 84GNUNET_NETWORK_STRUCT_BEGIN
85 85
86/** 86/**
87 * Header of a request from a member to the origin. 87 * Header of a request from a member to the origin.
88 */ 88 */
89struct GNUNET_MULTICAST_RequestHeader 89struct GNUNET_MULTICAST_RequestHeader
90{ 90{
91 /** 91 /**
92 * Header for all requests from a member to the origin. 92 * Header for all requests from a member to the origin.
93 */ 93 */
94 struct GNUNET_MessageHeader header; 94 struct GNUNET_MessageHeader header;
@@ -98,29 +98,29 @@ struct GNUNET_MULTICAST_RequestHeader
98 */ 98 */
99 struct GNUNET_CRYPTO_EccPublicSignKey member_key; 99 struct GNUNET_CRYPTO_EccPublicSignKey member_key;
100 100
101 /** 101 /**
102 * ECC signature of the request fragment. 102 * ECC signature of the request fragment.
103 * 103 *
104 * Signature must match the public key of the multicast group. 104 * Signature must match the public key of the multicast group.
105 */ 105 */
106 struct GNUNET_CRYPTO_EccSignature signature; 106 struct GNUNET_CRYPTO_EccSignature signature;
107 107
108 /** 108 /**
109 * Purpose for the signature and size of the signed data. 109 * Purpose for the signature and size of the signed data.
110 */ 110 */
111 struct GNUNET_CRYPTO_EccSignaturePurpose purpose; 111 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
112 112
113 /** 113 /**
114 * Number of the request fragment, monotonically increasing. 114 * Number of the request fragment, monotonically increasing.
115 */ 115 */
116 uint64_t fragment_id GNUNET_PACKED; 116 uint64_t fragment_id GNUNET_PACKED;
117 117
118 /** 118 /**
119 * Byte offset of this @e fragment of the @e request. 119 * Byte offset of this @e fragment of the @e request.
120 */ 120 */
121 uint64_t fragment_offset GNUNET_PACKED; 121 uint64_t fragment_offset GNUNET_PACKED;
122 122
123 /** 123 /**
124 * Number of the request this fragment belongs to. 124 * Number of the request this fragment belongs to.
125 * 125 *
126 * Set in GNUNET_MULTICAST_origin_to_all(). 126 * Set in GNUNET_MULTICAST_origin_to_all().
@@ -135,24 +135,24 @@ struct GNUNET_MULTICAST_RequestHeader
135 /* Followed by request body. */ 135 /* Followed by request body. */
136}; 136};
137 137
138/** 138/**
139 * Header of a join request sent to the origin or another member. 139 * Header of a join request sent to the origin or another member.
140 */ 140 */
141struct GNUNET_MULTICAST_JoinRequest 141struct GNUNET_MULTICAST_JoinRequest
142{ 142{
143 /** 143 /**
144 * Header for the join request. 144 * Header for the join request.
145 */ 145 */
146 struct GNUNET_MessageHeader header; 146 struct GNUNET_MessageHeader header;
147 147
148 /** 148 /**
149 * ECC signature of the rest of the fields of the join request. 149 * ECC signature of the rest of the fields of the join request.
150 * 150 *
151 * Signature must match the public key of the joining member. 151 * Signature must match the public key of the joining member.
152 */ 152 */
153 struct GNUNET_CRYPTO_EccSignature signature; 153 struct GNUNET_CRYPTO_EccSignature signature;
154 154
155 /** 155 /**
156 * Purpose for the signature and size of the signed data. 156 * Purpose for the signature and size of the signed data.
157 */ 157 */
158 struct GNUNET_CRYPTO_EccSignaturePurpose purpose; 158 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
@@ -178,7 +178,7 @@ struct GNUNET_MULTICAST_JoinRequest
178GNUNET_NETWORK_STRUCT_END 178GNUNET_NETWORK_STRUCT_END
179 179
180 180
181/** 181/**
182 * Handle that identifies a join request. 182 * Handle that identifies a join request.
183 * 183 *
184 * Used to match calls to #GNUNET_MULTICAST_JoinCallback to the 184 * Used to match calls to #GNUNET_MULTICAST_JoinCallback to the
@@ -189,7 +189,7 @@ struct GNUNET_MULTICAST_JoinHandle
189}; 189};
190 190
191 191
192/** 192/**
193 * Function to call with the decision made for a join request. 193 * Function to call with the decision made for a join request.
194 * 194 *
195 * Must be called once and only once in response to an invocation of the 195 * Must be called once and only once in response to an invocation of the
@@ -222,7 +222,7 @@ GNUNET_MULTICAST_join_decision (struct GNUNET_MULTICAST_JoinHandle *jh,
222} 222}
223 223
224 224
225/** 225/**
226 * Handle to pass back for the answer of a membership test. 226 * Handle to pass back for the answer of a membership test.
227 */ 227 */
228struct GNUNET_MULTICAST_MembershipTestHandle 228struct GNUNET_MULTICAST_MembershipTestHandle
@@ -230,7 +230,7 @@ struct GNUNET_MULTICAST_MembershipTestHandle
230}; 230};
231 231
232 232
233/** 233/**
234 * Call informing multicast about the decision taken for a membership test. 234 * Call informing multicast about the decision taken for a membership test.
235 * 235 *
236 * @param mth Handle that was given for the query. 236 * @param mth Handle that was given for the query.
@@ -244,7 +244,7 @@ GNUNET_MULTICAST_membership_test_result (struct GNUNET_MULTICAST_MembershipTestH
244} 244}
245 245
246 246
247/** 247/**
248 * Opaque handle to a replay request from the multicast service. 248 * Opaque handle to a replay request from the multicast service.
249 */ 249 */
250struct GNUNET_MULTICAST_ReplayHandle 250struct GNUNET_MULTICAST_ReplayHandle
@@ -252,7 +252,7 @@ struct GNUNET_MULTICAST_ReplayHandle
252}; 252};
253 253
254 254
255/** 255/**
256 * Replay a message fragment for the multicast group. 256 * Replay a message fragment for the multicast group.
257 * 257 *
258 * @param rh Replay handle identifying which replay operation was requested. 258 * @param rh Replay handle identifying which replay operation was requested.
@@ -267,7 +267,7 @@ GNUNET_MULTICAST_replay_response (struct GNUNET_MULTICAST_ReplayHandle *rh,
267} 267}
268 268
269 269
270/** 270/**
271 * Indicate the end of the replay session. 271 * Indicate the end of the replay session.
272 * 272 *
273 * Invalidates the replay handle. 273 * Invalidates the replay handle.
@@ -280,7 +280,7 @@ GNUNET_MULTICAST_replay_response_end (struct GNUNET_MULTICAST_ReplayHandle *rh)
280} 280}
281 281
282 282
283/** 283/**
284 * Replay a message for the multicast group. 284 * Replay a message for the multicast group.
285 * 285 *
286 * @param rh Replay handle identifying which replay operation was requested. 286 * @param rh Replay handle identifying which replay operation was requested.
@@ -295,7 +295,7 @@ GNUNET_MULTICAST_replay_response2 (struct GNUNET_MULTICAST_ReplayHandle *rh,
295} 295}
296 296
297 297
298/** 298/**
299 * Start a multicast group. 299 * Start a multicast group.
300 * 300 *
301 * Will advertise the origin in the P2P overlay network under the respective 301 * Will advertise the origin in the P2P overlay network under the respective
@@ -402,7 +402,7 @@ schedule_origin_to_all (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc
402 402
403} 403}
404 404
405/** 405/**
406 * Send a message to the multicast group. 406 * Send a message to the multicast group.
407 * 407 *
408 * @param origin Handle to the multicast group. 408 * @param origin Handle to the multicast group.
@@ -433,7 +433,7 @@ GNUNET_MULTICAST_origin_to_all (struct GNUNET_MULTICAST_Origin *origin,
433} 433}
434 434
435 435
436/** 436/**
437 * Resume message transmission to multicast group. 437 * Resume message transmission to multicast group.
438 * 438 *
439 * @param mh Request to cancel. 439 * @param mh Request to cancel.
@@ -445,7 +445,7 @@ GNUNET_MULTICAST_origin_to_all_resume (struct GNUNET_MULTICAST_OriginMessageHand
445} 445}
446 446
447 447
448/** 448/**
449 * Cancel request for message transmission to multicast group. 449 * Cancel request for message transmission to multicast group.
450 * 450 *
451 * @param mh Request to cancel. 451 * @param mh Request to cancel.
@@ -456,7 +456,7 @@ GNUNET_MULTICAST_origin_to_all_cancel (struct GNUNET_MULTICAST_OriginMessageHand
456} 456}
457 457
458 458
459/** 459/**
460 * Stop a multicast group. 460 * Stop a multicast group.
461 * 461 *
462 * @param origin Multicast group to stop. 462 * @param origin Multicast group to stop.
@@ -468,7 +468,7 @@ GNUNET_MULTICAST_origin_stop (struct GNUNET_MULTICAST_Origin *origin)
468} 468}
469 469
470 470
471/** 471/**
472 * Join a multicast group. 472 * Join a multicast group.
473 * 473 *
474 * The entity joining is always the local peer. Further information about the 474 * The entity joining is always the local peer. Further information about the
@@ -530,7 +530,7 @@ GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
530} 530}
531 531
532 532
533/** 533/**
534 * Handle for a replay request. 534 * Handle for a replay request.
535 */ 535 */
536struct GNUNET_MULTICAST_MemberReplayHandle 536struct GNUNET_MULTICAST_MemberReplayHandle
@@ -538,7 +538,7 @@ struct GNUNET_MULTICAST_MemberReplayHandle
538}; 538};
539 539
540 540
541/** 541/**
542 * Request a fragment to be replayed by fragment ID. 542 * Request a fragment to be replayed by fragment ID.
543 * 543 *
544 * Useful if messages below the @e max_known_fragment_id given when joining are 544 * Useful if messages below the @e max_known_fragment_id given when joining are
@@ -561,7 +561,7 @@ GNUNET_MULTICAST_member_replay_fragment (struct GNUNET_MULTICAST_Member *member,
561} 561}
562 562
563 563
564/** 564/**
565 * Request a message fragment to be replayed. 565 * Request a message fragment to be replayed.
566 * 566 *
567 * Useful if messages below the @e max_known_fragment_id given when joining are 567 * Useful if messages below the @e max_known_fragment_id given when joining are
@@ -588,7 +588,7 @@ GNUNET_MULTICAST_member_replay_message (struct GNUNET_MULTICAST_Member *member,
588} 588}
589 589
590 590
591/** 591/**
592 * Cancel a replay request. 592 * Cancel a replay request.
593 * 593 *
594 * @param rh Request to cancel. 594 * @param rh Request to cancel.
@@ -599,7 +599,7 @@ GNUNET_MULTICAST_member_replay_cancel (struct GNUNET_MULTICAST_MemberReplayHandl
599} 599}
600 600
601 601
602/** 602/**
603 * Part a multicast group. 603 * Part a multicast group.
604 * 604 *
605 * Disconnects from all group members and invalidates the @a member handle. 605 * Disconnects from all group members and invalidates the @a member handle.
@@ -616,9 +616,9 @@ GNUNET_MULTICAST_member_part (struct GNUNET_MULTICAST_Member *member)
616} 616}
617 617
618 618
619/** 619/**
620 * Send a message to the origin of the multicast group. 620 * Send a message to the origin of the multicast group.
621 * 621 *
622 * @param member Membership handle. 622 * @param member Membership handle.
623 * @param message_id Application layer ID for the message. Opaque to multicast. 623 * @param message_id Application layer ID for the message. Opaque to multicast.
624 * @param notify Callback to call to get the message. 624 * @param notify Callback to call to get the message.
@@ -635,7 +635,7 @@ GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member,
635} 635}
636 636
637 637
638/** 638/**
639 * Resume message transmission to origin. 639 * Resume message transmission to origin.
640 * 640 *
641 * @param rh Request to cancel. 641 * @param rh Request to cancel.
@@ -647,7 +647,7 @@ GNUNET_MULTICAST_member_to_origin_resume (struct GNUNET_MULTICAST_MemberRequestH
647} 647}
648 648
649 649
650/** 650/**
651 * Cancel request for message transmission to origin. 651 * Cancel request for message transmission to origin.
652 * 652 *
653 * @param rh Request to cancel. 653 * @param rh Request to cancel.
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c
index 4b110a548..7455c0ba5 100644
--- a/src/namestore/gnunet-namestore-fcfsd.c
+++ b/src/namestore/gnunet-namestore-fcfsd.c
@@ -120,7 +120,7 @@ struct Request
120 struct MHD_PostProcessor *pp; 120 struct MHD_PostProcessor *pp;
121 121
122 /** 122 /**
123 * URL to serve in response to this POST (if this request 123 * URL to serve in response to this POST (if this request
124 * was a 'POST') 124 * was a 'POST')
125 */ 125 */
126 const char *post_url; 126 const char *post_url;
@@ -129,7 +129,7 @@ struct Request
129 * Active request with the namestore. 129 * Active request with the namestore.
130 */ 130 */
131 struct GNUNET_NAMESTORE_QueueEntry *qe; 131 struct GNUNET_NAMESTORE_QueueEntry *qe;
132 132
133 /** 133 /**
134 * Current processing phase. 134 * Current processing phase.
135 */ 135 */
@@ -171,7 +171,7 @@ struct ZoneinfoRequest
171 * Buffer length 171 * Buffer length
172 */ 172 */
173 size_t buf_len; 173 size_t buf_len;
174 174
175 /** 175 /**
176 * Buffer write offset 176 * Buffer write offset
177 */ 177 */
@@ -270,8 +270,8 @@ iterate_cb (void *cls,
270 MHD_add_response_header (response, 270 MHD_add_response_header (response,
271 MHD_HTTP_HEADER_CONTENT_TYPE, 271 MHD_HTTP_HEADER_CONTENT_TYPE,
272 MIME_HTML); 272 MIME_HTML);
273 MHD_queue_response (zr->connection, 273 MHD_queue_response (zr->connection,
274 MHD_HTTP_OK, 274 MHD_HTTP_OK,
275 response); 275 response);
276 MHD_destroy_response (response); 276 MHD_destroy_response (response);
277 GNUNET_free (zr->zoneinfo); 277 GNUNET_free (zr->zoneinfo);
@@ -305,9 +305,9 @@ iterate_cb (void *cls,
305 zr->zoneinfo = new_buf; 305 zr->zoneinfo = new_buf;
306 zr->buf_len *= 2; 306 zr->buf_len *= 2;
307 } 307 }
308 sprintf (zr->zoneinfo + zr->write_offset, 308 sprintf (zr->zoneinfo + zr->write_offset,
309 "<tr><td>%s</td><td>%s</td></tr>", 309 "<tr><td>%s</td><td>%s</td></tr>",
310 name, 310 name,
311 pkey); 311 pkey);
312 zr->write_offset = strlen (zr->zoneinfo); 312 zr->write_offset = strlen (zr->zoneinfo);
313 GNUNET_NAMESTORE_zone_iterator_next (zr->list_it); 313 GNUNET_NAMESTORE_zone_iterator_next (zr->list_it);
@@ -359,8 +359,8 @@ serve_main_page (struct MHD_Connection *connection)
359 MHD_add_response_header (response, 359 MHD_add_response_header (response,
360 MHD_HTTP_HEADER_CONTENT_TYPE, 360 MHD_HTTP_HEADER_CONTENT_TYPE,
361 MIME_HTML); 361 MIME_HTML);
362 ret = MHD_queue_response (connection, 362 ret = MHD_queue_response (connection,
363 MHD_HTTP_OK, 363 MHD_HTTP_OK,
364 response); 364 response);
365 MHD_destroy_response (response); 365 MHD_destroy_response (response);
366 return ret; 366 return ret;
@@ -394,8 +394,8 @@ fill_s_reply (const char *info,
394 MHD_add_response_header (response, 394 MHD_add_response_header (response,
395 MHD_HTTP_HEADER_CONTENT_TYPE, 395 MHD_HTTP_HEADER_CONTENT_TYPE,
396 MIME_HTML); 396 MIME_HTML);
397 ret = MHD_queue_response (connection, 397 ret = MHD_queue_response (connection,
398 MHD_HTTP_OK, 398 MHD_HTTP_OK,
399 response); 399 response);
400 MHD_destroy_response (response); 400 MHD_destroy_response (response);
401 return ret; 401 return ret;
@@ -471,7 +471,7 @@ post_iterator (void *cls,
471 * GNUNET_YES (or other positive value) on success 471 * GNUNET_YES (or other positive value) on success
472 * @param emsg NULL on success, otherwise an error message 472 * @param emsg NULL on success, otherwise an error message
473 */ 473 */
474static void 474static void
475put_continuation (void *cls, 475put_continuation (void *cls,
476 int32_t success, 476 int32_t success,
477 const char *emsg) 477 const char *emsg)
@@ -502,7 +502,7 @@ put_continuation (void *cls,
502 * @param rd_count number of entries in 'rd' array 502 * @param rd_count number of entries in 'rd' array
503 * @param rd array of records with data to store 503 * @param rd array of records with data to store
504 */ 504 */
505static void 505static void
506zone_to_name_cb (void *cls, 506zone_to_name_cb (void *cls,
507 const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, 507 const struct GNUNET_CRYPTO_EccPrivateKey *zone_key,
508 const char *name, 508 const char *name,
@@ -512,7 +512,7 @@ zone_to_name_cb (void *cls,
512 struct Request *request = cls; 512 struct Request *request = cls;
513 struct GNUNET_NAMESTORE_RecordData r; 513 struct GNUNET_NAMESTORE_RecordData r;
514 struct GNUNET_CRYPTO_EccPublicSignKey pub; 514 struct GNUNET_CRYPTO_EccPublicSignKey pub;
515 515
516 request->qe = NULL; 516 request->qe = NULL;
517 if (NULL != name) 517 if (NULL != name)
518 { 518 {
@@ -548,14 +548,14 @@ zone_to_name_cb (void *cls,
548 * @param rd_count number of entries in 'rd' array 548 * @param rd_count number of entries in 'rd' array
549 * @param rd array of records with data to store 549 * @param rd array of records with data to store
550 */ 550 */
551static void 551static void
552lookup_result_processor (void *cls, 552lookup_result_processor (void *cls,
553 unsigned int rd_count, 553 unsigned int rd_count,
554 const struct GNUNET_NAMESTORE_RecordData *rd) 554 const struct GNUNET_NAMESTORE_RecordData *rd)
555{ 555{
556 struct Request *request = cls; 556 struct Request *request = cls;
557 struct GNUNET_CRYPTO_EccPublicSignKey pub; 557 struct GNUNET_CRYPTO_EccPublicSignKey pub;
558 558
559 if (0 != rd_count) 559 if (0 != rd_count)
560 { 560 {
561 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 561 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -606,7 +606,7 @@ lookup_block_processor (void *cls,
606 } 606 }
607 GNUNET_CRYPTO_ecc_key_get_public_for_signature (&fcfs_zone_pkey, 607 GNUNET_CRYPTO_ecc_key_get_public_for_signature (&fcfs_zone_pkey,
608 &pub); 608 &pub);
609 if (GNUNET_OK != 609 if (GNUNET_OK !=
610 GNUNET_NAMESTORE_block_decrypt (block, 610 GNUNET_NAMESTORE_block_decrypt (block,
611 &pub, 611 &pub,
612 request->domain_name, 612 request->domain_name,
@@ -650,7 +650,7 @@ create_response (void *cls,
650 const char *url, 650 const char *url,
651 const char *method, 651 const char *method,
652 const char *version, 652 const char *version,
653 const char *upload_data, 653 const char *upload_data,
654 size_t *upload_data_size, 654 size_t *upload_data_size,
655 void **ptr) 655 void **ptr)
656{ 656{
@@ -688,7 +688,7 @@ create_response (void *cls,
688 _("Failed to setup post processor for `%s'\n"), 688 _("Failed to setup post processor for `%s'\n"),
689 url); 689 url);
690 return MHD_NO; /* internal error */ 690 return MHD_NO; /* internal error */
691 } 691 }
692 return MHD_YES; 692 return MHD_YES;
693 } 693 }
694 if (NULL != request->pp) 694 if (NULL != request->pp)
@@ -759,14 +759,14 @@ create_response (void *cls,
759 GNUNET_break (0); 759 GNUNET_break (0);
760 return MHD_NO; 760 return MHD_NO;
761 } 761 }
762 return MHD_YES; /* will have a reply later... */ 762 return MHD_YES; /* will have a reply later... */
763 } 763 }
764 /* unsupported HTTP method */ 764 /* unsupported HTTP method */
765 response = MHD_create_response_from_buffer (strlen (METHOD_ERROR), 765 response = MHD_create_response_from_buffer (strlen (METHOD_ERROR),
766 (void *) METHOD_ERROR, 766 (void *) METHOD_ERROR,
767 MHD_RESPMEM_PERSISTENT); 767 MHD_RESPMEM_PERSISTENT);
768 ret = MHD_queue_response (connection, 768 ret = MHD_queue_response (connection,
769 MHD_HTTP_METHOD_NOT_ACCEPTABLE, 769 MHD_HTTP_METHOD_NOT_ACCEPTABLE,
770 response); 770 response);
771 MHD_destroy_response (response); 771 MHD_destroy_response (response);
772 return ret; 772 return ret;
@@ -900,7 +900,7 @@ do_shutdown (void *cls,
900} 900}
901 901
902 902
903/** 903/**
904 * Method called to inform about the egos of this peer. 904 * Method called to inform about the egos of this peer.
905 * 905 *
906 * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get, 906 * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get,
@@ -908,7 +908,7 @@ do_shutdown (void *cls,
908 * @a ego does indicate an error (i.e. name is taken or no default 908 * @a ego does indicate an error (i.e. name is taken or no default
909 * value is known). If @a ego is non-NULL and if '*ctx' 909 * value is known). If @a ego is non-NULL and if '*ctx'
910 * is set in those callbacks, the value WILL be passed to a subsequent 910 * is set in those callbacks, the value WILL be passed to a subsequent
911 * call to the identity callback of #GNUNET_IDENTITY_connect (if 911 * call to the identity callback of #GNUNET_IDENTITY_connect (if
912 * that one was not NULL). 912 * that one was not NULL).
913 * 913 *
914 * @param cls closure, NULL 914 * @param cls closure, NULL
@@ -941,12 +941,12 @@ identity_cb (void *cls,
941 { 941 {
942 httpd = MHD_start_daemon (options, 942 httpd = MHD_start_daemon (options,
943 (uint16_t) port, 943 (uint16_t) port,
944 NULL, NULL, 944 NULL, NULL,
945 &create_response, NULL, 945 &create_response, NULL,
946 MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 128, 946 MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 128,
947 MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 1, 947 MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 1,
948 MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 16, 948 MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 16,
949 MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (4 * 1024), 949 MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (4 * 1024),
950 MHD_OPTION_NOTIFY_COMPLETED, &request_completed_callback, NULL, 950 MHD_OPTION_NOTIFY_COMPLETED, &request_completed_callback, NULL,
951 MHD_OPTION_END); 951 MHD_OPTION_END);
952 if (MHD_USE_DEBUG == options) 952 if (MHD_USE_DEBUG == options)
@@ -1026,7 +1026,7 @@ main (int argc, char *const *argv)
1026 ret = 1026 ret =
1027 (GNUNET_OK == 1027 (GNUNET_OK ==
1028 GNUNET_PROGRAM_run (argc, argv, "fcfsd", 1028 GNUNET_PROGRAM_run (argc, argv, "fcfsd",
1029 _("GNU Name System First Come First Serve name registration service"), 1029 _("GNU Name System First Come First Serve name registration service"),
1030 options, 1030 options,
1031 &run, NULL)) ? 0 : 1; 1031 &run, NULL)) ? 0 : 1;
1032 GNUNET_free ((void*) argv); 1032 GNUNET_free ((void*) argv);
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 37995e8c6..ceedadc24 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -336,7 +336,7 @@ display_record (void *cls,
336 if ( (NULL == del_qe) && 336 if ( (NULL == del_qe) &&
337 (NULL == list_qe) && 337 (NULL == list_qe) &&
338 (NULL == add_qe_uri) && 338 (NULL == add_qe_uri) &&
339 (NULL == add_qe) ) 339 (NULL == add_qe) )
340 GNUNET_SCHEDULER_shutdown (); 340 GNUNET_SCHEDULER_shutdown ();
341 return; 341 return;
342 } 342 }
@@ -365,12 +365,12 @@ display_record (void *cls,
365 at.abs_value_us = rd[i].expiration_time; 365 at.abs_value_us = rd[i].expiration_time;
366 ets = GNUNET_STRINGS_absolute_time_to_string (at); 366 ets = GNUNET_STRINGS_absolute_time_to_string (at);
367 } 367 }
368 FPRINTF (stdout, 368 FPRINTF (stdout,
369 "\t%s: %s (%s)\n", 369 "\t%s: %s (%s)\n",
370 typestring, 370 typestring,
371 s, 371 s,
372 ets); 372 ets);
373 GNUNET_free (s); 373 GNUNET_free (s);
374 } 374 }
375 FPRINTF (stdout, "%s", "\n"); 375 FPRINTF (stdout, "%s", "\n");
376 GNUNET_NAMESTORE_zone_iterator_next (list_it); 376 GNUNET_NAMESTORE_zone_iterator_next (list_it);
@@ -435,7 +435,7 @@ get_existing_record (void *cls,
435 } 435 }
436 else if (GNUNET_NO == etime_is_rel) 436 else if (GNUNET_NO == etime_is_rel)
437 rde->expiration_time = etime_abs.abs_value_us; 437 rde->expiration_time = etime_abs.abs_value_us;
438 else 438 else
439 rde->expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; 439 rde->expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
440 GNUNET_assert (NULL != name); 440 GNUNET_assert (NULL != name);
441 add_qe = GNUNET_NAMESTORE_records_store (ns, 441 add_qe = GNUNET_NAMESTORE_records_store (ns,
@@ -479,7 +479,7 @@ display_records_from_block (void *cls,
479 } 479 }
480 FPRINTF (stdout, 480 FPRINTF (stdout,
481 "%s:\n", 481 "%s:\n",
482 name); 482 name);
483 for (i=0;i<rd_len;i++) 483 for (i=0;i<rd_len;i++)
484 { 484 {
485 typestring = GNUNET_NAMESTORE_number_to_typename (rd[i].record_type); 485 typestring = GNUNET_NAMESTORE_number_to_typename (rd[i].record_type);
@@ -492,11 +492,11 @@ display_records_from_block (void *cls,
492 (unsigned int) rd[i].record_type); 492 (unsigned int) rd[i].record_type);
493 continue; 493 continue;
494 } 494 }
495 FPRINTF (stdout, 495 FPRINTF (stdout,
496 "\t%s: %s\n", 496 "\t%s: %s\n",
497 typestring, 497 typestring,
498 s); 498 s);
499 GNUNET_free (s); 499 GNUNET_free (s);
500 } 500 }
501 FPRINTF (stdout, "%s", "\n"); 501 FPRINTF (stdout, "%s", "\n");
502} 502}
@@ -521,7 +521,7 @@ handle_block (void *cls,
521 { 521 {
522 fprintf (stderr, 522 fprintf (stderr,
523 "No matching block found\n"); 523 "No matching block found\n");
524 } 524 }
525 else if (GNUNET_OK != 525 else if (GNUNET_OK !=
526 GNUNET_NAMESTORE_block_decrypt (block, 526 GNUNET_NAMESTORE_block_decrypt (block,
527 &zone_pubkey, 527 &zone_pubkey,
@@ -535,7 +535,7 @@ handle_block (void *cls,
535 if ( (NULL == del_qe) && 535 if ( (NULL == del_qe) &&
536 (NULL == list_it) && 536 (NULL == list_it) &&
537 (NULL == add_qe_uri) && 537 (NULL == add_qe_uri) &&
538 (NULL == add_qe) ) 538 (NULL == add_qe) )
539 GNUNET_SCHEDULER_shutdown (); 539 GNUNET_SCHEDULER_shutdown ();
540} 540}
541 541
@@ -558,17 +558,17 @@ testservice_task (void *cls,
558 558
559 if (GNUNET_YES != result) 559 if (GNUNET_YES != result)
560 { 560 {
561 FPRINTF (stderr, _("Service `%s' is not running\n"), 561 FPRINTF (stderr, _("Service `%s' is not running\n"),
562 "namestore"); 562 "namestore");
563 return; 563 return;
564 } 564 }
565 if (! (add|del|list|(NULL != uri))) 565 if (! (add|del|list|(NULL != uri)))
566 { 566 {
567 /* nothing more to be done */ 567 /* nothing more to be done */
568 fprintf (stderr, 568 fprintf (stderr,
569 _("No options given\n")); 569 _("No options given\n"));
570 GNUNET_SCHEDULER_shutdown (); 570 GNUNET_SCHEDULER_shutdown ();
571 return; 571 return;
572 } 572 }
573 GNUNET_CRYPTO_ecc_key_get_public_for_signature (&zone_pkey, 573 GNUNET_CRYPTO_ecc_key_get_public_for_signature (&zone_pkey,
574 &pub); 574 &pub);
@@ -588,8 +588,8 @@ testservice_task (void *cls,
588 _("Missing option `%s' for operation `%s'\n"), 588 _("Missing option `%s' for operation `%s'\n"),
589 "-n", _("add")); 589 "-n", _("add"));
590 GNUNET_SCHEDULER_shutdown (); 590 GNUNET_SCHEDULER_shutdown ();
591 ret = 1; 591 ret = 1;
592 return; 592 return;
593 } 593 }
594 if (NULL == typestring) 594 if (NULL == typestring)
595 { 595 {
@@ -598,7 +598,7 @@ testservice_task (void *cls,
598 "-t", _("add")); 598 "-t", _("add"));
599 GNUNET_SCHEDULER_shutdown (); 599 GNUNET_SCHEDULER_shutdown ();
600 ret = 1; 600 ret = 1;
601 return; 601 return;
602 } 602 }
603 type = GNUNET_NAMESTORE_typename_to_number (typestring); 603 type = GNUNET_NAMESTORE_typename_to_number (typestring);
604 if (UINT32_MAX == type) 604 if (UINT32_MAX == type)
@@ -613,9 +613,9 @@ testservice_task (void *cls,
613 fprintf (stderr, 613 fprintf (stderr,
614 _("Missing option `%s' for operation `%s'\n"), 614 _("Missing option `%s' for operation `%s'\n"),
615 "-V", _("add")); 615 "-V", _("add"));
616 ret = 1; 616 ret = 1;
617 GNUNET_SCHEDULER_shutdown (); 617 GNUNET_SCHEDULER_shutdown ();
618 return; 618 return;
619 } 619 }
620 if (GNUNET_OK != 620 if (GNUNET_OK !=
621 GNUNET_NAMESTORE_string_to_value (type, 621 GNUNET_NAMESTORE_string_to_value (type,
@@ -636,8 +636,8 @@ testservice_task (void *cls,
636 _("Missing option `%s' for operation `%s'\n"), 636 _("Missing option `%s' for operation `%s'\n"),
637 "-e", _("add")); 637 "-e", _("add"));
638 GNUNET_SCHEDULER_shutdown (); 638 GNUNET_SCHEDULER_shutdown ();
639 ret = 1; 639 ret = 1;
640 return; 640 return;
641 } 641 }
642 if (0 == strcmp (expirationstring, "never")) 642 if (0 == strcmp (expirationstring, "never"))
643 { 643 {
@@ -650,7 +650,7 @@ testservice_task (void *cls,
650 { 650 {
651 etime_is_rel = GNUNET_YES; 651 etime_is_rel = GNUNET_YES;
652 } 652 }
653 else if (GNUNET_OK == 653 else if (GNUNET_OK ==
654 GNUNET_STRINGS_fancy_time_to_absolute (expirationstring, 654 GNUNET_STRINGS_fancy_time_to_absolute (expirationstring,
655 &etime_abs)) 655 &etime_abs))
656 { 656 {
@@ -663,7 +663,7 @@ testservice_task (void *cls,
663 expirationstring); 663 expirationstring);
664 GNUNET_SCHEDULER_shutdown (); 664 GNUNET_SCHEDULER_shutdown ();
665 ret = 1; 665 ret = 1;
666 return; 666 return;
667 } 667 }
668 add_zit = GNUNET_NAMESTORE_zone_iteration_start (ns, 668 add_zit = GNUNET_NAMESTORE_zone_iteration_start (ns,
669 &zone_pkey, 669 &zone_pkey,
@@ -679,7 +679,7 @@ testservice_task (void *cls,
679 "-n", _("del")); 679 "-n", _("del"));
680 GNUNET_SCHEDULER_shutdown (); 680 GNUNET_SCHEDULER_shutdown ();
681 ret = 1; 681 ret = 1;
682 return; 682 return;
683 } 683 }
684 del_qe = GNUNET_NAMESTORE_records_store (ns, 684 del_qe = GNUNET_NAMESTORE_records_store (ns,
685 &zone_pkey, 685 &zone_pkey,
@@ -726,7 +726,7 @@ testservice_task (void *cls,
726 (GNUNET_OK != 726 (GNUNET_OK !=
727 GNUNET_CRYPTO_ecc_public_sign_key_from_string (sh, strlen (sh), &pkey)) ) 727 GNUNET_CRYPTO_ecc_public_sign_key_from_string (sh, strlen (sh), &pkey)) )
728 { 728 {
729 fprintf (stderr, 729 fprintf (stderr,
730 _("Invalid URI `%s'\n"), 730 _("Invalid URI `%s'\n"),
731 uri); 731 uri);
732 GNUNET_SCHEDULER_shutdown (); 732 GNUNET_SCHEDULER_shutdown ();
@@ -744,7 +744,7 @@ testservice_task (void *cls,
744 } 744 }
745 else if (GNUNET_NO == etime_is_rel) 745 else if (GNUNET_NO == etime_is_rel)
746 rd.expiration_time = etime_abs.abs_value_us; 746 rd.expiration_time = etime_abs.abs_value_us;
747 else 747 else
748 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; 748 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
749 if (1 != shadow) 749 if (1 != shadow)
750 rd.flags |= GNUNET_NAMESTORE_RF_SHADOW_RECORD; 750 rd.flags |= GNUNET_NAMESTORE_RF_SHADOW_RECORD;
@@ -772,7 +772,7 @@ testservice_task (void *cls,
772 * An @a ego of NULL means the ego was not found. 772 * An @a ego of NULL means the ego was not found.
773 * 773 *
774 * @param cls closure with the configuration 774 * @param cls closure with the configuration
775 * @param ego an ego known to identity service, or NULL 775 * @param ego an ego known to identity service, or NULL
776 */ 776 */
777static void 777static void
778identity_cb (void *cls, 778identity_cb (void *cls,
@@ -783,7 +783,7 @@ identity_cb (void *cls,
783 el = NULL; 783 el = NULL;
784 if (NULL == ego) 784 if (NULL == ego)
785 { 785 {
786 fprintf (stderr, 786 fprintf (stderr,
787 _("Ego `%s' not known to identity service\n"), 787 _("Ego `%s' not known to identity service\n"),
788 ego_name); 788 ego_name);
789 GNUNET_SCHEDULER_shutdown (); 789 GNUNET_SCHEDULER_shutdown ();
@@ -813,7 +813,7 @@ run (void *cls, char *const *args, const char *cfgfile,
813{ 813{
814 if (NULL == ego_name) 814 if (NULL == ego_name)
815 { 815 {
816 fprintf (stderr, 816 fprintf (stderr,
817 _("You must specify which zone should be accessed\n")); 817 _("You must specify which zone should be accessed\n"));
818 return; 818 return;
819 } 819 }
@@ -846,28 +846,28 @@ main (int argc, char *const *argv)
846 &GNUNET_GETOPT_set_one, &add}, 846 &GNUNET_GETOPT_set_one, &add},
847 {'d', "delete", NULL, 847 {'d', "delete", NULL,
848 gettext_noop ("delete record"), 0, 848 gettext_noop ("delete record"), 0,
849 &GNUNET_GETOPT_set_one, &del}, 849 &GNUNET_GETOPT_set_one, &del},
850 {'D', "display", NULL, 850 {'D', "display", NULL,
851 gettext_noop ("display records"), 0, 851 gettext_noop ("display records"), 0,
852 &GNUNET_GETOPT_set_one, &list}, 852 &GNUNET_GETOPT_set_one, &list},
853 {'e', "expiration", "TIME", 853 {'e', "expiration", "TIME",
854 gettext_noop ("expiration time for record to use (for adding only), \"never\" is possible"), 1, 854 gettext_noop ("expiration time for record to use (for adding only), \"never\" is possible"), 1,
855 &GNUNET_GETOPT_set_string, &expirationstring}, 855 &GNUNET_GETOPT_set_string, &expirationstring},
856 {'m', "monitor", NULL, 856 {'m', "monitor", NULL,
857 gettext_noop ("monitor changes in the namestore"), 0, 857 gettext_noop ("monitor changes in the namestore"), 0,
858 &GNUNET_GETOPT_set_one, &monitor}, 858 &GNUNET_GETOPT_set_one, &monitor},
859 {'n', "name", "NAME", 859 {'n', "name", "NAME",
860 gettext_noop ("name of the record to add/delete/display"), 1, 860 gettext_noop ("name of the record to add/delete/display"), 1,
861 &GNUNET_GETOPT_set_string, &name}, 861 &GNUNET_GETOPT_set_string, &name},
862 {'t', "type", "TYPE", 862 {'t', "type", "TYPE",
863 gettext_noop ("type of the record to add/delete/display"), 1, 863 gettext_noop ("type of the record to add/delete/display"), 1,
864 &GNUNET_GETOPT_set_string, &typestring}, 864 &GNUNET_GETOPT_set_string, &typestring},
865 {'u', "uri", "URI", 865 {'u', "uri", "URI",
866 gettext_noop ("URI to import into our zone"), 1, 866 gettext_noop ("URI to import into our zone"), 1,
867 &GNUNET_GETOPT_set_string, &uri}, 867 &GNUNET_GETOPT_set_string, &uri},
868 {'V', "value", "VALUE", 868 {'V', "value", "VALUE",
869 gettext_noop ("value of the record to add/delete"), 1, 869 gettext_noop ("value of the record to add/delete"), 1,
870 &GNUNET_GETOPT_set_string, &value}, 870 &GNUNET_GETOPT_set_string, &value},
871 {'p', "public", NULL, 871 {'p', "public", NULL,
872 gettext_noop ("create or list public record"), 0, 872 gettext_noop ("create or list public record"), 0,
873 &GNUNET_GETOPT_set_one, &public}, 873 &GNUNET_GETOPT_set_one, &public},
@@ -876,7 +876,7 @@ main (int argc, char *const *argv)
876 &GNUNET_GETOPT_set_one, &shadow}, 876 &GNUNET_GETOPT_set_one, &shadow},
877 {'z', "zone", "EGO", 877 {'z', "zone", "EGO",
878 gettext_noop ("name of the ego controlling the zone"), 1, 878 gettext_noop ("name of the ego controlling the zone"), 1,
879 &GNUNET_GETOPT_set_string, &ego_name}, 879 &GNUNET_GETOPT_set_string, &ego_name},
880 GNUNET_GETOPT_OPTION_END 880 GNUNET_GETOPT_OPTION_END
881 }; 881 };
882 882
@@ -886,7 +886,7 @@ main (int argc, char *const *argv)
886 GNUNET_log_setup ("gnunet-namestore", "WARNING", NULL); 886 GNUNET_log_setup ("gnunet-namestore", "WARNING", NULL);
887 if (GNUNET_OK != 887 if (GNUNET_OK !=
888 GNUNET_PROGRAM_run (argc, argv, "gnunet-namestore", 888 GNUNET_PROGRAM_run (argc, argv, "gnunet-namestore",
889 _("GNUnet zone manipulation tool"), 889 _("GNUnet zone manipulation tool"),
890 options, 890 options,
891 &run, NULL)) 891 &run, NULL))
892 { 892 {
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 8251a41fa..ef200a8f4 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -260,7 +260,7 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
260 * @param client identification of the client 260 * @param client identification of the client
261 */ 261 */
262static void 262static void
263client_disconnect_notification (void *cls, 263client_disconnect_notification (void *cls,
264 struct GNUNET_SERVER_Client *client) 264 struct GNUNET_SERVER_Client *client)
265{ 265{
266 struct ZoneIteration *no; 266 struct ZoneIteration *no;
@@ -269,8 +269,8 @@ client_disconnect_notification (void *cls,
269 269
270 if (NULL == client) 270 if (NULL == client)
271 return; 271 return;
272 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 272 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
273 "Client %p disconnected\n", 273 "Client %p disconnected\n",
274 client); 274 client);
275 if (NULL == (nc = GNUNET_SERVER_client_get_user_context (client, struct NamestoreClient))) 275 if (NULL == (nc = GNUNET_SERVER_client_get_user_context (client, struct NamestoreClient)))
276 return; 276 return;
@@ -315,7 +315,7 @@ client_lookup (struct GNUNET_SERVER_Client *client)
315 nc = GNUNET_SERVER_client_get_user_context (client, struct NamestoreClient); 315 nc = GNUNET_SERVER_client_get_user_context (client, struct NamestoreClient);
316 if (NULL != nc) 316 if (NULL != nc)
317 return nc; 317 return nc;
318 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 318 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
319 "Client %p connected\n", 319 "Client %p connected\n",
320 client); 320 client);
321 nc = GNUNET_new (struct NamestoreClient); 321 nc = GNUNET_new (struct NamestoreClient);
@@ -361,7 +361,7 @@ handle_lookup_block_it (void *cls,
361 size_t esize; 361 size_t esize;
362 362
363 esize = ntohl (block->purpose.size) 363 esize = ntohl (block->purpose.size)
364 - sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) 364 - sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)
365 - sizeof (struct GNUNET_TIME_AbsoluteNBO); 365 - sizeof (struct GNUNET_TIME_AbsoluteNBO);
366 r = GNUNET_malloc (sizeof (struct LookupBlockResponseMessage) + esize); 366 r = GNUNET_malloc (sizeof (struct LookupBlockResponseMessage) + esize);
367 r->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE); 367 r->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE);
@@ -369,15 +369,15 @@ handle_lookup_block_it (void *cls,
369 r->gns_header.r_id = htonl (lnc->request_id); 369 r->gns_header.r_id = htonl (lnc->request_id);
370 r->expire = block->expiration_time; 370 r->expire = block->expiration_time;
371 r->signature = block->signature; 371 r->signature = block->signature;
372 r->derived_key = block->derived_key; 372 r->derived_key = block->derived_key;
373 memcpy (&r[1], &block[1], esize); 373 memcpy (&r[1], &block[1], esize);
374 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 374 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
375 "Sending `%s' message with expiration time %s\n", 375 "Sending `%s' message with expiration time %s\n",
376 "NAMESTORE_LOOKUP_BLOCK_RESPONSE", 376 "NAMESTORE_LOOKUP_BLOCK_RESPONSE",
377 GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (r->expire))); 377 GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (r->expire)));
378 GNUNET_SERVER_notification_context_unicast (snc, 378 GNUNET_SERVER_notification_context_unicast (snc,
379 lnc->nc->client, 379 lnc->nc->client,
380 &r->gns_header.header, 380 &r->gns_header.header,
381 GNUNET_NO); 381 GNUNET_NO);
382 GNUNET_free (r); 382 GNUNET_free (r);
383} 383}
@@ -401,38 +401,38 @@ handle_lookup_block (void *cls,
401 struct LookupBlockResponseMessage zir_end; 401 struct LookupBlockResponseMessage zir_end;
402 int ret; 402 int ret;
403 403
404 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 404 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
405 "Received `%s' message\n", 405 "Received `%s' message\n",
406 "NAMESTORE_LOOKUP_BLOCK"); 406 "NAMESTORE_LOOKUP_BLOCK");
407 nc = client_lookup(client); 407 nc = client_lookup(client);
408 ln_msg = (const struct LookupBlockMessage *) message; 408 ln_msg = (const struct LookupBlockMessage *) message;
409 lnc.request_id = ntohl (ln_msg->gns_header.r_id); 409 lnc.request_id = ntohl (ln_msg->gns_header.r_id);
410 lnc.nc = nc; 410 lnc.nc = nc;
411 if (GNUNET_SYSERR == 411 if (GNUNET_SYSERR ==
412 (ret = GSN_database->lookup_block (GSN_database->cls, 412 (ret = GSN_database->lookup_block (GSN_database->cls,
413 &ln_msg->query, 413 &ln_msg->query,
414 &handle_lookup_block_it, &lnc))) 414 &handle_lookup_block_it, &lnc)))
415 { 415 {
416 /* internal error (in database plugin); might be best to just hang up on 416 /* internal error (in database plugin); might be best to just hang up on
417 plugin rather than to signal that there are 'no' results, which 417 plugin rather than to signal that there are 'no' results, which
418 might also be false... */ 418 might also be false... */
419 GNUNET_break (0); 419 GNUNET_break (0);
420 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 420 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
421 return; 421 return;
422 } 422 }
423 if (0 == ret) 423 if (0 == ret)
424 { 424 {
425 /* no records match at all, generate empty response */ 425 /* no records match at all, generate empty response */
426 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 426 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
427 "Sending empty `%s' message\n", 427 "Sending empty `%s' message\n",
428 "NAMESTORE_LOOKUP_BLOCK_RESPONSE"); 428 "NAMESTORE_LOOKUP_BLOCK_RESPONSE");
429 memset (&zir_end, 0, sizeof (zir_end)); 429 memset (&zir_end, 0, sizeof (zir_end));
430 zir_end.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE); 430 zir_end.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE);
431 zir_end.gns_header.header.size = htons (sizeof (struct LookupBlockResponseMessage)); 431 zir_end.gns_header.header.size = htons (sizeof (struct LookupBlockResponseMessage));
432 zir_end.gns_header.r_id = ln_msg->gns_header.r_id; 432 zir_end.gns_header.r_id = ln_msg->gns_header.r_id;
433 GNUNET_SERVER_notification_context_unicast (snc, 433 GNUNET_SERVER_notification_context_unicast (snc,
434 client, 434 client,
435 &zir_end.gns_header.header, 435 &zir_end.gns_header.header,
436 GNUNET_NO); 436 GNUNET_NO);
437 437
438 } 438 }
@@ -453,7 +453,7 @@ handle_block_cache (void *cls,
453 const struct GNUNET_MessageHeader *message) 453 const struct GNUNET_MessageHeader *message)
454{ 454{
455 struct NamestoreClient *nc; 455 struct NamestoreClient *nc;
456 const struct BlockCacheMessage *rp_msg; 456 const struct BlockCacheMessage *rp_msg;
457 struct BlockCacheResponseMessage rpr_msg; 457 struct BlockCacheResponseMessage rpr_msg;
458 struct GNUNET_NAMESTORE_Block *block; 458 struct GNUNET_NAMESTORE_Block *block;
459 size_t esize; 459 size_t esize;
@@ -475,7 +475,7 @@ handle_block_cache (void *cls,
475 sizeof (struct GNUNET_TIME_AbsoluteNBO) + 475 sizeof (struct GNUNET_TIME_AbsoluteNBO) +
476 esize); 476 esize);
477 block->expiration_time = rp_msg->expire; 477 block->expiration_time = rp_msg->expire;
478 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 478 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
479 "Received `%s' message with expiration time %s\n", 479 "Received `%s' message with expiration time %s\n",
480 "NAMESTORE_BLOCK_CACHE", 480 "NAMESTORE_BLOCK_CACHE",
481 GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (block->expiration_time))); 481 GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (block->expiration_time)));
@@ -488,9 +488,9 @@ handle_block_cache (void *cls,
488 rpr_msg.gns_header.header.size = htons (sizeof (struct BlockCacheResponseMessage)); 488 rpr_msg.gns_header.header.size = htons (sizeof (struct BlockCacheResponseMessage));
489 rpr_msg.gns_header.r_id = rp_msg->gns_header.r_id; 489 rpr_msg.gns_header.r_id = rp_msg->gns_header.r_id;
490 rpr_msg.op_result = htonl (res); 490 rpr_msg.op_result = htonl (res);
491 GNUNET_SERVER_notification_context_unicast (snc, 491 GNUNET_SERVER_notification_context_unicast (snc,
492 nc->client, 492 nc->client,
493 &rpr_msg.gns_header.header, 493 &rpr_msg.gns_header.header,
494 GNUNET_NO); 494 GNUNET_NO);
495 GNUNET_SERVER_receive_done (client, GNUNET_OK); 495 GNUNET_SERVER_receive_done (client, GNUNET_OK);
496} 496}
@@ -525,7 +525,7 @@ send_lookup_response (struct GNUNET_SERVER_NotificationContext *nc,
525 char *rd_ser; 525 char *rd_ser;
526 526
527 name_len = strlen (name) + 1; 527 name_len = strlen (name) + 1;
528 rd_ser_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); 528 rd_ser_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd);
529 msg_size = sizeof (struct RecordResultMessage) + name_len + rd_ser_len; 529 msg_size = sizeof (struct RecordResultMessage) + name_len + rd_ser_len;
530 530
531 zir_msg = GNUNET_malloc (msg_size); 531 zir_msg = GNUNET_malloc (msg_size);
@@ -540,13 +540,13 @@ send_lookup_response (struct GNUNET_SERVER_NotificationContext *nc,
540 memcpy (name_tmp, name, name_len); 540 memcpy (name_tmp, name, name_len);
541 rd_ser = &name_tmp[name_len]; 541 rd_ser = &name_tmp[name_len];
542 GNUNET_NAMESTORE_records_serialize (rd_count, rd, rd_ser_len, rd_ser); 542 GNUNET_NAMESTORE_records_serialize (rd_count, rd, rd_ser_len, rd_ser);
543 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 543 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
544 "Sending `%s' message with %u records and size %u\n", 544 "Sending `%s' message with %u records and size %u\n",
545 "RECORD_RESULT", 545 "RECORD_RESULT",
546 rd_count, 546 rd_count,
547 msg_size); 547 msg_size);
548 GNUNET_SERVER_notification_context_unicast (nc, 548 GNUNET_SERVER_notification_context_unicast (nc,
549 client, 549 client,
550 &zir_msg->gns_header.header, 550 &zir_msg->gns_header.header,
551 GNUNET_NO); 551 GNUNET_NO);
552 GNUNET_free (zir_msg); 552 GNUNET_free (zir_msg);
@@ -569,7 +569,7 @@ refresh_block (const struct GNUNET_CRYPTO_EccPrivateKey *zone_key,
569 const struct GNUNET_NAMESTORE_RecordData *rd) 569 const struct GNUNET_NAMESTORE_RecordData *rd)
570{ 570{
571 struct GNUNET_NAMESTORE_Block *block; 571 struct GNUNET_NAMESTORE_Block *block;
572 572
573 if (0 == rd_count) 573 if (0 == rd_count)
574 block = GNUNET_NAMESTORE_block_create (zone_key, 574 block = GNUNET_NAMESTORE_block_create (zone_key,
575 GNUNET_TIME_UNIT_ZERO_ABS, 575 GNUNET_TIME_UNIT_ZERO_ABS,
@@ -589,7 +589,7 @@ refresh_block (const struct GNUNET_CRYPTO_EccPrivateKey *zone_key,
589 _("Failed to cache encrypted block of my own zone!\n")); 589 _("Failed to cache encrypted block of my own zone!\n"));
590 } 590 }
591 GNUNET_free (block); 591 GNUNET_free (block);
592} 592}
593 593
594 594
595/** 595/**
@@ -620,8 +620,8 @@ handle_record_store (void *cls,
620 struct GNUNET_CRYPTO_EccPublicSignKey pubkey; 620 struct GNUNET_CRYPTO_EccPublicSignKey pubkey;
621 struct ZoneMonitor *zm; 621 struct ZoneMonitor *zm;
622 622
623 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 623 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
624 "Received `%s' message\n", 624 "Received `%s' message\n",
625 "NAMESTORE_RECORD_STORE"); 625 "NAMESTORE_RECORD_STORE");
626 if (ntohs (message->size) < sizeof (struct RecordStoreMessage)) 626 if (ntohs (message->size) < sizeof (struct RecordStoreMessage))
627 { 627 {
@@ -686,9 +686,9 @@ handle_record_store (void *cls,
686 conv_name, 686 conv_name,
687 GNUNET_NAMESTORE_z2s (&pubkey)); 687 GNUNET_NAMESTORE_z2s (&pubkey));
688 688
689 if ( (0 == rd_count) && 689 if ( (0 == rd_count) &&
690 (GNUNET_NO == 690 (GNUNET_NO ==
691 GSN_database->iterate_records (GSN_database->cls, 691 GSN_database->iterate_records (GSN_database->cls,
692 &rp_msg->private_key, 0, NULL, 0)) ) 692 &rp_msg->private_key, 0, NULL, 0)) )
693 { 693 {
694 /* This name does not exist, so cannot be removed */ 694 /* This name does not exist, so cannot be removed */
@@ -701,15 +701,15 @@ handle_record_store (void *cls,
701 { 701 {
702 res = GSN_database->store_records (GSN_database->cls, 702 res = GSN_database->store_records (GSN_database->cls,
703 &rp_msg->private_key, 703 &rp_msg->private_key,
704 conv_name, 704 conv_name,
705 rd_count, rd); 705 rd_count, rd);
706 if (GNUNET_OK == res) 706 if (GNUNET_OK == res)
707 { 707 {
708 refresh_block (&rp_msg->private_key, 708 refresh_block (&rp_msg->private_key,
709 conv_name, 709 conv_name,
710 rd_count, rd); 710 rd_count, rd);
711 711
712 for (zm = monitor_head; NULL != zm; zm = zm->next) 712 for (zm = monitor_head; NULL != zm; zm = zm->next)
713 if (0 == memcmp (&rp_msg->private_key, &zm->zone, 713 if (0 == memcmp (&rp_msg->private_key, &zm->zone,
714 sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) 714 sizeof (struct GNUNET_CRYPTO_EccPrivateKey)))
715 send_lookup_response (monitor_nc, 715 send_lookup_response (monitor_nc,
@@ -722,10 +722,10 @@ handle_record_store (void *cls,
722 GNUNET_free (conv_name); 722 GNUNET_free (conv_name);
723 } 723 }
724 } 724 }
725 725
726 /* Send response */ 726 /* Send response */
727 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 727 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
728 "Sending `%s' message\n", 728 "Sending `%s' message\n",
729 "RECORD_STORE_RESPONSE"); 729 "RECORD_STORE_RESPONSE");
730 rcr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE); 730 rcr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE);
731 rcr_msg.gns_header.header.size = htons (sizeof (struct RecordStoreResponseMessage)); 731 rcr_msg.gns_header.header.size = htons (sizeof (struct RecordStoreResponseMessage));
@@ -788,8 +788,8 @@ handle_zone_to_name_it (void *cls,
788 char *name_tmp; 788 char *name_tmp;
789 char *rd_tmp; 789 char *rd_tmp;
790 790
791 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 791 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
792 "Found result for zone-to-name lookup: `%s'\n", 792 "Found result for zone-to-name lookup: `%s'\n",
793 name); 793 name);
794 res = GNUNET_YES; 794 res = GNUNET_YES;
795 name_len = (NULL == name) ? 0 : strlen (name) + 1; 795 name_len = (NULL == name) ? 0 : strlen (name) + 1;
@@ -840,7 +840,7 @@ handle_zone_to_name (void *cls,
840 struct ZoneToNameCtx ztn_ctx; 840 struct ZoneToNameCtx ztn_ctx;
841 struct ZoneToNameResponseMessage ztnr_msg; 841 struct ZoneToNameResponseMessage ztnr_msg;
842 842
843 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 843 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
844 "Received `%s' message\n", 844 "Received `%s' message\n",
845 "ZONE_TO_NAME"); 845 "ZONE_TO_NAME");
846 ztn_msg = (const struct ZoneToNameMessage *) message; 846 ztn_msg = (const struct ZoneToNameMessage *) message;
@@ -849,7 +849,7 @@ handle_zone_to_name (void *cls,
849 ztn_ctx.nc = nc; 849 ztn_ctx.nc = nc;
850 ztn_ctx.success = GNUNET_NO; 850 ztn_ctx.success = GNUNET_NO;
851 if (GNUNET_SYSERR == 851 if (GNUNET_SYSERR ==
852 GSN_database->zone_to_name (GSN_database->cls, 852 GSN_database->zone_to_name (GSN_database->cls,
853 &ztn_msg->zone, 853 &ztn_msg->zone,
854 &ztn_msg->value_zone, 854 &ztn_msg->value_zone,
855 &handle_zone_to_name_it, &ztn_ctx)) 855 &handle_zone_to_name_it, &ztn_ctx))
@@ -858,7 +858,7 @@ handle_zone_to_name (void *cls,
858 that might be wrong */ 858 that might be wrong */
859 GNUNET_break (0); 859 GNUNET_break (0);
860 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 860 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
861 return; 861 return;
862 } 862 }
863 if (GNUNET_NO == ztn_ctx.success) 863 if (GNUNET_NO == ztn_ctx.success)
864 { 864 {
@@ -945,17 +945,17 @@ zone_iteraterate_proc (void *cls,
945 945
946 if ((NULL == zone_key) && (NULL == name)) 946 if ((NULL == zone_key) && (NULL == name))
947 { 947 {
948 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 948 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
949 "Iteration done\n"); 949 "Iteration done\n");
950 proc->res_iteration_finished = IT_SUCCESS_NOT_MORE_RESULTS_AVAILABLE; 950 proc->res_iteration_finished = IT_SUCCESS_NOT_MORE_RESULTS_AVAILABLE;
951 return; 951 return;
952 } 952 }
953 if ((NULL == zone_key) || (NULL == name)) 953 if ((NULL == zone_key) || (NULL == name))
954 { 954 {
955 /* what is this!? should never happen */ 955 /* what is this!? should never happen */
956 proc->res_iteration_finished = IT_START; 956 proc->res_iteration_finished = IT_START;
957 GNUNET_break (0); 957 GNUNET_break (0);
958 return; 958 return;
959 } 959 }
960 proc->res_iteration_finished = IT_SUCCESS_MORE_AVAILABLE; 960 proc->res_iteration_finished = IT_SUCCESS_MORE_AVAILABLE;
961 send_lookup_response (snc, 961 send_lookup_response (snc,
@@ -1001,11 +1001,11 @@ run_zone_iteration_round (struct ZoneIteration *zi)
1001 while (IT_START == proc.res_iteration_finished) 1001 while (IT_START == proc.res_iteration_finished)
1002 { 1002 {
1003 if (GNUNET_SYSERR == 1003 if (GNUNET_SYSERR ==
1004 (ret = GSN_database->iterate_records (GSN_database->cls, 1004 (ret = GSN_database->iterate_records (GSN_database->cls,
1005 (0 == memcmp (&zi->zone, &zero, sizeof (zero))) 1005 (0 == memcmp (&zi->zone, &zero, sizeof (zero)))
1006 ? NULL 1006 ? NULL
1007 : &zi->zone, 1007 : &zi->zone,
1008 zi->offset, 1008 zi->offset,
1009 &zone_iteraterate_proc, &proc))) 1009 &zone_iteraterate_proc, &proc)))
1010 { 1010 {
1011 GNUNET_break (0); 1011 GNUNET_break (0);
@@ -1027,10 +1027,10 @@ run_zone_iteration_round (struct ZoneIteration *zi)
1027 rrm.gns_header.header.size = htons (sizeof (rrm)); 1027 rrm.gns_header.header.size = htons (sizeof (rrm));
1028 rrm.gns_header.r_id = htonl (zi->request_id); 1028 rrm.gns_header.r_id = htonl (zi->request_id);
1029 GNUNET_SERVER_notification_context_unicast (snc, 1029 GNUNET_SERVER_notification_context_unicast (snc,
1030 zi->client->client, 1030 zi->client->client,
1031 &rrm.gns_header.header, 1031 &rrm.gns_header.header,
1032 GNUNET_NO); 1032 GNUNET_NO);
1033 GNUNET_CONTAINER_DLL_remove (zi->client->op_head, 1033 GNUNET_CONTAINER_DLL_remove (zi->client->op_head,
1034 zi->client->op_tail, 1034 zi->client->op_tail,
1035 zi); 1035 zi);
1036 GNUNET_free (zi); 1036 GNUNET_free (zi);
@@ -1159,7 +1159,7 @@ handle_iteration_next (void *cls,
1159 * Send 'sync' message to zone monitor, we're now in sync. 1159 * Send 'sync' message to zone monitor, we're now in sync.
1160 * 1160 *
1161 * @param zm monitor that is now in sync 1161 * @param zm monitor that is now in sync
1162 */ 1162 */
1163static void 1163static void
1164monitor_sync (struct ZoneMonitor *zm) 1164monitor_sync (struct ZoneMonitor *zm)
1165{ 1165{
@@ -1234,8 +1234,8 @@ handle_monitor_start (void *cls,
1234{ 1234{
1235 const struct ZoneMonitorStartMessage *zis_msg; 1235 const struct ZoneMonitorStartMessage *zis_msg;
1236 struct ZoneMonitor *zm; 1236 struct ZoneMonitor *zm;
1237 1237
1238 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1238 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1239 "Received `%s' message\n", 1239 "Received `%s' message\n",
1240 "ZONE_MONITOR_START"); 1240 "ZONE_MONITOR_START");
1241 zis_msg = (const struct ZoneMonitorStartMessage *) message; 1241 zis_msg = (const struct ZoneMonitorStartMessage *) message;
@@ -1249,7 +1249,7 @@ handle_monitor_start (void *cls,
1249 GNUNET_SERVER_disable_receive_done_warning (client); 1249 GNUNET_SERVER_disable_receive_done_warning (client);
1250 GNUNET_SERVER_notification_context_add (monitor_nc, 1250 GNUNET_SERVER_notification_context_add (monitor_nc,
1251 client); 1251 client);
1252 zm->task = GNUNET_SCHEDULER_add_now (&monitor_next, zm); 1252 zm->task = GNUNET_SCHEDULER_add_now (&monitor_next, zm);
1253} 1253}
1254 1254
1255 1255
@@ -1265,7 +1265,7 @@ monitor_next (void *cls,
1265{ 1265{
1266 struct ZoneMonitor *zm = cls; 1266 struct ZoneMonitor *zm = cls;
1267 int ret; 1267 int ret;
1268 1268
1269 zm->task = GNUNET_SCHEDULER_NO_TASK; 1269 zm->task = GNUNET_SCHEDULER_NO_TASK;
1270 ret = GSN_database->iterate_records (GSN_database->cls, 1270 ret = GSN_database->iterate_records (GSN_database->cls,
1271 &zm->zone, 1271 &zm->zone,
@@ -1332,7 +1332,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1332 GNUNET_free (database); 1332 GNUNET_free (database);
1333 if (NULL == GSN_database) 1333 if (NULL == GSN_database)
1334 { 1334 {
1335 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1335 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1336 "Could not load database backend `%s'\n", 1336 "Could not load database backend `%s'\n",
1337 db_lib_name); 1337 db_lib_name);
1338 GNUNET_SCHEDULER_add_now (&cleanup_task, NULL); 1338 GNUNET_SCHEDULER_add_now (&cleanup_task, NULL);
diff --git a/src/namestore/namestore.h b/src/namestore/namestore.h
index a4b01a960..a8851e104 100644
--- a/src/namestore/namestore.h
+++ b/src/namestore/namestore.h
@@ -171,7 +171,7 @@ struct RecordStoreMessage
171 uint16_t rd_len GNUNET_PACKED; 171 uint16_t rd_len GNUNET_PACKED;
172 172
173 /** 173 /**
174 * Number of records contained 174 * Number of records contained
175 */ 175 */
176 uint16_t rd_count GNUNET_PACKED; 176 uint16_t rd_count GNUNET_PACKED;
177 177
@@ -221,12 +221,12 @@ struct ZoneToNameMessage
221 struct GNUNET_NAMESTORE_Header gns_header; 221 struct GNUNET_NAMESTORE_Header gns_header;
222 222
223 /** 223 /**
224 * The private key of the zone to look up in 224 * The private key of the zone to look up in
225 */ 225 */
226 struct GNUNET_CRYPTO_EccPrivateKey zone; 226 struct GNUNET_CRYPTO_EccPrivateKey zone;
227 227
228 /** 228 /**
229 * The public key of the target zone 229 * The public key of the target zone
230 */ 230 */
231 struct GNUNET_CRYPTO_EccPublicSignKey value_zone; 231 struct GNUNET_CRYPTO_EccPublicSignKey value_zone;
232}; 232};
@@ -259,7 +259,7 @@ struct ZoneToNameResponseMessage
259 259
260 /** 260 /**
261 * result in NBO: #GNUNET_OK on success, #GNUNET_NO if there were no 261 * result in NBO: #GNUNET_OK on success, #GNUNET_NO if there were no
262 * results, #GNUNET_SYSERR on error 262 * results, #GNUNET_SYSERR on error
263 */ 263 */
264 int16_t res GNUNET_PACKED; 264 int16_t res GNUNET_PACKED;
265 265
@@ -297,7 +297,7 @@ struct RecordResultMessage
297 uint16_t rd_len GNUNET_PACKED; 297 uint16_t rd_len GNUNET_PACKED;
298 298
299 /** 299 /**
300 * Number of records contained 300 * Number of records contained
301 */ 301 */
302 uint16_t rd_count GNUNET_PACKED; 302 uint16_t rd_count GNUNET_PACKED;
303 303
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index a1d17835f..3df6f8210 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -272,11 +272,11 @@ handle_lookup_block_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
272 size_t size) 272 size_t size)
273{ 273{
274 struct GNUNET_NAMESTORE_Block *block; 274 struct GNUNET_NAMESTORE_Block *block;
275 char buf[size + sizeof (struct GNUNET_NAMESTORE_Block) 275 char buf[size + sizeof (struct GNUNET_NAMESTORE_Block)
276 - sizeof (struct LookupBlockResponseMessage)]; 276 - sizeof (struct LookupBlockResponseMessage)];
277 277
278 LOG (GNUNET_ERROR_TYPE_DEBUG, 278 LOG (GNUNET_ERROR_TYPE_DEBUG,
279 "Received `%s'\n", 279 "Received `%s'\n",
280 "LOOKUP_BLOCK_RESPONSE"); 280 "LOOKUP_BLOCK_RESPONSE");
281 if (0 == GNUNET_TIME_absolute_ntoh (msg->expire).abs_value_us) 281 if (0 == GNUNET_TIME_absolute_ntoh (msg->expire).abs_value_us)
282 { 282 {
@@ -290,7 +290,7 @@ handle_lookup_block_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
290 block->signature = msg->signature; 290 block->signature = msg->signature;
291 block->derived_key = msg->derived_key; 291 block->derived_key = msg->derived_key;
292 block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN); 292 block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN);
293 block->purpose.size = htonl (size - sizeof (struct LookupBlockResponseMessage) + 293 block->purpose.size = htonl (size - sizeof (struct LookupBlockResponseMessage) +
294 sizeof (struct GNUNET_TIME_AbsoluteNBO) + 294 sizeof (struct GNUNET_TIME_AbsoluteNBO) +
295 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)); 295 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose));
296 block->expiration_time = msg->expire; 296 block->expiration_time = msg->expire;
@@ -332,11 +332,11 @@ handle_block_cache_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
332 "BLOCK_CACHE_RESPONSE"); 332 "BLOCK_CACHE_RESPONSE");
333 res = ntohl (msg->op_result); 333 res = ntohl (msg->op_result);
334 /* TODO: add actual error message from namestore to response... */ 334 /* TODO: add actual error message from namestore to response... */
335 if (NULL != qe->cont) 335 if (NULL != qe->cont)
336 qe->cont (qe->cont_cls, 336 qe->cont (qe->cont_cls,
337 res, 337 res,
338 (GNUNET_OK == res) ? 338 (GNUNET_OK == res) ?
339 NULL 339 NULL
340 : _("Namestore failed to cache block")); 340 : _("Namestore failed to cache block"));
341 return GNUNET_OK; 341 return GNUNET_OK;
342} 342}
@@ -358,8 +358,8 @@ handle_record_store_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
358{ 358{
359 int res; 359 int res;
360 const char *emsg; 360 const char *emsg;
361 361
362 LOG (GNUNET_ERROR_TYPE_DEBUG, 362 LOG (GNUNET_ERROR_TYPE_DEBUG,
363 "Received `%s'\n", 363 "Received `%s'\n",
364 "RECORD_STORE_RESPONSE"); 364 "RECORD_STORE_RESPONSE");
365 /* TODO: add actual error message from namestore to response... */ 365 /* TODO: add actual error message from namestore to response... */
@@ -368,7 +368,7 @@ handle_record_store_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
368 emsg = _("Namestore failed to store record\n"); 368 emsg = _("Namestore failed to store record\n");
369 else 369 else
370 emsg = NULL; 370 emsg = NULL;
371 if (NULL != qe->cont) 371 if (NULL != qe->cont)
372 qe->cont (qe->cont_cls, res, emsg); 372 qe->cont (qe->cont_cls, res, emsg);
373 return GNUNET_OK; 373 return GNUNET_OK;
374} 374}
@@ -397,7 +397,7 @@ handle_record_result (struct GNUNET_NAMESTORE_QueueEntry *qe,
397 unsigned int rd_count; 397 unsigned int rd_count;
398 398
399 LOG (GNUNET_ERROR_TYPE_DEBUG, 399 LOG (GNUNET_ERROR_TYPE_DEBUG,
400 "Received `%s'\n", 400 "Received `%s'\n",
401 "RECORD_RESULT"); 401 "RECORD_RESULT");
402 rd_len = ntohs (msg->rd_len); 402 rd_len = ntohs (msg->rd_len);
403 rd_count = ntohs (msg->rd_count); 403 rd_count = ntohs (msg->rd_count);
@@ -429,11 +429,11 @@ handle_record_result (struct GNUNET_NAMESTORE_QueueEntry *qe,
429 if (0 == name_len) 429 if (0 == name_len)
430 name = NULL; 430 name = NULL;
431 if (NULL != qe->proc) 431 if (NULL != qe->proc)
432 qe->proc (qe->proc_cls, 432 qe->proc (qe->proc_cls,
433 &msg->private_key, 433 &msg->private_key,
434 name, 434 name,
435 rd_count, 435 rd_count,
436 (rd_count > 0) ? rd : NULL); 436 (rd_count > 0) ? rd : NULL);
437 } 437 }
438 return GNUNET_OK; 438 return GNUNET_OK;
439} 439}
@@ -461,7 +461,7 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
461 const char *name_tmp; 461 const char *name_tmp;
462 const char *rd_tmp; 462 const char *rd_tmp;
463 463
464 LOG (GNUNET_ERROR_TYPE_DEBUG, 464 LOG (GNUNET_ERROR_TYPE_DEBUG,
465 "Received `%s'\n", 465 "Received `%s'\n",
466 "ZONE_TO_NAME_RESPONSE"); 466 "ZONE_TO_NAME_RESPONSE");
467 res = ntohs (msg->res); 467 res = ntohs (msg->res);
@@ -472,11 +472,11 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
472 "An error occured during zone to name operation\n"); 472 "An error occured during zone to name operation\n");
473 break; 473 break;
474 case GNUNET_NO: 474 case GNUNET_NO:
475 LOG (GNUNET_ERROR_TYPE_DEBUG, 475 LOG (GNUNET_ERROR_TYPE_DEBUG,
476 "Namestore has no result for zone to name mapping \n"); 476 "Namestore has no result for zone to name mapping \n");
477 break; 477 break;
478 case GNUNET_YES: 478 case GNUNET_YES:
479 LOG (GNUNET_ERROR_TYPE_DEBUG, 479 LOG (GNUNET_ERROR_TYPE_DEBUG,
480 "Namestore has result for zone to name mapping \n"); 480 "Namestore has result for zone to name mapping \n");
481 name_len = ntohs (msg->name_len); 481 name_len = ntohs (msg->name_len);
482 rd_count = ntohs (msg->rd_count); 482 rd_count = ntohs (msg->rd_count);
@@ -499,10 +499,10 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
499 } 499 }
500 /* normal end, call continuation with result */ 500 /* normal end, call continuation with result */
501 if (NULL != qe->proc) 501 if (NULL != qe->proc)
502 qe->proc (qe->proc_cls, 502 qe->proc (qe->proc_cls,
503 &msg->zone, 503 &msg->zone,
504 name_tmp, 504 name_tmp,
505 rd_count, rd); 505 rd_count, rd);
506 /* return is important here: break would call continuation with error! */ 506 /* return is important here: break would call continuation with error! */
507 return GNUNET_OK; 507 return GNUNET_OK;
508 } 508 }
@@ -530,11 +530,11 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
530static int 530static int
531manage_record_operations (struct GNUNET_NAMESTORE_QueueEntry *qe, 531manage_record_operations (struct GNUNET_NAMESTORE_QueueEntry *qe,
532 const struct GNUNET_MessageHeader *msg, 532 const struct GNUNET_MessageHeader *msg,
533 uint16_t type, 533 uint16_t type,
534 size_t size) 534 size_t size)
535{ 535{
536 /* handle different message type */ 536 /* handle different message type */
537 switch (type) 537 switch (type)
538 { 538 {
539 case GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE: 539 case GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE:
540 if (size < sizeof (struct LookupBlockResponseMessage)) 540 if (size < sizeof (struct LookupBlockResponseMessage))
@@ -601,7 +601,7 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze,
601 const char *name_tmp; 601 const char *name_tmp;
602 const char *rd_ser_tmp; 602 const char *rd_ser_tmp;
603 603
604 LOG (GNUNET_ERROR_TYPE_DEBUG, 604 LOG (GNUNET_ERROR_TYPE_DEBUG,
605 "Received `%s'\n", 605 "Received `%s'\n",
606 "ZONE_ITERATION_RESPONSE"); 606 "ZONE_ITERATION_RESPONSE");
607 msg_len = ntohs (msg->gns_header.header.size); 607 msg_len = ntohs (msg->gns_header.header.size);
@@ -614,8 +614,8 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze,
614 GNUNET_break (0); 614 GNUNET_break (0);
615 return GNUNET_SYSERR; 615 return GNUNET_SYSERR;
616 } 616 }
617 if ( (0 == name_len) && 617 if ( (0 == name_len) &&
618 (0 == (memcmp (&msg->private_key, 618 (0 == (memcmp (&msg->private_key,
619 &priv_dummy, 619 &priv_dummy,
620 sizeof (priv_dummy)))) ) 620 sizeof (priv_dummy)))) )
621 { 621 {
@@ -635,18 +635,18 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze,
635 { 635 {
636 struct GNUNET_NAMESTORE_RecordData rd[rd_count]; 636 struct GNUNET_NAMESTORE_RecordData rd[rd_count];
637 637
638 if (GNUNET_OK != GNUNET_NAMESTORE_records_deserialize (rd_len, 638 if (GNUNET_OK != GNUNET_NAMESTORE_records_deserialize (rd_len,
639 rd_ser_tmp, 639 rd_ser_tmp,
640 rd_count, 640 rd_count,
641 rd)) 641 rd))
642 { 642 {
643 GNUNET_break (0); 643 GNUNET_break (0);
644 return GNUNET_SYSERR; 644 return GNUNET_SYSERR;
645 } 645 }
646 if (NULL != ze->proc) 646 if (NULL != ze->proc)
647 ze->proc (ze->proc_cls, 647 ze->proc (ze->proc_cls,
648 &msg->private_key, 648 &msg->private_key,
649 name_tmp, 649 name_tmp,
650 rd_count, rd); 650 rd_count, rd);
651 return GNUNET_YES; 651 return GNUNET_YES;
652 } 652 }
@@ -669,7 +669,7 @@ manage_zone_operations (struct GNUNET_NAMESTORE_ZoneIterator *ze,
669 int type, size_t size) 669 int type, size_t size)
670{ 670{
671 /* handle different message type */ 671 /* handle different message type */
672 switch (type) 672 switch (type)
673 { 673 {
674 case GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT: 674 case GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT:
675 if (size < sizeof (struct RecordResultMessage)) 675 if (size < sizeof (struct RecordResultMessage))
@@ -678,7 +678,7 @@ manage_zone_operations (struct GNUNET_NAMESTORE_ZoneIterator *ze,
678 return GNUNET_SYSERR; 678 return GNUNET_SYSERR;
679 } 679 }
680 return handle_zone_iteration_response (ze, 680 return handle_zone_iteration_response (ze,
681 (const struct RecordResultMessage *) msg, 681 (const struct RecordResultMessage *) msg,
682 size); 682 size);
683 default: 683 default:
684 GNUNET_break (0); 684 GNUNET_break (0);
@@ -695,7 +695,7 @@ manage_zone_operations (struct GNUNET_NAMESTORE_ZoneIterator *ze,
695 * @param msg message received, NULL on timeout or fatal error 695 * @param msg message received, NULL on timeout or fatal error
696 */ 696 */
697static void 697static void
698process_namestore_message (void *cls, 698process_namestore_message (void *cls,
699 const struct GNUNET_MessageHeader *msg) 699 const struct GNUNET_MessageHeader *msg)
700{ 700{
701 struct GNUNET_NAMESTORE_Handle *h = cls; 701 struct GNUNET_NAMESTORE_Handle *h = cls;
@@ -717,7 +717,7 @@ process_namestore_message (void *cls,
717 if (size < sizeof (struct GNUNET_NAMESTORE_Header)) 717 if (size < sizeof (struct GNUNET_NAMESTORE_Header))
718 { 718 {
719 GNUNET_break_op (0); 719 GNUNET_break_op (0);
720 GNUNET_CLIENT_receive (h->client, 720 GNUNET_CLIENT_receive (h->client,
721 &process_namestore_message, h, 721 &process_namestore_message, h,
722 GNUNET_TIME_UNIT_FOREVER_REL); 722 GNUNET_TIME_UNIT_FOREVER_REL);
723 return; 723 return;
@@ -726,9 +726,9 @@ process_namestore_message (void *cls,
726 r_id = ntohl (gm->r_id); 726 r_id = ntohl (gm->r_id);
727 727
728 LOG (GNUNET_ERROR_TYPE_DEBUG, 728 LOG (GNUNET_ERROR_TYPE_DEBUG,
729 "Received message type %u size %u op %u\n", 729 "Received message type %u size %u op %u\n",
730 (unsigned int) type, 730 (unsigned int) type,
731 (unsigned int) size, 731 (unsigned int) size,
732 (unsigned int) r_id); 732 (unsigned int) r_id);
733 733
734 /* Is it a record related operation ? */ 734 /* Is it a record related operation ? */
@@ -738,7 +738,7 @@ process_namestore_message (void *cls,
738 if (NULL != qe) 738 if (NULL != qe)
739 { 739 {
740 ret = manage_record_operations (qe, msg, type, size); 740 ret = manage_record_operations (qe, msg, type, size);
741 if (GNUNET_SYSERR == ret) 741 if (GNUNET_SYSERR == ret)
742 { 742 {
743 /* protocol error, need to reconnect */ 743 /* protocol error, need to reconnect */
744 h->reconnect = GNUNET_YES; 744 h->reconnect = GNUNET_YES;
@@ -802,8 +802,8 @@ do_transmit (struct GNUNET_NAMESTORE_Handle *h);
802 * @return number of bytes copied into @a buf 802 * @return number of bytes copied into @a buf
803 */ 803 */
804static size_t 804static size_t
805transmit_message_to_namestore (void *cls, 805transmit_message_to_namestore (void *cls,
806 size_t size, 806 size_t size,
807 void *buf) 807 void *buf)
808{ 808{
809 struct GNUNET_NAMESTORE_Handle *h = cls; 809 struct GNUNET_NAMESTORE_Handle *h = cls;
@@ -819,14 +819,14 @@ transmit_message_to_namestore (void *cls,
819 } 819 }
820 ret = 0; 820 ret = 0;
821 cbuf = buf; 821 cbuf = buf;
822 while ( (NULL != (p = h->pending_head)) && 822 while ( (NULL != (p = h->pending_head)) &&
823 (p->size <= size) ) 823 (p->size <= size) )
824 { 824 {
825 memcpy (&cbuf[ret], &p[1], p->size); 825 memcpy (&cbuf[ret], &p[1], p->size);
826 ret += p->size; 826 ret += p->size;
827 size -= p->size; 827 size -= p->size;
828 GNUNET_CONTAINER_DLL_remove (h->pending_head, 828 GNUNET_CONTAINER_DLL_remove (h->pending_head,
829 h->pending_tail, 829 h->pending_tail,
830 p); 830 p);
831 if (GNUNET_NO == h->is_receiving) 831 if (GNUNET_NO == h->is_receiving)
832 { 832 {
@@ -889,7 +889,7 @@ reconnect (struct GNUNET_NAMESTORE_Handle *h)
889 * @param tc scheduler context 889 * @param tc scheduler context
890 */ 890 */
891static void 891static void
892reconnect_task (void *cls, 892reconnect_task (void *cls,
893 const struct GNUNET_SCHEDULER_TaskContext *tc) 893 const struct GNUNET_SCHEDULER_TaskContext *tc)
894{ 894{
895 struct GNUNET_NAMESTORE_Handle *h = cls; 895 struct GNUNET_NAMESTORE_Handle *h = cls;
@@ -1010,7 +1010,7 @@ GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h)
1010 1010
1011/** 1011/**
1012 * Store an item in the namestore. If the item is already present, 1012 * Store an item in the namestore. If the item is already present,
1013 * it is replaced with the new record. 1013 * it is replaced with the new record.
1014 * 1014 *
1015 * @param h handle to the namestore 1015 * @param h handle to the namestore
1016 * @param block block to store 1016 * @param block block to store
@@ -1032,8 +1032,8 @@ GNUNET_NAMESTORE_block_cache (struct GNUNET_NAMESTORE_Handle *h,
1032 size_t msg_size; 1032 size_t msg_size;
1033 1033
1034 GNUNET_assert (NULL != h); 1034 GNUNET_assert (NULL != h);
1035 blen = ntohl (block->purpose.size) 1035 blen = ntohl (block->purpose.size)
1036 - sizeof (struct GNUNET_TIME_AbsoluteNBO) 1036 - sizeof (struct GNUNET_TIME_AbsoluteNBO)
1037 - sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose); 1037 - sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose);
1038 rid = get_op_id (h); 1038 rid = get_op_id (h);
1039 qe = GNUNET_new (struct GNUNET_NAMESTORE_QueueEntry); 1039 qe = GNUNET_new (struct GNUNET_NAMESTORE_QueueEntry);
@@ -1055,9 +1055,9 @@ GNUNET_NAMESTORE_block_cache (struct GNUNET_NAMESTORE_Handle *h,
1055 msg->signature = block->signature; 1055 msg->signature = block->signature;
1056 msg->derived_key = block->derived_key; 1056 msg->derived_key = block->derived_key;
1057 memcpy (&msg[1], &block[1], blen); 1057 memcpy (&msg[1], &block[1], blen);
1058 LOG (GNUNET_ERROR_TYPE_DEBUG, 1058 LOG (GNUNET_ERROR_TYPE_DEBUG,
1059 "Sending `%s' message with size %u and expiration %s\n", 1059 "Sending `%s' message with size %u and expiration %s\n",
1060 "NAMESTORE_BLOCK_CACHE", 1060 "NAMESTORE_BLOCK_CACHE",
1061 (unsigned int) msg_size, 1061 (unsigned int) msg_size,
1062 GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (msg->expire))); 1062 GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (msg->expire)));
1063 GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); 1063 GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe);
@@ -1134,12 +1134,12 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h,
1134 name_tmp = (char *) &msg[1]; 1134 name_tmp = (char *) &msg[1];
1135 memcpy (name_tmp, label, name_len); 1135 memcpy (name_tmp, label, name_len);
1136 rd_ser = &name_tmp[name_len]; 1136 rd_ser = &name_tmp[name_len];
1137 GNUNET_break (rd_ser_len == 1137 GNUNET_break (rd_ser_len ==
1138 GNUNET_NAMESTORE_records_serialize (rd_count, rd, 1138 GNUNET_NAMESTORE_records_serialize (rd_count, rd,
1139 rd_ser_len, 1139 rd_ser_len,
1140 rd_ser)); 1140 rd_ser));
1141 LOG (GNUNET_ERROR_TYPE_DEBUG, 1141 LOG (GNUNET_ERROR_TYPE_DEBUG,
1142 "Sending `%s' message for name `%s' with size %u and %u records\n", 1142 "Sending `%s' message for name `%s' with size %u and %u records\n",
1143 "NAMESTORE_RECORD_STORE", label, msg_size, 1143 "NAMESTORE_RECORD_STORE", label, msg_size,
1144 rd_count); 1144 rd_count);
1145 GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); 1145 GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe);
@@ -1150,7 +1150,7 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h,
1150 1150
1151/** 1151/**
1152 * Get a result for a particular key from the namestore. The processor 1152 * Get a result for a particular key from the namestore. The processor
1153 * will only be called once. 1153 * will only be called once.
1154 * 1154 *
1155 * @param h handle to the namestore 1155 * @param h handle to the namestore
1156 * @param derived_hash hash of zone key combined with name to lookup 1156 * @param derived_hash hash of zone key combined with name to lookup
@@ -1160,7 +1160,7 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h,
1160 * @return a handle that can be used to cancel 1160 * @return a handle that can be used to cancel
1161 */ 1161 */
1162struct GNUNET_NAMESTORE_QueueEntry * 1162struct GNUNET_NAMESTORE_QueueEntry *
1163GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h, 1163GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h,
1164 const struct GNUNET_HashCode *derived_hash, 1164 const struct GNUNET_HashCode *derived_hash,
1165 GNUNET_NAMESTORE_BlockProcessor proc, void *proc_cls) 1165 GNUNET_NAMESTORE_BlockProcessor proc, void *proc_cls)
1166{ 1166{
@@ -1328,7 +1328,7 @@ GNUNET_NAMESTORE_zone_iterator_next (struct GNUNET_NAMESTORE_ZoneIterator *it)
1328 msg->gns_header.header.size = htons (msg_size); 1328 msg->gns_header.header.size = htons (msg_size);
1329 msg->gns_header.r_id = htonl (it->op_id); 1329 msg->gns_header.r_id = htonl (it->op_id);
1330 LOG (GNUNET_ERROR_TYPE_DEBUG, 1330 LOG (GNUNET_ERROR_TYPE_DEBUG,
1331 "Sending `%s' message\n", 1331 "Sending `%s' message\n",
1332 "ZONE_ITERATION_NEXT"); 1332 "ZONE_ITERATION_NEXT");
1333 GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); 1333 GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe);
1334 do_transmit (h); 1334 do_transmit (h);
@@ -1360,8 +1360,8 @@ GNUNET_NAMESTORE_zone_iteration_stop (struct GNUNET_NAMESTORE_ZoneIterator *it)
1360 msg->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP); 1360 msg->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP);
1361 msg->gns_header.header.size = htons (msg_size); 1361 msg->gns_header.header.size = htons (msg_size);
1362 msg->gns_header.r_id = htonl (it->op_id); 1362 msg->gns_header.r_id = htonl (it->op_id);
1363 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1363 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1364 "Sending `%s' message\n", 1364 "Sending `%s' message\n",
1365 "ZONE_ITERATION_STOP"); 1365 "ZONE_ITERATION_STOP");
1366 GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); 1366 GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe);
1367 do_transmit (h); 1367 do_transmit (h);
diff --git a/src/namestore/namestore_api_common.c b/src/namestore/namestore_api_common.c
index 5cadf8997..bf853ccdf 100644
--- a/src/namestore/namestore_api_common.c
+++ b/src/namestore/namestore_api_common.c
@@ -68,7 +68,7 @@ struct NetworkRecord
68 * Flags for the record, network byte order. 68 * Flags for the record, network byte order.
69 */ 69 */
70 uint32_t flags GNUNET_PACKED; 70 uint32_t flags GNUNET_PACKED;
71 71
72}; 72};
73 73
74GNUNET_NETWORK_STRUCT_END 74GNUNET_NETWORK_STRUCT_END
@@ -103,7 +103,7 @@ GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicSignKey *z)
103 static char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) * 8]; 103 static char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) * 8];
104 char *end; 104 char *end;
105 105
106 end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z, 106 end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z,
107 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), 107 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
108 buf, sizeof (buf)); 108 buf, sizeof (buf));
109 if (NULL == end) 109 if (NULL == end)
@@ -137,7 +137,7 @@ GNUNET_NAMESTORE_records_get_size (unsigned int rd_count,
137 GNUNET_assert ((ret + rd[i].data_size) >= ret); 137 GNUNET_assert ((ret + rd[i].data_size) >= ret);
138 ret += rd[i].data_size; 138 ret += rd[i].data_size;
139 } 139 }
140 return ret; 140 return ret;
141} 141}
142 142
143 143
@@ -159,7 +159,7 @@ GNUNET_NAMESTORE_records_serialize (unsigned int rd_count,
159 struct NetworkRecord rec; 159 struct NetworkRecord rec;
160 unsigned int i; 160 unsigned int i;
161 size_t off; 161 size_t off;
162 162
163 off = 0; 163 off = 0;
164 for (i=0;i<rd_count;i++) 164 for (i=0;i<rd_count;i++)
165 { 165 {
@@ -211,11 +211,11 @@ GNUNET_NAMESTORE_records_cmp (const struct GNUNET_NAMESTORE_RecordData *a,
211 { 211 {
212 LOG (GNUNET_ERROR_TYPE_DEBUG, 212 LOG (GNUNET_ERROR_TYPE_DEBUG,
213 "Expiration time %llu != %llu\n", 213 "Expiration time %llu != %llu\n",
214 a->expiration_time, 214 a->expiration_time,
215 b->expiration_time); 215 b->expiration_time);
216 return GNUNET_NO; 216 return GNUNET_NO;
217 } 217 }
218 if ((a->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS) 218 if ((a->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS)
219 != (b->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS)) 219 != (b->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS))
220 { 220 {
221 LOG (GNUNET_ERROR_TYPE_DEBUG, 221 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -227,8 +227,8 @@ GNUNET_NAMESTORE_records_cmp (const struct GNUNET_NAMESTORE_RecordData *a,
227 if (a->data_size != b->data_size) 227 if (a->data_size != b->data_size)
228 { 228 {
229 LOG (GNUNET_ERROR_TYPE_DEBUG, 229 LOG (GNUNET_ERROR_TYPE_DEBUG,
230 "Data size %lu != %lu\n", 230 "Data size %lu != %lu\n",
231 a->data_size, 231 a->data_size,
232 b->data_size); 232 b->data_size);
233 return GNUNET_NO; 233 return GNUNET_NO;
234 } 234 }
@@ -262,7 +262,7 @@ GNUNET_NAMESTORE_records_deserialize (size_t len,
262 struct NetworkRecord rec; 262 struct NetworkRecord rec;
263 unsigned int i; 263 unsigned int i;
264 size_t off; 264 size_t off;
265 265
266 off = 0; 266 off = 0;
267 for (i=0;i<rd_count;i++) 267 for (i=0;i<rd_count;i++)
268 { 268 {
@@ -284,7 +284,7 @@ GNUNET_NAMESTORE_records_deserialize (size_t len,
284 dest[i].flags, 284 dest[i].flags,
285 (unsigned long long) dest[i].expiration_time); 285 (unsigned long long) dest[i].expiration_time);
286 } 286 }
287 return GNUNET_OK; 287 return GNUNET_OK;
288} 288}
289 289
290 290
@@ -298,7 +298,7 @@ GNUNET_NAMESTORE_records_deserialize (size_t len,
298 * @return absolute expiration time 298 * @return absolute expiration time
299 */ 299 */
300struct GNUNET_TIME_Absolute 300struct GNUNET_TIME_Absolute
301GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count, 301GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count,
302 const struct GNUNET_NAMESTORE_RecordData *rd) 302 const struct GNUNET_NAMESTORE_RecordData *rd)
303{ 303{
304 unsigned int c; 304 unsigned int c;
@@ -309,7 +309,7 @@ GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count,
309 if (NULL == rd) 309 if (NULL == rd)
310 return GNUNET_TIME_UNIT_ZERO_ABS; 310 return GNUNET_TIME_UNIT_ZERO_ABS;
311 expire = GNUNET_TIME_UNIT_FOREVER_ABS; 311 expire = GNUNET_TIME_UNIT_FOREVER_ABS;
312 for (c = 0; c < rd_count; c++) 312 for (c = 0; c < rd_count; c++)
313 { 313 {
314 if (0 != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) 314 if (0 != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION))
315 { 315 {
@@ -320,7 +320,7 @@ GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count,
320 { 320 {
321 at.abs_value_us = rd[c].expiration_time; 321 at.abs_value_us = rd[c].expiration_time;
322 } 322 }
323 expire = GNUNET_TIME_absolute_min (at, expire); 323 expire = GNUNET_TIME_absolute_min (at, expire);
324 } 324 }
325 LOG (GNUNET_ERROR_TYPE_DEBUG, 325 LOG (GNUNET_ERROR_TYPE_DEBUG,
326 "Determined expiration time for block with %u records to be %s\n", 326 "Determined expiration time for block with %u records to be %s\n",
@@ -392,10 +392,10 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key,
392 memcpy (payload, &rd_count_nbo, sizeof (uint32_t)); 392 memcpy (payload, &rd_count_nbo, sizeof (uint32_t));
393 GNUNET_assert (payload_len == 393 GNUNET_assert (payload_len ==
394 GNUNET_NAMESTORE_records_serialize (rd_count, rd, 394 GNUNET_NAMESTORE_records_serialize (rd_count, rd,
395 payload_len, &payload[sizeof (uint32_t)])); 395 payload_len, &payload[sizeof (uint32_t)]));
396 block = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_Block) + 396 block = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_Block) +
397 sizeof (uint32_t) + payload_len); 397 sizeof (uint32_t) + payload_len);
398 block->purpose.size = htonl (sizeof (uint32_t) + payload_len + 398 block->purpose.size = htonl (sizeof (uint32_t) + payload_len +
399 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + 399 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
400 sizeof (struct GNUNET_TIME_AbsoluteNBO)); 400 sizeof (struct GNUNET_TIME_AbsoluteNBO));
401 block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN); 401 block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN);
@@ -436,8 +436,8 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key,
436 */ 436 */
437int 437int
438GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block) 438GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block)
439{ 439{
440 return GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, 440 return GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN,
441 &block->purpose, 441 &block->purpose,
442 &block->signature, 442 &block->signature,
443 &block->derived_key); 443 &block->derived_key);
@@ -452,7 +452,7 @@ GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block)
452 * @param label the name for the records 452 * @param label the name for the records
453 * @param proc function to call with the result 453 * @param proc function to call with the result
454 * @param proc_cls closure for proc 454 * @param proc_cls closure for proc
455 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was 455 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was
456 * not well-formed 456 * not well-formed
457 */ 457 */
458int 458int
@@ -468,7 +468,7 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block,
468 struct GNUNET_CRYPTO_SymmetricInitializationVector iv; 468 struct GNUNET_CRYPTO_SymmetricInitializationVector iv;
469 struct GNUNET_CRYPTO_SymmetricSessionKey skey; 469 struct GNUNET_CRYPTO_SymmetricSessionKey skey;
470 470
471 if (ntohl (block->purpose.size) < 471 if (ntohl (block->purpose.size) <
472 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + 472 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
473 sizeof (struct GNUNET_TIME_AbsoluteNBO)) 473 sizeof (struct GNUNET_TIME_AbsoluteNBO))
474 { 474 {
@@ -477,7 +477,7 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block,
477 } 477 }
478 derive_block_aes_key (&iv, &skey, label, zone_key); 478 derive_block_aes_key (&iv, &skey, label, zone_key);
479 { 479 {
480 char payload[payload_len]; 480 char payload[payload_len];
481 uint32_t rd_count; 481 uint32_t rd_count;
482 482
483 GNUNET_break (payload_len == 483 GNUNET_break (payload_len ==
@@ -496,7 +496,7 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block,
496 } 496 }
497 { 497 {
498 struct GNUNET_NAMESTORE_RecordData rd[rd_count]; 498 struct GNUNET_NAMESTORE_RecordData rd[rd_count];
499 499
500 if (GNUNET_OK != 500 if (GNUNET_OK !=
501 GNUNET_NAMESTORE_records_deserialize (payload_len - sizeof (uint32_t), 501 GNUNET_NAMESTORE_records_deserialize (payload_len - sizeof (uint32_t),
502 &payload[sizeof (uint32_t)], 502 &payload[sizeof (uint32_t)],
@@ -555,7 +555,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
555 { 555 {
556 GNUNET_break_op (0); 556 GNUNET_break_op (0);
557 return NULL; 557 return NULL;
558 } 558 }
559 return ns; 559 return ns;
560 } 560 }
561 case GNUNET_DNSPARSER_TYPE_CNAME: 561 case GNUNET_DNSPARSER_TYPE_CNAME:
@@ -572,7 +572,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
572 { 572 {
573 GNUNET_break_op (0); 573 GNUNET_break_op (0);
574 return NULL; 574 return NULL;
575 } 575 }
576 return cname; 576 return cname;
577 } 577 }
578 case GNUNET_DNSPARSER_TYPE_SOA: 578 case GNUNET_DNSPARSER_TYPE_SOA:
@@ -590,13 +590,13 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
590 GNUNET_break_op (0); 590 GNUNET_break_op (0);
591 return NULL; 591 return NULL;
592 } 592 }
593 GNUNET_asprintf (&result, 593 GNUNET_asprintf (&result,
594 "rname=%s mname=%s %lu,%lu,%lu,%lu,%lu", 594 "rname=%s mname=%s %lu,%lu,%lu,%lu,%lu",
595 soa->rname, 595 soa->rname,
596 soa->mname, 596 soa->mname,
597 soa->serial, 597 soa->serial,
598 soa->refresh, 598 soa->refresh,
599 soa->retry, 599 soa->retry,
600 soa->expire, 600 soa->expire,
601 soa->minimum_ttl); 601 soa->minimum_ttl);
602 GNUNET_DNSPARSER_free_soa (soa); 602 GNUNET_DNSPARSER_free_soa (soa);
@@ -616,7 +616,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
616 { 616 {
617 GNUNET_break_op (0); 617 GNUNET_break_op (0);
618 return NULL; 618 return NULL;
619 } 619 }
620 return ptr; 620 return ptr;
621 } 621 }
622 case GNUNET_DNSPARSER_TYPE_MX: 622 case GNUNET_DNSPARSER_TYPE_MX:
@@ -634,8 +634,8 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
634 GNUNET_break_op (0); 634 GNUNET_break_op (0);
635 return NULL; 635 return NULL;
636 } 636 }
637 GNUNET_asprintf (&result, 637 GNUNET_asprintf (&result,
638 "%hu,%s", 638 "%hu,%s",
639 mx->preference, 639 mx->preference,
640 mx->mxhost); 640 mx->mxhost);
641 GNUNET_DNSPARSER_free_mx (mx); 641 GNUNET_DNSPARSER_free_mx (mx);
@@ -710,7 +710,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
710 { 710 {
711 GNUNET_break_op (0); 711 GNUNET_break_op (0);
712 return NULL; 712 return NULL;
713 } 713 }
714 return ns; 714 return ns;
715 } 715 }
716 case GNUNET_DNSPARSER_TYPE_SRV: 716 case GNUNET_DNSPARSER_TYPE_SRV:
@@ -729,7 +729,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
729 GNUNET_break_op (0); 729 GNUNET_break_op (0);
730 return NULL; 730 return NULL;
731 } 731 }
732 GNUNET_asprintf (&result, 732 GNUNET_asprintf (&result,
733 "%d %d %d _%s._%s.%s", 733 "%d %d %d _%s._%s.%s",
734 srv->priority, 734 srv->priority,
735 srv->weight, 735 srv->weight,
@@ -750,7 +750,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
750 ('\0' != cdata[data_size - 1]) ) 750 ('\0' != cdata[data_size - 1]) )
751 return NULL; /* malformed */ 751 return NULL; /* malformed */
752 tlsa = data; 752 tlsa = data;
753 if (0 == GNUNET_asprintf (&tlsa_str, 753 if (0 == GNUNET_asprintf (&tlsa_str,
754 "%c %c %c %s", 754 "%c %c %c %s",
755 tlsa->usage, 755 tlsa->usage,
756 tlsa->selector, 756 tlsa->selector,
@@ -794,7 +794,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
794 char s_peer[103 + 1]; 794 char s_peer[103 + 1];
795 char s_serv[253 + 1]; 795 char s_serv[253 + 1];
796 unsigned int proto; 796 unsigned int proto;
797 797
798 if (NULL == s) 798 if (NULL == s)
799 return GNUNET_SYSERR; 799 return GNUNET_SYSERR;
800 switch (type) 800 switch (type)
@@ -820,7 +820,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
820 { 820 {
821 char nsbuf[256]; 821 char nsbuf[256];
822 size_t off; 822 size_t off;
823 823
824 off = 0; 824 off = 0;
825 if (GNUNET_OK != 825 if (GNUNET_OK !=
826 GNUNET_DNSPARSER_builder_add_name (nsbuf, 826 GNUNET_DNSPARSER_builder_add_name (nsbuf,
@@ -842,7 +842,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
842 { 842 {
843 char cnamebuf[256]; 843 char cnamebuf[256];
844 size_t off; 844 size_t off;
845 845
846 off = 0; 846 off = 0;
847 if (GNUNET_OK != 847 if (GNUNET_OK !=
848 GNUNET_DNSPARSER_builder_add_name (cnamebuf, 848 GNUNET_DNSPARSER_builder_add_name (cnamebuf,
@@ -873,7 +873,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
873 unsigned int soa_min; 873 unsigned int soa_min;
874 size_t off; 874 size_t off;
875 875
876 if (7 != SSCANF (s, 876 if (7 != SSCANF (s,
877 "rname=%253s mname=%253s %u,%u,%u,%u,%u", 877 "rname=%253s mname=%253s %u,%u,%u,%u,%u",
878 soa_rname, soa_mname, 878 soa_rname, soa_mname,
879 &soa_serial, &soa_refresh, &soa_retry, &soa_expire, &soa_min)) 879 &soa_serial, &soa_refresh, &soa_retry, &soa_expire, &soa_min))
@@ -912,7 +912,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
912 { 912 {
913 char ptrbuf[256]; 913 char ptrbuf[256];
914 size_t off; 914 size_t off;
915 915
916 off = 0; 916 off = 0;
917 if (GNUNET_OK != 917 if (GNUNET_OK !=
918 GNUNET_DNSPARSER_builder_add_name (ptrbuf, 918 GNUNET_DNSPARSER_builder_add_name (ptrbuf,
@@ -970,7 +970,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
970 *data_size = strlen (s); 970 *data_size = strlen (s);
971 return GNUNET_OK; 971 return GNUNET_OK;
972 case GNUNET_DNSPARSER_TYPE_AAAA: 972 case GNUNET_DNSPARSER_TYPE_AAAA:
973 if (1 != inet_pton (AF_INET6, s, &value_aaaa)) 973 if (1 != inet_pton (AF_INET6, s, &value_aaaa))
974 { 974 {
975 LOG (GNUNET_ERROR_TYPE_ERROR, 975 LOG (GNUNET_ERROR_TYPE_ERROR,
976 _("Unable to parse IPv6 address `%s'\n"), 976 _("Unable to parse IPv6 address `%s'\n"),
@@ -1005,7 +1005,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
1005 (1 != sscanf (s, "%u-", &line)) || 1005 (1 != sscanf (s, "%u-", &line)) ||
1006 (GNUNET_OK != 1006 (GNUNET_OK !=
1007 GNUNET_CRYPTO_ecc_public_sign_key_from_string (dash + 1, 1007 GNUNET_CRYPTO_ecc_public_sign_key_from_string (dash + 1,
1008 strlen (dash + 1), 1008 strlen (dash + 1),
1009 &peer.public_key)) ) 1009 &peer.public_key)) )
1010 { 1010 {
1011 LOG (GNUNET_ERROR_TYPE_ERROR, 1011 LOG (GNUNET_ERROR_TYPE_ERROR,
@@ -1055,7 +1055,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
1055 { 1055 {
1056 char nsbuf[256]; 1056 char nsbuf[256];
1057 size_t off; 1057 size_t off;
1058 1058
1059 off = 0; 1059 off = 0;
1060 if (GNUNET_OK != 1060 if (GNUNET_OK !=
1061 GNUNET_DNSPARSER_builder_add_name (nsbuf, 1061 GNUNET_DNSPARSER_builder_add_name (nsbuf,
@@ -1083,7 +1083,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
1083 (char*)&tlsa[1])) 1083 (char*)&tlsa[1]))
1084 { 1084 {
1085 LOG (GNUNET_ERROR_TYPE_ERROR, 1085 LOG (GNUNET_ERROR_TYPE_ERROR,
1086 _("Unable to parse TLSA record string `%s'\n"), 1086 _("Unable to parse TLSA record string `%s'\n"),
1087 s); 1087 s);
1088 *data_size = 0; 1088 *data_size = 0;
1089 GNUNET_free (tlsa); 1089 GNUNET_free (tlsa);
@@ -1103,9 +1103,9 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
1103 * Mapping of record type numbers to human-readable 1103 * Mapping of record type numbers to human-readable
1104 * record type names. 1104 * record type names.
1105 */ 1105 */
1106static struct { 1106static struct {
1107 const char *name; 1107 const char *name;
1108 uint32_t number; 1108 uint32_t number;
1109} name_map[] = { 1109} name_map[] = {
1110 { "A", GNUNET_DNSPARSER_TYPE_A }, 1110 { "A", GNUNET_DNSPARSER_TYPE_A },
1111 { "NS", GNUNET_DNSPARSER_TYPE_NS }, 1111 { "NS", GNUNET_DNSPARSER_TYPE_NS },
@@ -1141,7 +1141,7 @@ GNUNET_NAMESTORE_typename_to_number (const char *dns_typename)
1141 while ( (name_map[i].name != NULL) && 1141 while ( (name_map[i].name != NULL) &&
1142 (0 != strcasecmp (dns_typename, name_map[i].name)) ) 1142 (0 != strcasecmp (dns_typename, name_map[i].name)) )
1143 i++; 1143 i++;
1144 return name_map[i].number; 1144 return name_map[i].number;
1145} 1145}
1146 1146
1147 1147
@@ -1160,13 +1160,13 @@ GNUNET_NAMESTORE_number_to_typename (uint32_t type)
1160 while ( (name_map[i].name != NULL) && 1160 while ( (name_map[i].name != NULL) &&
1161 (type != name_map[i].number) ) 1161 (type != name_map[i].number) )
1162 i++; 1162 i++;
1163 return name_map[i].name; 1163 return name_map[i].name;
1164} 1164}
1165 1165
1166 1166
1167/** 1167/**
1168 * Test if a given record is expired. 1168 * Test if a given record is expired.
1169 * 1169 *
1170 * @return #GNUNET_YES if the record is expired, 1170 * @return #GNUNET_YES if the record is expired,
1171 * #GNUNET_NO if not 1171 * #GNUNET_NO if not
1172 */ 1172 */
@@ -1184,7 +1184,7 @@ GNUNET_NAMESTORE_is_expired (const struct GNUNET_NAMESTORE_RecordData *rd)
1184 1184
1185/** 1185/**
1186 * Calculate the DHT query for a given @a label in a given @a zone. 1186 * Calculate the DHT query for a given @a label in a given @a zone.
1187 * 1187 *
1188 * @param zone private key of the zone 1188 * @param zone private key of the zone
1189 * @param label label of the record 1189 * @param label label of the record
1190 * @param query hash to use for the query 1190 * @param query hash to use for the query
@@ -1203,7 +1203,7 @@ GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EccPrivateKe
1203 1203
1204/** 1204/**
1205 * Calculate the DHT query for a given @a label in a given @a zone. 1205 * Calculate the DHT query for a given @a label in a given @a zone.
1206 * 1206 *
1207 * @param pub public key of the zone 1207 * @param pub public key of the zone
1208 * @param label label of the record 1208 * @param label label of the record
1209 * @param query hash to use for the query 1209 * @param query hash to use for the query
@@ -1222,12 +1222,12 @@ GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicSign
1222 1222
1223/** 1223/**
1224 * Convert public key to the respective absolute domain name in the 1224 * Convert public key to the respective absolute domain name in the
1225 * ".zkey" pTLD. 1225 * ".zkey" pTLD.
1226 * This is one of the very few calls in the entire API that is 1226 * This is one of the very few calls in the entire API that is
1227 * NOT reentrant! 1227 * NOT reentrant!
1228 * 1228 *
1229 * @param pkey a public key with a point on the eliptic curve 1229 * @param pkey a public key with a point on the eliptic curve
1230 * @return string "X.zkey" where X is the public 1230 * @return string "X.zkey" where X is the public
1231 * key in an encoding suitable for DNS labels. 1231 * key in an encoding suitable for DNS labels.
1232 */ 1232 */
1233const char * 1233const char *
@@ -1249,10 +1249,10 @@ GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey
1249/** 1249/**
1250 * Convert an absolute domain name in the ".zkey" pTLD to the 1250 * Convert an absolute domain name in the ".zkey" pTLD to the
1251 * respective public key. 1251 * respective public key.
1252 * 1252 *
1253 * @param zkey string "X.zkey" where X is the coordinates of the public 1253 * @param zkey string "X.zkey" where X is the coordinates of the public
1254 * key in an encoding suitable for DNS labels. 1254 * key in an encoding suitable for DNS labels.
1255 * @param pkey set to a public key on the eliptic curve 1255 * @param pkey set to a public key on the eliptic curve
1256 * @return #GNUNET_SYSERR if @a zkey has the wrong syntax 1256 * @return #GNUNET_SYSERR if @a zkey has the wrong syntax
1257 */ 1257 */
1258int 1258int
@@ -1262,13 +1262,13 @@ GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey,
1262 char *cpy; 1262 char *cpy;
1263 char *dot; 1263 char *dot;
1264 const char *x; 1264 const char *x;
1265 1265
1266 cpy = GNUNET_strdup (zkey); 1266 cpy = GNUNET_strdup (zkey);
1267 x = cpy; 1267 x = cpy;
1268 if (NULL == (dot = strchr (x, (int) '.'))) 1268 if (NULL == (dot = strchr (x, (int) '.')))
1269 goto error; 1269 goto error;
1270 *dot = '\0'; 1270 *dot = '\0';
1271 if (0 != strcasecmp (dot + 1, 1271 if (0 != strcasecmp (dot + 1,
1272 "zkey")) 1272 "zkey"))
1273 goto error; 1273 goto error;
1274 1274
diff --git a/src/namestore/namestore_api_monitor.c b/src/namestore/namestore_api_monitor.c
index c6509941f..ccf556abd 100644
--- a/src/namestore/namestore_api_monitor.c
+++ b/src/namestore/namestore_api_monitor.c
@@ -193,14 +193,14 @@ handle_updates (void *cls,
193 GNUNET_break (0); 193 GNUNET_break (0);
194 reconnect (zm); 194 reconnect (zm);
195 return; 195 return;
196 } 196 }
197 GNUNET_CLIENT_receive (zm->h, 197 GNUNET_CLIENT_receive (zm->h,
198 &handle_updates, 198 &handle_updates,
199 zm, 199 zm,
200 GNUNET_TIME_UNIT_FOREVER_REL); 200 GNUNET_TIME_UNIT_FOREVER_REL);
201 zm->monitor (zm->cls, 201 zm->monitor (zm->cls,
202 &lrm->private_key, 202 &lrm->private_key,
203 name_tmp, 203 name_tmp,
204 rd_count, rd); 204 rd_count, rd);
205 } 205 }
206} 206}
@@ -224,7 +224,7 @@ transmit_monitor_message (void *cls,
224 224
225 zm->th = NULL; 225 zm->th = NULL;
226 if (size < sizeof (struct ZoneMonitorStartMessage)) 226 if (size < sizeof (struct ZoneMonitorStartMessage))
227 { 227 {
228 reconnect (zm); 228 reconnect (zm);
229 return 0; 229 return 0;
230 } 230 }
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c
index b3a8f59ea..92e3a8d8a 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -91,7 +91,7 @@ create_indices (PGconn * dbh)
91 GNUNET_POSTGRES_exec (dbh, "CREATE INDEX ir_name_rv ON ns091records (record_name_hash,rvalue)")) || 91 GNUNET_POSTGRES_exec (dbh, "CREATE INDEX ir_name_rv ON ns091records (record_name_hash,rvalue)")) ||
92 (GNUNET_OK != 92 (GNUNET_OK !=
93 GNUNET_POSTGRES_exec (dbh, "CREATE INDEX ir_rv ON ns091records (rvalue)")) ) 93 GNUNET_POSTGRES_exec (dbh, "CREATE INDEX ir_rv ON ns091records (rvalue)")) )
94 LOG (GNUNET_ERROR_TYPE_ERROR, 94 LOG (GNUNET_ERROR_TYPE_ERROR,
95 _("Failed to create indices\n")); 95 _("Failed to create indices\n"));
96} 96}
97 97
@@ -113,7 +113,7 @@ database_setup (struct Plugin *plugin)
113 "namestore-postgres"); 113 "namestore-postgres");
114 if (NULL == plugin->dbh) 114 if (NULL == plugin->dbh)
115 return GNUNET_SYSERR; 115 return GNUNET_SYSERR;
116 if (GNUNET_YES == 116 if (GNUNET_YES ==
117 GNUNET_CONFIGURATION_get_value_yesno (plugin->cfg, 117 GNUNET_CONFIGURATION_get_value_yesno (plugin->cfg,
118 "namestore-postgres", 118 "namestore-postgres",
119 "TEMPORARY_TABLE")) 119 "TEMPORARY_TABLE"))
@@ -121,15 +121,15 @@ database_setup (struct Plugin *plugin)
121 res = 121 res =
122 PQexec (plugin->dbh, 122 PQexec (plugin->dbh,
123 "CREATE TEMPORARY TABLE ns091records (" 123 "CREATE TEMPORARY TABLE ns091records ("
124 " zone_key BYTEA NOT NULL DEFAULT ''," 124 " zone_key BYTEA NOT NULL DEFAULT '',"
125 " zone_delegation BYTEA NOT NULL DEFAULT ''," 125 " zone_delegation BYTEA NOT NULL DEFAULT '',"
126 " zone_hash BYTEA NOT NULL DEFAULT ''," 126 " zone_hash BYTEA NOT NULL DEFAULT '',"
127 " record_count INTEGER NOT NULL DEFAULT 0," 127 " record_count INTEGER NOT NULL DEFAULT 0,"
128 " record_data BYTEA NOT NULL DEFAULT ''," 128 " record_data BYTEA NOT NULL DEFAULT '',"
129 " block_expiration_time BIGINT NOT NULL DEFAULT 0," 129 " block_expiration_time BIGINT NOT NULL DEFAULT 0,"
130 " signature BYTEA NOT NULL DEFAULT ''," 130 " signature BYTEA NOT NULL DEFAULT '',"
131 " record_name TEXT NOT NULL DEFAULT ''," 131 " record_name TEXT NOT NULL DEFAULT '',"
132 " record_name_hash BYTEA NOT NULL DEFAULT ''," 132 " record_name_hash BYTEA NOT NULL DEFAULT '',"
133 " rvalue BIGINT NOT NULL DEFAULT 0" 133 " rvalue BIGINT NOT NULL DEFAULT 0"
134 ")" "WITH OIDS"); 134 ")" "WITH OIDS");
135 } 135 }
@@ -137,15 +137,15 @@ database_setup (struct Plugin *plugin)
137 res = 137 res =
138 PQexec (plugin->dbh, 138 PQexec (plugin->dbh,
139 "CREATE TABLE ns091records (" 139 "CREATE TABLE ns091records ("
140 " zone_key BYTEA NOT NULL DEFAULT ''," 140 " zone_key BYTEA NOT NULL DEFAULT '',"
141 " zone_delegation BYTEA NOT NULL DEFAULT ''," 141 " zone_delegation BYTEA NOT NULL DEFAULT '',"
142 " zone_hash BYTEA NOT NULL DEFAULT ''," 142 " zone_hash BYTEA NOT NULL DEFAULT '',"
143 " record_count INTEGER NOT NULL DEFAULT 0," 143 " record_count INTEGER NOT NULL DEFAULT 0,"
144 " record_data BYTEA NOT NULL DEFAULT ''," 144 " record_data BYTEA NOT NULL DEFAULT '',"
145 " block_expiration_time BIGINT NOT NULL DEFAULT 0," 145 " block_expiration_time BIGINT NOT NULL DEFAULT 0,"
146 " signature BYTEA NOT NULL DEFAULT ''," 146 " signature BYTEA NOT NULL DEFAULT '',"
147 " record_name TEXT NOT NULL DEFAULT ''," 147 " record_name TEXT NOT NULL DEFAULT '',"
148 " record_name_hash BYTEA NOT NULL DEFAULT ''," 148 " record_name_hash BYTEA NOT NULL DEFAULT '',"
149 " rvalue BIGINT NOT NULL DEFAULT 0" 149 " rvalue BIGINT NOT NULL DEFAULT 0"
150 ")" "WITH OIDS"); 150 ")" "WITH OIDS");
151 151
@@ -167,7 +167,7 @@ database_setup (struct Plugin *plugin)
167 if ((GNUNET_OK != 167 if ((GNUNET_OK !=
168 GNUNET_POSTGRES_prepare (plugin->dbh, 168 GNUNET_POSTGRES_prepare (plugin->dbh,
169 "put_records", 169 "put_records",
170 "INSERT INTO ns091records (zone_key, record_name, record_count, record_data, block_expiration_time, signature" 170 "INSERT INTO ns091records (zone_key, record_name, record_count, record_data, block_expiration_time, signature"
171 ", zone_delegation, zone_hash, record_name_hash, rvalue) VALUES " 171 ", zone_delegation, zone_hash, record_name_hash, rvalue) VALUES "
172 "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", 10)) || 172 "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", 10)) ||
173 (GNUNET_OK != 173 (GNUNET_OK !=
@@ -177,22 +177,22 @@ database_setup (struct Plugin *plugin)
177 (GNUNET_OK != 177 (GNUNET_OK !=
178 GNUNET_POSTGRES_prepare (plugin->dbh, 178 GNUNET_POSTGRES_prepare (plugin->dbh,
179 "iterate_records", 179 "iterate_records",
180 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" 180 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature"
181 " FROM ns091records WHERE zone_hash=$1 AND record_name_hash=$2 ORDER BY rvalue LIMIT 1 OFFSET $3", 3)) || 181 " FROM ns091records WHERE zone_hash=$1 AND record_name_hash=$2 ORDER BY rvalue LIMIT 1 OFFSET $3", 3)) ||
182 (GNUNET_OK != 182 (GNUNET_OK !=
183 GNUNET_POSTGRES_prepare (plugin->dbh, 183 GNUNET_POSTGRES_prepare (plugin->dbh,
184 "iterate_by_zone", 184 "iterate_by_zone",
185 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" 185 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature"
186 " FROM ns091records WHERE zone_hash=$1 ORDER BY rvalue LIMIT 1 OFFSET $2", 2)) || 186 " FROM ns091records WHERE zone_hash=$1 ORDER BY rvalue LIMIT 1 OFFSET $2", 2)) ||
187 (GNUNET_OK != 187 (GNUNET_OK !=
188 GNUNET_POSTGRES_prepare (plugin->dbh, 188 GNUNET_POSTGRES_prepare (plugin->dbh,
189 "iterate_by_name", 189 "iterate_by_name",
190 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" 190 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature"
191 " FROM ns091records WHERE record_name_hash=$1 ORDER BY rvalue LIMIT 1 OFFSET $2", 2)) || 191 " FROM ns091records WHERE record_name_hash=$1 ORDER BY rvalue LIMIT 1 OFFSET $2", 2)) ||
192 (GNUNET_OK != 192 (GNUNET_OK !=
193 GNUNET_POSTGRES_prepare (plugin->dbh, 193 GNUNET_POSTGRES_prepare (plugin->dbh,
194 "iterate_all", 194 "iterate_all",
195 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" 195 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature"
196 " FROM ns091records ORDER BY rvalue LIMIT 1 OFFSET $1", 1)) || 196 " FROM ns091records ORDER BY rvalue LIMIT 1 OFFSET $1", 1)) ||
197 (GNUNET_OK != 197 (GNUNET_OK !=
198 GNUNET_POSTGRES_prepare (plugin->dbh, 198 GNUNET_POSTGRES_prepare (plugin->dbh,
@@ -223,8 +223,8 @@ TODO: removed
223 * @param name name to remove (at most 255 characters long) 223 * @param name name to remove (at most 255 characters long)
224 * @return GNUNET_OK on success 224 * @return GNUNET_OK on success
225 */ 225 */
226static int 226static int
227namestore_postgres_remove_records (void *cls, 227namestore_postgres_remove_records (void *cls,
228 const struct GNUNET_CRYPTO_ShortHashCode *zone, 228 const struct GNUNET_CRYPTO_ShortHashCode *zone,
229 const char *name) 229 const char *name)
230{ 230{
@@ -267,12 +267,12 @@ namestore_postgres_remove_records (void *cls,
267 * @param name name that is being mapped (at most 255 characters long) 267 * @param name name that is being mapped (at most 255 characters long)
268 * @param rd_count number of entries in 'rd' array 268 * @param rd_count number of entries in 'rd' array
269 * @param rd array of records with data to store 269 * @param rd array of records with data to store
270 * @param signature signature of the record block, NULL if signature is unavailable (i.e. 270 * @param signature signature of the record block, NULL if signature is unavailable (i.e.
271 * because the user queried for a particular record type only) 271 * because the user queried for a particular record type only)
272 * @return GNUNET_OK on success, else GNUNET_SYSERR 272 * @return GNUNET_OK on success, else GNUNET_SYSERR
273 */ 273 */
274static int 274static int
275namestore_postgres_put_records (void *cls, 275namestore_postgres_put_records (void *cls,
276 const struct GNUNET_CRYPTO_EccPublicSignKey *zone_key, 276 const struct GNUNET_CRYPTO_EccPublicSignKey *zone_key,
277 struct GNUNET_TIME_Absolute expire, 277 struct GNUNET_TIME_Absolute expire,
278 const char *name, 278 const char *name,
@@ -290,7 +290,7 @@ namestore_postgres_put_records (void *cls,
290 size_t data_size; 290 size_t data_size;
291 unsigned int i; 291 unsigned int i;
292 292
293 GNUNET_CRYPTO_short_hash (zone_key, 293 GNUNET_CRYPTO_short_hash (zone_key,
294 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), 294 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
295 &zone); 295 &zone);
296 (void) namestore_postgres_remove_records (plugin, &zone, name); 296 (void) namestore_postgres_remove_records (plugin, &zone, name);
@@ -336,7 +336,7 @@ namestore_postgres_put_records (void *cls,
336 sizeof (uint32_t), 336 sizeof (uint32_t),
337 data_size, 337 data_size,
338 sizeof (uint64_t), 338 sizeof (uint64_t),
339 sizeof (struct GNUNET_CRYPTO_EccSignature), 339 sizeof (struct GNUNET_CRYPTO_EccSignature),
340 sizeof (struct GNUNET_CRYPTO_ShortHashCode), 340 sizeof (struct GNUNET_CRYPTO_ShortHashCode),
341 sizeof (struct GNUNET_CRYPTO_ShortHashCode), 341 sizeof (struct GNUNET_CRYPTO_ShortHashCode),
342 sizeof (struct GNUNET_CRYPTO_ShortHashCode), 342 sizeof (struct GNUNET_CRYPTO_ShortHashCode),
@@ -358,7 +358,7 @@ namestore_postgres_put_records (void *cls,
358 return GNUNET_SYSERR; 358 return GNUNET_SYSERR;
359 PQclear (ret); 359 PQclear (ret);
360 } 360 }
361 return GNUNET_OK; 361 return GNUNET_OK;
362} 362}
363#endif 363#endif
364 364
@@ -404,7 +404,7 @@ get_record_and_call_iterator (struct Plugin *plugin,
404 if (0 == (cnt = PQntuples (res))) 404 if (0 == (cnt = PQntuples (res)))
405 { 405 {
406 /* no result */ 406 /* no result */
407 LOG (GNUNET_ERROR_TYPE_DEBUG, 407 LOG (GNUNET_ERROR_TYPE_DEBUG,
408 "Ending iteration (no more results)\n"); 408 "Ending iteration (no more results)\n");
409 PQclear (res); 409 PQclear (res);
410 410
@@ -412,10 +412,10 @@ get_record_and_call_iterator (struct Plugin *plugin,
412 return GNUNET_NO; 412 return GNUNET_NO;
413 } 413 }
414 GNUNET_assert (1 == cnt); 414 GNUNET_assert (1 == cnt);
415 if ((6 != PQnfields (res)) || 415 if ((6 != PQnfields (res)) ||
416 (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) != PQgetlength (res, 0, 0)) || 416 (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) != PQgetlength (res, 0, 0)) ||
417 (sizeof (uint32_t) != PQfsize (res, 2)) || 417 (sizeof (uint32_t) != PQfsize (res, 2)) ||
418 (sizeof (uint64_t) != PQfsize (res, 4)) || 418 (sizeof (uint64_t) != PQfsize (res, 4)) ||
419 (sizeof (struct GNUNET_CRYPTO_EccSignature) != PQgetlength (res, 0, 5))) 419 (sizeof (struct GNUNET_CRYPTO_EccSignature) != PQgetlength (res, 0, 5)))
420 { 420 {
421 GNUNET_break (0); 421 GNUNET_break (0);
@@ -444,7 +444,7 @@ get_record_and_call_iterator (struct Plugin *plugin,
444 { 444 {
445 struct GNUNET_NAMESTORE_RecordData rd[record_count]; 445 struct GNUNET_NAMESTORE_RecordData rd[record_count];
446 char buf[name_len + 1]; 446 char buf[name_len + 1];
447 447
448 memcpy (buf, name, name_len); 448 memcpy (buf, name, name_len);
449 buf[name_len] = '\0'; 449 buf[name_len] = '\0';
450 if (GNUNET_OK != 450 if (GNUNET_OK !=
@@ -461,7 +461,7 @@ get_record_and_call_iterator (struct Plugin *plugin,
461 return GNUNET_OK; 461 return GNUNET_OK;
462} 462}
463#endif 463#endif
464 464
465/** 465/**
466 * Iterate over the results for a particular key and zone in the 466 * Iterate over the results for a particular key and zone in the
467 * datastore. Will return at most one result to the iterator. 467 * datastore. Will return at most one result to the iterator.
@@ -474,8 +474,8 @@ get_record_and_call_iterator (struct Plugin *plugin,
474 * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUNET_SYSERR on error 474 * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUNET_SYSERR on error
475 * 'iter' will have been called unless the return value is 'GNUNET_SYSERR' 475 * 'iter' will have been called unless the return value is 'GNUNET_SYSERR'
476 */ 476 */
477static int 477static int
478namestore_postgres_iterate_records (void *cls, 478namestore_postgres_iterate_records (void *cls,
479 const struct GNUNET_CRYPTO_EccPrivateKey *zone, 479 const struct GNUNET_CRYPTO_EccPrivateKey *zone,
480 uint64_t offset, 480 uint64_t offset,
481 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) 481 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
@@ -537,7 +537,7 @@ namestore_postgres_iterate_records (void *cls,
537 first_param = 0; 537 first_param = 0;
538 } 538 }
539 res = 539 res =
540 PQexecPrepared (plugin->dbh, stmt_name, num_params, 540 PQexecPrepared (plugin->dbh, stmt_name, num_params,
541 &paramValues[first_param], 541 &paramValues[first_param],
542 &paramLengths[first_param], 542 &paramLengths[first_param],
543 &paramFormats[first_param], 1); 543 &paramFormats[first_param], 1);
@@ -561,7 +561,7 @@ namestore_postgres_iterate_records (void *cls,
561 * 'iter' will have been called unless the return value is 'GNUNET_SYSERR' 561 * 'iter' will have been called unless the return value is 'GNUNET_SYSERR'
562 */ 562 */
563static int 563static int
564namestore_postgres_zone_to_name (void *cls, 564namestore_postgres_zone_to_name (void *cls,
565 const struct GNUNET_CRYPTO_EccPrivateKey *zone, 565 const struct GNUNET_CRYPTO_EccPrivateKey *zone,
566 const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, 566 const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone,
567 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) 567 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
@@ -595,7 +595,7 @@ namestore_postgres_zone_to_name (void *cls,
595 * @param cls closure (internal context for the plugin) 595 * @param cls closure (internal context for the plugin)
596 * @param zone zone to delete 596 * @param zone zone to delete
597 */ 597 */
598static void 598static void
599namestore_postgres_delete_zone (void *cls, 599namestore_postgres_delete_zone (void *cls,
600 const struct GNUNET_CRYPTO_ShortHashCode *zone) 600 const struct GNUNET_CRYPTO_ShortHashCode *zone)
601{ 601{
@@ -717,7 +717,7 @@ libgnunet_plugin_namestore_postgres_init (void *cls)
717 if (NULL != plugin.cfg) 717 if (NULL != plugin.cfg)
718 return NULL; /* can only initialize once! */ 718 return NULL; /* can only initialize once! */
719 memset (&plugin, 0, sizeof (struct Plugin)); 719 memset (&plugin, 0, sizeof (struct Plugin));
720 plugin.cfg = cfg; 720 plugin.cfg = cfg;
721 if (GNUNET_OK != database_setup (&plugin)) 721 if (GNUNET_OK != database_setup (&plugin))
722 { 722 {
723 database_shutdown (&plugin); 723 database_shutdown (&plugin);
@@ -733,7 +733,7 @@ libgnunet_plugin_namestore_postgres_init (void *cls)
733 api->iterate_records = &namestore_postgres_iterate_records; 733 api->iterate_records = &namestore_postgres_iterate_records;
734 api->zone_to_name = &namestore_postgres_zone_to_name; 734 api->zone_to_name = &namestore_postgres_zone_to_name;
735 /* api->delete_zone = &namestore_postgres_delete_zone; */ 735 /* api->delete_zone = &namestore_postgres_delete_zone; */
736 LOG (GNUNET_ERROR_TYPE_INFO, 736 LOG (GNUNET_ERROR_TYPE_INFO,
737 _("Postgres database running\n")); 737 _("Postgres database running\n"));
738 return api; 738 return api;
739} 739}
@@ -754,7 +754,7 @@ libgnunet_plugin_namestore_postgres_done (void *cls)
754 database_shutdown (plugin); 754 database_shutdown (plugin);
755 plugin->cfg = NULL; 755 plugin->cfg = NULL;
756 GNUNET_free (api); 756 GNUNET_free (api);
757 LOG (GNUNET_ERROR_TYPE_DEBUG, 757 LOG (GNUNET_ERROR_TYPE_DEBUG,
758 "postgres plugin is finished\n"); 758 "postgres plugin is finished\n");
759 return NULL; 759 return NULL;
760} 760}
diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c
index 493981c06..1acb5aff2 100644
--- a/src/namestore/plugin_namestore_sqlite.c
+++ b/src/namestore/plugin_namestore_sqlite.c
@@ -136,7 +136,7 @@ sq_prepare (sqlite3 * dbh, const char *zSql, sqlite3_stmt ** ppStmt)
136 result = 136 result =
137 sqlite3_prepare_v2 (dbh, zSql, strlen (zSql), ppStmt, 137 sqlite3_prepare_v2 (dbh, zSql, strlen (zSql), ppStmt,
138 (const char **) &dummy); 138 (const char **) &dummy);
139 LOG (GNUNET_ERROR_TYPE_DEBUG, 139 LOG (GNUNET_ERROR_TYPE_DEBUG,
140 "Prepared `%s' / %p: %d\n", zSql, *ppStmt, result); 140 "Prepared `%s' / %p: %d\n", zSql, *ppStmt, result);
141 return result; 141 return result;
142} 142}
@@ -166,7 +166,7 @@ create_indices (sqlite3 * dbh)
166 (SQLITE_OK != 166 (SQLITE_OK !=
167 sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS it_iter ON ns096records (rvalue)", 167 sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS it_iter ON ns096records (rvalue)",
168 NULL, NULL, NULL)) ) 168 NULL, NULL, NULL)) )
169 LOG (GNUNET_ERROR_TYPE_ERROR, 169 LOG (GNUNET_ERROR_TYPE_ERROR,
170 "Failed to create indices: %s\n", sqlite3_errmsg (dbh)); 170 "Failed to create indices: %s\n", sqlite3_errmsg (dbh));
171} 171}
172 172
@@ -262,11 +262,11 @@ database_setup (struct Plugin *plugin)
262 if ((sqlite3_step (stmt) == SQLITE_DONE) && 262 if ((sqlite3_step (stmt) == SQLITE_DONE) &&
263 (sqlite3_exec 263 (sqlite3_exec
264 (plugin->dbh, 264 (plugin->dbh,
265 "CREATE TABLE ns096blocks (" 265 "CREATE TABLE ns096blocks ("
266 " query BLOB NOT NULL DEFAULT ''," 266 " query BLOB NOT NULL DEFAULT '',"
267 " block BLOB NOT NULL DEFAULT ''," 267 " block BLOB NOT NULL DEFAULT '',"
268 " expiration_time INT8 NOT NULL DEFAULT 0" 268 " expiration_time INT8 NOT NULL DEFAULT 0"
269 ")", 269 ")",
270 NULL, NULL, NULL) != SQLITE_OK)) 270 NULL, NULL, NULL) != SQLITE_OK))
271 { 271 {
272 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec"); 272 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec");
@@ -282,14 +282,14 @@ database_setup (struct Plugin *plugin)
282 if ((sqlite3_step (stmt) == SQLITE_DONE) && 282 if ((sqlite3_step (stmt) == SQLITE_DONE) &&
283 (sqlite3_exec 283 (sqlite3_exec
284 (plugin->dbh, 284 (plugin->dbh,
285 "CREATE TABLE ns096records (" 285 "CREATE TABLE ns096records ("
286 " zone_private_key BLOB NOT NULL DEFAULT ''," 286 " zone_private_key BLOB NOT NULL DEFAULT '',"
287 " pkey_hash BLOB," 287 " pkey_hash BLOB,"
288 " rvalue INT8 NOT NULL DEFAULT ''," 288 " rvalue INT8 NOT NULL DEFAULT '',"
289 " record_count INT NOT NULL DEFAULT 0," 289 " record_count INT NOT NULL DEFAULT 0,"
290 " record_data BLOB NOT NULL DEFAULT ''," 290 " record_data BLOB NOT NULL DEFAULT '',"
291 " label TEXT NOT NULL DEFAULT ''" 291 " label TEXT NOT NULL DEFAULT ''"
292 ")", 292 ")",
293 NULL, NULL, NULL) != SQLITE_OK)) 293 NULL, NULL, NULL) != SQLITE_OK))
294 { 294 {
295 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec"); 295 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec");
@@ -332,14 +332,14 @@ database_setup (struct Plugin *plugin)
332 &plugin->zone_to_name) != SQLITE_OK) || 332 &plugin->zone_to_name) != SQLITE_OK) ||
333 (sq_prepare 333 (sq_prepare
334 (plugin->dbh, 334 (plugin->dbh,
335 "SELECT record_count,record_data,label" 335 "SELECT record_count,record_data,label"
336 " FROM ns096records WHERE zone_private_key=? ORDER BY rvalue LIMIT 1 OFFSET ?", 336 " FROM ns096records WHERE zone_private_key=? ORDER BY rvalue LIMIT 1 OFFSET ?",
337 &plugin->iterate_zone) != SQLITE_OK) || 337 &plugin->iterate_zone) != SQLITE_OK) ||
338 (sq_prepare 338 (sq_prepare
339 (plugin->dbh, 339 (plugin->dbh,
340 "SELECT record_count,record_data,label,zone_private_key" 340 "SELECT record_count,record_data,label,zone_private_key"
341 " FROM ns096records ORDER BY rvalue LIMIT 1 OFFSET ?", 341 " FROM ns096records ORDER BY rvalue LIMIT 1 OFFSET ?",
342 &plugin->iterate_all_zones) != SQLITE_OK) 342 &plugin->iterate_all_zones) != SQLITE_OK)
343 ) 343 )
344 { 344 {
345 LOG_SQLITE (plugin,GNUNET_ERROR_TYPE_ERROR, "precompiling"); 345 LOG_SQLITE (plugin,GNUNET_ERROR_TYPE_ERROR, "precompiling");
@@ -415,7 +415,7 @@ namestore_sqlite_expire_blocks (struct Plugin *plugin)
415 int n; 415 int n;
416 416
417 now = GNUNET_TIME_absolute_get (); 417 now = GNUNET_TIME_absolute_get ();
418 if (SQLITE_OK != sqlite3_bind_int64 (plugin->expire_blocks, 418 if (SQLITE_OK != sqlite3_bind_int64 (plugin->expire_blocks,
419 1, now.abs_value_us)) 419 1, now.abs_value_us))
420 { 420 {
421 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 421 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
@@ -454,8 +454,8 @@ namestore_sqlite_expire_blocks (struct Plugin *plugin)
454 * @param block block to cache 454 * @param block block to cache
455 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 455 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
456 */ 456 */
457static int 457static int
458namestore_sqlite_cache_block (void *cls, 458namestore_sqlite_cache_block (void *cls,
459 const struct GNUNET_NAMESTORE_Block *block) 459 const struct GNUNET_NAMESTORE_Block *block)
460{ 460{
461 struct Plugin *plugin = cls; 461 struct Plugin *plugin = cls;
@@ -466,16 +466,16 @@ namestore_sqlite_cache_block (void *cls,
466 int n; 466 int n;
467 467
468 namestore_sqlite_expire_blocks (plugin); 468 namestore_sqlite_expire_blocks (plugin);
469 GNUNET_CRYPTO_hash (&block->derived_key, 469 GNUNET_CRYPTO_hash (&block->derived_key,
470 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), 470 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
471 &query); 471 &query);
472 expiration = GNUNET_TIME_absolute_ntoh (block->expiration_time); 472 expiration = GNUNET_TIME_absolute_ntoh (block->expiration_time);
473 dval = (int64_t) expiration.abs_value_us; 473 dval = (int64_t) expiration.abs_value_us;
474 if (dval < 0) 474 if (dval < 0)
475 dval = INT64_MAX; 475 dval = INT64_MAX;
476 block_size = ntohl (block->purpose.size) + 476 block_size = ntohl (block->purpose.size) +
477 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + 477 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
478 sizeof (struct GNUNET_CRYPTO_EccSignature); 478 sizeof (struct GNUNET_CRYPTO_EccSignature);
479 if (block_size > 64 * 65536) 479 if (block_size > 64 * 65536)
480 { 480 {
481 GNUNET_break (0); 481 GNUNET_break (0);
@@ -483,11 +483,11 @@ namestore_sqlite_cache_block (void *cls,
483 } 483 }
484 484
485 /* delete old version of the block */ 485 /* delete old version of the block */
486 if ( (SQLITE_OK != 486 if ( (SQLITE_OK !=
487 sqlite3_bind_blob (plugin->delete_block, 1, 487 sqlite3_bind_blob (plugin->delete_block, 1,
488 &query, sizeof (struct GNUNET_HashCode), 488 &query, sizeof (struct GNUNET_HashCode),
489 SQLITE_STATIC)) || 489 SQLITE_STATIC)) ||
490 (SQLITE_OK != 490 (SQLITE_OK !=
491 sqlite3_bind_int64 (plugin->delete_block, 491 sqlite3_bind_int64 (plugin->delete_block,
492 2, dval)) ) 492 2, dval)) )
493 { 493 {
@@ -519,30 +519,30 @@ namestore_sqlite_cache_block (void *cls,
519 "sqlite3_reset"); 519 "sqlite3_reset");
520 520
521 /* insert new version of the block */ 521 /* insert new version of the block */
522 if ((SQLITE_OK != 522 if ((SQLITE_OK !=
523 sqlite3_bind_blob (plugin->cache_block, 1, 523 sqlite3_bind_blob (plugin->cache_block, 1,
524 &query, sizeof (struct GNUNET_HashCode), 524 &query, sizeof (struct GNUNET_HashCode),
525 SQLITE_STATIC)) || 525 SQLITE_STATIC)) ||
526 (SQLITE_OK != 526 (SQLITE_OK !=
527 sqlite3_bind_blob (plugin->cache_block, 2, 527 sqlite3_bind_blob (plugin->cache_block, 2,
528 block, block_size, 528 block, block_size,
529 SQLITE_STATIC)) || 529 SQLITE_STATIC)) ||
530 (SQLITE_OK != 530 (SQLITE_OK !=
531 sqlite3_bind_int64 (plugin->cache_block, 3, 531 sqlite3_bind_int64 (plugin->cache_block, 3,
532 dval))) 532 dval)))
533 { 533 {
534 LOG_SQLITE (plugin, 534 LOG_SQLITE (plugin,
535 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 535 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
536 "sqlite3_bind_XXXX"); 536 "sqlite3_bind_XXXX");
537 if (SQLITE_OK != sqlite3_reset (plugin->cache_block)) 537 if (SQLITE_OK != sqlite3_reset (plugin->cache_block))
538 LOG_SQLITE (plugin, 538 LOG_SQLITE (plugin,
539 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 539 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
540 "sqlite3_reset"); 540 "sqlite3_reset");
541 return GNUNET_SYSERR; 541 return GNUNET_SYSERR;
542 542
543 } 543 }
544 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 544 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
545 "Caching block under derived key `%s'\n", 545 "Caching block under derived key `%s'\n",
546 GNUNET_h2s_full (&query)); 546 GNUNET_h2s_full (&query));
547 n = sqlite3_step (plugin->cache_block); 547 n = sqlite3_step (plugin->cache_block);
548 if (SQLITE_OK != sqlite3_reset (plugin->cache_block)) 548 if (SQLITE_OK != sqlite3_reset (plugin->cache_block))
@@ -551,7 +551,7 @@ namestore_sqlite_cache_block (void *cls,
551 switch (n) 551 switch (n)
552 { 552 {
553 case SQLITE_DONE: 553 case SQLITE_DONE:
554 LOG (GNUNET_ERROR_TYPE_DEBUG, 554 LOG (GNUNET_ERROR_TYPE_DEBUG,
555 "Record stored\n"); 555 "Record stored\n");
556 return GNUNET_OK; 556 return GNUNET_OK;
557 case SQLITE_BUSY: 557 case SQLITE_BUSY:
@@ -561,7 +561,7 @@ namestore_sqlite_cache_block (void *cls,
561 default: 561 default:
562 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 562 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
563 "sqlite3_step"); 563 "sqlite3_step");
564 return GNUNET_SYSERR; 564 return GNUNET_SYSERR;
565 } 565 }
566} 566}
567 567
@@ -577,7 +577,7 @@ namestore_sqlite_cache_block (void *cls,
577 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error 577 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error
578 */ 578 */
579static int 579static int
580namestore_sqlite_lookup_block (void *cls, 580namestore_sqlite_lookup_block (void *cls,
581 const struct GNUNET_HashCode *query, 581 const struct GNUNET_HashCode *query,
582 GNUNET_NAMESTORE_BlockCallback iter, void *iter_cls) 582 GNUNET_NAMESTORE_BlockCallback iter, void *iter_cls)
583{ 583{
@@ -598,26 +598,26 @@ namestore_sqlite_lookup_block (void *cls,
598 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 598 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
599 "sqlite3_reset"); 599 "sqlite3_reset");
600 return GNUNET_SYSERR; 600 return GNUNET_SYSERR;
601 } 601 }
602 ret = GNUNET_NO; 602 ret = GNUNET_NO;
603 if (SQLITE_ROW == (sret = sqlite3_step (plugin->lookup_block))) 603 if (SQLITE_ROW == (sret = sqlite3_step (plugin->lookup_block)))
604 { 604 {
605 block = sqlite3_column_blob (plugin->lookup_block, 0); 605 block = sqlite3_column_blob (plugin->lookup_block, 0);
606 block_size = sqlite3_column_bytes (plugin->lookup_block, 0); 606 block_size = sqlite3_column_bytes (plugin->lookup_block, 0);
607 if ( (block_size < sizeof (struct GNUNET_NAMESTORE_Block)) || 607 if ( (block_size < sizeof (struct GNUNET_NAMESTORE_Block)) ||
608 (ntohl (block->purpose.size) + 608 (ntohl (block->purpose.size) +
609 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + 609 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
610 sizeof (struct GNUNET_CRYPTO_EccSignature) != block_size) ) 610 sizeof (struct GNUNET_CRYPTO_EccSignature) != block_size) )
611 { 611 {
612 GNUNET_break (0); 612 GNUNET_break (0);
613 ret = GNUNET_SYSERR; 613 ret = GNUNET_SYSERR;
614 } 614 }
615 else 615 else
616 { 616 {
617 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 617 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
618 "Found block under derived key `%s'\n", 618 "Found block under derived key `%s'\n",
619 GNUNET_h2s_full (query)); 619 GNUNET_h2s_full (query));
620 iter (iter_cls, block); 620 iter (iter_cls, block);
621 ret = GNUNET_YES; 621 ret = GNUNET_YES;
622 } 622 }
623 } 623 }
@@ -625,13 +625,13 @@ namestore_sqlite_lookup_block (void *cls,
625 { 625 {
626 if (SQLITE_DONE != sret) 626 if (SQLITE_DONE != sret)
627 { 627 {
628 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite_step"); 628 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite_step");
629 ret = GNUNET_SYSERR; 629 ret = GNUNET_SYSERR;
630 } 630 }
631 else 631 else
632 { 632 {
633 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 633 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
634 "No block found under derived key `%s'\n", 634 "No block found under derived key `%s'\n",
635 GNUNET_h2s_full (query)); 635 GNUNET_h2s_full (query));
636 } 636 }
637 } 637 }
@@ -654,8 +654,8 @@ namestore_sqlite_lookup_block (void *cls,
654 * @param rd array of records with data to store 654 * @param rd array of records with data to store
655 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 655 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
656 */ 656 */
657static int 657static int
658namestore_sqlite_store_records (void *cls, 658namestore_sqlite_store_records (void *cls,
659 const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, 659 const struct GNUNET_CRYPTO_EccPrivateKey *zone_key,
660 const char *label, 660 const char *label,
661 unsigned int rd_count, 661 unsigned int rd_count,
@@ -696,19 +696,19 @@ namestore_sqlite_store_records (void *cls,
696 } 696 }
697 697
698 /* First delete 'old' records */ 698 /* First delete 'old' records */
699 if ((SQLITE_OK != sqlite3_bind_blob (plugin->delete_records, 1, 699 if ((SQLITE_OK != sqlite3_bind_blob (plugin->delete_records, 1,
700 zone_key, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) || 700 zone_key, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) ||
701 (SQLITE_OK != sqlite3_bind_text (plugin->delete_records, 2, label, -1, SQLITE_STATIC))) 701 (SQLITE_OK != sqlite3_bind_text (plugin->delete_records, 2, label, -1, SQLITE_STATIC)))
702 { 702 {
703 LOG_SQLITE (plugin, 703 LOG_SQLITE (plugin,
704 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 704 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
705 "sqlite3_bind_XXXX"); 705 "sqlite3_bind_XXXX");
706 if (SQLITE_OK != sqlite3_reset (plugin->delete_records)) 706 if (SQLITE_OK != sqlite3_reset (plugin->delete_records))
707 LOG_SQLITE (plugin, 707 LOG_SQLITE (plugin,
708 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 708 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
709 "sqlite3_reset"); 709 "sqlite3_reset");
710 return GNUNET_SYSERR; 710 return GNUNET_SYSERR;
711 711
712 } 712 }
713 n = sqlite3_step (plugin->delete_records); 713 n = sqlite3_step (plugin->delete_records);
714 if (SQLITE_OK != sqlite3_reset (plugin->delete_records)) 714 if (SQLITE_OK != sqlite3_reset (plugin->delete_records))
@@ -717,7 +717,7 @@ namestore_sqlite_store_records (void *cls,
717 717
718 if (0 != rd_count) 718 if (0 != rd_count)
719 { 719 {
720 if ((SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 1, 720 if ((SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 1,
721 zone_key, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) || 721 zone_key, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) ||
722 (SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 2, 722 (SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 2,
723 &pkey_hash, sizeof (struct GNUNET_HashCode), SQLITE_STATIC)) || 723 &pkey_hash, sizeof (struct GNUNET_HashCode), SQLITE_STATIC)) ||
@@ -726,11 +726,11 @@ namestore_sqlite_store_records (void *cls,
726 (SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 5, data, data_size, SQLITE_STATIC)) || 726 (SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 5, data, data_size, SQLITE_STATIC)) ||
727 (SQLITE_OK != sqlite3_bind_text (plugin->store_records, 6, label, -1, SQLITE_STATIC))) 727 (SQLITE_OK != sqlite3_bind_text (plugin->store_records, 6, label, -1, SQLITE_STATIC)))
728 { 728 {
729 LOG_SQLITE (plugin, 729 LOG_SQLITE (plugin,
730 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 730 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
731 "sqlite3_bind_XXXX"); 731 "sqlite3_bind_XXXX");
732 if (SQLITE_OK != sqlite3_reset (plugin->store_records)) 732 if (SQLITE_OK != sqlite3_reset (plugin->store_records))
733 LOG_SQLITE (plugin, 733 LOG_SQLITE (plugin,
734 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 734 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
735 "sqlite3_reset"); 735 "sqlite3_reset");
736 return GNUNET_SYSERR; 736 return GNUNET_SYSERR;
@@ -756,7 +756,7 @@ namestore_sqlite_store_records (void *cls,
756 default: 756 default:
757 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 757 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
758 "sqlite3_step"); 758 "sqlite3_step");
759 return GNUNET_SYSERR; 759 return GNUNET_SYSERR;
760 } 760 }
761} 761}
762 762
@@ -775,7 +775,7 @@ namestore_sqlite_store_records (void *cls,
775 */ 775 */
776static int 776static int
777get_record_and_call_iterator (struct Plugin *plugin, 777get_record_and_call_iterator (struct Plugin *plugin,
778 sqlite3_stmt *stmt, 778 sqlite3_stmt *stmt,
779 const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, 779 const struct GNUNET_CRYPTO_EccPrivateKey *zone_key,
780 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) 780 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
781{ 781{
@@ -788,7 +788,7 @@ get_record_and_call_iterator (struct Plugin *plugin,
788 788
789 ret = GNUNET_NO; 789 ret = GNUNET_NO;
790 if (SQLITE_ROW == (sret = sqlite3_step (stmt))) 790 if (SQLITE_ROW == (sret = sqlite3_step (stmt)))
791 { 791 {
792 record_count = sqlite3_column_int (stmt, 0); 792 record_count = sqlite3_column_int (stmt, 0);
793 data_size = sqlite3_column_bytes (stmt, 1); 793 data_size = sqlite3_column_bytes (stmt, 1);
794 data = sqlite3_column_blob (stmt, 1); 794 data = sqlite3_column_blob (stmt, 1);
@@ -813,7 +813,7 @@ get_record_and_call_iterator (struct Plugin *plugin,
813 because database might contain a large value here */ 813 because database might contain a large value here */
814 GNUNET_break (0); 814 GNUNET_break (0);
815 ret = GNUNET_SYSERR; 815 ret = GNUNET_SYSERR;
816 } 816 }
817 else 817 else
818 { 818 {
819 struct GNUNET_NAMESTORE_RecordData rd[record_count]; 819 struct GNUNET_NAMESTORE_RecordData rd[record_count];
@@ -857,8 +857,8 @@ get_record_and_call_iterator (struct Plugin *plugin,
857 * @param iter_cls closure for @a iter 857 * @param iter_cls closure for @a iter
858 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error 858 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error
859 */ 859 */
860static int 860static int
861namestore_sqlite_iterate_records (void *cls, 861namestore_sqlite_iterate_records (void *cls,
862 const struct GNUNET_CRYPTO_EccPrivateKey *zone, 862 const struct GNUNET_CRYPTO_EccPrivateKey *zone,
863 uint64_t offset, 863 uint64_t offset,
864 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) 864 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
@@ -876,7 +876,7 @@ namestore_sqlite_iterate_records (void *cls,
876 else 876 else
877 { 877 {
878 stmt = plugin->iterate_zone; 878 stmt = plugin->iterate_zone;
879 err = ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, 879 err = ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1,
880 zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), 880 zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey),
881 SQLITE_STATIC)) || 881 SQLITE_STATIC)) ||
882 (SQLITE_OK != sqlite3_bind_int64 (stmt, 2, 882 (SQLITE_OK != sqlite3_bind_int64 (stmt, 2,
@@ -891,7 +891,7 @@ namestore_sqlite_iterate_records (void *cls,
891 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 891 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
892 "sqlite3_reset"); 892 "sqlite3_reset");
893 return GNUNET_SYSERR; 893 return GNUNET_SYSERR;
894 } 894 }
895 return get_record_and_call_iterator (plugin, stmt, zone, iter, iter_cls); 895 return get_record_and_call_iterator (plugin, stmt, zone, iter, iter_cls);
896} 896}
897 897
@@ -908,7 +908,7 @@ namestore_sqlite_iterate_records (void *cls,
908 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error 908 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error
909 */ 909 */
910static int 910static int
911namestore_sqlite_zone_to_name (void *cls, 911namestore_sqlite_zone_to_name (void *cls,
912 const struct GNUNET_CRYPTO_EccPrivateKey *zone, 912 const struct GNUNET_CRYPTO_EccPrivateKey *zone,
913 const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, 913 const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone,
914 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) 914 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
@@ -917,10 +917,10 @@ namestore_sqlite_zone_to_name (void *cls,
917 sqlite3_stmt *stmt; 917 sqlite3_stmt *stmt;
918 918
919 stmt = plugin->zone_to_name; 919 stmt = plugin->zone_to_name;
920 if ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, 920 if ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1,
921 zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), 921 zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey),
922 SQLITE_STATIC)) || 922 SQLITE_STATIC)) ||
923 (SQLITE_OK != sqlite3_bind_blob (stmt, 2, 923 (SQLITE_OK != sqlite3_bind_blob (stmt, 2,
924 value_zone, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), 924 value_zone, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
925 SQLITE_STATIC)) ) 925 SQLITE_STATIC)) )
926 { 926 {
@@ -931,7 +931,7 @@ namestore_sqlite_zone_to_name (void *cls,
931 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 931 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
932 "sqlite3_reset"); 932 "sqlite3_reset");
933 return GNUNET_SYSERR; 933 return GNUNET_SYSERR;
934 } 934 }
935 return get_record_and_call_iterator (plugin, stmt, zone, iter, iter_cls); 935 return get_record_and_call_iterator (plugin, stmt, zone, iter, iter_cls);
936} 936}
937 937
@@ -952,7 +952,7 @@ libgnunet_plugin_namestore_sqlite_init (void *cls)
952 if (NULL != plugin.cfg) 952 if (NULL != plugin.cfg)
953 return NULL; /* can only initialize once! */ 953 return NULL; /* can only initialize once! */
954 memset (&plugin, 0, sizeof (struct Plugin)); 954 memset (&plugin, 0, sizeof (struct Plugin));
955 plugin.cfg = cfg; 955 plugin.cfg = cfg;
956 if (GNUNET_OK != database_setup (&plugin)) 956 if (GNUNET_OK != database_setup (&plugin))
957 { 957 {
958 database_shutdown (&plugin); 958 database_shutdown (&plugin);
@@ -965,7 +965,7 @@ libgnunet_plugin_namestore_sqlite_init (void *cls)
965 api->store_records = &namestore_sqlite_store_records; 965 api->store_records = &namestore_sqlite_store_records;
966 api->iterate_records = &namestore_sqlite_iterate_records; 966 api->iterate_records = &namestore_sqlite_iterate_records;
967 api->zone_to_name = &namestore_sqlite_zone_to_name; 967 api->zone_to_name = &namestore_sqlite_zone_to_name;
968 LOG (GNUNET_ERROR_TYPE_INFO, 968 LOG (GNUNET_ERROR_TYPE_INFO,
969 _("Sqlite database running\n")); 969 _("Sqlite database running\n"));
970 return api; 970 return api;
971} 971}
@@ -986,7 +986,7 @@ libgnunet_plugin_namestore_sqlite_done (void *cls)
986 database_shutdown (plugin); 986 database_shutdown (plugin);
987 plugin->cfg = NULL; 987 plugin->cfg = NULL;
988 GNUNET_free (api); 988 GNUNET_free (api);
989 LOG (GNUNET_ERROR_TYPE_DEBUG, 989 LOG (GNUNET_ERROR_TYPE_DEBUG,
990 "sqlite plugin is finished\n"); 990 "sqlite plugin is finished\n");
991 return NULL; 991 return NULL;
992} 992}
diff --git a/src/namestore/test_namestore_api_cache_block.c b/src/namestore/test_namestore_api_cache_block.c
index c3b4fb87f..8ed010abd 100644
--- a/src/namestore/test_namestore_api_cache_block.c
+++ b/src/namestore/test_namestore_api_cache_block.c
@@ -144,7 +144,7 @@ name_lookup_proc (void *cls,
144 &pubkey, name, &rd_decrypt_cb, (void *) name)); 144 &pubkey, name, &rd_decrypt_cb, (void *) name));
145} 145}
146 146
147static void 147static void
148cache_cont (void *cls, int32_t success, const char *emsg) 148cache_cont (void *cls, int32_t success, const char *emsg)
149{ 149{
150 const char *name = cls; 150 const char *name = cls;
@@ -166,7 +166,7 @@ cache_cont (void *cls, int32_t success, const char *emsg)
166 166
167 167
168static void 168static void
169run (void *cls, 169run (void *cls,
170 const struct GNUNET_CONFIGURATION_Handle *cfg, 170 const struct GNUNET_CONFIGURATION_Handle *cfg,
171 struct GNUNET_TESTING_Peer *peer) 171 struct GNUNET_TESTING_Peer *peer)
172{ 172{
@@ -175,7 +175,7 @@ run (void *cls,
175 char *hostkey_file; 175 char *hostkey_file;
176 const char * name = "dummy.dummy.gnunet"; 176 const char * name = "dummy.dummy.gnunet";
177 177
178 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 178 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
179 &endbadly, NULL); 179 &endbadly, NULL);
180 GNUNET_asprintf (&hostkey_file, 180 GNUNET_asprintf (&hostkey_file,
181 "zonefiles%s%s", 181 "zonefiles%s%s",
@@ -224,7 +224,7 @@ int
224main (int argc, char *argv[]) 224main (int argc, char *argv[])
225{ 225{
226 res = 1; 226 res = 1;
227 if (0 != 227 if (0 !=
228 GNUNET_TESTING_service_run ("test-namestore-api", 228 GNUNET_TESTING_service_run ("test-namestore-api",
229 "namestore", 229 "namestore",
230 "test_namestore_api.conf", 230 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_lookup_public.c b/src/namestore/test_namestore_api_lookup_public.c
index 3106c1c4f..f2b009ac5 100644
--- a/src/namestore/test_namestore_api_lookup_public.c
+++ b/src/namestore/test_namestore_api_lookup_public.c
@@ -144,7 +144,7 @@ name_lookup_proc (void *cls,
144 &pubkey, name, &rd_decrypt_cb, (void *) name)); 144 &pubkey, name, &rd_decrypt_cb, (void *) name));
145} 145}
146 146
147static void 147static void
148put_cont (void *cls, int32_t success, const char *emsg) 148put_cont (void *cls, int32_t success, const char *emsg)
149{ 149{
150 const char *name = cls; 150 const char *name = cls;
@@ -154,7 +154,7 @@ put_cont (void *cls, int32_t success, const char *emsg)
154 GNUNET_assert (NULL != cls); 154 GNUNET_assert (NULL != cls);
155 155
156 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 156 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
157 "Name store added record for `%s': %s\n", 157 "Name store added record for `%s': %s\n",
158 name, 158 name,
159 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 159 (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
160 160
@@ -168,7 +168,7 @@ put_cont (void *cls, int32_t success, const char *emsg)
168 168
169 169
170static void 170static void
171run (void *cls, 171run (void *cls,
172 const struct GNUNET_CONFIGURATION_Handle *cfg, 172 const struct GNUNET_CONFIGURATION_Handle *cfg,
173 struct GNUNET_TESTING_Peer *peer) 173 struct GNUNET_TESTING_Peer *peer)
174{ 174{
@@ -176,7 +176,7 @@ run (void *cls,
176 char *hostkey_file; 176 char *hostkey_file;
177 const char * name = "dummy.dummy.gnunet"; 177 const char * name = "dummy.dummy.gnunet";
178 178
179 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 179 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
180 &endbadly, NULL); 180 &endbadly, NULL);
181 GNUNET_asprintf (&hostkey_file, 181 GNUNET_asprintf (&hostkey_file,
182 "zonefiles%s%s", 182 "zonefiles%s%s",
@@ -213,7 +213,7 @@ int
213main (int argc, char *argv[]) 213main (int argc, char *argv[])
214{ 214{
215 res = 1; 215 res = 1;
216 if (0 != 216 if (0 !=
217 GNUNET_TESTING_service_run ("test-namestore-api", 217 GNUNET_TESTING_service_run ("test-namestore-api",
218 "namestore", 218 "namestore",
219 "test_namestore_api.conf", 219 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c
index bf410fe42..d0662617e 100644
--- a/src/namestore/test_namestore_api_monitoring.c
+++ b/src/namestore/test_namestore_api_monitoring.c
@@ -153,7 +153,7 @@ zone_proc (void *cls,
153 static int returned_records; 153 static int returned_records;
154 static int fail = GNUNET_NO; 154 static int fail = GNUNET_NO;
155 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 155 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
156 "Comparing results name %s\n", 156 "Comparing results name %s\n",
157 name); 157 name);
158 158
159 if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) 159 if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey)))
@@ -191,7 +191,7 @@ zone_proc (void *cls,
191 } 191 }
192 192
193 if (2 == ++returned_records) 193 if (2 == ++returned_records)
194 { 194 {
195 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) 195 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
196 { 196 {
197 GNUNET_SCHEDULER_cancel (endbadly_task); 197 GNUNET_SCHEDULER_cancel (endbadly_task);
@@ -254,7 +254,7 @@ create_record (unsigned int count)
254 254
255 255
256static void 256static void
257run (void *cls, 257run (void *cls,
258 const struct GNUNET_CONFIGURATION_Handle *cfg, 258 const struct GNUNET_CONFIGURATION_Handle *cfg,
259 struct GNUNET_TESTING_Peer *peer) 259 struct GNUNET_TESTING_Peer *peer)
260{ 260{
@@ -266,7 +266,7 @@ run (void *cls,
266 "zonefiles%s%s", 266 "zonefiles%s%s",
267 DIR_SEPARATOR_STR, 267 DIR_SEPARATOR_STR,
268 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); 268 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey");
269 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 269 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
270 "Using zonekey file `%s' \n", hostkey_file); 270 "Using zonekey file `%s' \n", hostkey_file);
271 privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); 271 privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file);
272 GNUNET_free (hostkey_file); 272 GNUNET_free (hostkey_file);
@@ -334,7 +334,7 @@ int
334main (int argc, char *argv[]) 334main (int argc, char *argv[])
335{ 335{
336 res = 1; 336 res = 1;
337 if (0 != 337 if (0 !=
338 GNUNET_TESTING_service_run ("test-namestore-api-monitoring", 338 GNUNET_TESTING_service_run ("test-namestore-api-monitoring",
339 "namestore", 339 "namestore",
340 "test_namestore_api.conf", 340 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c
index 3958e4d6c..4db1c6d62 100644
--- a/src/namestore/test_namestore_api_monitoring_existing.c
+++ b/src/namestore/test_namestore_api_monitoring_existing.c
@@ -154,7 +154,7 @@ zone_proc (void *cls,
154 static int returned_records; 154 static int returned_records;
155 static int fail = GNUNET_NO; 155 static int fail = GNUNET_NO;
156 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 156 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
157 "Comparing results name %s\n", 157 "Comparing results name %s\n",
158 name); 158 name);
159 159
160 if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) 160 if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey)))
@@ -192,7 +192,7 @@ zone_proc (void *cls,
192 } 192 }
193 193
194 if (2 == ++returned_records) 194 if (2 == ++returned_records)
195 { 195 {
196 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) 196 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
197 { 197 {
198 GNUNET_SCHEDULER_cancel (endbadly_task); 198 GNUNET_SCHEDULER_cancel (endbadly_task);
@@ -272,7 +272,7 @@ create_record (unsigned int count)
272 272
273 273
274static void 274static void
275run (void *cls, 275run (void *cls,
276 const struct GNUNET_CONFIGURATION_Handle *mycfg, 276 const struct GNUNET_CONFIGURATION_Handle *mycfg,
277 struct GNUNET_TESTING_Peer *peer) 277 struct GNUNET_TESTING_Peer *peer)
278{ 278{
@@ -284,7 +284,7 @@ run (void *cls,
284 "zonefiles%s%s", 284 "zonefiles%s%s",
285 DIR_SEPARATOR_STR, 285 DIR_SEPARATOR_STR,
286 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); 286 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey");
287 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 287 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
288 "Using zonekey file `%s' \n", hostkey_file); 288 "Using zonekey file `%s' \n", hostkey_file);
289 privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); 289 privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file);
290 GNUNET_free (hostkey_file); 290 GNUNET_free (hostkey_file);
@@ -339,7 +339,7 @@ int
339main (int argc, char *argv[]) 339main (int argc, char *argv[])
340{ 340{
341 res = 1; 341 res = 1;
342 if (0 != 342 if (0 !=
343 GNUNET_TESTING_service_run ("test-namestore-api-monitoring", 343 GNUNET_TESTING_service_run ("test-namestore-api-monitoring",
344 "namestore", 344 "namestore",
345 "test_namestore_api.conf", 345 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_put.c b/src/namestore/test_namestore_api_put.c
index 647b5e6af..e3610ccaf 100644
--- a/src/namestore/test_namestore_api_put.c
+++ b/src/namestore/test_namestore_api_put.c
@@ -100,8 +100,8 @@ put_cont (void *cls, int32_t success, const char *emsg)
100{ 100{
101 const char * name = cls; 101 const char * name = cls;
102 102
103 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 103 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
104 "Name store added record for `%s': %s\n", 104 "Name store added record for `%s': %s\n",
105 name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 105 name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
106 if (success == GNUNET_OK) 106 if (success == GNUNET_OK)
107 res = 0; 107 res = 0;
@@ -131,7 +131,7 @@ create_record (unsigned int count)
131 131
132 132
133static void 133static void
134run (void *cls, 134run (void *cls,
135 const struct GNUNET_CONFIGURATION_Handle *cfg, 135 const struct GNUNET_CONFIGURATION_Handle *cfg,
136 struct GNUNET_TESTING_Peer *peer) 136 struct GNUNET_TESTING_Peer *peer)
137{ 137{
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c
index 568a0cd8b..3f3823e89 100644
--- a/src/namestore/test_namestore_api_remove.c
+++ b/src/namestore/test_namestore_api_remove.c
@@ -96,8 +96,8 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
96 96
97 97
98static void 98static void
99remove_cont (void *cls, 99remove_cont (void *cls,
100 int32_t success, 100 int32_t success,
101 const char *emsg) 101 const char *emsg)
102{ 102{
103 if (GNUNET_YES != success) 103 if (GNUNET_YES != success)
@@ -128,16 +128,16 @@ rd_decrypt_cb (void *cls,
128 128
129 GNUNET_assert (GNUNET_NO == removed); 129 GNUNET_assert (GNUNET_NO == removed);
130 GNUNET_assert (1 == rd_count); 130 GNUNET_assert (1 == rd_count);
131 GNUNET_assert (NULL != rd); 131 GNUNET_assert (NULL != rd);
132 memset (rd_cmp_data, 'a', TEST_RECORD_DATALEN); 132 memset (rd_cmp_data, 'a', TEST_RECORD_DATALEN);
133 133
134 GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type); 134 GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type);
135 GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size); 135 GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size);
136 GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN)); 136 GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN));
137 137
138 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 138 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
139 "Block was decrypted successfully, removing records \n"); 139 "Block was decrypted successfully, removing records \n");
140 140
141 nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, 141 nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name,
142 0, NULL, &remove_cont, (void *) name); 142 0, NULL, &remove_cont, (void *) name);
143} 143}
@@ -178,14 +178,14 @@ name_lookup_proc (void *cls,
178 } 178 }
179 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 179 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
180 "Namestore returned block, decrypting \n"); 180 "Namestore returned block, decrypting \n");
181 GNUNET_assert (GNUNET_OK == 181 GNUNET_assert (GNUNET_OK ==
182 GNUNET_NAMESTORE_block_decrypt (block, 182 GNUNET_NAMESTORE_block_decrypt (block,
183 &pubkey, name, &rd_decrypt_cb, (void *) name)); 183 &pubkey, name, &rd_decrypt_cb, (void *) name));
184} 184}
185 185
186 186
187static void 187static void
188put_cont (void *cls, int32_t success, 188put_cont (void *cls, int32_t success,
189 const char *emsg) 189 const char *emsg)
190{ 190{
191 const char *name = cls; 191 const char *name = cls;
@@ -195,7 +195,7 @@ put_cont (void *cls, int32_t success,
195 { 195 {
196 GNUNET_break (0); 196 GNUNET_break (0);
197 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 197 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
198 "Namestore could not store record: `%s'\n", 198 "Namestore could not store record: `%s'\n",
199 emsg); 199 emsg);
200 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) 200 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
201 GNUNET_SCHEDULER_cancel (endbadly_task); 201 GNUNET_SCHEDULER_cancel (endbadly_task);
@@ -229,7 +229,7 @@ put_cont (void *cls, int32_t success,
229 229
230 230
231static void 231static void
232run (void *cls, 232run (void *cls,
233 const struct GNUNET_CONFIGURATION_Handle *cfg, 233 const struct GNUNET_CONFIGURATION_Handle *cfg,
234 struct GNUNET_TESTING_Peer *peer) 234 struct GNUNET_TESTING_Peer *peer)
235{ 235{
@@ -274,7 +274,7 @@ int
274main (int argc, char *argv[]) 274main (int argc, char *argv[])
275{ 275{
276 res = 1; 276 res = 1;
277 if (0 != 277 if (0 !=
278 GNUNET_TESTING_service_run ("test-namestore-api", 278 GNUNET_TESTING_service_run ("test-namestore-api",
279 "namestore", 279 "namestore",
280 "test_namestore_api.conf", 280 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c b/src/namestore/test_namestore_api_remove_not_existing_record.c
index cf1c3c3a9..86cf47e26 100644
--- a/src/namestore/test_namestore_api_remove_not_existing_record.c
+++ b/src/namestore/test_namestore_api_remove_not_existing_record.c
@@ -169,7 +169,7 @@ int
169main (int argc, char *argv[]) 169main (int argc, char *argv[])
170{ 170{
171 res = 1; 171 res = 1;
172 if (0 != 172 if (0 !=
173 GNUNET_TESTING_service_run ("test-namestore-api", 173 GNUNET_TESTING_service_run ("test-namestore-api",
174 "namestore", 174 "namestore",
175 "test_namestore_api.conf", 175 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c
index 1bb85ac47..69c47337f 100644
--- a/src/namestore/test_namestore_api_store.c
+++ b/src/namestore/test_namestore_api_store.c
@@ -144,7 +144,7 @@ name_lookup_proc (void *cls,
144 &pubkey, name, &rd_decrypt_cb, (void *) name)); 144 &pubkey, name, &rd_decrypt_cb, (void *) name));
145} 145}
146 146
147static void 147static void
148put_cont (void *cls, int32_t success, const char *emsg) 148put_cont (void *cls, int32_t success, const char *emsg)
149{ 149{
150 const char *name = cls; 150 const char *name = cls;
@@ -153,7 +153,7 @@ put_cont (void *cls, int32_t success, const char *emsg)
153 GNUNET_assert (NULL != cls); 153 GNUNET_assert (NULL != cls);
154 154
155 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 155 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
156 "Name store added record for `%s': %s\n", 156 "Name store added record for `%s': %s\n",
157 name, 157 name,
158 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 158 (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
159 159
@@ -166,7 +166,7 @@ put_cont (void *cls, int32_t success, const char *emsg)
166 166
167 167
168static void 168static void
169run (void *cls, 169run (void *cls,
170 const struct GNUNET_CONFIGURATION_Handle *cfg, 170 const struct GNUNET_CONFIGURATION_Handle *cfg,
171 struct GNUNET_TESTING_Peer *peer) 171 struct GNUNET_TESTING_Peer *peer)
172{ 172{
@@ -174,7 +174,7 @@ run (void *cls,
174 char *hostkey_file; 174 char *hostkey_file;
175 const char * name = "dummy.dummy.gnunet"; 175 const char * name = "dummy.dummy.gnunet";
176 176
177 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 177 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
178 &endbadly, NULL); 178 &endbadly, NULL);
179 GNUNET_asprintf (&hostkey_file, 179 GNUNET_asprintf (&hostkey_file,
180 "zonefiles%s%s", 180 "zonefiles%s%s",
@@ -211,7 +211,7 @@ int
211main (int argc, char *argv[]) 211main (int argc, char *argv[])
212{ 212{
213 res = 1; 213 res = 1;
214 if (0 != 214 if (0 !=
215 GNUNET_TESTING_service_run ("test-namestore-api", 215 GNUNET_TESTING_service_run ("test-namestore-api",
216 "namestore", 216 "namestore",
217 "test_namestore_api.conf", 217 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c
index 1a08635ed..8b10763c0 100644
--- a/src/namestore/test_namestore_api_store_update.c
+++ b/src/namestore/test_namestore_api_store_update.c
@@ -123,21 +123,21 @@ rd_decrypt_cb (void *cls,
123 { 123 {
124 char rd_cmp_data[TEST_RECORD_DATALEN]; 124 char rd_cmp_data[TEST_RECORD_DATALEN];
125 memset (rd_cmp_data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); 125 memset (rd_cmp_data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
126 126
127 GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type); 127 GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type);
128 GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size); 128 GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size);
129 GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN)); 129 GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN));
130 130
131 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 131 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
132 "Block was decrypted successfully, updating record \n"); 132 "Block was decrypted successfully, updating record \n");
133 133
134 rd_new.flags = GNUNET_NAMESTORE_RF_NONE; 134 rd_new.flags = GNUNET_NAMESTORE_RF_NONE;
135 rd_new.expiration_time = GNUNET_TIME_absolute_get().abs_value_us; 135 rd_new.expiration_time = GNUNET_TIME_absolute_get().abs_value_us;
136 rd_new.record_type = TEST_RECORD_TYPE2; 136 rd_new.record_type = TEST_RECORD_TYPE2;
137 rd_new.data_size = TEST_RECORD_DATALEN2; 137 rd_new.data_size = TEST_RECORD_DATALEN2;
138 rd_new.data = GNUNET_malloc (TEST_RECORD_DATALEN2); 138 rd_new.data = GNUNET_malloc (TEST_RECORD_DATALEN2);
139 memset ((char *) rd_new.data, TEST_RECORD_DATA2, TEST_RECORD_DATALEN2); 139 memset ((char *) rd_new.data, TEST_RECORD_DATA2, TEST_RECORD_DATALEN2);
140 140
141 nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, 141 nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name,
142 1, &rd_new, &put_cont, (void *) name); 142 1, &rd_new, &put_cont, (void *) name);
143 update_performed = GNUNET_YES; 143 update_performed = GNUNET_YES;
@@ -146,11 +146,11 @@ rd_decrypt_cb (void *cls,
146 { 146 {
147 char rd_cmp_data[TEST_RECORD_DATALEN2]; 147 char rd_cmp_data[TEST_RECORD_DATALEN2];
148 memset (rd_cmp_data, TEST_RECORD_DATA2, TEST_RECORD_DATALEN2); 148 memset (rd_cmp_data, TEST_RECORD_DATA2, TEST_RECORD_DATALEN2);
149 149
150 GNUNET_assert (TEST_RECORD_TYPE2 == rd[0].record_type); 150 GNUNET_assert (TEST_RECORD_TYPE2 == rd[0].record_type);
151 GNUNET_assert (TEST_RECORD_DATALEN2 == rd[0].data_size); 151 GNUNET_assert (TEST_RECORD_DATALEN2 == rd[0].data_size);
152 GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN2)); 152 GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN2));
153 153
154 GNUNET_SCHEDULER_add_now (&end, NULL); 154 GNUNET_SCHEDULER_add_now (&end, NULL);
155 } 155 }
156} 156}
@@ -210,7 +210,7 @@ put_cont (void *cls, int32_t success, const char *emsg)
210 210
211 211
212static void 212static void
213run (void *cls, 213run (void *cls,
214 const struct GNUNET_CONFIGURATION_Handle *cfg, 214 const struct GNUNET_CONFIGURATION_Handle *cfg,
215 struct GNUNET_TESTING_Peer *peer) 215 struct GNUNET_TESTING_Peer *peer)
216{ 216{
@@ -218,7 +218,7 @@ run (void *cls,
218 char *hostkey_file; 218 char *hostkey_file;
219 219
220 update_performed = GNUNET_NO; 220 update_performed = GNUNET_NO;
221 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 221 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
222 &endbadly, NULL); 222 &endbadly, NULL);
223 GNUNET_asprintf (&hostkey_file, 223 GNUNET_asprintf (&hostkey_file,
224 "zonefiles%s%s", 224 "zonefiles%s%s",
@@ -255,7 +255,7 @@ int
255main (int argc, char *argv[]) 255main (int argc, char *argv[])
256{ 256{
257 res = 1; 257 res = 1;
258 if (0 != 258 if (0 !=
259 GNUNET_TESTING_service_run ("test-namestore-api-store-update", 259 GNUNET_TESTING_service_run ("test-namestore-api-store-update",
260 "namestore", 260 "namestore",
261 "test_namestore_api.conf", 261 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c
index d496fe618..94fd6d008 100644
--- a/src/namestore/test_namestore_api_zone_iteration.c
+++ b/src/namestore/test_namestore_api_zone_iteration.c
@@ -173,7 +173,7 @@ zone_proc (void *cls,
173 else 173 else
174 res = 1; 174 res = 1;
175 175
176 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 176 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
177 "Received last result, iteration done after receing %u results\n", 177 "Received last result, iteration done after receing %u results\n",
178 returned_records ); 178 returned_records );
179 GNUNET_SCHEDULER_add_now (&end, NULL); 179 GNUNET_SCHEDULER_add_now (&end, NULL);
@@ -414,7 +414,7 @@ empty_zone_proc (void *cls,
414 414
415 415
416static void 416static void
417run (void *cls, 417run (void *cls,
418 const struct GNUNET_CONFIGURATION_Handle *cfg, 418 const struct GNUNET_CONFIGURATION_Handle *cfg,
419 struct GNUNET_TESTING_Peer *peer) 419 struct GNUNET_TESTING_Peer *peer)
420{ 420{
@@ -438,7 +438,7 @@ int
438main (int argc, char *argv[]) 438main (int argc, char *argv[])
439{ 439{
440 res = 1; 440 res = 1;
441 if (0 != 441 if (0 !=
442 GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration", 442 GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration",
443 "namestore", 443 "namestore",
444 "test_namestore_api.conf", 444 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
index 1f201ce46..a34e742f0 100644
--- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
+++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
@@ -416,7 +416,7 @@ int
416main (int argc, char *argv[]) 416main (int argc, char *argv[])
417{ 417{
418 res = 1; 418 res = 1;
419 if (0 != 419 if (0 !=
420 GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration", 420 GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration",
421 "namestore", 421 "namestore",
422 "test_namestore_api.conf", 422 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c
index 3e5014d8e..ebc26db79 100644
--- a/src/namestore/test_namestore_api_zone_iteration_stop.c
+++ b/src/namestore/test_namestore_api_zone_iteration_stop.c
@@ -450,7 +450,7 @@ int
450main (int argc, char *argv[]) 450main (int argc, char *argv[])
451{ 451{
452 res = 1; 452 res = 1;
453 if (0 != 453 if (0 !=
454 GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration-stop", 454 GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration-stop",
455 "namestore", 455 "namestore",
456 "test_namestore_api.conf", 456 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c
index e3df0bd22..1eeed1001 100644
--- a/src/namestore/test_namestore_api_zone_to_name.c
+++ b/src/namestore/test_namestore_api_zone_to_name.c
@@ -207,7 +207,7 @@ int
207main (int argc, char *argv[]) 207main (int argc, char *argv[])
208{ 208{
209 res = 1; 209 res = 1;
210 if (0 != 210 if (0 !=
211 GNUNET_TESTING_service_run ("test-namestore-api-zone-to-name", 211 GNUNET_TESTING_service_run ("test-namestore-api-zone-to-name",
212 "namestore", 212 "namestore",
213 "test_namestore_api.conf", 213 "test_namestore_api.conf",
diff --git a/src/namestore/test_plugin_namestore.c b/src/namestore/test_plugin_namestore.c
index d7742373a..5274e8bca 100644
--- a/src/namestore/test_plugin_namestore.c
+++ b/src/namestore/test_plugin_namestore.c
@@ -79,7 +79,7 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
79} 79}
80 80
81 81
82static void 82static void
83test_record (void *cls, 83test_record (void *cls,
84 const struct GNUNET_CRYPTO_EccPrivateKey *private_key, 84 const struct GNUNET_CRYPTO_EccPrivateKey *private_key,
85 const char *label, 85 const char *label,
@@ -134,7 +134,7 @@ put_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp, int id)
134 rd[i].data_size = id % 10; 134 rd[i].data_size = id % 10;
135 rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES).abs_value_us; 135 rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES).abs_value_us;
136 rd[i].record_type = 1 + (id % 13); 136 rd[i].record_type = 1 + (id % 13);
137 rd[i].flags = (id % 7); 137 rd[i].flags = (id % 7);
138 } 138 }
139 memset (&zone_private_key, (id % 241), sizeof (zone_private_key)); 139 memset (&zone_private_key, (id % 241), sizeof (zone_private_key));
140 memset (&signature, (id % 243), sizeof (signature)); 140 memset (&signature, (id % 243), sizeof (signature));
@@ -150,14 +150,14 @@ static void
150run (void *cls, char *const *args, const char *cfgfile, 150run (void *cls, char *const *args, const char *cfgfile,
151 const struct GNUNET_CONFIGURATION_Handle *cfg) 151 const struct GNUNET_CONFIGURATION_Handle *cfg)
152{ 152{
153 struct GNUNET_NAMESTORE_PluginFunctions *nsp; 153 struct GNUNET_NAMESTORE_PluginFunctions *nsp;
154 154
155 ok = 0; 155 ok = 0;
156 nsp = load_plugin (cfg); 156 nsp = load_plugin (cfg);
157 if (NULL == nsp) 157 if (NULL == nsp)
158 { 158 {
159 FPRINTF (stderr, 159 FPRINTF (stderr,
160 "%s", 160 "%s",
161 "Failed to initialize namestore. Database likely not setup, skipping test.\n"); 161 "Failed to initialize namestore. Database likely not setup, skipping test.\n");
162 return; 162 return;
163 } 163 }
diff --git a/src/nat/gnunet-helper-nat-client-windows.c b/src/nat/gnunet-helper-nat-client-windows.c
index 9121e7943..b949374f3 100644
--- a/src/nat/gnunet-helper-nat-client-windows.c
+++ b/src/nat/gnunet-helper-nat-client-windows.c
@@ -168,7 +168,7 @@ struct udp_header
168}; 168};
169 169
170/** 170/**
171 * Will this binary be run in permissions testing mode? 171 * Will this binary be run in permissions testing mode?
172 */ 172 */
173static boolean privilege_testing = FALSE; 173static boolean privilege_testing = FALSE;
174 174
@@ -468,10 +468,10 @@ main (int argc, char *const *argv)
468 struct in_addr target; 468 struct in_addr target;
469 WSADATA wsaData; 469 WSADATA wsaData;
470 unsigned int p; 470 unsigned int p;
471 471
472 if (argc > 1 && 0 != strcmp (argv[1], "-d")){ 472 if (argc > 1 && 0 != strcmp (argv[1], "-d")){
473 privilege_testing = TRUE; 473 privilege_testing = TRUE;
474 fprintf (stderr, 474 fprintf (stderr,
475 "%s", 475 "%s",
476 "DEBUG: Running binary in privilege testing mode."); 476 "DEBUG: Running binary in privilege testing mode.");
477 argv++; 477 argv++;
@@ -489,14 +489,14 @@ main (int argc, char *const *argv)
489 (1 != inet_pton (AF_INET, argv[2], &target))) 489 (1 != inet_pton (AF_INET, argv[2], &target)))
490 { 490 {
491 fprintf (stderr, 491 fprintf (stderr,
492 "Error parsing IPv4 address: %s\n", 492 "Error parsing IPv4 address: %s\n",
493 strerror (errno)); 493 strerror (errno));
494 return 1; 494 return 1;
495 } 495 }
496 if ((1 != sscanf (argv[3], "%u", &p)) || (0 == p) || (0xFFFF < p)) 496 if ((1 != sscanf (argv[3], "%u", &p)) || (0 == p) || (0xFFFF < p))
497 { 497 {
498 fprintf (stderr, 498 fprintf (stderr,
499 "Error parsing port value `%s'\n", 499 "Error parsing port value `%s'\n",
500 argv[3]); 500 argv[3]);
501 return 1; 501 return 1;
502 } 502 }
@@ -504,14 +504,14 @@ main (int argc, char *const *argv)
504 504
505 if (0 != WSAStartup (MAKEWORD (2, 1), &wsaData)) 505 if (0 != WSAStartup (MAKEWORD (2, 1), &wsaData))
506 { 506 {
507 fprintf (stderr, 507 fprintf (stderr,
508 "%s", 508 "%s",
509 "Failed to find Winsock 2.1 or better.\n"); 509 "Failed to find Winsock 2.1 or better.\n");
510 return 2; 510 return 2;
511 } 511 }
512 if (1 != inet_pton (AF_INET, DUMMY_IP, &dummy)) 512 if (1 != inet_pton (AF_INET, DUMMY_IP, &dummy))
513 { 513 {
514 fprintf (stderr, 514 fprintf (stderr,
515 "%s", 515 "%s",
516 "Internal error converting dummy IP to binary.\n"); 516 "Internal error converting dummy IP to binary.\n");
517 return 2; 517 return 2;
@@ -522,7 +522,7 @@ main (int argc, char *const *argv)
522 send_icmp (&external, &target); 522 send_icmp (&external, &target);
523 send_icmp_udp (&external, &target); 523 send_icmp_udp (&external, &target);
524 } 524 }
525 closesocket (rawsock); 525 closesocket (rawsock);
526 WSACleanup (); 526 WSACleanup ();
527 return 0; 527 return 0;
528} 528}
diff --git a/src/nat/gnunet-helper-nat-server-windows.c b/src/nat/gnunet-helper-nat-server-windows.c
index 7962e3071..18040428f 100644
--- a/src/nat/gnunet-helper-nat-server-windows.c
+++ b/src/nat/gnunet-helper-nat-server-windows.c
@@ -188,7 +188,7 @@ struct udp_header
188}; 188};
189 189
190/** 190/**
191 * Will this binary be run in permissions testing mode? 191 * Will this binary be run in permissions testing mode?
192 */ 192 */
193static boolean privilege_testing = FALSE; 193static boolean privilege_testing = FALSE;
194 194
@@ -533,7 +533,7 @@ main (int argc, char *const *argv)
533 WSADATA wsaData; 533 WSADATA wsaData;
534 unsigned int alt = 0; 534 unsigned int alt = 0;
535 535
536 if ( (argc > 1) && (0 != strcmp (argv[1], "-d"))) 536 if ( (argc > 1) && (0 != strcmp (argv[1], "-d")))
537 { 537 {
538 privilege_testing = TRUE; 538 privilege_testing = TRUE;
539 fprintf (stderr, 539 fprintf (stderr,
@@ -542,7 +542,7 @@ main (int argc, char *const *argv)
542 argv++; 542 argv++;
543 argc--; 543 argc--;
544 } 544 }
545 545
546 if (2 != argc) 546 if (2 != argc)
547 { 547 {
548 fprintf (stderr, 548 fprintf (stderr,
diff --git a/src/nat/gnunet-helper-nat-server.c b/src/nat/gnunet-helper-nat-server.c
index d3c890b98..37b875ee4 100644
--- a/src/nat/gnunet-helper-nat-server.c
+++ b/src/nat/gnunet-helper-nat-server.c
@@ -602,7 +602,7 @@ main (int argc, char *const *argv)
602 } 602 }
603 603
604 /* select failed (internal error or OS out of resources) */ 604 /* select failed (internal error or OS out of resources) */
605 global_ret = 11; 605 global_ret = 11;
606error_exit: 606error_exit:
607 if (-1 != icmpsock) 607 if (-1 != icmpsock)
608 (void) close (icmpsock); 608 (void) close (icmpsock);
diff --git a/src/nat/nat.c b/src/nat/nat.c
index 0aefc4312..03a77ddc3 100644
--- a/src/nat/nat.c
+++ b/src/nat/nat.c
@@ -1147,7 +1147,7 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, int is_tcp,
1147 if ((h->internal_address != NULL) && 1147 if ((h->internal_address != NULL) &&
1148 (inet_pton (AF_INET, h->internal_address, &in_addr) != 1)) 1148 (inet_pton (AF_INET, h->internal_address, &in_addr) != 1))
1149 { 1149 {
1150 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, 1150 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
1151 "nat", "INTERNAL_ADDRESS", 1151 "nat", "INTERNAL_ADDRESS",
1152 _("malformed")); 1152 _("malformed"));
1153 GNUNET_free (h->internal_address); 1153 GNUNET_free (h->internal_address);
diff --git a/src/nat/nat_auto.c b/src/nat/nat_auto.c
index 68689243e..3d0040a04 100644
--- a/src/nat/nat_auto.c
+++ b/src/nat/nat_auto.c
@@ -86,7 +86,7 @@ enum AutoPhase
86 * Last phase, we're done. 86 * Last phase, we're done.
87 */ 87 */
88 AUTO_DONE 88 AUTO_DONE
89 89
90}; 90};
91 91
92 92
@@ -105,12 +105,12 @@ struct GNUNET_NAT_AutoHandle
105 * Function to call when done. 105 * Function to call when done.
106 */ 106 */
107 GNUNET_NAT_AutoResultCallback fin_cb; 107 GNUNET_NAT_AutoResultCallback fin_cb;
108 108
109 /** 109 /**
110 * Closure for 'fin_cb'. 110 * Closure for 'fin_cb'.
111 */ 111 */
112 void *fin_cb_cls; 112 void *fin_cb_cls;
113 113
114 /** 114 /**
115 * Handle for active 'GNUNET_NAT_mini_get_external_ipv4'-operation. 115 * Handle for active 'GNUNET_NAT_mini_get_external_ipv4'-operation.
116 */ 116 */
@@ -171,7 +171,7 @@ fail_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
171 ah->task = GNUNET_SCHEDULER_NO_TASK; 171 ah->task = GNUNET_SCHEDULER_NO_TASK;
172 GNUNET_NAT_test_stop (ah->tst); 172 GNUNET_NAT_test_stop (ah->tst);
173 ah->tst = NULL; 173 ah->tst = NULL;
174 GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", 174 GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat",
175 "ENABLE_ICMP_SERVER", 175 "ENABLE_ICMP_SERVER",
176 "NO"); 176 "NO");
177 next_phase (ah); 177 next_phase (ah);
@@ -195,10 +195,10 @@ result_callback (void *cls, int success)
195 GNUNET_NAT_test_stop (ah->tst); 195 GNUNET_NAT_test_stop (ah->tst);
196 ah->tst = NULL; 196 ah->tst = NULL;
197 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 197 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
198 success 198 success
199 ? _("NAT traversal with ICMP Server succeeded.\n") 199 ? _("NAT traversal with ICMP Server succeeded.\n")
200 : _("NAT traversal with ICMP Server failed.\n")); 200 : _("NAT traversal with ICMP Server failed.\n"));
201 GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", "ENABLE_ICMP_SERVER", 201 GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", "ENABLE_ICMP_SERVER",
202 success ? "YES": "NO"); 202 success ? "YES": "NO");
203 next_phase (ah); 203 next_phase (ah);
204} 204}
@@ -352,7 +352,7 @@ nipo (void *cls, const char *name, int isDefault, const struct sockaddr *addr,
352 352
353 353
354/** 354/**
355 * Determine our local IP addresses; detect internal IP & IPv6-support 355 * Determine our local IP addresses; detect internal IP & IPv6-support
356 * 356 *
357 * @param ah auto setup context 357 * @param ah auto setup context
358 */ 358 */
@@ -361,7 +361,7 @@ test_local_ip (struct GNUNET_NAT_AutoHandle *ah)
361{ 361{
362 ah->have_v6 = GNUNET_NO; 362 ah->have_v6 = GNUNET_NO;
363 GNUNET_OS_network_interfaces_list (&nipo, ah); 363 GNUNET_OS_network_interfaces_list (&nipo, ah);
364 GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", "DISABLEV6", 364 GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", "DISABLEV6",
365 (GNUNET_YES == ah->have_v6) ? "NO" : "YES"); 365 (GNUNET_YES == ah->have_v6) ? "NO" : "YES");
366 next_phase (ah); 366 next_phase (ah);
367} 367}
@@ -396,10 +396,10 @@ test_upnpc (struct GNUNET_NAT_AutoHandle *ah)
396 /* FIXME: test if upnpc is actually working, that is, if transports 396 /* FIXME: test if upnpc is actually working, that is, if transports
397 start to work once we use UPnP */ 397 start to work once we use UPnP */
398 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 398 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
399 (have_upnpc) 399 (have_upnpc)
400 ? _("upnpc found, enabling its use\n") 400 ? _("upnpc found, enabling its use\n")
401 : _("upnpc not found\n")); 401 : _("upnpc not found\n"));
402 GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", "ENABLE_UPNP", 402 GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", "ENABLE_UPNP",
403 (GNUNET_YES == have_upnpc) ? "YES" : "NO"); 403 (GNUNET_YES == have_upnpc) ? "YES" : "NO");
404 next_phase (ah); 404 next_phase (ah);
405} 405}
@@ -430,7 +430,7 @@ test_icmp_server (struct GNUNET_NAT_AutoHandle *ah)
430 GNUNET_free_non_null (tmp); 430 GNUNET_free_non_null (tmp);
431 GNUNET_free (binary); 431 GNUNET_free (binary);
432 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 432 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
433 (hns) 433 (hns)
434 ? _("gnunet-helper-nat-server found, testing it\n") 434 ? _("gnunet-helper-nat-server found, testing it\n")
435 : _("No working gnunet-helper-nat-server found\n")); 435 : _("No working gnunet-helper-nat-server found\n"));
436 if (hns) 436 if (hns)
@@ -465,7 +465,7 @@ test_icmp_client (struct GNUNET_NAT_AutoHandle *ah)
465 GNUNET_free_non_null (tmp); 465 GNUNET_free_non_null (tmp);
466 GNUNET_free (binary); 466 GNUNET_free (binary);
467 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 467 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
468 (hnc) 468 (hnc)
469 ? _("gnunet-helper-nat-client found, enabling it\n") 469 ? _("gnunet-helper-nat-client found, enabling it\n")
470 : _("gnunet-helper-nat-client not found or behind NAT, disabling it\n")); 470 : _("gnunet-helper-nat-client not found or behind NAT, disabling it\n"));
471 next_phase (ah); 471 next_phase (ah);
@@ -543,14 +543,14 @@ GNUNET_NAT_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
543 ah->initial_cfg = GNUNET_CONFIGURATION_dup (cfg); 543 ah->initial_cfg = GNUNET_CONFIGURATION_dup (cfg);
544 544
545 /* never use loopback addresses if user wanted autoconfiguration */ 545 /* never use loopback addresses if user wanted autoconfiguration */
546 GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", 546 GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat",
547 "USE_LOCALADDR", 547 "USE_LOCALADDR",
548 "NO"); 548 "NO");
549 next_phase (ah); 549 next_phase (ah);
550 return ah; 550 return ah;
551} 551}
552 552
553 553
554/** 554/**
555 * Abort autoconfiguration. 555 * Abort autoconfiguration.
556 * 556 *
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c
index fa0b97440..2dbca7541 100644
--- a/src/nse/gnunet-nse-profiler.c
+++ b/src/nse/gnunet-nse-profiler.c
@@ -133,7 +133,7 @@ static int verbose;
133 133
134/** 134/**
135 * Name of the file with the hosts to run the test over (configuration option) 135 * Name of the file with the hosts to run the test over (configuration option)
136 */ 136 */
137static char *hosts_file; 137static char *hosts_file;
138 138
139/** 139/**
@@ -274,7 +274,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
274 if (GNUNET_YES == shutting_down) 274 if (GNUNET_YES == shutting_down)
275 return; 275 return;
276 shutting_down = GNUNET_YES; 276 shutting_down = GNUNET_YES;
277 LOG_DEBUG ("Ending test.\n"); 277 LOG_DEBUG ("Ending test.\n");
278 close_monitor_connections (); 278 close_monitor_connections ();
279 if (NULL != data_file) 279 if (NULL != data_file)
280 { 280 {
@@ -314,7 +314,7 @@ shutdown_now ()
314 * of the size estimation values seen 314 * of the size estimation values seen
315 */ 315 */
316static void 316static void
317handle_estimate (void *cls, 317handle_estimate (void *cls,
318 struct GNUNET_TIME_Absolute timestamp, 318 struct GNUNET_TIME_Absolute timestamp,
319 double estimate, double std_dev) 319 double estimate, double std_dev)
320{ 320{
@@ -329,7 +329,7 @@ handle_estimate (void *cls,
329 peer, estimate, std_dev); 329 peer, estimate, std_dev);
330 return; 330 return;
331 } 331 }
332 size = GNUNET_snprintf (output_buffer, 332 size = GNUNET_snprintf (output_buffer,
333 sizeof (output_buffer), 333 sizeof (output_buffer),
334 "%p %llu %llu %f %f %f\n", 334 "%p %llu %llu %f %f %f\n",
335 peer, peers_running, 335 peer, peers_running,
@@ -345,7 +345,7 @@ handle_estimate (void *cls,
345/** 345/**
346 * Adapter function called to establish a connection to 346 * Adapter function called to establish a connection to
347 * NSE service. 347 * NSE service.
348 * 348 *
349 * @param cls closure (the 'struct NSEPeer') 349 * @param cls closure (the 'struct NSEPeer')
350 * @param cfg configuration of the peer to connect to; will be available until 350 * @param cfg configuration of the peer to connect to; will be available until
351 * GNUNET_TESTBED_operation_done() is called on the operation returned 351 * GNUNET_TESTBED_operation_done() is called on the operation returned
@@ -365,11 +365,11 @@ nse_connect_adapter (void *cls,
365/** 365/**
366 * Adapter function called to destroy a connection to 366 * Adapter function called to destroy a connection to
367 * NSE service. 367 * NSE service.
368 * 368 *
369 * @param cls closure 369 * @param cls closure
370 * @param op_result service handle returned from the connect adapter 370 * @param op_result service handle returned from the connect adapter
371 */ 371 */
372static void 372static void
373nse_disconnect_adapter (void *cls, 373nse_disconnect_adapter (void *cls,
374 void *op_result) 374 void *op_result)
375{ 375{
@@ -389,7 +389,7 @@ nse_disconnect_adapter (void *cls,
389 */ 389 */
390static int 390static int
391stat_iterator (void *cls, 391stat_iterator (void *cls,
392 const char *subsystem, 392 const char *subsystem,
393 const char *name, 393 const char *name,
394 uint64_t value, int is_persistent) 394 uint64_t value, int is_persistent)
395{ 395{
@@ -404,7 +404,7 @@ stat_iterator (void *cls,
404 if (0 != flag) 404 if (0 != flag)
405 flag = 1; 405 flag = 1;
406 size = GNUNET_asprintf (&output_buffer, "%llu %llu %u\n", 406 size = GNUNET_asprintf (&output_buffer, "%llu %llu %u\n",
407 now.abs_value_us / 1000LL / 1000LL, 407 now.abs_value_us / 1000LL / 1000LL,
408 value, flag); 408 value, flag);
409 if (size != GNUNET_DISK_file_write (data_file, output_buffer, size)) 409 if (size != GNUNET_DISK_file_write (data_file, output_buffer, size))
410 { 410 {
@@ -431,7 +431,7 @@ stat_connect_adapter (void *cls,
431 const struct GNUNET_CONFIGURATION_Handle *cfg) 431 const struct GNUNET_CONFIGURATION_Handle *cfg)
432{ 432{
433 struct NSEPeer *peer = cls; 433 struct NSEPeer *peer = cls;
434 434
435 peer->sh = GNUNET_STATISTICS_create ("nse-profiler", cfg); 435 peer->sh = GNUNET_STATISTICS_create ("nse-profiler", cfg);
436 return peer->sh; 436 return peer->sh;
437} 437}
@@ -502,18 +502,18 @@ connect_nse_service ()
502 unsigned int connections; 502 unsigned int connections;
503 503
504 if (0 == connection_limit) 504 if (0 == connection_limit)
505 return; 505 return;
506 LOG_DEBUG ("Connecting to nse service of peers\n"); 506 LOG_DEBUG ("Connecting to nse service of peers\n");
507 connections = 0; 507 connections = 0;
508 for (i = 0; i < num_peers_in_round[current_round]; i++) 508 for (i = 0; i < num_peers_in_round[current_round]; i++)
509 { 509 {
510 if ((num_peers_in_round[current_round] > connection_limit) && 510 if ((num_peers_in_round[current_round] > connection_limit) &&
511 (0 != (i % (num_peers_in_round[current_round] / connection_limit)))) 511 (0 != (i % (num_peers_in_round[current_round] / connection_limit))))
512 continue; 512 continue;
513 LOG_DEBUG ("Connecting to nse service of peer %d\n", i); 513 LOG_DEBUG ("Connecting to nse service of peer %d\n", i);
514 current_peer = GNUNET_malloc (sizeof (struct NSEPeer)); 514 current_peer = GNUNET_malloc (sizeof (struct NSEPeer));
515 current_peer->daemon = daemons[i]; 515 current_peer->daemon = daemons[i];
516 current_peer->nse_op 516 current_peer->nse_op
517 = GNUNET_TESTBED_service_connect (NULL, 517 = GNUNET_TESTBED_service_connect (NULL,
518 current_peer->daemon, 518 current_peer->daemon,
519 "nse", 519 "nse",
@@ -545,7 +545,7 @@ connect_nse_service ()
545 * @param tc scheduler context (unused) 545 * @param tc scheduler context (unused)
546 */ 546 */
547static void 547static void
548next_round (void *cls, 548next_round (void *cls,
549 const struct GNUNET_SCHEDULER_TaskContext *tc); 549 const struct GNUNET_SCHEDULER_TaskContext *tc);
550 550
551 551
@@ -558,7 +558,7 @@ next_round (void *cls,
558 * @param tc unused 558 * @param tc unused
559 */ 559 */
560static void 560static void
561finish_round (void *cls, 561finish_round (void *cls,
562 const struct GNUNET_SCHEDULER_TaskContext *tc) 562 const struct GNUNET_SCHEDULER_TaskContext *tc)
563{ 563{
564 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 564 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
@@ -606,12 +606,12 @@ make_oplist_entry ()
606 * @param op the operation handle 606 * @param op the operation handle
607 * @param emsg NULL on success; otherwise an error description 607 * @param emsg NULL on success; otherwise an error description
608 */ 608 */
609static void 609static void
610manage_service_cb (void *cls, struct GNUNET_TESTBED_Operation *op, 610manage_service_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
611 const char *emsg) 611 const char *emsg)
612{ 612{
613 struct OpListEntry *entry = cls; 613 struct OpListEntry *entry = cls;
614 614
615 GNUNET_TESTBED_operation_done (entry->op); 615 GNUNET_TESTBED_operation_done (entry->op);
616 if (NULL != emsg) 616 if (NULL != emsg)
617 { 617 {
@@ -673,13 +673,13 @@ adjust_running_peers ()
673 * @param tc unused 673 * @param tc unused
674 */ 674 */
675static void 675static void
676next_round (void *cls, 676next_round (void *cls,
677 const struct GNUNET_SCHEDULER_TaskContext *tc) 677 const struct GNUNET_SCHEDULER_TaskContext *tc)
678{ 678{
679 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 679 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
680 return; 680 return;
681 LOG_DEBUG ("Disconnecting nse service of peers\n"); 681 LOG_DEBUG ("Disconnecting nse service of peers\n");
682 current_round++; 682 current_round++;
683 if (current_round == num_rounds) 683 if (current_round == num_rounds)
684 { 684 {
685 /* this was the last round, terminate */ 685 /* this was the last round, terminate */
@@ -705,7 +705,7 @@ next_round (void *cls,
705 * @param event information on what is happening 705 * @param event information on what is happening
706 */ 706 */
707static void 707static void
708master_controller_cb (void *cls, 708master_controller_cb (void *cls,
709 const struct GNUNET_TESTBED_EventInformation *event) 709 const struct GNUNET_TESTBED_EventInformation *event)
710{ 710{
711 switch (event->type) 711 switch (event->type)
@@ -735,7 +735,7 @@ master_controller_cb (void *cls,
735 * @param links_failed the number of overlay link connection attempts that 735 * @param links_failed the number of overlay link connection attempts that
736 * failed 736 * failed
737 */ 737 */
738static void 738static void
739test_master (void *cls, 739test_master (void *cls,
740 struct GNUNET_TESTBED_RunHandle *h, 740 struct GNUNET_TESTBED_RunHandle *h,
741 unsigned int num_peers_, 741 unsigned int num_peers_,
@@ -775,7 +775,7 @@ run (void *cls, char *const *args, const char *cfgfile,
775{ 775{
776 char *tok; 776 char *tok;
777 uint64_t event_mask; 777 uint64_t event_mask;
778 unsigned int num; 778 unsigned int num;
779 779
780 ok = 1; 780 ok = 1;
781 testing_cfg = GNUNET_CONFIGURATION_dup (cfg); 781 testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
@@ -806,7 +806,7 @@ run (void *cls, char *const *args, const char *cfgfile,
806 return; 806 return;
807 } 807 }
808 if ( (NULL != data_filename) && 808 if ( (NULL != data_filename) &&
809 (NULL == (data_file = 809 (NULL == (data_file =
810 GNUNET_DISK_file_open (data_filename, 810 GNUNET_DISK_file_open (data_filename,
811 GNUNET_DISK_OPEN_READWRITE | 811 GNUNET_DISK_OPEN_READWRITE |
812 GNUNET_DISK_OPEN_TRUNCATE | 812 GNUNET_DISK_OPEN_TRUNCATE |
@@ -839,7 +839,7 @@ run (void *cls, char *const *args, const char *cfgfile,
839 NULL, /* master_controller_cb cls */ 839 NULL, /* master_controller_cb cls */
840 &test_master, 840 &test_master,
841 NULL); /* test_master cls */ 841 NULL); /* test_master cls */
842 shutdown_task_id = 842 shutdown_task_id =
843 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 843 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
844 &shutdown_task, NULL); 844 &shutdown_task, NULL);
845} 845}
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index 2453c7e11..6dff5b8c5 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -53,7 +53,7 @@
53 53
54/** 54/**
55 * Should messages be delayed randomly? This option should be set to 55 * Should messages be delayed randomly? This option should be set to
56 * #GNUNET_NO only for experiments, not in production. 56 * #GNUNET_NO only for experiments, not in production.
57 */ 57 */
58#define USE_RANDOM_DELAYS GNUNET_YES 58#define USE_RANDOM_DELAYS GNUNET_YES
59 59
@@ -406,13 +406,13 @@ setup_estimate_message (struct GNUNET_NSE_ClientMessage *em)
406 * @param message the message received 406 * @param message the message received
407 */ 407 */
408static void 408static void
409handle_start_message (void *cls, 409handle_start_message (void *cls,
410 struct GNUNET_SERVER_Client *client, 410 struct GNUNET_SERVER_Client *client,
411 const struct GNUNET_MessageHeader *message) 411 const struct GNUNET_MessageHeader *message)
412{ 412{
413 struct GNUNET_NSE_ClientMessage em; 413 struct GNUNET_NSE_ClientMessage em;
414 414
415 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 415 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
416 "Received START message from client\n"); 416 "Received START message from client\n");
417 GNUNET_SERVER_notification_context_add (nc, client); 417 GNUNET_SERVER_notification_context_add (nc, client);
418 setup_estimate_message (&em); 418 setup_estimate_message (&em);
@@ -483,7 +483,7 @@ pow_hash (const void *buf,
483 size_t buf_len, 483 size_t buf_len,
484 struct GNUNET_HashCode *result) 484 struct GNUNET_HashCode *result)
485{ 485{
486 GNUNET_break (0 == 486 GNUNET_break (0 ==
487 gcry_kdf_derive (buf, buf_len, 487 gcry_kdf_derive (buf, buf_len,
488 GCRY_KDF_SCRYPT, 488 GCRY_KDF_SCRYPT,
489 1 /* subalgo */, 489 1 /* subalgo */,
@@ -572,7 +572,7 @@ get_transmit_delay (int round_offset)
572 * @param tc scheduler context 572 * @param tc scheduler context
573 */ 573 */
574static void 574static void
575transmit_task_cb (void *cls, 575transmit_task_cb (void *cls,
576 const struct GNUNET_SCHEDULER_TaskContext *tc); 576 const struct GNUNET_SCHEDULER_TaskContext *tc);
577 577
578 578
@@ -586,7 +586,7 @@ transmit_task_cb (void *cls,
586 * @return number of bytes written to @a buf 586 * @return number of bytes written to @a buf
587 */ 587 */
588static size_t 588static size_t
589transmit_ready (void *cls, 589transmit_ready (void *cls,
590 size_t size, 590 size_t size,
591 void *buf) 591 void *buf)
592{ 592{
@@ -635,7 +635,7 @@ transmit_ready (void *cls,
635 GNUNET_NO); 635 GNUNET_NO);
636#if ENABLE_NSE_HISTOGRAM 636#if ENABLE_NSE_HISTOGRAM
637 peer_entry->transmitted_messages++; 637 peer_entry->transmitted_messages++;
638 peer_entry->last_transmitted_size = 638 peer_entry->last_transmitted_size =
639 ntohl(size_estimate_messages[idx].matching_bits); 639 ntohl(size_estimate_messages[idx].matching_bits);
640#endif 640#endif
641 memcpy (buf, &size_estimate_messages[idx], 641 memcpy (buf, &size_estimate_messages[idx],
@@ -651,7 +651,7 @@ transmit_ready (void *cls,
651 * @param tc scheduler context 651 * @param tc scheduler context
652 */ 652 */
653static void 653static void
654transmit_task_cb (void *cls, 654transmit_task_cb (void *cls,
655 const struct GNUNET_SCHEDULER_TaskContext *tc) 655 const struct GNUNET_SCHEDULER_TaskContext *tc)
656{ 656{
657 struct NSEPeerEntry *peer_entry = cls; 657 struct NSEPeerEntry *peer_entry = cls;
@@ -681,8 +681,8 @@ update_network_size_estimate ()
681 struct GNUNET_NSE_ClientMessage em; 681 struct GNUNET_NSE_ClientMessage em;
682 682
683 setup_estimate_message (&em); 683 setup_estimate_message (&em);
684 GNUNET_SERVER_notification_context_broadcast (nc, 684 GNUNET_SERVER_notification_context_broadcast (nc,
685 &em.header, 685 &em.header,
686 GNUNET_YES); 686 GNUNET_YES);
687} 687}
688 688
@@ -734,8 +734,8 @@ setup_flood_message (unsigned int slot,
734 * @return #GNUNET_OK (continue to iterate) 734 * @return #GNUNET_OK (continue to iterate)
735 */ 735 */
736static int 736static int
737schedule_current_round (void *cls, 737schedule_current_round (void *cls,
738 const struct GNUNET_PeerIdentity * key, 738 const struct GNUNET_PeerIdentity * key,
739 void *value) 739 void *value)
740{ 740{
741 struct NSEPeerEntry *peer_entry = value; 741 struct NSEPeerEntry *peer_entry = value;
@@ -774,7 +774,7 @@ schedule_current_round (void *cls,
774 * @param tc context for this message 774 * @param tc context for this message
775 */ 775 */
776static void 776static void
777update_flood_message (void *cls, 777update_flood_message (void *cls,
778 const struct GNUNET_SCHEDULER_TaskContext *tc) 778 const struct GNUNET_SCHEDULER_TaskContext *tc)
779{ 779{
780 struct GNUNET_TIME_Relative offset; 780 struct GNUNET_TIME_Relative offset;
@@ -989,8 +989,8 @@ verify_message_crypto (const struct GNUNET_NSE_FloodMessage *incoming_flood)
989 * @return #GNUNET_OK (continue to iterate) 989 * @return #GNUNET_OK (continue to iterate)
990 */ 990 */
991static int 991static int
992update_flood_times (void *cls, 992update_flood_times (void *cls,
993 const struct GNUNET_PeerIdentity *key, 993 const struct GNUNET_PeerIdentity *key,
994 void *value) 994 void *value)
995{ 995{
996 struct NSEPeerEntry *exclude = cls; 996 struct NSEPeerEntry *exclude = cls;
@@ -1032,7 +1032,7 @@ update_flood_times (void *cls,
1032 * @param peer peer identity this message is from (ignored) 1032 * @param peer peer identity this message is from (ignored)
1033 */ 1033 */
1034static int 1034static int
1035handle_p2p_size_estimate (void *cls, 1035handle_p2p_size_estimate (void *cls,
1036 const struct GNUNET_PeerIdentity *peer, 1036 const struct GNUNET_PeerIdentity *peer,
1037 const struct GNUNET_MessageHeader *message) 1037 const struct GNUNET_MessageHeader *message)
1038{ 1038{
@@ -1059,12 +1059,12 @@ handle_p2p_size_estimate (void *cls,
1059 char pred[5]; 1059 char pred[5];
1060 struct GNUNET_PeerIdentity os; 1060 struct GNUNET_PeerIdentity os;
1061 1061
1062 GNUNET_snprintf (origin, 1062 GNUNET_snprintf (origin,
1063 sizeof (origin), 1063 sizeof (origin),
1064 "%4s", 1064 "%4s",
1065 GNUNET_i2s (&incoming_flood->origin)); 1065 GNUNET_i2s (&incoming_flood->origin));
1066 GNUNET_snprintf (pred, 1066 GNUNET_snprintf (pred,
1067 sizeof (pred), 1067 sizeof (pred),
1068 "%4s", 1068 "%4s",
1069 GNUNET_i2s (peer)); 1069 GNUNET_i2s (peer));
1070 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1070 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1083,7 +1083,7 @@ handle_p2p_size_estimate (void *cls,
1083 } 1083 }
1084#if ENABLE_NSE_HISTOGRAM 1084#if ENABLE_NSE_HISTOGRAM
1085 peer_entry->received_messages++; 1085 peer_entry->received_messages++;
1086 if (peer_entry->transmitted_messages > 0 && 1086 if (peer_entry->transmitted_messages > 0 &&
1087 peer_entry->last_transmitted_size >= matching_bits) 1087 peer_entry->last_transmitted_size >= matching_bits)
1088 GNUNET_STATISTICS_update(stats, "# cross messages", 1, GNUNET_NO); 1088 GNUNET_STATISTICS_update(stats, "# cross messages", 1, GNUNET_NO);
1089#endif 1089#endif
@@ -1117,7 +1117,7 @@ handle_p2p_size_estimate (void *cls,
1117 { 1117 {
1118 /* send to self, update our own estimate IF this also comes from us! */ 1118 /* send to self, update our own estimate IF this also comes from us! */
1119 if (0 == 1119 if (0 ==
1120 memcmp (&incoming_flood->origin, 1120 memcmp (&incoming_flood->origin,
1121 &my_identity, sizeof (my_identity))) 1121 &my_identity, sizeof (my_identity)))
1122 update_network_size_estimate (); 1122 update_network_size_estimate ();
1123 return GNUNET_OK; 1123 return GNUNET_OK;
@@ -1131,7 +1131,7 @@ handle_p2p_size_estimate (void *cls,
1131 peer_entry->previous_round = GNUNET_YES; 1131 peer_entry->previous_round = GNUNET_YES;
1132 if (idx != estimate_index) 1132 if (idx != estimate_index)
1133 { 1133 {
1134 /* do not transmit information for the previous round to this peer 1134 /* do not transmit information for the previous round to this peer
1135 anymore (but allow current round) */ 1135 anymore (but allow current round) */
1136 return GNUNET_OK; 1136 return GNUNET_OK;
1137 } 1137 }
@@ -1249,7 +1249,7 @@ handle_core_connect (void *cls,
1249 * @param peer peer identity this notification is about 1249 * @param peer peer identity this notification is about
1250 */ 1250 */
1251static void 1251static void
1252handle_core_disconnect (void *cls, 1252handle_core_disconnect (void *cls,
1253 const struct GNUNET_PeerIdentity *peer) 1253 const struct GNUNET_PeerIdentity *peer)
1254{ 1254{
1255 struct NSEPeerEntry *pos; 1255 struct NSEPeerEntry *pos;
@@ -1288,8 +1288,8 @@ handle_core_disconnect (void *cls,
1288 * @param cls NULL 1288 * @param cls NULL
1289 * @param size the amount of data sent (ignored) 1289 * @param size the amount of data sent (ignored)
1290 */ 1290 */
1291static void 1291static void
1292flush_comp_cb (void *cls, 1292flush_comp_cb (void *cls,
1293 size_t size) 1293 size_t size)
1294{ 1294{
1295 GNUNET_TESTBED_LOGGER_disconnect (lh); 1295 GNUNET_TESTBED_LOGGER_disconnect (lh);
@@ -1359,7 +1359,7 @@ shutdown_task (void *cls,
1359 * @param identity the public identity of this peer 1359 * @param identity the public identity of this peer
1360 */ 1360 */
1361static void 1361static void
1362core_init (void *cls, 1362core_init (void *cls,
1363 const struct GNUNET_PeerIdentity *identity) 1363 const struct GNUNET_PeerIdentity *identity)
1364{ 1364{
1365 struct GNUNET_TIME_Absolute now; 1365 struct GNUNET_TIME_Absolute now;
@@ -1406,7 +1406,7 @@ core_init (void *cls,
1406 * @param c configuration to use 1406 * @param c configuration to use
1407 */ 1407 */
1408static void 1408static void
1409run (void *cls, 1409run (void *cls,
1410 struct GNUNET_SERVER_Handle *server, 1410 struct GNUNET_SERVER_Handle *server,
1411 const struct GNUNET_CONFIGURATION_Handle *c) 1411 const struct GNUNET_CONFIGURATION_Handle *c)
1412{ 1412{
@@ -1424,7 +1424,7 @@ run (void *cls,
1424 struct GNUNET_CRYPTO_EccPrivateKey *pk; 1424 struct GNUNET_CRYPTO_EccPrivateKey *pk;
1425 1425
1426 cfg = c; 1426 cfg = c;
1427 srv = server; 1427 srv = server;
1428 if (GNUNET_OK != 1428 if (GNUNET_OK !=
1429 GNUNET_CONFIGURATION_get_value_time (cfg, "NSE", "INTERVAL", 1429 GNUNET_CONFIGURATION_get_value_time (cfg, "NSE", "INTERVAL",
1430 &gnunet_nse_interval)) 1430 &gnunet_nse_interval))
@@ -1436,7 +1436,7 @@ run (void *cls,
1436 } 1436 }
1437 if (GNUNET_OK != 1437 if (GNUNET_OK !=
1438 GNUNET_CONFIGURATION_get_value_time (cfg, "NSE", "WORKDELAY", 1438 GNUNET_CONFIGURATION_get_value_time (cfg, "NSE", "WORKDELAY",
1439 &proof_find_delay)) 1439 &proof_find_delay))
1440 { 1440 {
1441 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, 1441 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
1442 "NSE", "WORKDELAY"); 1442 "NSE", "WORKDELAY");
@@ -1461,7 +1461,7 @@ run (void *cls,
1461 GNUNET_SCHEDULER_shutdown (); 1461 GNUNET_SCHEDULER_shutdown ();
1462 return; 1462 return;
1463 } 1463 }
1464 1464
1465#if ENABLE_NSE_HISTOGRAM 1465#if ENABLE_NSE_HISTOGRAM
1466 if (NULL == (lh = GNUNET_TESTBED_LOGGER_connect (cfg))) 1466 if (NULL == (lh = GNUNET_TESTBED_LOGGER_connect (cfg)))
1467 { 1467 {
@@ -1477,7 +1477,7 @@ run (void *cls,
1477 pk = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg); 1477 pk = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg);
1478 GNUNET_assert (NULL != pk); 1478 GNUNET_assert (NULL != pk);
1479 my_private_key = pk; 1479 my_private_key = pk;
1480 GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, 1480 GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key,
1481 &my_identity.public_key); 1481 &my_identity.public_key);
1482 if (GNUNET_OK != 1482 if (GNUNET_OK !=
1483 GNUNET_CONFIGURATION_get_value_filename (cfg, "NSE", "PROOFFILE", &proof)) 1483 GNUNET_CONFIGURATION_get_value_filename (cfg, "NSE", "PROOFFILE", &proof))
@@ -1486,7 +1486,7 @@ run (void *cls,
1486 _ 1486 _
1487 ("NSE service is lacking key configuration settings. Exiting.\n")); 1487 ("NSE service is lacking key configuration settings. Exiting.\n"));
1488 GNUNET_free (my_private_key); 1488 GNUNET_free (my_private_key);
1489 my_private_key = NULL; 1489 my_private_key = NULL;
1490 GNUNET_SCHEDULER_shutdown (); 1490 GNUNET_SCHEDULER_shutdown ();
1491 return; 1491 return;
1492 } 1492 }
@@ -1530,7 +1530,7 @@ run (void *cls,
1530 * @return 0 ok, 1 on error 1530 * @return 0 ok, 1 on error
1531 */ 1531 */
1532int 1532int
1533main (int argc, 1533main (int argc,
1534 char *const *argv) 1534 char *const *argv)
1535{ 1535{
1536 return (GNUNET_OK == 1536 return (GNUNET_OK ==
@@ -1545,7 +1545,7 @@ main (int argc,
1545/** 1545/**
1546 * MINIMIZE heap size (way below 128k) since this process doesn't need much. 1546 * MINIMIZE heap size (way below 128k) since this process doesn't need much.
1547 */ 1547 */
1548void __attribute__ ((constructor)) 1548void __attribute__ ((constructor))
1549GNUNET_ARM_memory_init () 1549GNUNET_ARM_memory_init ()
1550{ 1550{
1551 mallopt (M_TRIM_THRESHOLD, 4 * 1024); 1551 mallopt (M_TRIM_THRESHOLD, 4 * 1024);
diff --git a/src/nse/nse_api.c b/src/nse/nse_api.c
index 3542b5f8a..bc927f481 100644
--- a/src/nse/nse_api.c
+++ b/src/nse/nse_api.c
@@ -106,7 +106,7 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
106 GNUNET_CLIENT_disconnect (h->client); 106 GNUNET_CLIENT_disconnect (h->client);
107 h->client = NULL; 107 h->client = NULL;
108 h->reconnect_task = 108 h->reconnect_task =
109 GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, 109 GNUNET_SCHEDULER_add_delayed (h->reconnect_delay,
110 &reconnect, h); 110 &reconnect, h);
111 return; 111 return;
112 } 112 }
@@ -118,7 +118,7 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
118 } 118 }
119 client_msg = (const struct GNUNET_NSE_ClientMessage *) msg; 119 client_msg = (const struct GNUNET_NSE_ClientMessage *) msg;
120 h->recv_cb (h->recv_cb_cls, GNUNET_TIME_absolute_ntoh (client_msg->timestamp), 120 h->recv_cb (h->recv_cb_cls, GNUNET_TIME_absolute_ntoh (client_msg->timestamp),
121 GNUNET_ntoh_double (client_msg->size_estimate), 121 GNUNET_ntoh_double (client_msg->size_estimate),
122 GNUNET_ntoh_double (client_msg->std_deviation)); 122 GNUNET_ntoh_double (client_msg->std_deviation));
123 GNUNET_CLIENT_receive (h->client, &message_handler, h, 123 GNUNET_CLIENT_receive (h->client, &message_handler, h,
124 GNUNET_TIME_UNIT_FOREVER_REL); 124 GNUNET_TIME_UNIT_FOREVER_REL);
@@ -175,13 +175,13 @@ send_start (void *cls, size_t size, void *buf)
175 { 175 {
176 /* Connect error... */ 176 /* Connect error... */
177 LOG (GNUNET_ERROR_TYPE_DEBUG, 177 LOG (GNUNET_ERROR_TYPE_DEBUG,
178 "Error while trying to transmit `%s' request.\n", 178 "Error while trying to transmit `%s' request.\n",
179 "START"); 179 "START");
180 reschedule_connect (h); 180 reschedule_connect (h);
181 return 0; 181 return 0;
182 } 182 }
183 LOG (GNUNET_ERROR_TYPE_DEBUG, 183 LOG (GNUNET_ERROR_TYPE_DEBUG,
184 "Transmitting `%s' request.\n", 184 "Transmitting `%s' request.\n",
185 "START"); 185 "START");
186 GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader)); 186 GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader));
187 187
@@ -201,7 +201,7 @@ send_start (void *cls, size_t size, void *buf)
201 * @param tc scheduler context 201 * @param tc scheduler context
202 */ 202 */
203static void 203static void
204reconnect (void *cls, 204reconnect (void *cls,
205 const struct GNUNET_SCHEDULER_TaskContext *tc) 205 const struct GNUNET_SCHEDULER_TaskContext *tc)
206{ 206{
207 struct GNUNET_NSE_Handle *h = cls; 207 struct GNUNET_NSE_Handle *h = cls;
diff --git a/src/nse/perf_kdf.c b/src/nse/perf_kdf.c
index aac71916b..800be3d1b 100644
--- a/src/nse/perf_kdf.c
+++ b/src/nse/perf_kdf.c
@@ -43,7 +43,7 @@ pow_hash (const void *buf,
43 size_t buf_len, 43 size_t buf_len,
44 struct GNUNET_HashCode *result) 44 struct GNUNET_HashCode *result)
45{ 45{
46 GNUNET_break (0 == 46 GNUNET_break (0 ==
47 gcry_kdf_derive (buf, buf_len, 47 gcry_kdf_derive (buf, buf_len,
48 GCRY_KDF_SCRYPT, 48 GCRY_KDF_SCRYPT,
49 1 /* subalgo */, 49 1 /* subalgo */,
diff --git a/src/nse/test_nse_api.c b/src/nse/test_nse_api.c
index 171595b79..324d4ff16 100644
--- a/src/nse/test_nse_api.c
+++ b/src/nse/test_nse_api.c
@@ -76,7 +76,7 @@ check_nse_message (void *cls, struct GNUNET_TIME_Absolute timestamp,
76 76
77 77
78static void 78static void
79run (void *cls, 79run (void *cls,
80 const struct GNUNET_CONFIGURATION_Handle *cfg, 80 const struct GNUNET_CONFIGURATION_Handle *cfg,
81 struct GNUNET_TESTING_Peer *peer) 81 struct GNUNET_TESTING_Peer *peer)
82{ 82{
diff --git a/src/nse/test_nse_multipeer.c b/src/nse/test_nse_multipeer.c
index 45462013c..9b085dd90 100644
--- a/src/nse/test_nse_multipeer.c
+++ b/src/nse/test_nse_multipeer.c
@@ -52,7 +52,7 @@ struct NSEPeer
52 52
53 /** 53 /**
54 * Handle to NSE service. 54 * Handle to NSE service.
55 */ 55 */
56 struct GNUNET_NSE_Handle *nse_handle; 56 struct GNUNET_NSE_Handle *nse_handle;
57}; 57};
58 58
@@ -100,9 +100,9 @@ handle_estimate (void *cls, struct GNUNET_TIME_Absolute timestamp,
100 100
101 FPRINTF (stderr, 101 FPRINTF (stderr,
102 "Received network size estimate from peer %u. logSize: %f std.dev. %f (%f/%u)\n", 102 "Received network size estimate from peer %u. logSize: %f std.dev. %f (%f/%u)\n",
103 (unsigned int) (peer - nse_peers), 103 (unsigned int) (peer - nse_peers),
104 estimate, std_dev, 104 estimate, std_dev,
105 GNUNET_NSE_log_estimate_to_n (estimate), 105 GNUNET_NSE_log_estimate_to_n (estimate),
106 NUM_PEERS); 106 NUM_PEERS);
107 ok = 0; 107 ok = 0;
108} 108}
@@ -118,7 +118,7 @@ handle_estimate (void *cls, struct GNUNET_TIME_Absolute timestamp,
118 * operation has executed successfully. 118 * operation has executed successfully.
119 */ 119 */
120static void 120static void
121nse_connect_complete_cb (void *cls, 121nse_connect_complete_cb (void *cls,
122 struct GNUNET_TESTBED_Operation *op, 122 struct GNUNET_TESTBED_Operation *op,
123 void *ca_result, 123 void *ca_result,
124 const char *emsg) 124 const char *emsg)
@@ -143,18 +143,18 @@ nse_connect_complete_cb (void *cls,
143/** 143/**
144 * Adapter function called to establish a connection to 144 * Adapter function called to establish a connection to
145 * the NSE service. 145 * the NSE service.
146 * 146 *
147 * @param cls closure 147 * @param cls closure
148 * @param cfg configuration of the peer to connect to; will be available until 148 * @param cfg configuration of the peer to connect to; will be available until
149 * GNUNET_TESTBED_operation_done() is called on the operation returned 149 * GNUNET_TESTBED_operation_done() is called on the operation returned
150 * from GNUNET_TESTBED_service_connect() 150 * from GNUNET_TESTBED_service_connect()
151 * @return service handle to return in 'op_result', NULL on error 151 * @return service handle to return in 'op_result', NULL on error
152 */ 152 */
153static void * 153static void *
154nse_connect_adapter (void *cls, 154nse_connect_adapter (void *cls,
155 const struct GNUNET_CONFIGURATION_Handle *cfg) 155 const struct GNUNET_CONFIGURATION_Handle *cfg)
156{ 156{
157 return GNUNET_NSE_connect (cfg, 157 return GNUNET_NSE_connect (cfg,
158 &handle_estimate, 158 &handle_estimate,
159 cls); 159 cls);
160} 160}
@@ -163,7 +163,7 @@ nse_connect_adapter (void *cls,
163/** 163/**
164 * Adapter function called to destroy connection to 164 * Adapter function called to destroy connection to
165 * NSE service. 165 * NSE service.
166 * 166 *
167 * @param cls closure 167 * @param cls closure
168 * @param op_result service handle returned from the connect adapter 168 * @param op_result service handle returned from the connect adapter
169 */ 169 */
@@ -177,7 +177,7 @@ nse_disconnect_adapter (void *cls,
177 177
178/** 178/**
179 * Actual "main" function for the testcase. 179 * Actual "main" function for the testcase.
180 * 180 *
181 * @param cls closure 181 * @param cls closure
182 * @param h the run handle 182 * @param h the run handle
183 * @param num_peers number of peers in 'peers' 183 * @param num_peers number of peers in 'peers'
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c
index af7a8f757..67aeddbe7 100644
--- a/src/peerinfo-tool/gnunet-peerinfo.c
+++ b/src/peerinfo-tool/gnunet-peerinfo.c
@@ -62,7 +62,7 @@ struct AddressRecord
62 * Printable address. 62 * Printable address.
63 */ 63 */
64 char *result; 64 char *result;
65 65
66 /** 66 /**
67 * Print context this address record belongs to. 67 * Print context this address record belongs to.
68 */ 68 */
@@ -90,7 +90,7 @@ struct PrintContext
90 * Identity of the peer. 90 * Identity of the peer.
91 */ 91 */
92 struct GNUNET_PeerIdentity peer; 92 struct GNUNET_PeerIdentity peer;
93 93
94 /** 94 /**
95 * List of printable addresses. 95 * List of printable addresses.
96 */ 96 */
@@ -140,7 +140,7 @@ static int include_friend_only;
140static int get_self; 140static int get_self;
141 141
142/** 142/**
143 * Option 143 * Option
144 */ 144 */
145static int get_uri; 145static int get_uri;
146 146
@@ -155,7 +155,7 @@ static int default_operation;
155static int get_info; 155static int get_info;
156 156
157/** 157/**
158 * Option 158 * Option
159 */ 159 */
160static char *put_uri; 160static char *put_uri;
161 161
@@ -248,7 +248,7 @@ dump_pc (struct PrintContext *pc)
248 GNUNET_free (pc); 248 GNUNET_free (pc);
249 if ( (NULL == pc_head) && 249 if ( (NULL == pc_head) &&
250 (NULL == pic) ) 250 (NULL == pic) )
251 tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL); 251 tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
252} 252}
253 253
254 254
@@ -330,7 +330,7 @@ print_address (void *cls, const struct GNUNET_HELLO_Address *address,
330 * Currently prints the GNUNET_PeerIdentity and the transport address. 330 * Currently prints the GNUNET_PeerIdentity and the transport address.
331 * 331 *
332 * @param cls the 'struct PrintContext' 332 * @param cls the 'struct PrintContext'
333 * @param peer identity of the peer 333 * @param peer identity of the peer
334 * @param hello addresses of the peer 334 * @param hello addresses of the peer
335 * @param err_msg error message 335 * @param err_msg error message
336 */ 336 */
@@ -346,7 +346,7 @@ print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer,
346 pic = NULL; /* end of iteration */ 346 pic = NULL; /* end of iteration */
347 if (NULL != err_msg) 347 if (NULL != err_msg)
348 { 348 {
349 FPRINTF (stderr, 349 FPRINTF (stderr,
350 _("Error in communication with PEERINFO service: %s\n"), 350 _("Error in communication with PEERINFO service: %s\n"),
351 err_msg); 351 err_msg);
352 } 352 }
@@ -366,13 +366,13 @@ print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer,
366 } 366 }
367 pc = GNUNET_malloc (sizeof (struct PrintContext)); 367 pc = GNUNET_malloc (sizeof (struct PrintContext));
368 GNUNET_CONTAINER_DLL_insert (pc_head, 368 GNUNET_CONTAINER_DLL_insert (pc_head,
369 pc_tail, 369 pc_tail,
370 pc); 370 pc);
371 pc->peer = *peer; 371 pc->peer = *peer;
372 pc->friend_only = friend_only; 372 pc->friend_only = friend_only;
373 GNUNET_HELLO_iterate_addresses (hello, 373 GNUNET_HELLO_iterate_addresses (hello,
374 GNUNET_NO, 374 GNUNET_NO,
375 &count_address, 375 &count_address,
376 pc); 376 pc);
377 if (0 == pc->off) 377 if (0 == pc->off)
378 { 378 {
@@ -381,7 +381,7 @@ print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer,
381 } 381 }
382 pc->address_list_size = pc->off; 382 pc->address_list_size = pc->off;
383 pc->address_list = GNUNET_malloc (sizeof (struct AddressRecord) * pc->off); 383 pc->address_list = GNUNET_malloc (sizeof (struct AddressRecord) * pc->off);
384 GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, 384 GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO,
385 &print_address, pc); 385 &print_address, pc);
386} 386}
387 387
@@ -479,7 +479,7 @@ dump_my_hello (void *cls, const struct GNUNET_PeerIdentity *peer,
479 */ 479 */
480static void 480static void
481print_my_uri (void *cls, const struct GNUNET_PeerIdentity *peer, 481print_my_uri (void *cls, const struct GNUNET_PeerIdentity *peer,
482 const struct GNUNET_HELLO_Message *hello, 482 const struct GNUNET_HELLO_Message *hello,
483 const char *err_msg) 483 const char *err_msg)
484{ 484{
485 if (peer == NULL) 485 if (peer == NULL)
@@ -487,7 +487,7 @@ print_my_uri (void *cls, const struct GNUNET_PeerIdentity *peer,
487 pic = NULL; 487 pic = NULL;
488 if (err_msg != NULL) 488 if (err_msg != NULL)
489 FPRINTF (stderr, 489 FPRINTF (stderr,
490 _("Error in communication with PEERINFO service: %s\n"), 490 _("Error in communication with PEERINFO service: %s\n"),
491 err_msg); 491 err_msg);
492 tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL); 492 tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
493 return; 493 return;
@@ -526,7 +526,7 @@ add_continuation (void *cls,
526 526
527 527
528/** 528/**
529 * Parse the PUT URI given at the command line and add it to our peerinfo 529 * Parse the PUT URI given at the command line and add it to our peerinfo
530 * database. 530 * database.
531 * 531 *
532 * @param put_uri URI string to parse 532 * @param put_uri URI string to parse
@@ -537,7 +537,7 @@ parse_hello_uri (const char *put_uri)
537{ 537{
538 struct GNUNET_HELLO_Message *hello = NULL; 538 struct GNUNET_HELLO_Message *hello = NULL;
539 539
540 int ret = GNUNET_HELLO_parse_uri(put_uri, &my_peer_identity.public_key, 540 int ret = GNUNET_HELLO_parse_uri(put_uri, &my_peer_identity.public_key,
541 &hello, &GPI_plugins_find); 541 &hello, &GPI_plugins_find);
542 542
543 if (NULL != hello) { 543 if (NULL != hello) {
@@ -639,10 +639,10 @@ run (void *cls, char *const *args, const char *cfgfile,
639 put_uri = GNUNET_strdup (args[0]); 639 put_uri = GNUNET_strdup (args[0]);
640 args++; 640 args++;
641 } 641 }
642 if (NULL != args[0]) 642 if (NULL != args[0])
643 { 643 {
644 FPRINTF (stderr, 644 FPRINTF (stderr,
645 _("Invalid command line argument `%s'\n"), 645 _("Invalid command line argument `%s'\n"),
646 args[0]); 646 args[0]);
647 return; 647 return;
648 } 648 }
@@ -669,7 +669,7 @@ run (void *cls, char *const *args, const char *cfgfile,
669 return; 669 return;
670 } 670 }
671 GNUNET_free (fn); 671 GNUNET_free (fn);
672 GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv, 672 GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv,
673 &my_peer_identity.public_key); 673 &my_peer_identity.public_key);
674 GNUNET_free (priv); 674 GNUNET_free (priv);
675 } 675 }
@@ -719,7 +719,7 @@ state_machine (void *cls,
719 { 719 {
720 get_self = GNUNET_NO; 720 get_self = GNUNET_NO;
721 if (be_quiet) 721 if (be_quiet)
722 printf ("%s\n", 722 printf ("%s\n",
723 GNUNET_i2s_full (&my_peer_identity)); 723 GNUNET_i2s_full (&my_peer_identity));
724 else 724 else
725 printf (_("I am peer `%s'.\n"), 725 printf (_("I am peer `%s'.\n"),
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c
index cf28484eb..d62e81eae 100644
--- a/src/peerinfo/gnunet-service-peerinfo.c
+++ b/src/peerinfo/gnunet-service-peerinfo.c
@@ -81,7 +81,7 @@ struct TransmitContext
81 * Server transmit context 81 * Server transmit context
82 */ 82 */
83 struct GNUNET_SERVER_TransmitContext *tc; 83 struct GNUNET_SERVER_TransmitContext *tc;
84 84
85 /** 85 /**
86 * Include friend only HELLOs GNUNET_YES or _NO 86 * Include friend only HELLOs GNUNET_YES or _NO
87 */ 87 */
@@ -315,7 +315,7 @@ update_hello (const struct GNUNET_PeerIdentity *peer,
315 * addresses. Removes the file if one the HELLO is mal-formed. If all 315 * addresses. Removes the file if one the HELLO is mal-formed. If all
316 * addresses are expired, the HELLO is also removed (but the HELLO 316 * addresses are expired, the HELLO is also removed (but the HELLO
317 * with the public key is still returned if it was found and valid). 317 * with the public key is still returned if it was found and valid).
318 * 318 *
319 * The file can contain multiple HELLO messages, but onlu a public and a friend only 319 * The file can contain multiple HELLO messages, but onlu a public and a friend only
320 * HELLO should be included 320 * HELLO should be included
321 * 321 *
@@ -351,7 +351,7 @@ read_host_file (const char *fn, int unlink_garbage, struct ReadHostFileContext *
351 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 351 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
352 _("Failed to parse HELLO in file `%s': %s\n"), 352 _("Failed to parse HELLO in file `%s': %s\n"),
353 fn, "Fail has invalid size"); 353 fn, "Fail has invalid size");
354 if ( (GNUNET_YES == unlink_garbage) && 354 if ( (GNUNET_YES == unlink_garbage) &&
355 (0 != UNLINK (fn)) && 355 (0 != UNLINK (fn)) &&
356 (ENOENT != errno) ) 356 (ENOENT != errno) )
357 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn); 357 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn);
@@ -368,26 +368,26 @@ read_host_file (const char *fn, int unlink_garbage, struct ReadHostFileContext *
368 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 368 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
369 _("Failed to parse HELLO in file `%s': %s %u \n"), 369 _("Failed to parse HELLO in file `%s': %s %u \n"),
370 fn, "HELLO is invalid and has size of ", size_hello); 370 fn, "HELLO is invalid and has size of ", size_hello);
371 if ((GNUNET_YES == unlink_garbage) && 371 if ((GNUNET_YES == unlink_garbage) &&
372 (0 != UNLINK (fn)) && 372 (0 != UNLINK (fn)) &&
373 (ENOENT != errno) ) 373 (ENOENT != errno) )
374 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn); 374 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn);
375 return; 375 return;
376 } 376 }
377 377
378 now = GNUNET_TIME_absolute_get (); 378 now = GNUNET_TIME_absolute_get ();
379 hello_clean = GNUNET_HELLO_iterate_addresses (hello, GNUNET_YES, 379 hello_clean = GNUNET_HELLO_iterate_addresses (hello, GNUNET_YES,
380 &discard_expired, &now); 380 &discard_expired, &now);
381 left = 0; 381 left = 0;
382 (void) GNUNET_HELLO_iterate_addresses (hello_clean, GNUNET_NO, 382 (void) GNUNET_HELLO_iterate_addresses (hello_clean, GNUNET_NO,
383 &count_addresses, &left); 383 &count_addresses, &left);
384 384
385 if (0 == left) 385 if (0 == left)
386 { 386 {
387 GNUNET_free (hello_clean); 387 GNUNET_free (hello_clean);
388 break; 388 break;
389 } 389 }
390 390
391 if (GNUNET_NO == GNUNET_HELLO_is_friend_only (hello_clean)) 391 if (GNUNET_NO == GNUNET_HELLO_is_friend_only (hello_clean))
392 { 392 {
393 if (NULL == r->hello) 393 if (NULL == r->hello)
@@ -497,7 +497,7 @@ struct DirScanContext
497 * GNUNET_YES if we should remove files that are broken, 497 * GNUNET_YES if we should remove files that are broken,
498 * GNUNET_NO if the directory we are iterating over should 498 * GNUNET_NO if the directory we are iterating over should
499 * be treated as read-only by us. 499 * be treated as read-only by us.
500 */ 500 */
501 int remove_files; 501 int remove_files;
502 502
503 /** 503 /**
@@ -565,7 +565,7 @@ hosts_directory_scan_callback (void *cls, const char *fullname)
565 } 565 }
566 id = id_public; 566 id = id_public;
567 } 567 }
568 568
569 if ( (NULL != r.hello) && (NULL != r.friend_only_hello) && 569 if ( (NULL != r.hello) && (NULL != r.friend_only_hello) &&
570 (0 != memcmp (&id_friend, &id_public, sizeof (id_friend))) ) 570 (0 != memcmp (&id_friend, &id_public, sizeof (id_friend))) )
571 { 571 {
@@ -575,7 +575,7 @@ hosts_directory_scan_callback (void *cls, const char *fullname)
575 remove_garbage (fullname); 575 remove_garbage (fullname);
576 return GNUNET_OK; 576 return GNUNET_OK;
577 } 577 }
578 if (GNUNET_OK == GNUNET_CRYPTO_ecc_public_sign_key_from_string (filename, 578 if (GNUNET_OK == GNUNET_CRYPTO_ecc_public_sign_key_from_string (filename,
579 strlen (filename), 579 strlen (filename),
580 &identity.public_key)) 580 &identity.public_key))
581 { 581 {
@@ -641,7 +641,7 @@ cron_scan_directory_data_hosts (void *cls,
641 if ((0 == dsc.matched) && (0 == (++retries & 31))) 641 if ((0 == dsc.matched) && (0 == (++retries & 31)))
642 GNUNET_log (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, 642 GNUNET_log (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
643 _("Still no peers found in `%s'!\n"), networkIdDirectory); 643 _("Still no peers found in `%s'!\n"), networkIdDirectory);
644 GNUNET_SCHEDULER_add_delayed_with_priority (DATA_HOST_FREQ, 644 GNUNET_SCHEDULER_add_delayed_with_priority (DATA_HOST_FREQ,
645 GNUNET_SCHEDULER_PRIORITY_IDLE, 645 GNUNET_SCHEDULER_PRIORITY_IDLE,
646 &cron_scan_directory_data_hosts, 646 &cron_scan_directory_data_hosts,
647 NULL); 647 NULL);
@@ -655,14 +655,14 @@ update_friend_hello (const struct GNUNET_HELLO_Message *hello,
655 struct GNUNET_HELLO_Message * res; 655 struct GNUNET_HELLO_Message * res;
656 struct GNUNET_HELLO_Message * tmp; 656 struct GNUNET_HELLO_Message * tmp;
657 struct GNUNET_CRYPTO_EccPublicSignKey pk; 657 struct GNUNET_CRYPTO_EccPublicSignKey pk;
658 658
659 if (NULL != friend_hello) 659 if (NULL != friend_hello)
660 { 660 {
661 res = GNUNET_HELLO_merge (hello, friend_hello); 661 res = GNUNET_HELLO_merge (hello, friend_hello);
662 GNUNET_assert (GNUNET_YES == GNUNET_HELLO_is_friend_only (res)); 662 GNUNET_assert (GNUNET_YES == GNUNET_HELLO_is_friend_only (res));
663 return res; 663 return res;
664 } 664 }
665 665
666 if (GNUNET_OK != 666 if (GNUNET_OK !=
667 GNUNET_HELLO_get_key (hello, &pk)) 667 GNUNET_HELLO_get_key (hello, &pk))
668 { 668 {
@@ -779,7 +779,7 @@ update_hello (const struct GNUNET_PeerIdentity *peer,
779 store_friend_hello = GNUNET_YES; 779 store_friend_hello = GNUNET_YES;
780 size += GNUNET_HELLO_size (host->friend_only_hello); 780 size += GNUNET_HELLO_size (host->friend_only_hello);
781 } 781 }
782 782
783 if ((GNUNET_NO == store_hello) && (GNUNET_NO == store_friend_hello)) 783 if ((GNUNET_NO == store_hello) && (GNUNET_NO == store_friend_hello))
784 { 784 {
785 /* no valid addresses, don't put HELLO on disk; in fact, 785 /* no valid addresses, don't put HELLO on disk; in fact,
@@ -790,7 +790,7 @@ update_hello (const struct GNUNET_PeerIdentity *peer,
790 { 790 {
791 buffer = GNUNET_malloc (size); 791 buffer = GNUNET_malloc (size);
792 pos = 0; 792 pos = 0;
793 793
794 if (GNUNET_YES == store_hello) 794 if (GNUNET_YES == store_hello)
795 { 795 {
796 memcpy (buffer, host->hello, GNUNET_HELLO_size (host->hello)); 796 memcpy (buffer, host->hello, GNUNET_HELLO_size (host->hello));
@@ -802,7 +802,7 @@ update_hello (const struct GNUNET_PeerIdentity *peer,
802 pos += GNUNET_HELLO_size (host->friend_only_hello); 802 pos += GNUNET_HELLO_size (host->friend_only_hello);
803 } 803 }
804 GNUNET_assert (pos == size); 804 GNUNET_assert (pos == size);
805 805
806 if (GNUNET_SYSERR == GNUNET_DISK_fn_write (fn, buffer, size, 806 if (GNUNET_SYSERR == GNUNET_DISK_fn_write (fn, buffer, size,
807 GNUNET_DISK_PERM_USER_READ | 807 GNUNET_DISK_PERM_USER_READ |
808 GNUNET_DISK_PERM_USER_WRITE | 808 GNUNET_DISK_PERM_USER_WRITE |
@@ -860,13 +860,13 @@ add_to_tc (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
860 GNUNET_assert (hs < GNUNET_SERVER_MAX_MESSAGE_SIZE - 860 GNUNET_assert (hs < GNUNET_SERVER_MAX_MESSAGE_SIZE -
861 sizeof (struct InfoMessage)); 861 sizeof (struct InfoMessage));
862 memcpy (&im[1], pos->friend_only_hello, hs); 862 memcpy (&im[1], pos->friend_only_hello, hs);
863 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 863 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
864 "Sending friend-only HELLO with size %u for peer `%4s'\n", 864 "Sending friend-only HELLO with size %u for peer `%4s'\n",
865 hs, GNUNET_i2s (key)); 865 hs, GNUNET_i2s (key));
866 } 866 }
867 else 867 else
868 { 868 {
869 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 869 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
870 "Adding no HELLO for peer `%s'\n", 870 "Adding no HELLO for peer `%s'\n",
871 GNUNET_i2s (key)); 871 GNUNET_i2s (key));
872 } 872 }
@@ -1086,14 +1086,14 @@ do_notify_entry (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
1086 /* We have no public hello */ 1086 /* We have no public hello */
1087 return GNUNET_YES; 1087 return GNUNET_YES;
1088 } 1088 }
1089 1089
1090 if ( (NULL == he->friend_only_hello) && 1090 if ( (NULL == he->friend_only_hello) &&
1091 (GNUNET_YES == nc->include_friend_only) ) 1091 (GNUNET_YES == nc->include_friend_only) )
1092 { 1092 {
1093 /* We have no friend hello */ 1093 /* We have no friend hello */
1094 return GNUNET_YES; 1094 return GNUNET_YES;
1095 } 1095 }
1096 1096
1097 msg = make_info_message (he, nc->include_friend_only); 1097 msg = make_info_message (he, nc->include_friend_only);
1098 GNUNET_SERVER_notification_context_unicast (notify_list, 1098 GNUNET_SERVER_notification_context_unicast (notify_list,
1099 nc->client, 1099 nc->client,
@@ -1118,13 +1118,13 @@ handle_notify (void *cls, struct GNUNET_SERVER_Client *client,
1118 struct NotifyMessage *nm = (struct NotifyMessage *) message; 1118 struct NotifyMessage *nm = (struct NotifyMessage *) message;
1119 struct NotificationContext *nc; 1119 struct NotificationContext *nc;
1120 1120
1121 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1121 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1122 "`%s' message received\n", 1122 "`%s' message received\n",
1123 "NOTIFY"); 1123 "NOTIFY");
1124 nc = GNUNET_malloc (sizeof (struct NotificationContext)); 1124 nc = GNUNET_malloc (sizeof (struct NotificationContext));
1125 nc->client = client; 1125 nc->client = client;
1126 nc->include_friend_only = ntohl (nm->include_friend_only); 1126 nc->include_friend_only = ntohl (nm->include_friend_only);
1127 1127
1128 GNUNET_CONTAINER_DLL_insert (nc_head, nc_tail, nc); 1128 GNUNET_CONTAINER_DLL_insert (nc_head, nc_tail, nc);
1129 GNUNET_SERVER_client_mark_monitor (client); 1129 GNUNET_SERVER_client_mark_monitor (client);
1130 GNUNET_SERVER_notification_context_add (notify_list, client); 1130 GNUNET_SERVER_notification_context_add (notify_list, client);
@@ -1139,7 +1139,7 @@ handle_notify (void *cls, struct GNUNET_SERVER_Client *client,
1139 * @param cls unused 1139 * @param cls unused
1140 * @param client server client 1140 * @param client server client
1141 */ 1141 */
1142static void 1142static void
1143disconnect_cb (void *cls,struct GNUNET_SERVER_Client *client) 1143disconnect_cb (void *cls,struct GNUNET_SERVER_Client *client)
1144{ 1144{
1145 struct NotificationContext *cur; 1145 struct NotificationContext *cur;
@@ -1251,7 +1251,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1251 GNUNET_SCHEDULER_shutdown (); 1251 GNUNET_SCHEDULER_shutdown ();
1252 return; 1252 return;
1253 } 1253 }
1254 1254
1255 GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE, 1255 GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE,
1256 &cron_scan_directory_data_hosts, NULL); 1256 &cron_scan_directory_data_hosts, NULL);
1257 1257
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c
index fad77a194..794060487 100644
--- a/src/peerinfo/peerinfo_api.c
+++ b/src/peerinfo/peerinfo_api.c
@@ -455,7 +455,7 @@ GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h,
455 * 455 *
456 * @param ac handle for the add operation to cancel 456 * @param ac handle for the add operation to cancel
457 */ 457 */
458void 458void
459GNUNET_PEERINFO_add_peer_cancel (struct GNUNET_PEERINFO_AddContext *ac) 459GNUNET_PEERINFO_add_peer_cancel (struct GNUNET_PEERINFO_AddContext *ac)
460{ 460{
461 struct GNUNET_PEERINFO_Handle *h = ac->h; 461 struct GNUNET_PEERINFO_Handle *h = ac->h;
@@ -528,7 +528,7 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
528 h->in_receive = GNUNET_YES; 528 h->in_receive = GNUNET_YES;
529 GNUNET_CLIENT_receive (h->client, &peerinfo_handler, h, 529 GNUNET_CLIENT_receive (h->client, &peerinfo_handler, h,
530 GNUNET_TIME_absolute_get_remaining (h->ic_head->timeout)); 530 GNUNET_TIME_absolute_get_remaining (h->ic_head->timeout));
531 } 531 }
532 if (NULL != cb) 532 if (NULL != cb)
533 cb (cb_cls, NULL, NULL, NULL); 533 cb (cb_cls, NULL, NULL, NULL);
534 return; 534 return;
@@ -557,11 +557,11 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
557 "Received HELLO for peer `%s', expected peer `%s'\n", 557 "Received HELLO for peer `%s', expected peer `%s'\n",
558 GNUNET_i2s (&im->peer), 558 GNUNET_i2s (&im->peer),
559 GNUNET_i2s (&ic->peer)); 559 GNUNET_i2s (&ic->peer));
560 560
561 GNUNET_break (0); 561 GNUNET_break (0);
562 GNUNET_PEERINFO_iterate_cancel (ic); 562 GNUNET_PEERINFO_iterate_cancel (ic);
563 reconnect (h); 563 reconnect (h);
564 if (NULL != cb) 564 if (NULL != cb)
565 cb (cb_cls, NULL, NULL, 565 cb (cb_cls, NULL, NULL,
566 _("Received invalid message from `PEERINFO' service.")); 566 _("Received invalid message from `PEERINFO' service."));
567 return; 567 return;
@@ -576,7 +576,7 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
576 GNUNET_break (0); 576 GNUNET_break (0);
577 GNUNET_PEERINFO_iterate_cancel (ic); 577 GNUNET_PEERINFO_iterate_cancel (ic);
578 reconnect (h); 578 reconnect (h);
579 if (NULL != cb) 579 if (NULL != cb)
580 cb (cb_cls, NULL, NULL, 580 cb (cb_cls, NULL, NULL,
581 _("Received invalid message from `PEERINFO' service.")); 581 _("Received invalid message from `PEERINFO' service."));
582 return; 582 return;
@@ -587,7 +587,7 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
587 GNUNET_break (0); 587 GNUNET_break (0);
588 GNUNET_PEERINFO_iterate_cancel (ic); 588 GNUNET_PEERINFO_iterate_cancel (ic);
589 reconnect (h); 589 reconnect (h);
590 if (NULL != cb) 590 if (NULL != cb)
591 cb (cb_cls, NULL, NULL, 591 cb (cb_cls, NULL, NULL,
592 _("Received invalid message from `PEERINFO' service.")); 592 _("Received invalid message from `PEERINFO' service."));
593 return; 593 return;
@@ -598,7 +598,7 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
598 GNUNET_break (0); 598 GNUNET_break (0);
599 GNUNET_PEERINFO_iterate_cancel (ic); 599 GNUNET_PEERINFO_iterate_cancel (ic);
600 reconnect (h); 600 reconnect (h);
601 if (NULL != cb) 601 if (NULL != cb)
602 cb (cb_cls, NULL, NULL, 602 cb (cb_cls, NULL, NULL,
603 _("Received invalid message from `PEERINFO' service.")); 603 _("Received invalid message from `PEERINFO' service."));
604 return; 604 return;
diff --git a/src/peerinfo/perf_peerinfo_api.c b/src/peerinfo/perf_peerinfo_api.c
index 9ef84f463..4eb84e8c2 100755
--- a/src/peerinfo/perf_peerinfo_api.c
+++ b/src/peerinfo/perf_peerinfo_api.c
@@ -106,7 +106,7 @@ process (void *cls, const struct GNUNET_PeerIdentity *peer,
106 106
107 107
108static void 108static void
109run (void *cls, 109run (void *cls,
110 const struct GNUNET_CONFIGURATION_Handle *cfg, 110 const struct GNUNET_CONFIGURATION_Handle *cfg,
111 struct GNUNET_TESTING_Peer *peer) 111 struct GNUNET_TESTING_Peer *peer)
112{ 112{
diff --git a/src/peerinfo/test_peerinfo_api.c b/src/peerinfo/test_peerinfo_api.c
index 07f9fe16d..d69456e0c 100644
--- a/src/peerinfo/test_peerinfo_api.c
+++ b/src/peerinfo/test_peerinfo_api.c
@@ -143,7 +143,7 @@ process (void *cls, const struct GNUNET_PeerIdentity *peer,
143 143
144 144
145static void 145static void
146run (void *cls, 146run (void *cls,
147 const struct GNUNET_CONFIGURATION_Handle *cfg, 147 const struct GNUNET_CONFIGURATION_Handle *cfg,
148 struct GNUNET_TESTING_Peer *peer) 148 struct GNUNET_TESTING_Peer *peer)
149{ 149{
diff --git a/src/peerinfo/test_peerinfo_api_friend_only.c b/src/peerinfo/test_peerinfo_api_friend_only.c
index 9526830b3..e2c4ec574 100644
--- a/src/peerinfo/test_peerinfo_api_friend_only.c
+++ b/src/peerinfo/test_peerinfo_api_friend_only.c
@@ -129,7 +129,7 @@ process (void *cls, const struct GNUNET_PeerIdentity *peer,
129 129
130 130
131static void 131static void
132run (void *cls, 132run (void *cls,
133 const struct GNUNET_CONFIGURATION_Handle *cfg, 133 const struct GNUNET_CONFIGURATION_Handle *cfg,
134 struct GNUNET_TESTING_Peer *peer) 134 struct GNUNET_TESTING_Peer *peer)
135{ 135{
diff --git a/src/peerinfo/test_peerinfo_api_notify_friend_only.c b/src/peerinfo/test_peerinfo_api_notify_friend_only.c
index fed8072b7..f37107898 100644
--- a/src/peerinfo/test_peerinfo_api_notify_friend_only.c
+++ b/src/peerinfo/test_peerinfo_api_notify_friend_only.c
@@ -241,7 +241,7 @@ add_peer ()
241 241
242 242
243static void 243static void
244run (void *cls, 244run (void *cls,
245 const struct GNUNET_CONFIGURATION_Handle *cfg, 245 const struct GNUNET_CONFIGURATION_Handle *cfg,
246 struct GNUNET_TESTING_Peer *peer) 246 struct GNUNET_TESTING_Peer *peer)
247{ 247{
diff --git a/src/peerinfo/test_peerinfo_shipped_hellos.c b/src/peerinfo/test_peerinfo_shipped_hellos.c
index 0c3ae2b3c..db61777b0 100644
--- a/src/peerinfo/test_peerinfo_shipped_hellos.c
+++ b/src/peerinfo/test_peerinfo_shipped_hellos.c
@@ -91,7 +91,7 @@ process (void *cls, const struct GNUNET_PeerIdentity *peer,
91 91
92 92
93static void 93static void
94run (void *cls, 94run (void *cls,
95 const struct GNUNET_CONFIGURATION_Handle *cfg, 95 const struct GNUNET_CONFIGURATION_Handle *cfg,
96 struct GNUNET_TESTING_Peer *peer) 96 struct GNUNET_TESTING_Peer *peer)
97{ 97{
diff --git a/src/psyc/gnunet-service-psyc.c b/src/psyc/gnunet-service-psyc.c
index a6393cd72..7f5189ab8 100644
--- a/src/psyc/gnunet-service-psyc.c
+++ b/src/psyc/gnunet-service-psyc.c
@@ -80,7 +80,7 @@ struct Channel
80 struct TransmitMessage *tmit_head; 80 struct TransmitMessage *tmit_head;
81 struct TransmitMessage *tmit_tail; 81 struct TransmitMessage *tmit_tail;
82 82
83 char *tmit_buf; 83 char *tmit_buf;
84 uint32_t tmit_mod_count; 84 uint32_t tmit_mod_count;
85 uint32_t tmit_mod_recvd; 85 uint32_t tmit_mod_recvd;
86 uint16_t tmit_size; 86 uint16_t tmit_size;
diff --git a/src/psyc/psyc_api.c b/src/psyc/psyc_api.c
index f85bb7ae8..abe7bb028 100644
--- a/src/psyc/psyc_api.c
+++ b/src/psyc/psyc_api.c
@@ -18,7 +18,7 @@
18 * Boston, MA 02111-1307, USA. 18 * Boston, MA 02111-1307, USA.
19 */ 19 */
20 20
21/** 21/**
22 * @file psyc/psyc_api.c 22 * @file psyc/psyc_api.c
23 * @brief PSYC service; high-level access to the PSYC protocol 23 * @brief PSYC service; high-level access to the PSYC protocol
24 * note that clients of this API are NOT expected to 24 * note that clients of this API are NOT expected to
@@ -46,7 +46,7 @@ struct OperationHandle
46 const struct GNUNET_MessageHeader *msg; 46 const struct GNUNET_MessageHeader *msg;
47}; 47};
48 48
49/** 49/**
50 * Handle to access PSYC channel operations for both the master and slaves. 50 * Handle to access PSYC channel operations for both the master and slaves.
51 */ 51 */
52struct GNUNET_PSYC_Channel 52struct GNUNET_PSYC_Channel
@@ -109,7 +109,7 @@ struct GNUNET_PSYC_Channel
109}; 109};
110 110
111 111
112/** 112/**
113 * Handle for the master of a PSYC channel. 113 * Handle for the master of a PSYC channel.
114 */ 114 */
115struct GNUNET_PSYC_Master 115struct GNUNET_PSYC_Master
@@ -122,7 +122,7 @@ struct GNUNET_PSYC_Master
122}; 122};
123 123
124 124
125/** 125/**
126 * Handle for a PSYC channel slave. 126 * Handle for a PSYC channel slave.
127 */ 127 */
128struct GNUNET_PSYC_Slave 128struct GNUNET_PSYC_Slave
@@ -131,7 +131,7 @@ struct GNUNET_PSYC_Slave
131}; 131};
132 132
133 133
134/** 134/**
135 * Handle that identifies a join request. 135 * Handle that identifies a join request.
136 * 136 *
137 * Used to match calls to #GNUNET_PSYC_JoinCallback to the 137 * Used to match calls to #GNUNET_PSYC_JoinCallback to the
@@ -143,7 +143,7 @@ struct GNUNET_PSYC_JoinHandle
143}; 143};
144 144
145 145
146/** 146/**
147 * Handle for a pending PSYC transmission operation. 147 * Handle for a pending PSYC transmission operation.
148 */ 148 */
149struct GNUNET_PSYC_MasterTransmitHandle 149struct GNUNET_PSYC_MasterTransmitHandle
@@ -156,7 +156,7 @@ struct GNUNET_PSYC_MasterTransmitHandle
156}; 156};
157 157
158 158
159/** 159/**
160 * Handle for a pending PSYC transmission operation. 160 * Handle for a pending PSYC transmission operation.
161 */ 161 */
162struct GNUNET_PSYC_SlaveTransmitHandle 162struct GNUNET_PSYC_SlaveTransmitHandle
@@ -165,7 +165,7 @@ struct GNUNET_PSYC_SlaveTransmitHandle
165}; 165};
166 166
167 167
168/** 168/**
169 * Handle to a story telling operation. 169 * Handle to a story telling operation.
170 */ 170 */
171struct GNUNET_PSYC_Story 171struct GNUNET_PSYC_Story
@@ -435,7 +435,7 @@ disconnect (void *c)
435} 435}
436 436
437 437
438/** 438/**
439 * Start a PSYC master channel. 439 * Start a PSYC master channel.
440 * 440 *
441 * Will start a multicast group identified by the given ECC key. Messages 441 * Will start a multicast group identified by the given ECC key. Messages
@@ -494,7 +494,7 @@ GNUNET_PSYC_master_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
494} 494}
495 495
496 496
497/** 497/**
498 * Stop a PSYC master channel. 498 * Stop a PSYC master channel.
499 * 499 *
500 * @param master PSYC channel master to stop. 500 * @param master PSYC channel master to stop.
@@ -507,7 +507,7 @@ GNUNET_PSYC_master_stop (struct GNUNET_PSYC_Master *mst)
507} 507}
508 508
509 509
510/** 510/**
511 * Function to call with the decision made for a join request. 511 * Function to call with the decision made for a join request.
512 * 512 *
513 * Must be called once and only once in response to an invocation of the 513 * Must be called once and only once in response to an invocation of the
@@ -567,7 +567,7 @@ send_modifier (void *cls, struct GNUNET_ENV_Modifier *mod)
567} 567}
568 568
569 569
570/** 570/**
571 * Send a message to call a method to all members in the PSYC channel. 571 * Send a message to call a method to all members in the PSYC channel.
572 * 572 *
573 * @param mst Handle to the PSYC channel. 573 * @param mst Handle to the PSYC channel.
@@ -610,7 +610,7 @@ GNUNET_PSYC_master_transmit (struct GNUNET_PSYC_Master *mst,
610 GNUNET_CONTAINER_DLL_insert (ch->transmit_head, ch->transmit_tail, op); 610 GNUNET_CONTAINER_DLL_insert (ch->transmit_head, ch->transmit_tail, op);
611 611
612 GNUNET_ENV_environment_iterate (env, send_modifier, mst); 612 GNUNET_ENV_environment_iterate (env, send_modifier, mst);
613 613
614 struct GNUNET_PSYC_MasterTransmitHandle *th = GNUNET_malloc (sizeof (*th)); 614 struct GNUNET_PSYC_MasterTransmitHandle *th = GNUNET_malloc (sizeof (*th));
615 th->master = mst; 615 th->master = mst;
616 th->env = env; 616 th->env = env;
@@ -620,7 +620,7 @@ GNUNET_PSYC_master_transmit (struct GNUNET_PSYC_Master *mst,
620} 620}
621 621
622 622
623/** 623/**
624 * Abort transmission request to the channel. 624 * Abort transmission request to the channel.
625 * 625 *
626 * @param th Handle of the request that is being aborted. 626 * @param th Handle of the request that is being aborted.
@@ -633,11 +633,11 @@ GNUNET_PSYC_master_transmit_cancel (struct GNUNET_PSYC_MasterTransmitHandle *th)
633 if (GNUNET_NO != ch->in_transmit) 633 if (GNUNET_NO != ch->in_transmit)
634 return; 634 return;
635 635
636 636
637} 637}
638 638
639 639
640/** 640/**
641 * Join a PSYC channel. 641 * Join a PSYC channel.
642 * 642 *
643 * The entity joining is always the local peer. The user must immediately use 643 * The entity joining is always the local peer. The user must immediately use
@@ -704,7 +704,7 @@ GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
704} 704}
705 705
706 706
707/** 707/**
708 * Part a PSYC channel. 708 * Part a PSYC channel.
709 * 709 *
710 * Will terminate the connection to the PSYC service. Polite clients should 710 * Will terminate the connection to the PSYC service. Polite clients should
@@ -720,7 +720,7 @@ GNUNET_PSYC_slave_part (struct GNUNET_PSYC_Slave *slv)
720} 720}
721 721
722 722
723/** 723/**
724 * Request a message to be sent to the channel master. 724 * Request a message to be sent to the channel master.
725 * 725 *
726 * @param slave Slave handle. 726 * @param slave Slave handle.
@@ -745,7 +745,7 @@ GNUNET_PSYC_slave_transmit (struct GNUNET_PSYC_Slave *slave,
745} 745}
746 746
747 747
748/** 748/**
749 * Abort transmission request to master. 749 * Abort transmission request to master.
750 * 750 *
751 * @param th Handle of the request that is being aborted. 751 * @param th Handle of the request that is being aborted.
@@ -757,7 +757,7 @@ GNUNET_PSYC_slave_transmit_cancel (struct GNUNET_PSYC_SlaveTransmitHandle *th)
757} 757}
758 758
759 759
760/** 760/**
761 * Convert a channel @a master to a @e channel handle to access the @e channel 761 * Convert a channel @a master to a @e channel handle to access the @e channel
762 * APIs. 762 * APIs.
763 * 763 *
@@ -771,7 +771,7 @@ GNUNET_PSYC_master_get_channel (struct GNUNET_PSYC_Master *master)
771} 771}
772 772
773 773
774/** 774/**
775 * Convert @a slave to a @e channel handle to access the @e channel APIs. 775 * Convert @a slave to a @e channel handle to access the @e channel APIs.
776 * 776 *
777 * @param slave Slave handle. 777 * @param slave Slave handle.
@@ -784,7 +784,7 @@ GNUNET_PSYC_slave_get_channel (struct GNUNET_PSYC_Slave *slave)
784} 784}
785 785
786 786
787/** 787/**
788 * Add a slave to the channel's membership list. 788 * Add a slave to the channel's membership list.
789 * 789 *
790 * Note that this will NOT generate any PSYC traffic, it will merely update the 790 * Note that this will NOT generate any PSYC traffic, it will merely update the
@@ -827,7 +827,7 @@ GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *ch,
827} 827}
828 828
829 829
830/** 830/**
831 * Remove a slave from the channel's membership list. 831 * Remove a slave from the channel's membership list.
832 * 832 *
833 * Note that this will NOT generate any PSYC traffic, it will merely update the 833 * Note that this will NOT generate any PSYC traffic, it will merely update the
@@ -868,7 +868,7 @@ GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *ch,
868} 868}
869 869
870 870
871/** 871/**
872 * Request to be told the message history of the channel. 872 * Request to be told the message history of the channel.
873 * 873 *
874 * Historic messages (but NOT the state at the time) will be replayed (given to 874 * Historic messages (but NOT the state at the time) will be replayed (given to
@@ -904,7 +904,7 @@ GNUNET_PSYC_channel_story_tell (struct GNUNET_PSYC_Channel *ch,
904} 904}
905 905
906 906
907/** 907/**
908 * Abort story telling. 908 * Abort story telling.
909 * 909 *
910 * This function must not be called from within method handlers (as given to 910 * This function must not be called from within method handlers (as given to
@@ -919,7 +919,7 @@ GNUNET_PSYC_channel_story_tell_cancel (struct GNUNET_PSYC_Story *story)
919} 919}
920 920
921 921
922/** 922/**
923 * Retrieve the best matching channel state variable. 923 * Retrieve the best matching channel state variable.
924 * 924 *
925 * If the requested variable name is not present in the state, the nearest 925 * If the requested variable name is not present in the state, the nearest
@@ -944,7 +944,7 @@ GNUNET_PSYC_channel_state_get (struct GNUNET_PSYC_Channel *channel,
944} 944}
945 945
946 946
947/** 947/**
948 * Return all channel state variables whose name matches a given prefix. 948 * Return all channel state variables whose name matches a given prefix.
949 * 949 *
950 * A name matches if it starts with the given @a name_prefix, thus requesting 950 * A name matches if it starts with the given @a name_prefix, thus requesting
@@ -970,7 +970,7 @@ GNUNET_PSYC_channel_state_get_prefix (struct GNUNET_PSYC_Channel *channel,
970} 970}
971 971
972 972
973/** 973/**
974 * Cancel a state query operation. 974 * Cancel a state query operation.
975 * 975 *
976 * @param query Handle for the operation to cancel. 976 * @param query Handle for the operation to cancel.
diff --git a/src/psycstore/gnunet-service-psycstore.c b/src/psycstore/gnunet-service-psycstore.c
index 128bfd46c..a00d653b0 100644
--- a/src/psycstore/gnunet-service-psycstore.c
+++ b/src/psycstore/gnunet-service-psycstore.c
@@ -86,7 +86,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
86} 86}
87 87
88 88
89/** 89/**
90 * Send a result code back to the client. 90 * Send a result code back to the client.
91 * 91 *
92 * @param client Client that should receive the result code. 92 * @param client Client that should receive the result code.
diff --git a/src/psycstore/plugin_psycstore_sqlite.c b/src/psycstore/plugin_psycstore_sqlite.c
index 592eaf384..adc52c254 100644
--- a/src/psycstore/plugin_psycstore_sqlite.c
+++ b/src/psycstore/plugin_psycstore_sqlite.c
@@ -610,13 +610,13 @@ database_shutdown (struct Plugin *plugin)
610 GNUNET_free_non_null (plugin->fn); 610 GNUNET_free_non_null (plugin->fn);
611} 611}
612 612
613/** 613/**
614 * Execute a prepared statement with a @a channel_key argument. 614 * Execute a prepared statement with a @a channel_key argument.
615 * 615 *
616 * @param plugin Plugin handle. 616 * @param plugin Plugin handle.
617 * @param stmt Statement to execute. 617 * @param stmt Statement to execute.
618 * @param channel_key Public key of the channel. 618 * @param channel_key Public key of the channel.
619 * 619 *
620 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 620 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
621 */ 621 */
622static int 622static int
@@ -778,7 +778,7 @@ slave_key_store (struct Plugin *plugin,
778} 778}
779 779
780 780
781/** 781/**
782 * Store join/leave events for a PSYC channel in order to be able to answer 782 * Store join/leave events for a PSYC channel in order to be able to answer
783 * membership test queries later. 783 * membership test queries later.
784 * 784 *
@@ -840,11 +840,11 @@ membership_store (void *cls,
840 return GNUNET_OK; 840 return GNUNET_OK;
841} 841}
842 842
843/** 843/**
844 * Test if a member was admitted to the channel at the given message ID. 844 * Test if a member was admitted to the channel at the given message ID.
845 * 845 *
846 * @see GNUNET_PSYCSTORE_membership_test() 846 * @see GNUNET_PSYCSTORE_membership_test()
847 * 847 *
848 * @return #GNUNET_YES if the member was admitted, #GNUNET_NO if not, 848 * @return #GNUNET_YES if the member was admitted, #GNUNET_NO if not,
849 * #GNUNET_SYSERR if there was en error. 849 * #GNUNET_SYSERR if there was en error.
850 */ 850 */
@@ -888,11 +888,11 @@ membership_test (void *cls,
888 return ret; 888 return ret;
889} 889}
890 890
891/** 891/**
892 * Store a message fragment sent to a channel. 892 * Store a message fragment sent to a channel.
893 * 893 *
894 * @see GNUNET_PSYCSTORE_fragment_store() 894 * @see GNUNET_PSYCSTORE_fragment_store()
895 * 895 *
896 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 896 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
897 */ 897 */
898static int 898static int
@@ -961,11 +961,11 @@ fragment_store (void *cls,
961 return GNUNET_OK; 961 return GNUNET_OK;
962} 962}
963 963
964/** 964/**
965 * Set additional flags for a given message. 965 * Set additional flags for a given message.
966 * 966 *
967 * They are OR'd with any existing flags set. 967 * They are OR'd with any existing flags set.
968 * 968 *
969 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 969 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
970 */ 970 */
971static int 971static int
@@ -1036,11 +1036,11 @@ fragment_row (sqlite3_stmt *stmt, GNUNET_PSYCSTORE_FragmentCallback cb,
1036 return cb (cb_cls, (void *) msg, sqlite3_column_int64 (stmt, 8)); 1036 return cb (cb_cls, (void *) msg, sqlite3_column_int64 (stmt, 8));
1037} 1037}
1038 1038
1039/** 1039/**
1040 * Retrieve a message fragment by fragment ID. 1040 * Retrieve a message fragment by fragment ID.
1041 * 1041 *
1042 * @see GNUNET_PSYCSTORE_fragment_get() 1042 * @see GNUNET_PSYCSTORE_fragment_get()
1043 * 1043 *
1044 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 1044 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
1045 */ 1045 */
1046static int 1046static int
@@ -1087,11 +1087,11 @@ fragment_get (void *cls,
1087 return ret; 1087 return ret;
1088} 1088}
1089 1089
1090/** 1090/**
1091 * Retrieve all fragments of a message. 1091 * Retrieve all fragments of a message.
1092 * 1092 *
1093 * @see GNUNET_PSYCSTORE_message_get() 1093 * @see GNUNET_PSYCSTORE_message_get()
1094 * 1094 *
1095 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 1095 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
1096 */ 1096 */
1097static int 1097static int
@@ -1150,12 +1150,12 @@ message_get (void *cls,
1150 return ret; 1150 return ret;
1151} 1151}
1152 1152
1153/** 1153/**
1154 * Retrieve a fragment of message specified by its message ID and fragment 1154 * Retrieve a fragment of message specified by its message ID and fragment
1155 * offset. 1155 * offset.
1156 * 1156 *
1157 * @see GNUNET_PSYCSTORE_message_get_fragment() 1157 * @see GNUNET_PSYCSTORE_message_get_fragment()
1158 * 1158 *
1159 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 1159 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
1160 */ 1160 */
1161static int 1161static int
@@ -1204,11 +1204,11 @@ message_get_fragment (void *cls,
1204 return ret; 1204 return ret;
1205} 1205}
1206 1206
1207/** 1207/**
1208 * Retrieve the max. values of message counters for a channel. 1208 * Retrieve the max. values of message counters for a channel.
1209 * 1209 *
1210 * @see GNUNET_PSYCSTORE_counters_get() 1210 * @see GNUNET_PSYCSTORE_counters_get()
1211 * 1211 *
1212 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 1212 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
1213 */ 1213 */
1214static int 1214static int
@@ -1257,11 +1257,11 @@ counters_message_get (void *cls,
1257 return ret; 1257 return ret;
1258} 1258}
1259 1259
1260/** 1260/**
1261 * Retrieve the max. values of state counters for a channel. 1261 * Retrieve the max. values of state counters for a channel.
1262 * 1262 *
1263 * @see GNUNET_PSYCSTORE_counters_get() 1263 * @see GNUNET_PSYCSTORE_counters_get()
1264 * 1264 *
1265 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 1265 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
1266 */ 1266 */
1267static int 1267static int
@@ -1307,9 +1307,9 @@ counters_state_get (void *cls,
1307} 1307}
1308 1308
1309 1309
1310/** 1310/**
1311 * Set a state variable to the given value. 1311 * Set a state variable to the given value.
1312 * 1312 *
1313 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 1313 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
1314 */ 1314 */
1315static int 1315static int
@@ -1440,11 +1440,11 @@ state_modify_begin (void *cls,
1440} 1440}
1441 1441
1442 1442
1443/** 1443/**
1444 * Set the current value of state variable. 1444 * Set the current value of state variable.
1445 * 1445 *
1446 * @see GNUNET_PSYCSTORE_state_modify() 1446 * @see GNUNET_PSYCSTORE_state_modify()
1447 * 1447 *
1448 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 1448 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
1449 */ 1449 */
1450static int 1450static int
@@ -1494,11 +1494,11 @@ state_sync_begin (void *cls,
1494} 1494}
1495 1495
1496 1496
1497/** 1497/**
1498 * Set the current value of state variable. 1498 * Set the current value of state variable.
1499 * 1499 *
1500 * @see GNUNET_PSYCSTORE_state_modify() 1500 * @see GNUNET_PSYCSTORE_state_modify()
1501 * 1501 *
1502 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 1502 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
1503 */ 1503 */
1504static int 1504static int
@@ -1539,11 +1539,11 @@ state_sync_end (void *cls,
1539} 1539}
1540 1540
1541 1541
1542/** 1542/**
1543 * Reset the state of a channel. 1543 * Reset the state of a channel.
1544 * 1544 *
1545 * @see GNUNET_PSYCSTORE_state_reset() 1545 * @see GNUNET_PSYCSTORE_state_reset()
1546 * 1546 *
1547 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 1547 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
1548 */ 1548 */
1549static int 1549static int
@@ -1554,11 +1554,11 @@ state_reset (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key
1554} 1554}
1555 1555
1556 1556
1557/** 1557/**
1558 * Update signed values of state variables in the state store. 1558 * Update signed values of state variables in the state store.
1559 * 1559 *
1560 * @see GNUNET_PSYCSTORE_state_hash_update() 1560 * @see GNUNET_PSYCSTORE_state_hash_update()
1561 * 1561 *
1562 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 1562 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
1563 */ 1563 */
1564static int 1564static int
@@ -1570,11 +1570,11 @@ state_update_signed (void *cls,
1570} 1570}
1571 1571
1572 1572
1573/** 1573/**
1574 * Retrieve a state variable by name. 1574 * Retrieve a state variable by name.
1575 * 1575 *
1576 * @see GNUNET_PSYCSTORE_state_get() 1576 * @see GNUNET_PSYCSTORE_state_get()
1577 * 1577 *
1578 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 1578 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
1579 */ 1579 */
1580static int 1580static int
@@ -1621,11 +1621,11 @@ state_get (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
1621} 1621}
1622 1622
1623 1623
1624/** 1624/**
1625 * Retrieve all state variables for a channel with the given prefix. 1625 * Retrieve all state variables for a channel with the given prefix.
1626 * 1626 *
1627 * @see GNUNET_PSYCSTORE_state_get_prefix() 1627 * @see GNUNET_PSYCSTORE_state_get_prefix()
1628 * 1628 *
1629 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 1629 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
1630 */ 1630 */
1631static int 1631static int
@@ -1688,11 +1688,11 @@ state_get_prefix (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channe
1688} 1688}
1689 1689
1690 1690
1691/** 1691/**
1692 * Retrieve all signed state variables for a channel. 1692 * Retrieve all signed state variables for a channel.
1693 * 1693 *
1694 * @see GNUNET_PSYCSTORE_state_get_signed() 1694 * @see GNUNET_PSYCSTORE_state_get_signed()
1695 * 1695 *
1696 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 1696 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
1697 */ 1697 */
1698static int 1698static int
@@ -1748,7 +1748,7 @@ state_get_signed (void *cls,
1748} 1748}
1749 1749
1750 1750
1751/** 1751/**
1752 * Entry point for the plugin. 1752 * Entry point for the plugin.
1753 * 1753 *
1754 * @param cls The struct GNUNET_CONFIGURATION_Handle. 1754 * @param cls The struct GNUNET_CONFIGURATION_Handle.
diff --git a/src/psycstore/psycstore_api.c b/src/psycstore/psycstore_api.c
index 2b8c9305e..0e72d9ca2 100644
--- a/src/psycstore/psycstore_api.c
+++ b/src/psycstore/psycstore_api.c
@@ -37,7 +37,7 @@
37 37
38typedef void (*DataCallback) (); 38typedef void (*DataCallback) ();
39 39
40/** 40/**
41 * Handle for an operation with the PSYCstore service. 41 * Handle for an operation with the PSYCstore service.
42 */ 42 */
43struct GNUNET_PSYCSTORE_OperationHandle 43struct GNUNET_PSYCSTORE_OperationHandle
@@ -162,9 +162,9 @@ get_next_op_id (struct GNUNET_PSYCSTORE_Handle *h)
162} 162}
163 163
164 164
165/** 165/**
166 * Find operation by ID. 166 * Find operation by ID.
167 * 167 *
168 * @return OperationHandle if found, or NULL otherwise. 168 * @return OperationHandle if found, or NULL otherwise.
169 */ 169 */
170static struct GNUNET_PSYCSTORE_OperationHandle * 170static struct GNUNET_PSYCSTORE_OperationHandle *
@@ -634,7 +634,7 @@ GNUNET_PSYCSTORE_operation_cancel (struct GNUNET_PSYCSTORE_OperationHandle *op)
634} 634}
635 635
636 636
637/** 637/**
638 * Store join/leave events for a PSYC channel in order to be able to answer 638 * Store join/leave events for a PSYC channel in order to be able to answer
639 * membership test queries later. 639 * membership test queries later.
640 * 640 *
@@ -699,7 +699,7 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h,
699} 699}
700 700
701 701
702/** 702/**
703 * Test if a member was admitted to the channel at the given message ID. 703 * Test if a member was admitted to the channel at the given message ID.
704 * 704 *
705 * This is useful when relaying and replaying messages to check if a particular 705 * This is useful when relaying and replaying messages to check if a particular
@@ -754,7 +754,7 @@ GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h,
754} 754}
755 755
756 756
757/** 757/**
758 * Store a message fragment sent to a channel. 758 * Store a message fragment sent to a channel.
759 * 759 *
760 * @param h Handle for the PSYCstore. 760 * @param h Handle for the PSYCstore.
@@ -764,7 +764,7 @@ GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h,
764 * state modifiers. 764 * state modifiers.
765 * @param rcb Callback to call with the result of the operation. 765 * @param rcb Callback to call with the result of the operation.
766 * @param rcb_cls Closure for the callback. 766 * @param rcb_cls Closure for the callback.
767 * 767 *
768 * @return Handle that can be used to cancel the operation. 768 * @return Handle that can be used to cancel the operation.
769 */ 769 */
770struct GNUNET_PSYCSTORE_OperationHandle * 770struct GNUNET_PSYCSTORE_OperationHandle *
@@ -801,7 +801,7 @@ GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h,
801} 801}
802 802
803 803
804/** 804/**
805 * Retrieve a message fragment by fragment ID. 805 * Retrieve a message fragment by fragment ID.
806 * 806 *
807 * @param h Handle for the PSYCstore. 807 * @param h Handle for the PSYCstore.
@@ -810,7 +810,7 @@ GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h,
810 * @param fcb Callback to call with the retrieved fragments. 810 * @param fcb Callback to call with the retrieved fragments.
811 * @param rcb Callback to call with the result of the operation. 811 * @param rcb Callback to call with the result of the operation.
812 * @param cls Closure for the callbacks. 812 * @param cls Closure for the callbacks.
813 * 813 *
814 * @return Handle that can be used to cancel the operation. 814 * @return Handle that can be used to cancel the operation.
815 */ 815 */
816struct GNUNET_PSYCSTORE_OperationHandle * 816struct GNUNET_PSYCSTORE_OperationHandle *
@@ -846,7 +846,7 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h,
846} 846}
847 847
848 848
849/** 849/**
850 * Retrieve all fragments of a message. 850 * Retrieve all fragments of a message.
851 * 851 *
852 * @param h Handle for the PSYCstore. 852 * @param h Handle for the PSYCstore.
@@ -855,7 +855,7 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h,
855 * @param fcb Callback to call with the retrieved fragments. 855 * @param fcb Callback to call with the retrieved fragments.
856 * @param rcb Callback to call with the result of the operation. 856 * @param rcb Callback to call with the result of the operation.
857 * @param cls Closure for the callbacks. 857 * @param cls Closure for the callbacks.
858 * 858 *
859 * @return Handle that can be used to cancel the operation. 859 * @return Handle that can be used to cancel the operation.
860 */ 860 */
861struct GNUNET_PSYCSTORE_OperationHandle * 861struct GNUNET_PSYCSTORE_OperationHandle *
@@ -891,7 +891,7 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
891} 891}
892 892
893 893
894/** 894/**
895 * Retrieve a fragment of message specified by its message ID and fragment 895 * Retrieve a fragment of message specified by its message ID and fragment
896 * offset. 896 * offset.
897 * 897 *
@@ -902,7 +902,7 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
902 * @param fcb Callback to call with the retrieved fragments. 902 * @param fcb Callback to call with the retrieved fragments.
903 * @param rcb Callback to call with the result of the operation. 903 * @param rcb Callback to call with the result of the operation.
904 * @param cls Closure for the callbacks. 904 * @param cls Closure for the callbacks.
905 * 905 *
906 * @return Handle that can be used to cancel the operation. 906 * @return Handle that can be used to cancel the operation.
907 */ 907 */
908struct GNUNET_PSYCSTORE_OperationHandle * 908struct GNUNET_PSYCSTORE_OperationHandle *
@@ -940,7 +940,7 @@ GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h,
940} 940}
941 941
942 942
943/** 943/**
944 * Retrieve latest values of counters for a channel master. 944 * Retrieve latest values of counters for a channel master.
945 * 945 *
946 * The current value of counters are needed when a channel master is restarted, 946 * The current value of counters are needed when a channel master is restarted,
@@ -950,7 +950,7 @@ GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h,
950 * @param channel_key Public key that identifies the channel. 950 * @param channel_key Public key that identifies the channel.
951 * @param mccb Callback to call with the result. 951 * @param mccb Callback to call with the result.
952 * @param mccb_cls Closure for the callback. 952 * @param mccb_cls Closure for the callback.
953 * 953 *
954 * @return Handle that can be used to cancel the operation. 954 * @return Handle that can be used to cancel the operation.
955 */ 955 */
956struct GNUNET_PSYCSTORE_OperationHandle * 956struct GNUNET_PSYCSTORE_OperationHandle *
@@ -982,7 +982,7 @@ GNUNET_PSYCSTORE_counters_get (struct GNUNET_PSYCSTORE_Handle *h,
982} 982}
983 983
984 984
985/** 985/**
986 * Apply modifiers of a message to the current channel state. 986 * Apply modifiers of a message to the current channel state.
987 * 987 *
988 * An error is returned if there are missing messages containing state 988 * An error is returned if there are missing messages containing state
@@ -996,7 +996,7 @@ GNUNET_PSYCSTORE_counters_get (struct GNUNET_PSYCSTORE_Handle *h,
996 * @param modifiers List of modifiers to apply. 996 * @param modifiers List of modifiers to apply.
997 * @param rcb Callback to call with the result of the operation. 997 * @param rcb Callback to call with the result of the operation.
998 * @param rcb_cls Closure for the callback. 998 * @param rcb_cls Closure for the callback.
999 * 999 *
1000 * @return Handle that can be used to cancel the operation. 1000 * @return Handle that can be used to cancel the operation.
1001 */ 1001 */
1002struct GNUNET_PSYCSTORE_OperationHandle * 1002struct GNUNET_PSYCSTORE_OperationHandle *
@@ -1055,7 +1055,7 @@ GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h,
1055} 1055}
1056 1056
1057 1057
1058/** 1058/**
1059 * Store synchronized state. 1059 * Store synchronized state.
1060 * 1060 *
1061 * @param h Handle for the PSYCstore. 1061 * @param h Handle for the PSYCstore.
@@ -1065,7 +1065,7 @@ GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h,
1065 * @param modifiers Full state to store. 1065 * @param modifiers Full state to store.
1066 * @param rcb Callback to call with the result of the operation. 1066 * @param rcb Callback to call with the result of the operation.
1067 * @param rcb_cls Closure for the callback. 1067 * @param rcb_cls Closure for the callback.
1068 * 1068 *
1069 * @return Handle that can be used to cancel the operation. 1069 * @return Handle that can be used to cancel the operation.
1070 */ 1070 */
1071struct GNUNET_PSYCSTORE_OperationHandle * 1071struct GNUNET_PSYCSTORE_OperationHandle *
@@ -1118,7 +1118,7 @@ GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h,
1118} 1118}
1119 1119
1120 1120
1121/** 1121/**
1122 * Reset the state of a channel. 1122 * Reset the state of a channel.
1123 * 1123 *
1124 * Delete all state variables stored for the given channel. 1124 * Delete all state variables stored for the given channel.
@@ -1127,7 +1127,7 @@ GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h,
1127 * @param channel_key The channel we are interested in. 1127 * @param channel_key The channel we are interested in.
1128 * @param rcb Callback to call with the result of the operation. 1128 * @param rcb Callback to call with the result of the operation.
1129 * @param rcb_cls Closure for the callback. 1129 * @param rcb_cls Closure for the callback.
1130 * 1130 *
1131 * @return Handle that can be used to cancel the operation. 1131 * @return Handle that can be used to cancel the operation.
1132 */ 1132 */
1133struct GNUNET_PSYCSTORE_OperationHandle * 1133struct GNUNET_PSYCSTORE_OperationHandle *
@@ -1161,7 +1161,7 @@ GNUNET_PSYCSTORE_state_reset (struct GNUNET_PSYCSTORE_Handle *h,
1161 1161
1162 1162
1163 1163
1164/** 1164/**
1165 * Update signed values of state variables in the state store. 1165 * Update signed values of state variables in the state store.
1166 * 1166 *
1167 * @param h Handle for the PSYCstore. 1167 * @param h Handle for the PSYCstore.
@@ -1204,7 +1204,7 @@ GNUNET_PSYCSTORE_state_hash_update (struct GNUNET_PSYCSTORE_Handle *h,
1204} 1204}
1205 1205
1206 1206
1207/** 1207/**
1208 * Retrieve the best matching state variable. 1208 * Retrieve the best matching state variable.
1209 * 1209 *
1210 * @param h Handle for the PSYCstore. 1210 * @param h Handle for the PSYCstore.
@@ -1213,7 +1213,7 @@ GNUNET_PSYCSTORE_state_hash_update (struct GNUNET_PSYCSTORE_Handle *h,
1213 * @param scb Callback to return the matching state variable. 1213 * @param scb Callback to return the matching state variable.
1214 * @param rcb Callback to call with the result of the operation. 1214 * @param rcb Callback to call with the result of the operation.
1215 * @param cls Closure for the callbacks. 1215 * @param cls Closure for the callbacks.
1216 * 1216 *
1217 * @return Handle that can be used to cancel the operation. 1217 * @return Handle that can be used to cancel the operation.
1218 */ 1218 */
1219struct GNUNET_PSYCSTORE_OperationHandle * 1219struct GNUNET_PSYCSTORE_OperationHandle *
@@ -1251,7 +1251,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h,
1251 1251
1252 1252
1253 1253
1254/** 1254/**
1255 * Retrieve all state variables for a channel with the given prefix. 1255 * Retrieve all state variables for a channel with the given prefix.
1256 * 1256 *
1257 * @param h Handle for the PSYCstore. 1257 * @param h Handle for the PSYCstore.
@@ -1260,7 +1260,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h,
1260 * @param scb Callback to return matching state variables. 1260 * @param scb Callback to return matching state variables.
1261 * @param rcb Callback to call with the result of the operation. 1261 * @param rcb Callback to call with the result of the operation.
1262 * @param cls Closure for the callbacks. 1262 * @param cls Closure for the callbacks.
1263 * 1263 *
1264 * @return Handle that can be used to cancel the operation. 1264 * @return Handle that can be used to cancel the operation.
1265 */ 1265 */
1266struct GNUNET_PSYCSTORE_OperationHandle * 1266struct GNUNET_PSYCSTORE_OperationHandle *
diff --git a/src/pt/gnunet-daemon-pt.c b/src/pt/gnunet-daemon-pt.c
index 1d9abf81a..f10274328 100644
--- a/src/pt/gnunet-daemon-pt.c
+++ b/src/pt/gnunet-daemon-pt.c
@@ -64,7 +64,7 @@ enum RequestGroup
64 /** 64 /**
65 * DNS answers 65 * DNS answers
66 */ 66 */
67 ANSWERS = 0, 67 ANSWERS = 0,
68 68
69 /** 69 /**
70 * DNS authority records 70 * DNS authority records
@@ -92,7 +92,7 @@ struct ReplyContext
92 * Handle to submit the final result. 92 * Handle to submit the final result.
93 */ 93 */
94 struct GNUNET_DNS_RequestHandle *rh; 94 struct GNUNET_DNS_RequestHandle *rh;
95 95
96 /** 96 /**
97 * DNS packet that is being modified. 97 * DNS packet that is being modified.
98 */ 98 */
@@ -117,7 +117,7 @@ struct ReplyContext
117 * Group that is being modified 117 * Group that is being modified
118 */ 118 */
119 enum RequestGroup group; 119 enum RequestGroup group;
120 120
121}; 121};
122 122
123 123
@@ -144,7 +144,7 @@ struct MeshExit
144 * not initialze a tunnel to this peer yet. 144 * not initialze a tunnel to this peer yet.
145 */ 145 */
146 struct GNUNET_MESH_Tunnel *mesh_tunnel; 146 struct GNUNET_MESH_Tunnel *mesh_tunnel;
147 147
148 /** 148 /**
149 * At what time did the peer's advertisement expire? 149 * At what time did the peer's advertisement expire?
150 */ 150 */
@@ -177,7 +177,7 @@ struct MeshExit
177 177
178 /** 178 /**
179 * Identity of the peer that is providing the exit for us. 179 * Identity of the peer that is providing the exit for us.
180 */ 180 */
181 struct GNUNET_PeerIdentity peer; 181 struct GNUNET_PeerIdentity peer;
182 182
183 /** 183 /**
@@ -218,7 +218,7 @@ struct RequestContext
218 * Handle for interaction with DNS service. 218 * Handle for interaction with DNS service.
219 */ 219 */
220 struct GNUNET_DNS_RequestHandle *rh; 220 struct GNUNET_DNS_RequestHandle *rh;
221 221
222 /** 222 /**
223 * Message we're sending out via MESH, allocated at the 223 * Message we're sending out via MESH, allocated at the
224 * end of this struct. 224 * end of this struct.
@@ -243,7 +243,7 @@ struct RequestContext
243 /** 243 /**
244 * #GNUNET_NO if this request is still in the transmit_queue, 244 * #GNUNET_NO if this request is still in the transmit_queue,
245 * #GNUNET_YES if we are in the receive_queue. 245 * #GNUNET_YES if we are in the receive_queue.
246 */ 246 */
247 int16_t was_transmitted; 247 int16_t was_transmitted;
248 248
249}; 249};
@@ -388,7 +388,7 @@ get_tunnel_weight (struct MeshExit *exit)
388 uint32_t dropped; 388 uint32_t dropped;
389 uint32_t drop_percent; 389 uint32_t drop_percent;
390 uint32_t good_percent; 390 uint32_t good_percent;
391 391
392 GNUNET_assert (exit->num_transmitted >= exit->num_answered); 392 GNUNET_assert (exit->num_transmitted >= exit->num_answered);
393 dropped = exit->num_transmitted - exit->num_answered; 393 dropped = exit->num_transmitted - exit->num_answered;
394 if (exit->num_transmitted > 0) 394 if (exit->num_transmitted > 0)
@@ -408,7 +408,7 @@ get_tunnel_weight (struct MeshExit *exit)
408 408
409/** 409/**
410 * Choose a mesh exit for a DNS request. We try to use a tunnel 410 * Choose a mesh exit for a DNS request. We try to use a tunnel
411 * that is reliable and currently available. All existing 411 * that is reliable and currently available. All existing
412 * tunnels are given a base weight of 1, plus a score relating 412 * tunnels are given a base weight of 1, plus a score relating
413 * to the total number of queries answered in relation to the 413 * to the total number of queries answered in relation to the
414 * total number of queries we sent to that tunnel. That 414 * total number of queries we sent to that tunnel. That
@@ -520,7 +520,7 @@ submit_request (struct ReplyContext *rc);
520 * will match 'result_af' from the request 520 * will match 'result_af' from the request
521 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af') 521 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af')
522 * that the VPN allocated for the redirection; 522 * that the VPN allocated for the redirection;
523 * traffic to this IP will now be redirected to the 523 * traffic to this IP will now be redirected to the
524 * specified target peer; NULL on error 524 * specified target peer; NULL on error
525 */ 525 */
526static void 526static void
@@ -633,7 +633,7 @@ submit_request (struct ReplyContext *rc)
633 finish_request (rc); 633 finish_request (rc);
634 return; 634 return;
635 default: 635 default:
636 GNUNET_assert (0); 636 GNUNET_assert (0);
637 } 637 }
638 for (i=rc->offset;i<ra_len;i++) 638 for (i=rc->offset;i<ra_len;i++)
639 { 639 {
@@ -694,7 +694,7 @@ work_test (const struct GNUNET_DNSPARSER_Record *ra,
694 694
695 695
696/** 696/**
697 * This function is called AFTER we got an IP address for a 697 * This function is called AFTER we got an IP address for a
698 * DNS request. Now, the PT daemon has the chance to substitute 698 * DNS request. Now, the PT daemon has the chance to substitute
699 * the IP address with one from the VPN range to tunnel requests 699 * the IP address with one from the VPN range to tunnel requests
700 * destined for this IP address via VPN and MESH. 700 * destined for this IP address via VPN and MESH.
@@ -704,7 +704,7 @@ work_test (const struct GNUNET_DNSPARSER_Record *ra,
704 * @param request_length number of bytes in request 704 * @param request_length number of bytes in request
705 * @param request udp payload of the DNS request 705 * @param request udp payload of the DNS request
706 */ 706 */
707static void 707static void
708dns_post_request_handler (void *cls, 708dns_post_request_handler (void *cls,
709 struct GNUNET_DNS_RequestHandle *rh, 709 struct GNUNET_DNS_RequestHandle *rh,
710 size_t request_length, 710 size_t request_length,
@@ -809,7 +809,7 @@ timeout_request (void *cls,
809{ 809{
810 struct RequestContext *rc = cls; 810 struct RequestContext *rc = cls;
811 struct MeshExit *exit = rc->exit; 811 struct MeshExit *exit = rc->exit;
812 812
813 if (rc->was_transmitted) 813 if (rc->was_transmitted)
814 { 814 {
815 exit->num_transmitted++; 815 exit->num_transmitted++;
@@ -844,7 +844,7 @@ timeout_request (void *cls,
844 exit_tail, 844 exit_tail,
845 exit); 845 exit);
846 /* go back to semi-innocent: mark as not great, but 846 /* go back to semi-innocent: mark as not great, but
847 avoid a prohibitively negative score (see 847 avoid a prohibitively negative score (see
848 #get_tunnel_weight, which checks for a certain 848 #get_tunnel_weight, which checks for a certain
849 minimum number of transmissions before making 849 minimum number of transmissions before making
850 up an opinion) */ 850 up an opinion) */
@@ -858,7 +858,7 @@ timeout_request (void *cls,
858 858
859 859
860/** 860/**
861 * This function is called *before* the DNS request has been 861 * This function is called *before* the DNS request has been
862 * given to a "local" DNS resolver. Tunneling for DNS requests 862 * given to a "local" DNS resolver. Tunneling for DNS requests
863 * was enabled, so we now need to send the request via some MESH 863 * was enabled, so we now need to send the request via some MESH
864 * tunnel to a DNS EXIT for resolution. 864 * tunnel to a DNS EXIT for resolution.
@@ -868,7 +868,7 @@ timeout_request (void *cls,
868 * @param request_length number of bytes in request 868 * @param request_length number of bytes in request
869 * @param request udp payload of the DNS request 869 * @param request udp payload of the DNS request
870 */ 870 */
871static void 871static void
872dns_pre_request_handler (void *cls, 872dns_pre_request_handler (void *cls,
873 struct GNUNET_DNS_RequestHandle *rh, 873 struct GNUNET_DNS_RequestHandle *rh,
874 size_t request_length, 874 size_t request_length,
@@ -943,7 +943,7 @@ dns_pre_request_handler (void *cls,
943 * #GNUNET_SYSERR to close it (signal serious error) 943 * #GNUNET_SYSERR to close it (signal serious error)
944 */ 944 */
945static int 945static int
946receive_dns_response (void *cls, 946receive_dns_response (void *cls,
947 struct GNUNET_MESH_Tunnel *tunnel, 947 struct GNUNET_MESH_Tunnel *tunnel,
948 void **tunnel_ctx, 948 void **tunnel_ctx,
949 const struct GNUNET_MessageHeader *message) 949 const struct GNUNET_MessageHeader *message)
@@ -979,7 +979,7 @@ receive_dns_response (void *cls,
979 GNUNET_free (rc); 979 GNUNET_free (rc);
980 exit->num_answered++; 980 exit->num_answered++;
981 exit->num_transmitted++; 981 exit->num_transmitted++;
982 return GNUNET_OK; 982 return GNUNET_OK;
983 } 983 }
984 } 984 }
985 GNUNET_STATISTICS_update (stats, 985 GNUNET_STATISTICS_update (stats,
@@ -993,7 +993,7 @@ receive_dns_response (void *cls,
993 * Abort all pending DNS requests with the given mesh exit. 993 * Abort all pending DNS requests with the given mesh exit.
994 * 994 *
995 * @param exit mesh exit to abort requests for 995 * @param exit mesh exit to abort requests for
996 */ 996 */
997static void 997static void
998abort_all_requests (struct MeshExit *exit) 998abort_all_requests (struct MeshExit *exit)
999{ 999{
@@ -1006,7 +1006,7 @@ abort_all_requests (struct MeshExit *exit)
1006 rc); 1006 rc);
1007 GNUNET_DNS_request_drop (rc->rh); 1007 GNUNET_DNS_request_drop (rc->rh);
1008 GNUNET_SCHEDULER_cancel (rc->timeout_task); 1008 GNUNET_SCHEDULER_cancel (rc->timeout_task);
1009 GNUNET_free (rc); 1009 GNUNET_free (rc);
1010 } 1010 }
1011 while (NULL != (rc = exit->transmit_queue_head)) 1011 while (NULL != (rc = exit->transmit_queue_head))
1012 { 1012 {
@@ -1015,7 +1015,7 @@ abort_all_requests (struct MeshExit *exit)
1015 rc); 1015 rc);
1016 GNUNET_DNS_request_drop (rc->rh); 1016 GNUNET_DNS_request_drop (rc->rh);
1017 GNUNET_SCHEDULER_cancel (rc->timeout_task); 1017 GNUNET_SCHEDULER_cancel (rc->timeout_task);
1018 GNUNET_free (rc); 1018 GNUNET_free (rc);
1019 } 1019 }
1020} 1020}
1021 1021
@@ -1093,7 +1093,7 @@ cleanup (void *cls,
1093/** 1093/**
1094 * Function called whenever a tunnel is destroyed. Should clean up 1094 * Function called whenever a tunnel is destroyed. Should clean up
1095 * the associated state and attempt to build a new one. 1095 * the associated state and attempt to build a new one.
1096 * 1096 *
1097 * It must NOT call #GNUNET_MESH_tunnel_destroy on the tunnel. 1097 * It must NOT call #GNUNET_MESH_tunnel_destroy on the tunnel.
1098 * 1098 *
1099 * @param cls closure (the `struct MeshExit` set from #GNUNET_MESH_connect) 1099 * @param cls closure (the `struct MeshExit` set from #GNUNET_MESH_connect)
@@ -1103,12 +1103,12 @@ cleanup (void *cls,
1103 */ 1103 */
1104static void 1104static void
1105mesh_tunnel_end_cb (void *cls, 1105mesh_tunnel_end_cb (void *cls,
1106 const struct GNUNET_MESH_Tunnel *tunnel, 1106 const struct GNUNET_MESH_Tunnel *tunnel,
1107 void *tunnel_ctx) 1107 void *tunnel_ctx)
1108{ 1108{
1109 struct MeshExit *exit = tunnel_ctx; 1109 struct MeshExit *exit = tunnel_ctx;
1110 struct MeshExit *alt; 1110 struct MeshExit *alt;
1111 struct RequestContext *rc; 1111 struct RequestContext *rc;
1112 1112
1113 if (NULL != exit->mesh_th) 1113 if (NULL != exit->mesh_th)
1114 { 1114 {
@@ -1149,7 +1149,7 @@ mesh_tunnel_end_cb (void *cls,
1149 else 1149 else
1150 { 1150 {
1151 /* the same peer was chosen, just make sure the queue processing is restarted */ 1151 /* the same peer was chosen, just make sure the queue processing is restarted */
1152 alt = exit; 1152 alt = exit;
1153 } 1153 }
1154 if ( (NULL == alt->mesh_th) && 1154 if ( (NULL == alt->mesh_th) &&
1155 (NULL != (rc = alt->transmit_queue_head)) ) 1155 (NULL != (rc = alt->transmit_queue_head)) )
@@ -1163,7 +1163,7 @@ mesh_tunnel_end_cb (void *cls,
1163 1163
1164 1164
1165/** 1165/**
1166 * Function called whenever we find an advertisement for a 1166 * Function called whenever we find an advertisement for a
1167 * DNS exit in the DHT. If we don't have a mesh tunnel, 1167 * DNS exit in the DHT. If we don't have a mesh tunnel,
1168 * we should build one; otherwise, we should save the 1168 * we should build one; otherwise, we should save the
1169 * advertisement for later use. 1169 * advertisement for later use.
@@ -1185,7 +1185,7 @@ static void
1185handle_dht_result (void *cls, 1185handle_dht_result (void *cls,
1186 struct GNUNET_TIME_Absolute exp, 1186 struct GNUNET_TIME_Absolute exp,
1187 const struct GNUNET_HashCode *key, 1187 const struct GNUNET_HashCode *key,
1188 const struct GNUNET_PeerIdentity *get_path, 1188 const struct GNUNET_PeerIdentity *get_path,
1189 unsigned int get_path_length, 1189 unsigned int get_path_length,
1190 const struct GNUNET_PeerIdentity *put_path, 1190 const struct GNUNET_PeerIdentity *put_path,
1191 unsigned int put_path_length, 1191 unsigned int put_path_length,
@@ -1201,7 +1201,7 @@ handle_dht_result (void *cls,
1201 return; 1201 return;
1202 } 1202 }
1203 ad = data; 1203 ad = data;
1204 for (exit = exit_head; NULL != exit; exit = exit->next) 1204 for (exit = exit_head; NULL != exit; exit = exit->next)
1205 if (0 == memcmp (&ad->peer, 1205 if (0 == memcmp (&ad->peer,
1206 &exit->peer, 1206 &exit->peer,
1207 sizeof (struct GNUNET_PeerIdentity))) 1207 sizeof (struct GNUNET_PeerIdentity)))
@@ -1240,23 +1240,23 @@ run (void *cls, char *const *args GNUNET_UNUSED,
1240 cfg = cfg_; 1240 cfg = cfg_;
1241 stats = GNUNET_STATISTICS_create ("pt", cfg); 1241 stats = GNUNET_STATISTICS_create ("pt", cfg);
1242 ipv4_pt = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_IPV4"); 1242 ipv4_pt = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_IPV4");
1243 ipv6_pt = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_IPV6"); 1243 ipv6_pt = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_IPV6");
1244 dns_tunnel = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_DNS"); 1244 dns_tunnel = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_DNS");
1245 if (! (ipv4_pt || ipv6_pt || dns_tunnel)) 1245 if (! (ipv4_pt || ipv6_pt || dns_tunnel))
1246 { 1246 {
1247 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1247 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1248 _("No useful service enabled. Exiting.\n")); 1248 _("No useful service enabled. Exiting.\n"));
1249 GNUNET_SCHEDULER_shutdown (); 1249 GNUNET_SCHEDULER_shutdown ();
1250 return; 1250 return;
1251 } 1251 }
1252 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls); 1252 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls);
1253 if (ipv4_pt || ipv6_pt) 1253 if (ipv4_pt || ipv6_pt)
1254 { 1254 {
1255 dns_post_handle 1255 dns_post_handle
1256 = GNUNET_DNS_connect (cfg, 1256 = GNUNET_DNS_connect (cfg,
1257 GNUNET_DNS_FLAG_POST_RESOLUTION, 1257 GNUNET_DNS_FLAG_POST_RESOLUTION,
1258 &dns_post_request_handler, NULL); 1258 &dns_post_request_handler, NULL);
1259 if (NULL == dns_post_handle) 1259 if (NULL == dns_post_handle)
1260 { 1260 {
1261 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1261 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1262 _("Failed to connect to %s service. Exiting.\n"), 1262 _("Failed to connect to %s service. Exiting.\n"),
@@ -1281,11 +1281,11 @@ run (void *cls, char *const *args GNUNET_UNUSED,
1281 {NULL, 0, 0} 1281 {NULL, 0, 0}
1282 }; 1282 };
1283 1283
1284 dns_pre_handle 1284 dns_pre_handle
1285 = GNUNET_DNS_connect (cfg, 1285 = GNUNET_DNS_connect (cfg,
1286 GNUNET_DNS_FLAG_PRE_RESOLUTION, 1286 GNUNET_DNS_FLAG_PRE_RESOLUTION,
1287 &dns_pre_request_handler, NULL); 1287 &dns_pre_request_handler, NULL);
1288 if (NULL == dns_pre_handle) 1288 if (NULL == dns_pre_handle)
1289 { 1289 {
1290 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1290 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1291 _("Failed to connect to %s service. Exiting.\n"), 1291 _("Failed to connect to %s service. Exiting.\n"),
diff --git a/src/pt/test_gns_vpn.c b/src/pt/test_gns_vpn.c
index adf8b7d85..a0b2d926f 100644
--- a/src/pt/test_gns_vpn.c
+++ b/src/pt/test_gns_vpn.c
@@ -217,9 +217,9 @@ curl_main ()
217 } 217 }
218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download complete, shutting down!\n"); 218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download complete, shutting down!\n");
219 do_shutdown (); 219 do_shutdown ();
220 return; 220 return;
221 } 221 }
222 GNUNET_assert (CURLM_OK == curl_multi_fdset (multi, &rs, &ws, &es, &max)); 222 GNUNET_assert (CURLM_OK == curl_multi_fdset (multi, &rs, &ws, &es, &max));
223 if ( (CURLM_OK != curl_multi_timeout (multi, &timeout)) || 223 if ( (CURLM_OK != curl_multi_timeout (multi, &timeout)) ||
224 (-1 == timeout) ) 224 (-1 == timeout) )
225 delay = GNUNET_TIME_UNIT_SECONDS; 225 delay = GNUNET_TIME_UNIT_SECONDS;
@@ -236,14 +236,14 @@ curl_main ()
236 &nrs, 236 &nrs,
237 &nws, 237 &nws,
238 &curl_task, 238 &curl_task,
239 NULL); 239 NULL);
240} 240}
241 241
242 242
243static void 243static void
244start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 244start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
245{ 245{
246 GNUNET_asprintf (&url, 246 GNUNET_asprintf (&url,
247 "http://%s/hello_world", 247 "http://%s/hello_world",
248 TEST_DOMAIN); 248 TEST_DOMAIN);
249 curl = curl_easy_init (); 249 curl = curl_easy_init ();
@@ -280,7 +280,7 @@ disco_ns (void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
280 * will match 'result_af' from the request 280 * will match 'result_af' from the request
281 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af') 281 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af')
282 * that the VPN allocated for the redirection; 282 * that the VPN allocated for the redirection;
283 * traffic to this IP will now be redirected to the 283 * traffic to this IP will now be redirected to the
284 * specified target peer; NULL on error 284 * specified target peer; NULL on error
285 */ 285 */
286static void 286static void
@@ -290,11 +290,11 @@ commence_testing (void *cls, int32_t success, const char *emsg)
290 290
291 if ((emsg != NULL) && (GNUNET_YES != success)) 291 if ((emsg != NULL) && (GNUNET_YES != success))
292 { 292 {
293 fprintf (stderr, 293 fprintf (stderr,
294 "NS failed to create record %s\n", emsg); 294 "NS failed to create record %s\n", emsg);
295 GNUNET_SCHEDULER_shutdown (); 295 GNUNET_SCHEDULER_shutdown ();
296 return; 296 return;
297 } 297 }
298 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), &start_curl, NULL); 298 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), &start_curl, NULL);
299} 299}
300 300
@@ -302,7 +302,7 @@ commence_testing (void *cls, int32_t success, const char *emsg)
302/** 302/**
303 * Function to keep the HTTP server running. 303 * Function to keep the HTTP server running.
304 */ 304 */
305static void 305static void
306mhd_main (void); 306mhd_main (void);
307 307
308 308
@@ -316,7 +316,7 @@ mhd_task (void *cls,
316} 316}
317 317
318 318
319static void 319static void
320mhd_main () 320mhd_main ()
321{ 321{
322 struct GNUNET_NETWORK_FDSet nrs; 322 struct GNUNET_NETWORK_FDSet nrs;
@@ -351,7 +351,7 @@ mhd_main ()
351 &nrs, 351 &nrs,
352 &nws, 352 &nws,
353 &mhd_task, 353 &mhd_task,
354 NULL); 354 NULL);
355} 355}
356 356
357 357
@@ -367,7 +367,7 @@ run (void *cls,
367 struct GNUNET_NAMESTORE_RecordData rd; 367 struct GNUNET_NAMESTORE_RecordData rd;
368 char *rd_string; 368 char *rd_string;
369 char *zone_keyfile; 369 char *zone_keyfile;
370 370
371 GNUNET_TESTING_peer_get_identity (peer, &id); 371 GNUNET_TESTING_peer_get_identity (peer, &id);
372 GNUNET_CRYPTO_hash_to_enc ((struct GNUNET_HashCode*)&id, &peername); 372 GNUNET_CRYPTO_hash_to_enc ((struct GNUNET_HashCode*)&id, &peername);
373 373
@@ -383,7 +383,7 @@ run (void *cls,
383 MHD_OPTION_END); 383 MHD_OPTION_END);
384 GNUNET_assert (NULL != mhd); 384 GNUNET_assert (NULL != mhd);
385 mhd_main (); 385 mhd_main ();
386 386
387 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", 387 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
388 "ZONEKEY", 388 "ZONEKEY",
389 &zone_keyfile)) 389 &zone_keyfile))
@@ -433,7 +433,7 @@ open_dev_null (int target_fd,
433 if (fd == target_fd) 433 if (fd == target_fd)
434 return; 434 return;
435 if (-1 == dup2 (fd, target_fd)) 435 if (-1 == dup2 (fd, target_fd))
436 { 436 {
437 (void) close (fd); 437 (void) close (fd);
438 abort (); 438 abort ();
439 } 439 }
@@ -443,13 +443,13 @@ open_dev_null (int target_fd,
443 443
444/** 444/**
445 * Run the given command and wait for it to complete. 445 * Run the given command and wait for it to complete.
446 * 446 *
447 * @param file name of the binary to run 447 * @param file name of the binary to run
448 * @param cmd command line arguments (as given to 'execv') 448 * @param cmd command line arguments (as given to 'execv')
449 * @return 0 on success, 1 on any error 449 * @return 0 on success, 1 on any error
450 */ 450 */
451static int 451static int
452fork_and_exec (const char *file, 452fork_and_exec (const char *file,
453 char *const cmd[]) 453 char *const cmd[])
454{ 454{
455 int status; 455 int status;
@@ -459,8 +459,8 @@ fork_and_exec (const char *file,
459 pid = fork (); 459 pid = fork ();
460 if (-1 == pid) 460 if (-1 == pid)
461 { 461 {
462 fprintf (stderr, 462 fprintf (stderr,
463 "fork failed: %s\n", 463 "fork failed: %s\n",
464 strerror (errno)); 464 strerror (errno));
465 return 1; 465 return 1;
466 } 466 }
@@ -469,25 +469,25 @@ fork_and_exec (const char *file,
469 /* we are the child process */ 469 /* we are the child process */
470 /* close stdin/stdout to not cause interference 470 /* close stdin/stdout to not cause interference
471 with the helper's main protocol! */ 471 with the helper's main protocol! */
472 (void) close (0); 472 (void) close (0);
473 open_dev_null (0, O_RDONLY); 473 open_dev_null (0, O_RDONLY);
474 (void) close (1); 474 (void) close (1);
475 open_dev_null (1, O_WRONLY); 475 open_dev_null (1, O_WRONLY);
476 (void) execv (file, cmd); 476 (void) execv (file, cmd);
477 /* can only get here on error */ 477 /* can only get here on error */
478 fprintf (stderr, 478 fprintf (stderr,
479 "exec `%s' failed: %s\n", 479 "exec `%s' failed: %s\n",
480 file, 480 file,
481 strerror (errno)); 481 strerror (errno));
482 _exit (1); 482 _exit (1);
483 } 483 }
484 /* keep running waitpid as long as the only error we get is 'EINTR' */ 484 /* keep running waitpid as long as the only error we get is 'EINTR' */
485 while ( (-1 == (ret = waitpid (pid, &status, 0))) && 485 while ( (-1 == (ret = waitpid (pid, &status, 0))) &&
486 (errno == EINTR) ); 486 (errno == EINTR) );
487 if (-1 == ret) 487 if (-1 == ret)
488 { 488 {
489 fprintf (stderr, 489 fprintf (stderr,
490 "waitpid failed: %s\n", 490 "waitpid failed: %s\n",
491 strerror (errno)); 491 strerror (errno));
492 return 1; 492 return 1;
493 } 493 }
@@ -508,19 +508,19 @@ main (int argc, char *const *argv)
508 { 508 {
509 "iptables", "-t", "mangle", "-L", "-v", NULL 509 "iptables", "-t", "mangle", "-L", "-v", NULL
510 }; 510 };
511 511
512 if (0 == access ("/sbin/iptables", X_OK)) 512 if (0 == access ("/sbin/iptables", X_OK))
513 sbin_iptables = "/sbin/iptables"; 513 sbin_iptables = "/sbin/iptables";
514 else if (0 == access ("/usr/sbin/iptables", X_OK)) 514 else if (0 == access ("/usr/sbin/iptables", X_OK))
515 sbin_iptables = "/usr/sbin/iptables"; 515 sbin_iptables = "/usr/sbin/iptables";
516 else 516 else
517 { 517 {
518 fprintf (stderr, 518 fprintf (stderr,
519 "Executable iptables not found in approved directories: %s, skipping\n", 519 "Executable iptables not found in approved directories: %s, skipping\n",
520 strerror (errno)); 520 strerror (errno));
521 return 0; 521 return 0;
522 } 522 }
523 523
524 if (0 != fork_and_exec (sbin_iptables, iptables_args)) 524 if (0 != fork_and_exec (sbin_iptables, iptables_args))
525 { 525 {
526 fprintf (stderr, 526 fprintf (stderr,
@@ -548,20 +548,20 @@ main (int argc, char *const *argv)
548 GNUNET_OS_check_helper_binary (bin_exit, GNUNET_YES, "-d gnunet-vpn - - - 169.1.3.3.7 255.255.255.0")) || //no nat, ipv4 only 548 GNUNET_OS_check_helper_binary (bin_exit, GNUNET_YES, "-d gnunet-vpn - - - 169.1.3.3.7 255.255.255.0")) || //no nat, ipv4 only
549 (GNUNET_YES != 549 (GNUNET_YES !=
550 GNUNET_OS_check_helper_binary (bin_dns, GNUNET_YES, NULL))) ) // TODO: once we have a windows-testcase, add test parameters here 550 GNUNET_OS_check_helper_binary (bin_dns, GNUNET_YES, NULL))) ) // TODO: once we have a windows-testcase, add test parameters here
551 { 551 {
552 fprintf (stderr, 552 fprintf (stderr,
553 "WARNING: gnunet-helper-{exit,vpn,dns} binaries in $PATH are not SUID, refusing to run test (as it would have to fail).\n"); 553 "WARNING: gnunet-helper-{exit,vpn,dns} binaries in $PATH are not SUID, refusing to run test (as it would have to fail).\n");
554 fprintf (stderr, 554 fprintf (stderr,
555 "Change $PATH ('.' in $PATH before $GNUNET_PREFIX/bin is problematic) or permissions (run 'make install' as root) to fix this!\n"); 555 "Change $PATH ('.' in $PATH before $GNUNET_PREFIX/bin is problematic) or permissions (run 'make install' as root) to fix this!\n");
556 GNUNET_free (bin_vpn); 556 GNUNET_free (bin_vpn);
557 GNUNET_free (bin_exit); 557 GNUNET_free (bin_exit);
558 GNUNET_free (bin_dns); 558 GNUNET_free (bin_dns);
559 return 0; 559 return 0;
560 } 560 }
561 GNUNET_free (bin_vpn); 561 GNUNET_free (bin_vpn);
562 GNUNET_free (bin_exit); 562 GNUNET_free (bin_exit);
563 GNUNET_free (bin_dns); 563 GNUNET_free (bin_dns);
564 564
565 dest_ip = "169.254.86.1"; 565 dest_ip = "169.254.86.1";
566 dest_af = AF_INET; 566 dest_af = AF_INET;
567 src_af = AF_INET; 567 src_af = AF_INET;
@@ -570,11 +570,11 @@ main (int argc, char *const *argv)
570 use_v6 = GNUNET_YES; 570 use_v6 = GNUNET_YES;
571 else 571 else
572 use_v6 = GNUNET_NO; 572 use_v6 = GNUNET_NO;
573 573
574 if ( (GNUNET_OK != GNUNET_NETWORK_test_pf (src_af)) || 574 if ( (GNUNET_OK != GNUNET_NETWORK_test_pf (src_af)) ||
575 (GNUNET_OK != GNUNET_NETWORK_test_pf (dest_af)) ) 575 (GNUNET_OK != GNUNET_NETWORK_test_pf (dest_af)) )
576 { 576 {
577 fprintf (stderr, 577 fprintf (stderr,
578 "Required address families not supported by this system, skipping test.\n"); 578 "Required address families not supported by this system, skipping test.\n");
579 return 0; 579 return 0;
580 } 580 }
diff --git a/src/pt/test_gnunet_vpn.c b/src/pt/test_gnunet_vpn.c
index 975cb7ee0..7e83fdcd1 100644
--- a/src/pt/test_gnunet_vpn.c
+++ b/src/pt/test_gnunet_vpn.c
@@ -357,7 +357,7 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
357 struct in6_addr v6; 357 struct in6_addr v6;
358 void *addr; 358 void *addr;
359 enum MHD_FLAG flags; 359 enum MHD_FLAG flags;
360 360
361 vpn = GNUNET_VPN_connect (cfg); 361 vpn = GNUNET_VPN_connect (cfg);
362 GNUNET_assert (NULL != vpn); 362 GNUNET_assert (NULL != vpn);
363 flags = MHD_USE_DEBUG; 363 flags = MHD_USE_DEBUG;
@@ -366,8 +366,8 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
366 mhd = 366 mhd =
367 MHD_start_daemon (flags, PORT, NULL, NULL, &mhd_ahc, NULL, 367 MHD_start_daemon (flags, PORT, NULL, NULL, &mhd_ahc, NULL,
368 MHD_OPTION_END); 368 MHD_OPTION_END);
369 369
370 370
371 GNUNET_assert (NULL != mhd); 371 GNUNET_assert (NULL != mhd);
372 mhd_main (); 372 mhd_main ();
373 addr = NULL; 373 addr = NULL;
@@ -384,7 +384,7 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
384 default: 384 default:
385 GNUNET_assert (0); 385 GNUNET_assert (0);
386 } 386 }
387 rr = GNUNET_VPN_redirect_to_ip (vpn, src_af, dest_af, addr, 387 rr = GNUNET_VPN_redirect_to_ip (vpn, src_af, dest_af, addr,
388 GNUNET_TIME_UNIT_FOREVER_ABS, &allocation_cb, 388 GNUNET_TIME_UNIT_FOREVER_ABS, &allocation_cb,
389 NULL); 389 NULL);
390 ctrl_c_task_id = 390 ctrl_c_task_id =
@@ -436,7 +436,7 @@ main (int argc, char *const *argv)
436 return 1; 436 return 1;
437 } 437 }
438 type++; 438 type++;
439 /* on Windows, .exe is suffixed to these binaries, 439 /* on Windows, .exe is suffixed to these binaries,
440 * thus cease comparison after the 6th char. 440 * thus cease comparison after the 6th char.
441 */ 441 */
442 if (0 == strncmp (type, "4_to_6",6)) 442 if (0 == strncmp (type, "4_to_6",6))
@@ -468,7 +468,7 @@ main (int argc, char *const *argv)
468 fprintf (stderr, "invalid binary suffix `%s'\n", type); 468 fprintf (stderr, "invalid binary suffix `%s'\n", type);
469 return 1; 469 return 1;
470 } 470 }
471 if ((GNUNET_OK != GNUNET_NETWORK_test_pf (src_af)) || 471 if ((GNUNET_OK != GNUNET_NETWORK_test_pf (src_af)) ||
472 (GNUNET_OK != GNUNET_NETWORK_test_pf (dest_af))) 472 (GNUNET_OK != GNUNET_NETWORK_test_pf (dest_af)))
473 { 473 {
474 fprintf (stderr, 474 fprintf (stderr,
@@ -483,8 +483,8 @@ main (int argc, char *const *argv)
483 if (0 != 483 if (0 !=
484 GNUNET_TESTING_peer_run ("test-gnunet-vpn", "test_gnunet_vpn.conf", &run, 484 GNUNET_TESTING_peer_run ("test-gnunet-vpn", "test_gnunet_vpn.conf", &run,
485 NULL)) 485 NULL))
486 return 1; 486 return 1;
487 GNUNET_DISK_directory_remove ("/tmp/gnunet-test-vpn"); 487 GNUNET_DISK_directory_remove ("/tmp/gnunet-test-vpn");
488 return global_ret; 488 return global_ret;
489} 489}
490 490
diff --git a/src/regex/gnunet-daemon-regexprofiler.c b/src/regex/gnunet-daemon-regexprofiler.c
index 0fb47d23a..bcb99aaf5 100644
--- a/src/regex/gnunet-daemon-regexprofiler.c
+++ b/src/regex/gnunet-daemon-regexprofiler.c
@@ -135,7 +135,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
135 135
136/** 136/**
137 * Announce a previously announced regex re-using cached data. 137 * Announce a previously announced regex re-using cached data.
138 * 138 *
139 * @param cls Closure (regex to announce if needed). 139 * @param cls Closure (regex to announce if needed).
140 * @param tc TaskContext. 140 * @param tc TaskContext.
141 */ 141 */
@@ -309,7 +309,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
309 "REANNOUNCE_PERIOD_MAX", 309 "REANNOUNCE_PERIOD_MAX",
310 &reannounce_period_max)) 310 &reannounce_period_max))
311 { 311 {
312 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 312 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
313 "reannounce_period_max not given. Using 10 minutes.\n"); 313 "reannounce_period_max not given. Using 10 minutes.\n");
314 reannounce_period_max = 314 reannounce_period_max =
315 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10); 315 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10);
diff --git a/src/regex/gnunet-regex-profiler.c b/src/regex/gnunet-regex-profiler.c
index 4e55bd1c6..5a7cb9acd 100644
--- a/src/regex/gnunet-regex-profiler.c
+++ b/src/regex/gnunet-regex-profiler.c
@@ -725,7 +725,7 @@ regex_found_handler (void *cls,
725 725
726 if (GNUNET_YES == peer->search_str_matched) 726 if (GNUNET_YES == peer->search_str_matched)
727 { 727 {
728 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 728 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
729 "String %s on peer %u already matched!\n", 729 "String %s on peer %u already matched!\n",
730 peer->search_str, peer->id); 730 peer->search_str, peer->id);
731 return; 731 return;
@@ -824,7 +824,7 @@ search_timed_out (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
824 824
825 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 825 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
826 "Search timed out after %s." 826 "Search timed out after %s."
827 "Collecting stats and shutting down.\n", 827 "Collecting stats and shutting down.\n",
828 GNUNET_STRINGS_relative_time_to_string (search_timeout_time, 828 GNUNET_STRINGS_relative_time_to_string (search_timeout_time,
829 GNUNET_NO)); 829 GNUNET_NO));
830 830
@@ -1008,7 +1008,7 @@ announce_next_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1008 1008
1009 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Starting daemon %u\n", next_search); 1009 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Starting daemon %u\n", next_search);
1010 peer = &peers[next_search]; 1010 peer = &peers[next_search];
1011 peer->daemon_op = 1011 peer->daemon_op =
1012 GNUNET_TESTBED_peer_manage_service (NULL, 1012 GNUNET_TESTBED_peer_manage_service (NULL,
1013 peer->peer_handle, 1013 peer->peer_handle,
1014 "regexprofiler", 1014 "regexprofiler",
@@ -1113,7 +1113,7 @@ dht_da (void *cls, void *op_result)
1113 * @param links_failed the number of overlay link connection attempts that 1113 * @param links_failed the number of overlay link connection attempts that
1114 * failed 1114 * failed
1115 */ 1115 */
1116static void 1116static void
1117test_master (void *cls, 1117test_master (void *cls,
1118 struct GNUNET_TESTBED_RunHandle *h, 1118 struct GNUNET_TESTBED_RunHandle *h,
1119 unsigned int num_peers_, 1119 unsigned int num_peers_,
@@ -1148,7 +1148,7 @@ test_master (void *cls,
1148 settle_time = 1148 settle_time =
1149 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 1149 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
1150 10 * num_peers); 1150 10 * num_peers);
1151 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1151 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1152 "Waiting for DHT for %s to settle new connections.\n\n", 1152 "Waiting for DHT for %s to settle new connections.\n\n",
1153 GNUNET_STRINGS_relative_time_to_string(settle_time, GNUNET_NO)); 1153 GNUNET_STRINGS_relative_time_to_string(settle_time, GNUNET_NO));
1154 GNUNET_SCHEDULER_add_delayed (settle_time, &do_announce, NULL); 1154 GNUNET_SCHEDULER_add_delayed (settle_time, &do_announce, NULL);
@@ -1168,7 +1168,7 @@ test_master (void *cls,
1168 * @param event information on what is happening 1168 * @param event information on what is happening
1169 */ 1169 */
1170static void 1170static void
1171master_controller_cb (void *cls, 1171master_controller_cb (void *cls,
1172 const struct GNUNET_TESTBED_EventInformation *event) 1172 const struct GNUNET_TESTBED_EventInformation *event)
1173{ 1173{
1174 switch (event->type) 1174 switch (event->type)
@@ -1315,7 +1315,7 @@ run (void *cls, char *const *args, const char *cfgfile,
1315 "REANNOUNCE_PERIOD_MAX", 1315 "REANNOUNCE_PERIOD_MAX",
1316 &reannounce_period_max)) 1316 &reannounce_period_max))
1317 { 1317 {
1318 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1318 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1319 "reannounce_period_max not given. Using 10 minutes.\n"); 1319 "reannounce_period_max not given. Using 10 minutes.\n");
1320 reannounce_period_max = 1320 reannounce_period_max =
1321 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10); 1321 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10);
@@ -1424,7 +1424,7 @@ run (void *cls, char *const *args, const char *cfgfile,
1424 "SETUP_TIMEOUT", 1424 "SETUP_TIMEOUT",
1425 &abort_time)) 1425 &abort_time))
1426 { 1426 {
1427 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1427 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1428 "SETUP_TIMEOUT not given. Using 15 minutes.\n"); 1428 "SETUP_TIMEOUT not given. Using 15 minutes.\n");
1429 abort_time = 1429 abort_time =
1430 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15); 1430 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15);
diff --git a/src/regex/gnunet-service-regex.c b/src/regex/gnunet-service-regex.c
index 22175331c..620086b15 100644
--- a/src/regex/gnunet-service-regex.c
+++ b/src/regex/gnunet-service-regex.c
@@ -193,7 +193,7 @@ reannounce (void *cls,
193 * @param message the actual message 193 * @param message the actual message
194 */ 194 */
195static void 195static void
196handle_announce (void *cls, 196handle_announce (void *cls,
197 struct GNUNET_SERVER_Client *client, 197 struct GNUNET_SERVER_Client *client,
198 const struct GNUNET_MessageHeader *message) 198 const struct GNUNET_MessageHeader *message)
199{ 199{
@@ -238,7 +238,7 @@ handle_announce (void *cls,
238 return; 238 return;
239 } 239 }
240 GNUNET_CONTAINER_DLL_insert (client_head, 240 GNUNET_CONTAINER_DLL_insert (client_head,
241 client_tail, 241 client_tail,
242 ce); 242 ce);
243 GNUNET_SERVER_receive_done (client, GNUNET_OK); 243 GNUNET_SERVER_receive_done (client, GNUNET_OK);
244} 244}
@@ -254,7 +254,7 @@ handle_announce (void *cls,
254 * @param put_path Path of the put request. 254 * @param put_path Path of the put request.
255 * @param put_path_length Length of the put_path. 255 * @param put_path_length Length of the put_path.
256 */ 256 */
257static void 257static void
258handle_search_result (void *cls, 258handle_search_result (void *cls,
259 const struct GNUNET_PeerIdentity *id, 259 const struct GNUNET_PeerIdentity *id,
260 const struct GNUNET_PeerIdentity *get_path, 260 const struct GNUNET_PeerIdentity *get_path,
@@ -283,11 +283,11 @@ handle_search_result (void *cls,
283 result->put_path_length = htons ((uint16_t) put_path_length); 283 result->put_path_length = htons ((uint16_t) put_path_length);
284 result->id = *id; 284 result->id = *id;
285 gp = &result->id; 285 gp = &result->id;
286 memcpy (&gp[1], 286 memcpy (&gp[1],
287 get_path, 287 get_path,
288 get_path_length * sizeof (struct GNUNET_PeerIdentity)); 288 get_path_length * sizeof (struct GNUNET_PeerIdentity));
289 memcpy (&gp[1 + get_path_length], 289 memcpy (&gp[1 + get_path_length],
290 put_path, 290 put_path,
291 put_path_length * sizeof (struct GNUNET_PeerIdentity)); 291 put_path_length * sizeof (struct GNUNET_PeerIdentity));
292 GNUNET_SERVER_notification_context_unicast (nc, 292 GNUNET_SERVER_notification_context_unicast (nc,
293 ce->client, 293 ce->client,
@@ -304,7 +304,7 @@ handle_search_result (void *cls,
304 * @param message the actual message 304 * @param message the actual message
305 */ 305 */
306static void 306static void
307handle_search (void *cls, 307handle_search (void *cls,
308 struct GNUNET_SERVER_Client *client, 308 struct GNUNET_SERVER_Client *client,
309 const struct GNUNET_MessageHeader *message) 309 const struct GNUNET_MessageHeader *message)
310{ 310{
@@ -338,7 +338,7 @@ handle_search (void *cls,
338 return; 338 return;
339 } 339 }
340 GNUNET_CONTAINER_DLL_insert (client_head, 340 GNUNET_CONTAINER_DLL_insert (client_head,
341 client_tail, 341 client_tail,
342 ce); 342 ce);
343 GNUNET_SERVER_notification_context_add (nc, client); 343 GNUNET_SERVER_notification_context_add (nc, client);
344 GNUNET_SERVER_receive_done (client, GNUNET_OK); 344 GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -364,7 +364,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
364 364
365 my_private_key = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg); 365 my_private_key = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg);
366 if (NULL == my_private_key) 366 if (NULL == my_private_key)
367 { 367 {
368 GNUNET_SCHEDULER_shutdown (); 368 GNUNET_SCHEDULER_shutdown ();
369 return; 369 return;
370 } 370 }
diff --git a/src/regex/perf-regex.c b/src/regex/perf-regex.c
index 823601c84..3f1e77115 100644
--- a/src/regex/perf-regex.c
+++ b/src/regex/perf-regex.c
@@ -41,7 +41,7 @@
41 * @param num_edges number of edges leaving current state. 41 * @param num_edges number of edges leaving current state.
42 * @param edges edges leaving current state. 42 * @param edges edges leaving current state.
43 */ 43 */
44static void 44static void
45print_edge (void *cls, 45print_edge (void *cls,
46 const struct GNUNET_HashCode *key, 46 const struct GNUNET_HashCode *key,
47 const char *proof, 47 const char *proof,
@@ -64,7 +64,7 @@ print_edge (void *cls,
64 64
65/** 65/**
66 * The main function of the regex performace test. 66 * The main function of the regex performace test.
67 * 67 *
68 * Read a set of regex from a file, combine them and create a DFA from the 68 * Read a set of regex from a file, combine them and create a DFA from the
69 * resulting combined regex. 69 * resulting combined regex.
70 * 70 *
@@ -86,7 +86,7 @@ main (int argc, char *const *argv)
86 if (3 != argc) 86 if (3 != argc)
87 { 87 {
88 fprintf (stderr, 88 fprintf (stderr,
89 "Usage: %s REGEX_FILE COMPRESSION\n", 89 "Usage: %s REGEX_FILE COMPRESSION\n",
90 argv[0]); 90 argv[0]);
91 return 1; 91 return 1;
92 } 92 }
@@ -104,9 +104,9 @@ main (int argc, char *const *argv)
104 GNUNET_asprintf (&regex, "GNUNET_REGEX_PROFILER_(%s)(0|1)*", buffer); 104 GNUNET_asprintf (&regex, "GNUNET_REGEX_PROFILER_(%s)(0|1)*", buffer);
105 size = strlen (regex); 105 size = strlen (regex);
106 106
107 fprintf (stderr, 107 fprintf (stderr,
108 "Combined regex (%ld bytes):\n%s\n", 108 "Combined regex (%ld bytes):\n%s\n",
109 size, 109 size,
110 regex); 110 regex);
111 dfa = REGEX_INTERNAL_construct_dfa (regex, size, compression); 111 dfa = REGEX_INTERNAL_construct_dfa (regex, size, compression);
112 printf ("********* ALL EDGES *********'\n"); 112 printf ("********* ALL EDGES *********'\n");
diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c
index 0897641d5..3d7b97725 100644
--- a/src/regex/plugin_block_regex.c
+++ b/src/regex/plugin_block_regex.c
@@ -174,7 +174,7 @@ evaluate_block_regex_accept (void *cls, enum GNUNET_BLOCK_Type type,
174 if (ntohl (rba->purpose.size) != 174 if (ntohl (rba->purpose.size) !=
175 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + 175 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
176 sizeof (struct GNUNET_TIME_AbsoluteNBO) + 176 sizeof (struct GNUNET_TIME_AbsoluteNBO) +
177 sizeof (struct GNUNET_HashCode)) 177 sizeof (struct GNUNET_HashCode))
178 { 178 {
179 GNUNET_break_op(0); 179 GNUNET_break_op(0);
180 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 180 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
@@ -184,7 +184,7 @@ evaluate_block_regex_accept (void *cls, enum GNUNET_BLOCK_Type type,
184 /* technically invalid, but can happen without an error, so 184 /* technically invalid, but can happen without an error, so
185 we're nice by reporting it as a 'duplicate' */ 185 we're nice by reporting it as a 'duplicate' */
186 return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE; 186 return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE;
187 } 187 }
188 if (GNUNET_OK != 188 if (GNUNET_OK !=
189 GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT, 189 GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT,
190 &rba->purpose, 190 &rba->purpose,
diff --git a/src/regex/regex_api.c b/src/regex/regex_api.c
index afc028cdb..e18674d65 100644
--- a/src/regex/regex_api.c
+++ b/src/regex/regex_api.c
@@ -40,11 +40,11 @@ struct GNUNET_REGEX_Announcement
40 */ 40 */
41 struct GNUNET_CLIENT_Connection *client; 41 struct GNUNET_CLIENT_Connection *client;
42 42
43 /** 43 /**
44 * Our configuration. 44 * Our configuration.
45 */ 45 */
46 const struct GNUNET_CONFIGURATION_Handle *cfg; 46 const struct GNUNET_CONFIGURATION_Handle *cfg;
47 47
48 /** 48 /**
49 * Message we're sending to the service. 49 * Message we're sending to the service.
50 */ 50 */
@@ -55,7 +55,7 @@ struct GNUNET_REGEX_Announcement
55/** 55/**
56 * We got a response (!?) or disconnect after asking regex 56 * We got a response (!?) or disconnect after asking regex
57 * to do the announcement. Retry. 57 * to do the announcement. Retry.
58 * 58 *
59 * @param cls the 'struct GNUNET_REGEX_Announcement' to retry 59 * @param cls the 'struct GNUNET_REGEX_Announcement' to retry
60 * @param msg NULL on disconnect 60 * @param msg NULL on disconnect
61 */ 61 */
@@ -65,7 +65,7 @@ handle_a_reconnect (void *cls,
65 65
66 66
67/** 67/**
68 * Try sending the announcement request to regex. On 68 * Try sending the announcement request to regex. On
69 * errors (i.e. regex died), try again. 69 * errors (i.e. regex died), try again.
70 * 70 *
71 * @param a the announcement to retry 71 * @param a the announcement to retry
@@ -87,7 +87,7 @@ retry_announcement (struct GNUNET_REGEX_Announcement *a)
87/** 87/**
88 * We got a response (!?) or disconnect after asking regex 88 * We got a response (!?) or disconnect after asking regex
89 * to do the announcement. Retry. 89 * to do the announcement. Retry.
90 * 90 *
91 * @param cls the 'struct GNUNET_REGEX_Announcement' to retry 91 * @param cls the 'struct GNUNET_REGEX_Announcement' to retry
92 * @param msg NULL on disconnect 92 * @param msg NULL on disconnect
93 */ 93 */
@@ -107,7 +107,7 @@ handle_a_reconnect (void *cls,
107 * Announce the given peer under the given regular expression. Does 107 * Announce the given peer under the given regular expression. Does
108 * not free resources, must call GNUNET_REGEX_announce_cancel for 108 * not free resources, must call GNUNET_REGEX_announce_cancel for
109 * that. 109 * that.
110 * 110 *
111 * @param cfg configuration to use 111 * @param cfg configuration to use
112 * @param regex Regular expression to announce. 112 * @param regex Regular expression to announce.
113 * @param refresh_delay after what delay should the announcement be repeated? 113 * @param refresh_delay after what delay should the announcement be repeated?
@@ -151,7 +151,7 @@ GNUNET_REGEX_announce (const struct GNUNET_CONFIGURATION_Handle *cfg,
151 151
152/** 152/**
153 * Stop announcing the regex specified by the given handle. 153 * Stop announcing the regex specified by the given handle.
154 * 154 *
155 * @param a handle returned by a previous GNUNET_REGEX_announce call. 155 * @param a handle returned by a previous GNUNET_REGEX_announce call.
156 */ 156 */
157void 157void
@@ -172,11 +172,11 @@ struct GNUNET_REGEX_Search
172 */ 172 */
173 struct GNUNET_CLIENT_Connection *client; 173 struct GNUNET_CLIENT_Connection *client;
174 174
175 /** 175 /**
176 * Our configuration. 176 * Our configuration.
177 */ 177 */
178 const struct GNUNET_CONFIGURATION_Handle *cfg; 178 const struct GNUNET_CONFIGURATION_Handle *cfg;
179 179
180 /** 180 /**
181 * Function to call with results. 181 * Function to call with results.
182 */ 182 */
@@ -186,7 +186,7 @@ struct GNUNET_REGEX_Search
186 * Closure for 'callback'. 186 * Closure for 'callback'.
187 */ 187 */
188 void *callback_cls; 188 void *callback_cls;
189 189
190 /** 190 /**
191 * Search message to transmit to the service. 191 * Search message to transmit to the service.
192 */ 192 */
@@ -197,7 +197,7 @@ struct GNUNET_REGEX_Search
197/** 197/**
198 * We got a response or disconnect after asking regex 198 * We got a response or disconnect after asking regex
199 * to do the search. Handle it. 199 * to do the search. Handle it.
200 * 200 *
201 * @param cls the 'struct GNUNET_REGEX_Search' to retry 201 * @param cls the 'struct GNUNET_REGEX_Search' to retry
202 * @param msg NULL on disconnect 202 * @param msg NULL on disconnect
203 */ 203 */
@@ -207,7 +207,7 @@ handle_search_response (void *cls,
207 207
208 208
209/** 209/**
210 * Try sending the search request to regex. On 210 * Try sending the search request to regex. On
211 * errors (i.e. regex died), try again. 211 * errors (i.e. regex died), try again.
212 * 212 *
213 * @param s the search to retry 213 * @param s the search to retry
@@ -229,7 +229,7 @@ retry_search (struct GNUNET_REGEX_Search *s)
229/** 229/**
230 * We got a response or disconnect after asking regex 230 * We got a response or disconnect after asking regex
231 * to do the search. Handle it. 231 * to do the search. Handle it.
232 * 232 *
233 * @param cls the 'struct GNUNET_REGEX_Search' to retry 233 * @param cls the 'struct GNUNET_REGEX_Search' to retry
234 * @param msg NULL on disconnect, otherwise presumably a response 234 * @param msg NULL on disconnect, otherwise presumably a response
235 */ 235 */
@@ -257,7 +257,7 @@ handle_search_response (void *cls,
257 result = (const struct ResultMessage *) msg; 257 result = (const struct ResultMessage *) msg;
258 gpl = ntohs (result->get_path_length); 258 gpl = ntohs (result->get_path_length);
259 ppl = ntohs (result->put_path_length); 259 ppl = ntohs (result->put_path_length);
260 if (size == (sizeof (struct ResultMessage) + 260 if (size == (sizeof (struct ResultMessage) +
261 (gpl + ppl) * sizeof (struct GNUNET_PeerIdentity))) 261 (gpl + ppl) * sizeof (struct GNUNET_PeerIdentity)))
262 { 262 {
263 const struct GNUNET_PeerIdentity *pid; 263 const struct GNUNET_PeerIdentity *pid;
@@ -269,7 +269,7 @@ handle_search_response (void *cls,
269 s->callback (s->callback_cls, 269 s->callback (s->callback_cls,
270 pid, 270 pid,
271 &pid[1], gpl, 271 &pid[1], gpl,
272 &pid[1 + gpl], ppl); 272 &pid[1 + gpl], ppl);
273 return; 273 return;
274 } 274 }
275 } 275 }
@@ -323,7 +323,7 @@ GNUNET_REGEX_search (const struct GNUNET_CONFIGURATION_Handle *cfg,
323 323
324/** 324/**
325 * Stop search and free all data used by a GNUNET_REGEX_search call. 325 * Stop search and free all data used by a GNUNET_REGEX_search call.
326 * 326 *
327 * @param s Handle returned by a previous GNUNET_REGEX_search call. 327 * @param s Handle returned by a previous GNUNET_REGEX_search call.
328 */ 328 */
329void 329void
diff --git a/src/regex/regex_block_lib.c b/src/regex/regex_block_lib.c
index af74e89e6..8a1f08290 100644
--- a/src/regex/regex_block_lib.c
+++ b/src/regex/regex_block_lib.c
@@ -98,7 +98,7 @@ GNUNET_NETWORK_STRUCT_END
98 * @param block block to test 98 * @param block block to test
99 * @param size number of bytes in block 99 * @param size number of bytes in block
100 * @return GNUNET_YES if the block is accepting, GNUNET_NO if not 100 * @return GNUNET_YES if the block is accepting, GNUNET_NO if not
101 */ 101 */
102int 102int
103GNUNET_BLOCK_is_accepting (const struct RegexBlock *block, 103GNUNET_BLOCK_is_accepting (const struct RegexBlock *block,
104 size_t size) 104 size_t size)
@@ -164,7 +164,7 @@ struct CheckEdgeContext
164 * @param token Token that follows to next state. 164 * @param token Token that follows to next state.
165 * @param len Lenght of token. 165 * @param len Lenght of token.
166 * @param key Hash of next state. 166 * @param key Hash of next state.
167 * 167 *
168 * @return GNUNET_YES, to keep iterating 168 * @return GNUNET_YES, to keep iterating
169 */ 169 */
170static int 170static int
@@ -175,7 +175,7 @@ check_edge (void *cls,
175{ 175{
176 struct CheckEdgeContext *ctx = cls; 176 struct CheckEdgeContext *ctx = cls;
177 177
178 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 178 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
179 "edge %.*s [%u]: %s->%s\n", 179 "edge %.*s [%u]: %s->%s\n",
180 (int) len, token, len, GNUNET_h2s(key)); 180 (int) len, token, len, GNUNET_h2s(key));
181 if (NULL == ctx->xquery) 181 if (NULL == ctx->xquery)
@@ -212,7 +212,7 @@ REGEX_BLOCK_check (const struct RegexBlock *block,
212 int res; 212 int res;
213 213
214 LOG (GNUNET_ERROR_TYPE_DEBUG, "Block check\n"); 214 LOG (GNUNET_ERROR_TYPE_DEBUG, "Block check\n");
215 if (GNUNET_OK != 215 if (GNUNET_OK !=
216 REGEX_BLOCK_get_key (block, size, 216 REGEX_BLOCK_get_key (block, size,
217 &key)) 217 &key))
218 { 218 {
@@ -267,17 +267,17 @@ REGEX_BLOCK_get_key (const struct RegexBlock *block,
267 uint16_t num_edges; 267 uint16_t num_edges;
268 size_t total; 268 size_t total;
269 269
270 if (block_len < sizeof (struct RegexBlock)) 270 if (block_len < sizeof (struct RegexBlock))
271 { 271 {
272 GNUNET_break_op (0); 272 GNUNET_break_op (0);
273 return GNUNET_SYSERR; 273 return GNUNET_SYSERR;
274 } 274 }
275 num_destinations = ntohs (block->num_destinations); 275 num_destinations = ntohs (block->num_destinations);
276 num_edges = ntohs (block->num_edges); 276 num_edges = ntohs (block->num_edges);
277 len = ntohs (block->proof_len); 277 len = ntohs (block->proof_len);
278 destinations = (const struct GNUNET_HashCode *) &block[1]; 278 destinations = (const struct GNUNET_HashCode *) &block[1];
279 edges = (const struct EdgeInfo *) &destinations[num_destinations]; 279 edges = (const struct EdgeInfo *) &destinations[num_destinations];
280 total = sizeof (struct RegexBlock) + num_destinations * sizeof (struct GNUNET_HashCode) + num_edges + sizeof (struct EdgeInfo) + len; 280 total = sizeof (struct RegexBlock) + num_destinations * sizeof (struct GNUNET_HashCode) + num_edges + sizeof (struct EdgeInfo) + len;
281 if (block_len < total) 281 if (block_len < total)
282 { 282 {
283 GNUNET_break_op (0); 283 GNUNET_break_op (0);
@@ -321,7 +321,7 @@ REGEX_BLOCK_iterate (const struct RegexBlock *block,
321 size_t off; 321 size_t off;
322 322
323 LOG (GNUNET_ERROR_TYPE_DEBUG, "Block iterate\n"); 323 LOG (GNUNET_ERROR_TYPE_DEBUG, "Block iterate\n");
324 if (size < sizeof (struct RegexBlock)) 324 if (size < sizeof (struct RegexBlock))
325 { 325 {
326 GNUNET_break_op (0); 326 GNUNET_break_op (0);
327 return GNUNET_SYSERR; 327 return GNUNET_SYSERR;
@@ -333,14 +333,14 @@ REGEX_BLOCK_iterate (const struct RegexBlock *block,
333 edges = (const struct EdgeInfo *) &destinations[num_destinations]; 333 edges = (const struct EdgeInfo *) &destinations[num_destinations];
334 aux = (const char *) &edges[num_edges]; 334 aux = (const char *) &edges[num_edges];
335 total = sizeof (struct RegexBlock) + num_destinations * sizeof (struct GNUNET_HashCode) + num_edges * sizeof (struct EdgeInfo) + len; 335 total = sizeof (struct RegexBlock) + num_destinations * sizeof (struct GNUNET_HashCode) + num_edges * sizeof (struct EdgeInfo) + len;
336 if (size < total) 336 if (size < total)
337 { 337 {
338 GNUNET_break_op (0); 338 GNUNET_break_op (0);
339 return GNUNET_SYSERR; 339 return GNUNET_SYSERR;
340 } 340 }
341 for (n=0;n<num_edges;n++) 341 for (n=0;n<num_edges;n++)
342 total += ntohs (edges[n].token_length); 342 total += ntohs (edges[n].token_length);
343 if (size != total) 343 if (size != total)
344 { 344 {
345 fprintf (stderr, "Expected %u, got %u\n", 345 fprintf (stderr, "Expected %u, got %u\n",
346 (unsigned int) size, 346 (unsigned int) size,
@@ -360,8 +360,8 @@ REGEX_BLOCK_iterate (const struct RegexBlock *block,
360 ntohs (edges[n].token_length), ntohs (edges[n].token_length), 360 ntohs (edges[n].token_length), ntohs (edges[n].token_length),
361 &aux[off]); 361 &aux[off]);
362 if (NULL != iterator) 362 if (NULL != iterator)
363 if (GNUNET_NO == iterator (iter_cls, 363 if (GNUNET_NO == iterator (iter_cls,
364 &aux[off], 364 &aux[off],
365 ntohs (edges[n].token_length), 365 ntohs (edges[n].token_length),
366 &destinations[ntohs (edges[n].destination_index)])) 366 &destinations[ntohs (edges[n].destination_index)]))
367 return GNUNET_OK; 367 return GNUNET_OK;
@@ -403,7 +403,7 @@ REGEX_BLOCK_create (const char *proof,
403 char *aux; 403 char *aux;
404 404
405 len = strlen (proof); 405 len = strlen (proof);
406 if (len > UINT16_MAX) 406 if (len > UINT16_MAX)
407 { 407 {
408 GNUNET_break (0); 408 GNUNET_break (0);
409 return NULL; 409 return NULL;
@@ -413,7 +413,7 @@ REGEX_BLOCK_create (const char *proof,
413 for (i=0;i<num_edges;i++) 413 for (i=0;i<num_edges;i++)
414 { 414 {
415 slen = strlen (edges[i].label); 415 slen = strlen (edges[i].label);
416 if (slen > UINT16_MAX) 416 if (slen > UINT16_MAX)
417 { 417 {
418 GNUNET_break (0); 418 GNUNET_break (0);
419 return NULL; 419 return NULL;
@@ -449,7 +449,7 @@ REGEX_BLOCK_create (const char *proof,
449 edgeinfos = (struct EdgeInfo *) &dests[unique_destinations]; 449 edgeinfos = (struct EdgeInfo *) &dests[unique_destinations];
450 aux = (char *) &edgeinfos[num_edges]; 450 aux = (char *) &edgeinfos[num_edges];
451 off = len; 451 off = len;
452 memcpy (aux, proof, len); 452 memcpy (aux, proof, len);
453 for (i=0;i<num_edges;i++) 453 for (i=0;i<num_edges;i++)
454 { 454 {
455 slen = strlen (edges[i].label); 455 slen = strlen (edges[i].label);
diff --git a/src/regex/regex_block_lib.h b/src/regex/regex_block_lib.h
index 28da934e3..4ea4c0765 100644
--- a/src/regex/regex_block_lib.h
+++ b/src/regex/regex_block_lib.h
@@ -106,7 +106,7 @@ REGEX_BLOCK_check (const struct RegexBlock *block,
106 * @param cls Closure. 106 * @param cls Closure.
107 * @param token Token that follows to next state. 107 * @param token Token that follows to next state.
108 * @param len Length of token. 108 * @param len Length of token.
109 * @param key Hash of next state. 109 * @param key Hash of next state.
110 * 110 *
111 * @return GNUNET_YES if should keep iterating, GNUNET_NO otherwise. 111 * @return GNUNET_YES if should keep iterating, GNUNET_NO otherwise.
112 */ 112 */
@@ -158,7 +158,7 @@ REGEX_BLOCK_get_key (const struct RegexBlock *block,
158 * @param block block to test 158 * @param block block to test
159 * @param size number of bytes in block 159 * @param size number of bytes in block
160 * @return GNUNET_YES if the block is accepting, GNUNET_NO if not 160 * @return GNUNET_YES if the block is accepting, GNUNET_NO if not
161 */ 161 */
162int 162int
163GNUNET_BLOCK_is_accepting (const struct RegexBlock *block, 163GNUNET_BLOCK_is_accepting (const struct RegexBlock *block,
164 size_t block_len); 164 size_t block_len);
diff --git a/src/regex/regex_internal.c b/src/regex/regex_internal.c
index 6789b2f72..4e0d5acc5 100644
--- a/src/regex/regex_internal.c
+++ b/src/regex/regex_internal.c
@@ -552,7 +552,7 @@ struct StringBuffer
552 * Allocated buffer. 552 * Allocated buffer.
553 */ 553 */
554 char *abuf; 554 char *abuf;
555 555
556 /** 556 /**
557 * Length of the string in the buffer. 557 * Length of the string in the buffer.
558 */ 558 */
@@ -575,10 +575,10 @@ struct StringBuffer
575 * change). This is used in an optimization that improves 575 * change). This is used in an optimization that improves
576 * performance by about 1% --- if we use int16_t here. With just 576 * performance by about 1% --- if we use int16_t here. With just
577 * "int" for both flags, performance drops (on my system) significantly, 577 * "int" for both flags, performance drops (on my system) significantly,
578 * most likely due to increased cache misses. 578 * most likely due to increased cache misses.
579 */ 579 */
580 int16_t synced; 580 int16_t synced;
581 581
582}; 582};
583 583
584 584
@@ -604,10 +604,10 @@ sb_nullstrcmp (const struct StringBuffer *s1,
604 return -1; 604 return -1;
605 return memcmp (s1->sbuf, s2->sbuf, s1->slen); 605 return memcmp (s1->sbuf, s2->sbuf, s1->slen);
606} 606}
607 607
608 608
609/** 609/**
610 * Compare two strings for equality. 610 * Compare two strings for equality.
611 * 611 *
612 * @param s1 first string for comparison. 612 * @param s1 first string for comparison.
613 * @param s2 second string for comparison. 613 * @param s2 second string for comparison.
@@ -622,7 +622,7 @@ sb_strcmp (const struct StringBuffer *s1,
622 return -1; 622 return -1;
623 return memcmp (s1->sbuf, s2->sbuf, s1->slen); 623 return memcmp (s1->sbuf, s2->sbuf, s1->slen);
624} 624}
625 625
626 626
627/** 627/**
628 * Reallocate the buffer of 'ret' to fit 'nlen' characters; 628 * Reallocate the buffer of 'ret' to fit 'nlen' characters;
@@ -647,7 +647,7 @@ sb_realloc (struct StringBuffer *ret,
647 ret->sbuf = ret->abuf; 647 ret->sbuf = ret->abuf;
648 GNUNET_free_non_null (old); 648 GNUNET_free_non_null (old);
649} 649}
650 650
651 651
652/** 652/**
653 * Append a string. 653 * Append a string.
@@ -669,7 +669,7 @@ sb_append (struct StringBuffer *ret,
669 sarg->slen); 669 sarg->slen);
670 ret->slen += sarg->slen; 670 ret->slen += sarg->slen;
671} 671}
672 672
673 673
674/** 674/**
675 * Append a C string. 675 * Append a C string.
@@ -693,7 +693,7 @@ sb_append_cstr (struct StringBuffer *ret,
693 cstr_len); 693 cstr_len);
694 ret->slen += cstr_len; 694 ret->slen += cstr_len;
695} 695}
696 696
697 697
698/** 698/**
699 * Wrap a string buffer, that is, set ret to the format string 699 * Wrap a string buffer, that is, set ret to the format string
@@ -854,7 +854,7 @@ sb_free (struct StringBuffer *sb)
854static void 854static void
855sb_strdup (struct StringBuffer *out, 855sb_strdup (struct StringBuffer *out,
856 const struct StringBuffer *in) 856 const struct StringBuffer *in)
857 857
858{ 858{
859 out->null_flag = in->null_flag; 859 out->null_flag = in->null_flag;
860 if (GNUNET_YES == out->null_flag) 860 if (GNUNET_YES == out->null_flag)
@@ -935,7 +935,7 @@ needs_parentheses (const struct StringBuffer *str)
935 } 935 }
936 /* while '(' before ')', count opening parens */ 936 /* while '(' before ')', count opening parens */
937 while ( (NULL != (op = memchr (pos, '(', end - pos))) && 937 while ( (NULL != (op = memchr (pos, '(', end - pos))) &&
938 (op < cl) ) 938 (op < cl) )
939 { 939 {
940 cnt++; 940 cnt++;
941 pos = op + 1; 941 pos = op + 1;
@@ -971,7 +971,7 @@ remove_parentheses (struct StringBuffer *str)
971 if (0) 971 if (0)
972 return; 972 return;
973 sbuf = str->sbuf; 973 sbuf = str->sbuf;
974 if ( (GNUNET_YES == str->null_flag) || 974 if ( (GNUNET_YES == str->null_flag) ||
975 (1 >= (slen = str->slen)) || 975 (1 >= (slen = str->slen)) ||
976 ('(' != str->sbuf[0]) || 976 ('(' != str->sbuf[0]) ||
977 (')' != str->sbuf[slen - 1]) ) 977 (')' != str->sbuf[slen - 1]) )
@@ -981,7 +981,7 @@ remove_parentheses (struct StringBuffer *str)
981 end = &sbuf[slen - 1]; 981 end = &sbuf[slen - 1];
982 op = memchr (pos, '(', end - pos); 982 op = memchr (pos, '(', end - pos);
983 cp = memchr (pos, ')', end - pos); 983 cp = memchr (pos, ')', end - pos);
984 while (NULL != cp) 984 while (NULL != cp)
985 { 985 {
986 while ( (NULL != op) && 986 while ( (NULL != op) &&
987 (op < cp) ) 987 (op < cp) )
@@ -1007,7 +1007,7 @@ remove_parentheses (struct StringBuffer *str)
1007 return; 1007 return;
1008 } 1008 }
1009 str->sbuf++; 1009 str->sbuf++;
1010 str->slen -= 2; 1010 str->slen -= 2;
1011} 1011}
1012 1012
1013 1013
@@ -1022,10 +1022,10 @@ remove_parentheses (struct StringBuffer *str)
1022static int 1022static int
1023has_epsilon (const struct StringBuffer *str) 1023has_epsilon (const struct StringBuffer *str)
1024{ 1024{
1025 return 1025 return
1026 (GNUNET_YES != str->null_flag) && 1026 (GNUNET_YES != str->null_flag) &&
1027 (0 < str->slen) && 1027 (0 < str->slen) &&
1028 ('(' == str->sbuf[0]) && 1028 ('(' == str->sbuf[0]) &&
1029 ('|' == str->sbuf[1]) && 1029 ('|' == str->sbuf[1]) &&
1030 (')' == str->sbuf[str->slen - 1]); 1030 (')' == str->sbuf[str->slen - 1]);
1031} 1031}
@@ -1048,8 +1048,8 @@ remove_epsilon (const struct StringBuffer *str,
1048 { 1048 {
1049 ret->null_flag = GNUNET_YES; 1049 ret->null_flag = GNUNET_YES;
1050 return; 1050 return;
1051 } 1051 }
1052 if ( (str->slen > 1) && 1052 if ( (str->slen > 1) &&
1053 ('(' == str->sbuf[0]) && 1053 ('(' == str->sbuf[0]) &&
1054 ('|' == str->sbuf[1]) && 1054 ('|' == str->sbuf[1]) &&
1055 (')' == str->sbuf[str->slen - 1]) ) 1055 (')' == str->sbuf[str->slen - 1]) )
@@ -1080,11 +1080,11 @@ remove_epsilon (const struct StringBuffer *str,
1080 * @return -1 if any of the strings is NULL, 0 if equal, non 0 otherwise 1080 * @return -1 if any of the strings is NULL, 0 if equal, non 0 otherwise
1081 */ 1081 */
1082static int 1082static int
1083sb_strncmp (const struct StringBuffer *str1, 1083sb_strncmp (const struct StringBuffer *str1,
1084 const struct StringBuffer *str2, size_t n) 1084 const struct StringBuffer *str2, size_t n)
1085{ 1085{
1086 size_t max; 1086 size_t max;
1087 1087
1088 if ( (str1->slen != str2->slen) && 1088 if ( (str1->slen != str2->slen) &&
1089 ( (str1->slen < n) || 1089 ( (str1->slen < n) ||
1090 (str2->slen < n) ) ) 1090 (str2->slen < n) ) )
@@ -1106,17 +1106,17 @@ sb_strncmp (const struct StringBuffer *str1,
1106 * @return -1 if any of the strings is NULL, 0 if equal, non 0 otherwise 1106 * @return -1 if any of the strings is NULL, 0 if equal, non 0 otherwise
1107 */ 1107 */
1108static int 1108static int
1109sb_strncmp_cstr (const struct StringBuffer *str1, 1109sb_strncmp_cstr (const struct StringBuffer *str1,
1110 const char *str2, size_t n) 1110 const char *str2, size_t n)
1111{ 1111{
1112 if (str1->slen < n) 1112 if (str1->slen < n)
1113 return -1; 1113 return -1;
1114 return memcmp (str1->sbuf, str2, n); 1114 return memcmp (str1->sbuf, str2, n);
1115} 1115}
1116 1116
1117 1117
1118/** 1118/**
1119 * Initialize string buffer for storing strings of up to n 1119 * Initialize string buffer for storing strings of up to n
1120 * characters. 1120 * characters.
1121 * 1121 *
1122 * @param sb buffer to initialize 1122 * @param sb buffer to initialize
@@ -1143,7 +1143,7 @@ sb_init (struct StringBuffer *sb,
1143 * @return -1 if any of the strings is NULL, 0 if equal, non 0 otherwise 1143 * @return -1 if any of the strings is NULL, 0 if equal, non 0 otherwise
1144 */ 1144 */
1145static int 1145static int
1146sb_strkcmp (const struct StringBuffer *str1, 1146sb_strkcmp (const struct StringBuffer *str1,
1147 const struct StringBuffer *str2, size_t k) 1147 const struct StringBuffer *str2, size_t k)
1148{ 1148{
1149 if ( (GNUNET_YES == str1->null_flag) || 1149 if ( (GNUNET_YES == str1->null_flag) ||
@@ -1196,7 +1196,7 @@ number_states (void *cls, const unsigned int count,
1196 * @param R_cur_r optimization -- kept between iterations to avoid realloc 1196 * @param R_cur_r optimization -- kept between iterations to avoid realloc
1197 */ 1197 */
1198static void 1198static void
1199automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij, 1199automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1200 const struct StringBuffer *R_last_ik, 1200 const struct StringBuffer *R_last_ik,
1201 const struct StringBuffer *R_last_kk, 1201 const struct StringBuffer *R_last_kk,
1202 const struct StringBuffer *R_last_kj, 1202 const struct StringBuffer *R_last_kj,
@@ -1227,8 +1227,8 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1227 * R_cur_r == R^{(k-1)}_{ik} ( R^{(k-1)}_{kk} )^* R^{(k-1)}_{kj} 1227 * R_cur_r == R^{(k-1)}_{ik} ( R^{(k-1)}_{kk} )^* R^{(k-1)}_{kj}
1228 */ 1228 */
1229 1229
1230 if ( (GNUNET_YES == R_last_ij->null_flag) && 1230 if ( (GNUNET_YES == R_last_ij->null_flag) &&
1231 ( (GNUNET_YES == R_last_ik->null_flag) || 1231 ( (GNUNET_YES == R_last_ik->null_flag) ||
1232 (GNUNET_YES == R_last_kj->null_flag))) 1232 (GNUNET_YES == R_last_kj->null_flag)))
1233 { 1233 {
1234 /* R^{(k)}_{ij} = N | N */ 1234 /* R^{(k)}_{ij} = N | N */
@@ -1237,13 +1237,13 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1237 return; 1237 return;
1238 } 1238 }
1239 1239
1240 if ( (GNUNET_YES == R_last_ik->null_flag) || 1240 if ( (GNUNET_YES == R_last_ik->null_flag) ||
1241 (GNUNET_YES == R_last_kj->null_flag) ) 1241 (GNUNET_YES == R_last_kj->null_flag) )
1242 { 1242 {
1243 /* R^{(k)}_{ij} = R^{(k-1)}_{ij} | N */ 1243 /* R^{(k)}_{ij} = R^{(k-1)}_{ij} | N */
1244 if (GNUNET_YES == R_last_ij->synced) 1244 if (GNUNET_YES == R_last_ij->synced)
1245 { 1245 {
1246 R_cur_ij->synced = GNUNET_YES; 1246 R_cur_ij->synced = GNUNET_YES;
1247 R_cur_ij->null_flag = GNUNET_NO; 1247 R_cur_ij->null_flag = GNUNET_NO;
1248 return; 1248 return;
1249 } 1249 }
@@ -1256,10 +1256,10 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1256 /* $R^{(k)}_{ij} = N | R^{(k-1)}_{ik} ( R^{(k-1)}_{kk} )^* R^{(k-1)}_{kj} OR 1256 /* $R^{(k)}_{ij} = N | R^{(k-1)}_{ik} ( R^{(k-1)}_{kk} )^* R^{(k-1)}_{kj} OR
1257 * $R^{(k)}_{ij} = R^{(k-1)}_{ij} | R^{(k-1)}_{ik} ( R^{(k-1)}_{kk} )^* R^{(k-1)}_{kj} */ 1257 * $R^{(k)}_{ij} = R^{(k-1)}_{ij} | R^{(k-1)}_{ik} ( R^{(k-1)}_{kk} )^* R^{(k-1)}_{kj} */
1258 1258
1259 R_cur_r->null_flag = GNUNET_YES; 1259 R_cur_r->null_flag = GNUNET_YES;
1260 R_cur_r->slen = 0; 1260 R_cur_r->slen = 0;
1261 R_cur_l->null_flag = GNUNET_YES; 1261 R_cur_l->null_flag = GNUNET_YES;
1262 R_cur_l->slen = 0; 1262 R_cur_l->slen = 0;
1263 1263
1264 /* cache results from strcmp, we might need these many times */ 1264 /* cache results from strcmp, we might need these many times */
1265 ij_kj_cmp = sb_nullstrcmp (R_last_ij, R_last_kj); 1265 ij_kj_cmp = sb_nullstrcmp (R_last_ij, R_last_kj);
@@ -1291,8 +1291,8 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1291 remove_epsilon (R_last_ij, &R_temp_ij); 1291 remove_epsilon (R_last_ij, &R_temp_ij);
1292 remove_parentheses (&R_temp_ij); 1292 remove_parentheses (&R_temp_ij);
1293 1293
1294 if ( (0 == sb_strcmp (&R_temp_ij, &R_temp_ik)) && 1294 if ( (0 == sb_strcmp (&R_temp_ij, &R_temp_ik)) &&
1295 (0 == sb_strcmp (&R_temp_ik, &R_temp_kk)) && 1295 (0 == sb_strcmp (&R_temp_ik, &R_temp_kk)) &&
1296 (0 == sb_strcmp (&R_temp_kk, &R_temp_kj)) ) 1296 (0 == sb_strcmp (&R_temp_kk, &R_temp_kj)) )
1297 { 1297 {
1298 if (0 == R_temp_ij.slen) 1298 if (0 == R_temp_ij.slen)
@@ -1395,16 +1395,16 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1395 length = R_temp_kk.slen - R_last_ik->slen; 1395 length = R_temp_kk.slen - R_last_ik->slen;
1396 1396
1397 /* a(ba)*bx = (ab)+x */ 1397 /* a(ba)*bx = (ab)+x */
1398 if ( (length > 0) && 1398 if ( (length > 0) &&
1399 (GNUNET_YES != R_last_kk->null_flag) && 1399 (GNUNET_YES != R_last_kk->null_flag) &&
1400 (0 < R_last_kk->slen) && 1400 (0 < R_last_kk->slen) &&
1401 (GNUNET_YES != R_last_kj->null_flag) && 1401 (GNUNET_YES != R_last_kj->null_flag) &&
1402 (0 < R_last_kj->slen) && 1402 (0 < R_last_kj->slen) &&
1403 (GNUNET_YES != R_last_ik->null_flag) && 1403 (GNUNET_YES != R_last_ik->null_flag) &&
1404 (0 < R_last_ik->slen) && 1404 (0 < R_last_ik->slen) &&
1405 (0 == sb_strkcmp (&R_temp_kk, R_last_ik, length)) && 1405 (0 == sb_strkcmp (&R_temp_kk, R_last_ik, length)) &&
1406 (0 == sb_strncmp (&R_temp_kk, R_last_kj, length)) ) 1406 (0 == sb_strncmp (&R_temp_kk, R_last_kj, length)) )
1407 { 1407 {
1408 struct StringBuffer temp_a; 1408 struct StringBuffer temp_a;
1409 struct StringBuffer temp_b; 1409 struct StringBuffer temp_b;
1410 1410
@@ -1452,7 +1452,7 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1452 sb_printf1 (R_cur_r, "%.*s*", 1, &R_temp_kk); 1452 sb_printf1 (R_cur_r, "%.*s*", 1, &R_temp_kk);
1453 } 1453 }
1454 /* aa*a = a+a */ 1454 /* aa*a = a+a */
1455 else if ( (0 == clean_ik_kk_cmp) && 1455 else if ( (0 == clean_ik_kk_cmp) &&
1456 (0 == clean_kk_kj_cmp) && 1456 (0 == clean_kk_kj_cmp) &&
1457 (! has_epsilon (R_last_ik)) ) 1457 (! has_epsilon (R_last_ik)) )
1458 { 1458 {
@@ -1550,7 +1550,7 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1550 sb_free (&R_temp_kk); 1550 sb_free (&R_temp_kk);
1551 sb_free (&R_temp_kj); 1551 sb_free (&R_temp_kj);
1552 1552
1553 if ( (GNUNET_YES == R_cur_l->null_flag) && 1553 if ( (GNUNET_YES == R_cur_l->null_flag) &&
1554 (GNUNET_YES == R_cur_r->null_flag) ) 1554 (GNUNET_YES == R_cur_r->null_flag) )
1555 { 1555 {
1556 R_cur_ij->null_flag = GNUNET_YES; 1556 R_cur_ij->null_flag = GNUNET_YES;
@@ -1670,7 +1670,7 @@ automaton_create_proofs (struct REGEX_INTERNAL_Automaton *a)
1670 for (i = 0; i < n; i++) 1670 for (i = 0; i < n; i++)
1671 for (j = 0; j < n; j++) 1671 for (j = 0; j < n; j++)
1672 if (needs_parentheses (&R_last[i * n + j])) 1672 if (needs_parentheses (&R_last[i * n + j]))
1673 sb_wrap (&R_last[i * n + j], "(%.*s)", 2); 1673 sb_wrap (&R_last[i * n + j], "(%.*s)", 2);
1674 /* Compute regular expressions of length "k" between each pair of states per 1674 /* Compute regular expressions of length "k" between each pair of states per
1675 * induction */ 1675 * induction */
1676 memset (&R_cur_l, 0, sizeof (struct StringBuffer)); 1676 memset (&R_cur_l, 0, sizeof (struct StringBuffer));
@@ -1726,14 +1726,14 @@ automaton_create_proofs (struct REGEX_INTERNAL_Automaton *a)
1726 if ( (0 == complete_regex.slen) && 1726 if ( (0 == complete_regex.slen) &&
1727 (0 < R_last[a->start->dfs_id * n + i].slen) ) 1727 (0 < R_last[a->start->dfs_id * n + i].slen) )
1728 { 1728 {
1729 sb_append (&complete_regex, 1729 sb_append (&complete_regex,
1730 &R_last[a->start->dfs_id * n + i]); 1730 &R_last[a->start->dfs_id * n + i]);
1731 } 1731 }
1732 else if ( (GNUNET_YES != R_last[a->start->dfs_id * n + i].null_flag) && 1732 else if ( (GNUNET_YES != R_last[a->start->dfs_id * n + i].null_flag) &&
1733 (0 < R_last[a->start->dfs_id * n + i].slen) ) 1733 (0 < R_last[a->start->dfs_id * n + i].slen) )
1734 { 1734 {
1735 sb_append_cstr (&complete_regex, "|"); 1735 sb_append_cstr (&complete_regex, "|");
1736 sb_append (&complete_regex, 1736 sb_append (&complete_regex,
1737 &R_last[a->start->dfs_id * n + i]); 1737 &R_last[a->start->dfs_id * n + i]);
1738 } 1738 }
1739 } 1739 }
@@ -1742,11 +1742,11 @@ automaton_create_proofs (struct REGEX_INTERNAL_Automaton *a)
1742 1742
1743 /* cleanup */ 1743 /* cleanup */
1744 sb_free (&complete_regex); 1744 sb_free (&complete_regex);
1745 for (i = 0; i < n; i++) 1745 for (i = 0; i < n; i++)
1746 for (j = 0; j < n; j++) 1746 for (j = 0; j < n; j++)
1747 { 1747 {
1748 sb_free (&R_cur[i * n + j]); 1748 sb_free (&R_cur[i * n + j]);
1749 sb_free (&R_last[i * n + j]); 1749 sb_free (&R_last[i * n + j]);
1750 } 1750 }
1751 GNUNET_free (R_cur); 1751 GNUNET_free (R_cur);
1752 GNUNET_free (R_last); 1752 GNUNET_free (R_last);
@@ -1804,15 +1804,15 @@ dfa_state_create (struct REGEX_INTERNAL_Context *ctx,
1804 pos += strlen (pos); 1804 pos += strlen (pos);
1805 1805
1806 /* Add a transition for each distinct label to NULL state */ 1806 /* Add a transition for each distinct label to NULL state */
1807 for (ctran = cstate->transitions_head; NULL != ctran; ctran = ctran->next) 1807 for (ctran = cstate->transitions_head; NULL != ctran; ctran = ctran->next)
1808 if (NULL != ctran->label) 1808 if (NULL != ctran->label)
1809 state_add_transition (ctx, s, ctran->label, NULL); 1809 state_add_transition (ctx, s, ctran->label, NULL);
1810 1810
1811 /* If the nfa_states contain an accepting state, the new dfa state is also 1811 /* If the nfa_states contain an accepting state, the new dfa state is also
1812 * accepting. */ 1812 * accepting. */
1813 if (cstate->accepting) 1813 if (cstate->accepting)
1814 s->accepting = 1; 1814 s->accepting = 1;
1815 } 1815 }
1816 pos[-1] = '}'; 1816 pos[-1] = '}';
1817 s->name = GNUNET_realloc (s->name, strlen (s->name) + 1); 1817 s->name = GNUNET_realloc (s->name, strlen (s->name) + 1);
1818 1818
@@ -2495,7 +2495,7 @@ nfa_closure_set_create (struct REGEX_INTERNAL_StateSet *ret,
2495 /* Add start state to closure only for epsilon closure */ 2495 /* Add start state to closure only for epsilon closure */
2496 if (NULL == label) 2496 if (NULL == label)
2497 state_set_append (ret, s); 2497 state_set_append (ret, s);
2498 2498
2499 /* initialize work stack */ 2499 /* initialize work stack */
2500 cls_stack.head = NULL; 2500 cls_stack.head = NULL;
2501 cls_stack.tail = NULL; 2501 cls_stack.tail = NULL;
@@ -2506,7 +2506,7 @@ nfa_closure_set_create (struct REGEX_INTERNAL_StateSet *ret,
2506 { 2506 {
2507 GNUNET_CONTAINER_MDLL_remove (ST, cls_stack.head, cls_stack.tail, 2507 GNUNET_CONTAINER_MDLL_remove (ST, cls_stack.head, cls_stack.tail,
2508 currentstate); 2508 currentstate);
2509 cls_stack.len--; 2509 cls_stack.len--;
2510 for (ctran = currentstate->transitions_head; NULL != ctran; 2510 for (ctran = currentstate->transitions_head; NULL != ctran;
2511 ctran = ctran->next) 2511 ctran = ctran->next)
2512 { 2512 {
@@ -2521,7 +2521,7 @@ nfa_closure_set_create (struct REGEX_INTERNAL_StateSet *ret,
2521 clsstate); 2521 clsstate);
2522 cls_stack.len++; 2522 cls_stack.len++;
2523 clsstate->contained = 1; 2523 clsstate->contained = 1;
2524 } 2524 }
2525 } 2525 }
2526 } 2526 }
2527 for (i = 0; i < ret->off; i++) 2527 for (i = 0; i < ret->off; i++)
@@ -3429,9 +3429,9 @@ REGEX_INTERNAL_iterate_all_edges (struct REGEX_INTERNAL_Automaton *a,
3429 unsigned int num_edges; 3429 unsigned int num_edges;
3430 3430
3431 num_edges = state_get_edges (s, edges); 3431 num_edges = state_get_edges (s, edges);
3432 if ( ( (NULL != s->proof) && 3432 if ( ( (NULL != s->proof) &&
3433 (0 < strlen (s->proof)) ) || s->accepting) 3433 (0 < strlen (s->proof)) ) || s->accepting)
3434 iterator (iterator_cls, &s->hash, s->proof, 3434 iterator (iterator_cls, &s->hash, s->proof,
3435 s->accepting, 3435 s->accepting,
3436 num_edges, edges); 3436 num_edges, edges);
3437 s->marked = GNUNET_NO; 3437 s->marked = GNUNET_NO;
@@ -3439,7 +3439,7 @@ REGEX_INTERNAL_iterate_all_edges (struct REGEX_INTERNAL_Automaton *a,
3439 3439
3440 iterate_initial_edge (GNUNET_REGEX_INITIAL_BYTES, 3440 iterate_initial_edge (GNUNET_REGEX_INITIAL_BYTES,
3441 GNUNET_REGEX_INITIAL_BYTES, 3441 GNUNET_REGEX_INITIAL_BYTES,
3442 NULL, a->start, 3442 NULL, a->start,
3443 iterator, iterator_cls); 3443 iterator, iterator_cls);
3444} 3444}
3445 3445
diff --git a/src/regex/regex_internal_dht.c b/src/regex/regex_internal_dht.c
index ef0155177..55ca426cb 100644
--- a/src/regex/regex_internal_dht.c
+++ b/src/regex/regex_internal_dht.c
@@ -121,7 +121,7 @@ regex_iterator (void *cls,
121 ab.purpose.purpose = ntohl (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT); 121 ab.purpose.purpose = ntohl (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT);
122 ab.expiration_time = GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_DHT_MAX_EXPIRATION)); 122 ab.expiration_time = GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_DHT_MAX_EXPIRATION));
123 ab.key = *key; 123 ab.key = *key;
124 GNUNET_CRYPTO_ecc_key_get_public_for_signature (h->priv, 124 GNUNET_CRYPTO_ecc_key_get_public_for_signature (h->priv,
125 &ab.peer.public_key); 125 &ab.peer.public_key);
126 GNUNET_assert (GNUNET_OK == 126 GNUNET_assert (GNUNET_OK ==
127 GNUNET_CRYPTO_ecc_sign (h->priv, 127 GNUNET_CRYPTO_ecc_sign (h->priv,
@@ -151,7 +151,7 @@ regex_iterator (void *cls,
151 GNUNET_DHT_put (h->dht, key, 151 GNUNET_DHT_put (h->dht, key,
152 DHT_REPLICATION, 152 DHT_REPLICATION,
153 DHT_OPT, 153 DHT_OPT,
154 GNUNET_BLOCK_TYPE_REGEX, 154 GNUNET_BLOCK_TYPE_REGEX,
155 size, block, 155 size, block,
156 GNUNET_TIME_relative_to_absolute (DHT_TTL), 156 GNUNET_TIME_relative_to_absolute (DHT_TTL),
157 DHT_TTL, 157 DHT_TTL,
@@ -167,13 +167,13 @@ regex_iterator (void *cls,
167/** 167/**
168 * Announce a regular expression: put all states of the automaton in the DHT. 168 * Announce a regular expression: put all states of the automaton in the DHT.
169 * Does not free resources, must call REGEX_INTERNAL_announce_cancel for that. 169 * Does not free resources, must call REGEX_INTERNAL_announce_cancel for that.
170 * 170 *
171 * @param dht An existing and valid DHT service handle. CANNOT be NULL. 171 * @param dht An existing and valid DHT service handle. CANNOT be NULL.
172 * @param priv our private key, must remain valid until the announcement is cancelled 172 * @param priv our private key, must remain valid until the announcement is cancelled
173 * @param regex Regular expression to announce. 173 * @param regex Regular expression to announce.
174 * @param compression How many characters per edge can we squeeze? 174 * @param compression How many characters per edge can we squeeze?
175 * @param stats Optional statistics handle to report usage. Can be NULL. 175 * @param stats Optional statistics handle to report usage. Can be NULL.
176 * 176 *
177 * @return Handle to reuse o free cached resources. 177 * @return Handle to reuse o free cached resources.
178 * Must be freed by calling REGEX_INTERNAL_announce_cancel. 178 * Must be freed by calling REGEX_INTERNAL_announce_cancel.
179 */ 179 */
@@ -201,14 +201,14 @@ REGEX_INTERNAL_announce (struct GNUNET_DHT_Handle *dht,
201/** 201/**
202 * Announce again a regular expression previously announced. 202 * Announce again a regular expression previously announced.
203 * Does use caching to speed up process. 203 * Does use caching to speed up process.
204 * 204 *
205 * @param h Handle returned by a previous REGEX_INTERNAL_announce call. 205 * @param h Handle returned by a previous REGEX_INTERNAL_announce call.
206 */ 206 */
207void 207void
208REGEX_INTERNAL_reannounce (struct REGEX_INTERNAL_Announcement *h) 208REGEX_INTERNAL_reannounce (struct REGEX_INTERNAL_Announcement *h)
209{ 209{
210 GNUNET_assert (NULL != h->dfa); /* make sure to call announce first */ 210 GNUNET_assert (NULL != h->dfa); /* make sure to call announce first */
211 LOG (GNUNET_ERROR_TYPE_INFO, 211 LOG (GNUNET_ERROR_TYPE_INFO,
212 "REGEX_INTERNAL_reannounce: %s\n", 212 "REGEX_INTERNAL_reannounce: %s\n",
213 h->regex); 213 h->regex);
214 REGEX_INTERNAL_iterate_reachable_edges (h->dfa, &regex_iterator, h); 214 REGEX_INTERNAL_iterate_reachable_edges (h->dfa, &regex_iterator, h);
@@ -218,7 +218,7 @@ REGEX_INTERNAL_reannounce (struct REGEX_INTERNAL_Announcement *h)
218/** 218/**
219 * Clear all cached data used by a regex announce. 219 * Clear all cached data used by a regex announce.
220 * Does not close DHT connection. 220 * Does not close DHT connection.
221 * 221 *
222 * @param h Handle returned by a previous REGEX_INTERNAL_announce call. 222 * @param h Handle returned by a previous REGEX_INTERNAL_announce call.
223 */ 223 */
224void 224void
@@ -264,7 +264,7 @@ struct RegexSearchContext
264 264
265/** 265/**
266 * Type of values in 'dht_get_results'. 266 * Type of values in 'dht_get_results'.
267 */ 267 */
268struct Result 268struct Result
269{ 269{
270 /** 270 /**
@@ -306,7 +306,7 @@ struct REGEX_INTERNAL_Search
306 struct GNUNET_CONTAINER_MultiHashMap *dht_get_handles; 306 struct GNUNET_CONTAINER_MultiHashMap *dht_get_handles;
307 307
308 /** 308 /**
309 * Results from running DHT GETs, values are of type 309 * Results from running DHT GETs, values are of type
310 * 'struct Result'. 310 * 'struct Result'.
311 */ 311 */
312 struct GNUNET_CONTAINER_MultiHashMap *dht_get_results; 312 struct GNUNET_CONTAINER_MultiHashMap *dht_get_results;
@@ -320,7 +320,7 @@ struct REGEX_INTERNAL_Search
320 * Number of contexts (branches/steps in search). 320 * Number of contexts (branches/steps in search).
321 */ 321 */
322 unsigned int n_contexts; 322 unsigned int n_contexts;
323 323
324 /** 324 /**
325 * @param callback Callback for found peers. 325 * @param callback Callback for found peers.
326 */ 326 */
@@ -375,14 +375,14 @@ dht_get_string_accept_handler (void *cls, struct GNUNET_TIME_Absolute exp,
375 struct RegexSearchContext *ctx = cls; 375 struct RegexSearchContext *ctx = cls;
376 struct REGEX_INTERNAL_Search *info = ctx->info; 376 struct REGEX_INTERNAL_Search *info = ctx->info;
377 377
378 LOG (GNUNET_ERROR_TYPE_DEBUG, 378 LOG (GNUNET_ERROR_TYPE_DEBUG,
379 "Regex result accept for %s (key %s)\n", 379 "Regex result accept for %s (key %s)\n",
380 info->description, GNUNET_h2s(key)); 380 info->description, GNUNET_h2s(key));
381 381
382 GNUNET_STATISTICS_update (info->stats, 382 GNUNET_STATISTICS_update (info->stats,
383 "# regex accepting blocks found", 383 "# regex accepting blocks found",
384 1, GNUNET_NO); 384 1, GNUNET_NO);
385 GNUNET_STATISTICS_update (info->stats, 385 GNUNET_STATISTICS_update (info->stats,
386 "# regex accepting block bytes found", 386 "# regex accepting block bytes found",
387 size, GNUNET_NO); 387 size, GNUNET_NO);
388 info->callback (info->callback_cls, 388 info->callback (info->callback_cls,
@@ -395,7 +395,7 @@ dht_get_string_accept_handler (void *cls, struct GNUNET_TIME_Absolute exp,
395/** 395/**
396 * Find a path to a peer that offers a regex servcie compatible 396 * Find a path to a peer that offers a regex servcie compatible
397 * with a given string. 397 * with a given string.
398 * 398 *
399 * @param key The key of the accepting state. 399 * @param key The key of the accepting state.
400 * @param ctx Context containing info about the string, tunnel, etc. 400 * @param ctx Context containing info about the string, tunnel, etc.
401 */ 401 */
@@ -457,7 +457,7 @@ dht_get_string_handler (void *cls, struct GNUNET_TIME_Absolute exp,
457 size_t len; 457 size_t len;
458 struct Result *copy; 458 struct Result *copy;
459 459
460 LOG (GNUNET_ERROR_TYPE_INFO, 460 LOG (GNUNET_ERROR_TYPE_INFO,
461 "DHT GET result for %s (%s)\n", 461 "DHT GET result for %s (%s)\n",
462 GNUNET_h2s (key), ctx->info->description); 462 GNUNET_h2s (key), ctx->info->description);
463 copy = GNUNET_malloc (sizeof (struct Result) + size); 463 copy = GNUNET_malloc (sizeof (struct Result) + size);
@@ -503,18 +503,18 @@ regex_result_iterator (void *cls,
503 const struct RegexBlock *block = result->data; 503 const struct RegexBlock *block = result->data;
504 struct RegexSearchContext *ctx = cls; 504 struct RegexSearchContext *ctx = cls;
505 505
506 if ( (GNUNET_YES == 506 if ( (GNUNET_YES ==
507 GNUNET_BLOCK_is_accepting (block, result->size)) && 507 GNUNET_BLOCK_is_accepting (block, result->size)) &&
508 (ctx->position == strlen (ctx->info->description)) ) 508 (ctx->position == strlen (ctx->info->description)) )
509 { 509 {
510 LOG (GNUNET_ERROR_TYPE_INFO, 510 LOG (GNUNET_ERROR_TYPE_INFO,
511 "Found accepting known block\n"); 511 "Found accepting known block\n");
512 regex_find_path (key, ctx); 512 regex_find_path (key, ctx);
513 return GNUNET_YES; // We found an accept state! 513 return GNUNET_YES; // We found an accept state!
514 } 514 }
515 LOG (GNUNET_ERROR_TYPE_DEBUG, 515 LOG (GNUNET_ERROR_TYPE_DEBUG,
516 "* %u, %u, [%u]\n", 516 "* %u, %u, [%u]\n",
517 ctx->position, 517 ctx->position,
518 strlen (ctx->info->description), 518 strlen (ctx->info->description),
519 GNUNET_BLOCK_is_accepting (block, result->size)); 519 GNUNET_BLOCK_is_accepting (block, result->size));
520 regex_next_edge (block, result->size, ctx); 520 regex_next_edge (block, result->size, ctx);
@@ -554,12 +554,12 @@ regex_edge_iterator (void *cls,
554 if (len > current_len) 554 if (len > current_len)
555 { 555 {
556 LOG (GNUNET_ERROR_TYPE_DEBUG, "Token too long, END\n"); 556 LOG (GNUNET_ERROR_TYPE_DEBUG, "Token too long, END\n");
557 return GNUNET_YES; 557 return GNUNET_YES;
558 } 558 }
559 if (0 != strncmp (current, token, len)) 559 if (0 != strncmp (current, token, len))
560 { 560 {
561 LOG (GNUNET_ERROR_TYPE_DEBUG, "Token doesn't match, END\n"); 561 LOG (GNUNET_ERROR_TYPE_DEBUG, "Token doesn't match, END\n");
562 return GNUNET_YES; 562 return GNUNET_YES;
563 } 563 }
564 564
565 if (len > ctx->longest_match) 565 if (len > ctx->longest_match)
@@ -598,7 +598,7 @@ regex_next_edge (const struct RegexBlock *block,
598 int result; 598 int result;
599 599
600 LOG (GNUNET_ERROR_TYPE_DEBUG, "Next edge\n"); 600 LOG (GNUNET_ERROR_TYPE_DEBUG, "Next edge\n");
601 /* Find the longest match for the current string position, 601 /* Find the longest match for the current string position,
602 * among tokens in the given block */ 602 * among tokens in the given block */
603 ctx->longest_match = 0; 603 ctx->longest_match = 0;
604 result = REGEX_BLOCK_iterate (block, size, 604 result = REGEX_BLOCK_iterate (block, size,
@@ -608,7 +608,7 @@ regex_next_edge (const struct RegexBlock *block,
608 /* Did anything match? */ 608 /* Did anything match? */
609 if (0 == ctx->longest_match) 609 if (0 == ctx->longest_match)
610 { 610 {
611 LOG (GNUNET_ERROR_TYPE_DEBUG, 611 LOG (GNUNET_ERROR_TYPE_DEBUG,
612 "no match in block\n"); 612 "no match in block\n");
613 return; 613 return;
614 } 614 }
@@ -623,7 +623,7 @@ regex_next_edge (const struct RegexBlock *block,
623 if (GNUNET_YES == 623 if (GNUNET_YES ==
624 GNUNET_CONTAINER_multihashmap_contains (info->dht_get_handles, hash)) 624 GNUNET_CONTAINER_multihashmap_contains (info->dht_get_handles, hash))
625 { 625 {
626 LOG (GNUNET_ERROR_TYPE_DEBUG, 626 LOG (GNUNET_ERROR_TYPE_DEBUG,
627 "GET for %s running, END\n", 627 "GET for %s running, END\n",
628 GNUNET_h2s (hash)); 628 GNUNET_h2s (hash));
629 GNUNET_CONTAINER_multihashmap_get_multiple (info->dht_get_results, 629 GNUNET_CONTAINER_multihashmap_get_multiple (info->dht_get_results,
@@ -636,11 +636,11 @@ regex_next_edge (const struct RegexBlock *block,
636 GNUNET_STATISTICS_update (info->stats, "# regex nodes traversed", 636 GNUNET_STATISTICS_update (info->stats, "# regex nodes traversed",
637 1, GNUNET_NO); 637 1, GNUNET_NO);
638 638
639 LOG (GNUNET_ERROR_TYPE_INFO, 639 LOG (GNUNET_ERROR_TYPE_INFO,
640 "looking for %s\n", 640 "looking for %s\n",
641 GNUNET_h2s (hash)); 641 GNUNET_h2s (hash));
642 rest = &new_ctx->info->description[new_ctx->position]; 642 rest = &new_ctx->info->description[new_ctx->position];
643 get_h = 643 get_h =
644 GNUNET_DHT_get_start (info->dht, /* handle */ 644 GNUNET_DHT_get_start (info->dht, /* handle */
645 GNUNET_BLOCK_TYPE_REGEX, /* type */ 645 GNUNET_BLOCK_TYPE_REGEX, /* type */
646 hash, /* key to search */ 646 hash, /* key to search */
@@ -671,7 +671,7 @@ regex_next_edge (const struct RegexBlock *block,
671 * @param callback Callback for found peers. 671 * @param callback Callback for found peers.
672 * @param callback_cls Closure for @c callback. 672 * @param callback_cls Closure for @c callback.
673 * @param stats Optional statistics handle to report usage. Can be NULL. 673 * @param stats Optional statistics handle to report usage. Can be NULL.
674 * 674 *
675 * @return Handle to stop search and free resources. 675 * @return Handle to stop search and free resources.
676 * Must be freed by calling REGEX_INTERNAL_search_cancel. 676 * Must be freed by calling REGEX_INTERNAL_search_cancel.
677 */ 677 */
@@ -712,8 +712,8 @@ REGEX_INTERNAL_search (struct GNUNET_DHT_Handle *dht,
712 ctx->position = size; 712 ctx->position = size;
713 ctx->info = h; 713 ctx->info = h;
714 GNUNET_array_append (h->contexts, h->n_contexts, ctx); 714 GNUNET_array_append (h->contexts, h->n_contexts, ctx);
715 LOG (GNUNET_ERROR_TYPE_DEBUG, 715 LOG (GNUNET_ERROR_TYPE_DEBUG,
716 "consumed %u bits out of %u, now looking for %s\n", 716 "consumed %u bits out of %u, now looking for %s\n",
717 size, len, 717 size, len,
718 GNUNET_h2s (&key)); 718 GNUNET_h2s (&key));
719 719
diff --git a/src/regex/regex_internal_lib.h b/src/regex/regex_internal_lib.h
index 96334c1c3..6b69d79eb 100644
--- a/src/regex/regex_internal_lib.h
+++ b/src/regex/regex_internal_lib.h
@@ -170,13 +170,13 @@ struct REGEX_INTERNAL_Search;
170/** 170/**
171 * Announce a regular expression: put all states of the automaton in the DHT. 171 * Announce a regular expression: put all states of the automaton in the DHT.
172 * Does not free resources, must call REGEX_INTERNAL_announce_cancel for that. 172 * Does not free resources, must call REGEX_INTERNAL_announce_cancel for that.
173 * 173 *
174 * @param dht An existing and valid DHT service handle. CANNOT be NULL. 174 * @param dht An existing and valid DHT service handle. CANNOT be NULL.
175 * @param priv our private key, must remain valid until the announcement is cancelled 175 * @param priv our private key, must remain valid until the announcement is cancelled
176 * @param regex Regular expression to announce. 176 * @param regex Regular expression to announce.
177 * @param compression How many characters per edge can we squeeze? 177 * @param compression How many characters per edge can we squeeze?
178 * @param stats Optional statistics handle to report usage. Can be NULL. 178 * @param stats Optional statistics handle to report usage. Can be NULL.
179 * 179 *
180 * @return Handle to reuse o free cached resources. 180 * @return Handle to reuse o free cached resources.
181 * Must be freed by calling REGEX_INTERNAL_announce_cancel. 181 * Must be freed by calling REGEX_INTERNAL_announce_cancel.
182 */ 182 */
@@ -191,7 +191,7 @@ REGEX_INTERNAL_announce (struct GNUNET_DHT_Handle *dht,
191/** 191/**
192 * Announce again a regular expression previously announced. 192 * Announce again a regular expression previously announced.
193 * Does use caching to speed up process. 193 * Does use caching to speed up process.
194 * 194 *
195 * @param h Handle returned by a previous REGEX_INTERNAL_announce call. 195 * @param h Handle returned by a previous REGEX_INTERNAL_announce call.
196 */ 196 */
197void 197void
@@ -201,7 +201,7 @@ REGEX_INTERNAL_reannounce (struct REGEX_INTERNAL_Announcement *h);
201/** 201/**
202 * Clear all cached data used by a regex announce. 202 * Clear all cached data used by a regex announce.
203 * Does not close DHT connection. 203 * Does not close DHT connection.
204 * 204 *
205 * @param h Handle returned by a previous REGEX_INTERNAL_announce call. 205 * @param h Handle returned by a previous REGEX_INTERNAL_announce call.
206 */ 206 */
207void 207void
@@ -236,7 +236,7 @@ typedef void (*REGEX_INTERNAL_Found)(void *cls,
236 * @param callback Callback for found peers. 236 * @param callback Callback for found peers.
237 * @param callback_cls Closure for @c callback. 237 * @param callback_cls Closure for @c callback.
238 * @param stats Optional statistics handle to report usage. Can be NULL. 238 * @param stats Optional statistics handle to report usage. Can be NULL.
239 * 239 *
240 * @return Handle to stop search and free resources. 240 * @return Handle to stop search and free resources.
241 * Must be freed by calling REGEX_INTERNAL_search_cancel. 241 * Must be freed by calling REGEX_INTERNAL_search_cancel.
242 */ 242 */
@@ -250,7 +250,7 @@ REGEX_INTERNAL_search (struct GNUNET_DHT_Handle *dht,
250/** 250/**
251 * Stop search and free all data used by a REGEX_INTERNAL_search call. 251 * Stop search and free all data used by a REGEX_INTERNAL_search call.
252 * Does not close DHT connection. 252 * Does not close DHT connection.
253 * 253 *
254 * @param h Handle returned by a previous REGEX_INTERNAL_search call. 254 * @param h Handle returned by a previous REGEX_INTERNAL_search call.
255 */ 255 */
256void 256void
diff --git a/src/regex/regex_ipc.h b/src/regex/regex_ipc.h
index fd6440bb8..ab7aa45cd 100644
--- a/src/regex/regex_ipc.h
+++ b/src/regex/regex_ipc.h
@@ -43,7 +43,7 @@ struct AnnounceMessage
43 * How many characters can we squeeze per edge? 43 * How many characters can we squeeze per edge?
44 */ 44 */
45 uint16_t compression; 45 uint16_t compression;
46 46
47 /** 47 /**
48 * Always zero. 48 * Always zero.
49 */ 49 */
@@ -97,7 +97,7 @@ struct ResultMessage
97 * Identity of the peer that was found. 97 * Identity of the peer that was found.
98 */ 98 */
99 struct GNUNET_PeerIdentity id; 99 struct GNUNET_PeerIdentity id;
100 100
101 /* followed by GET path and PUT path arrays */ 101 /* followed by GET path and PUT path arrays */
102 102
103}; 103};
diff --git a/src/regex/regex_test_lib.c b/src/regex/regex_test_lib.c
index 449575150..b871ea872 100644
--- a/src/regex/regex_test_lib.c
+++ b/src/regex/regex_test_lib.c
@@ -1,17 +1,17 @@
1/* 1/*
2 * This file is part of GNUnet 2 * This file is part of GNUnet
3 * (C) 2012 Christian Grothoff (and other contributing authors) 3 * (C) 2012 Christian Grothoff (and other contributing authors)
4 * 4 *
5 * GNUnet is free software; you can redistribute it and/or modify 5 * GNUnet is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published 6 * it under the terms of the GNU General Public License as published
7 * by the Free Software Foundation; either version 3, or (at your 7 * by the Free Software Foundation; either version 3, or (at your
8 * option) any later version. 8 * option) any later version.
9 * 9 *
10 * GNUnet is distributed in the hope that it will be useful, but 10 * GNUnet is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of 11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details. 13 * General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with GNUnet; see the file COPYING. If not, write to the 16 * along with GNUnet; see the file COPYING. If not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
@@ -153,10 +153,10 @@ regex_combine (struct RegexCombineCtx *ctx)
153 153
154/** 154/**
155 * Get the number of matching characters on the prefix of both strings. 155 * Get the number of matching characters on the prefix of both strings.
156 * 156 *
157 * @param s1 String 1. 157 * @param s1 String 1.
158 * @param s2 String 2. 158 * @param s2 String 2.
159 * 159 *
160 * @return Number of characters of matching prefix. 160 * @return Number of characters of matching prefix.
161 */ 161 */
162static unsigned int 162static unsigned int
@@ -183,10 +183,10 @@ get_prefix_length (const char *s1, const char *s2)
183/** 183/**
184 * Return the child context with the longest prefix match with the regex. 184 * Return the child context with the longest prefix match with the regex.
185 * Usually only one child will match, search all just in case. 185 * Usually only one child will match, search all just in case.
186 * 186 *
187 * @param ctx Context whose children to search. 187 * @param ctx Context whose children to search.
188 * @param regex String to match. 188 * @param regex String to match.
189 * 189 *
190 * @return Child with the longest prefix, NULL if no child matches. 190 * @return Child with the longest prefix, NULL if no child matches.
191 */ 191 */
192static struct RegexCombineCtx * 192static struct RegexCombineCtx *
diff --git a/src/regex/regex_test_lib.h b/src/regex/regex_test_lib.h
index 87dcadf72..a9fcab2f1 100644
--- a/src/regex/regex_test_lib.h
+++ b/src/regex/regex_test_lib.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * This file is part of GNUnet 2 * This file is part of GNUnet
3 * (C) 2012 Christian Grothoff (and other contributing authors) 3 * (C) 2012 Christian Grothoff (and other contributing authors)
4 * 4 *
5 * GNUnet is free software; you can redistribute it and/or modify 5 * GNUnet is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published 6 * it under the terms of the GNU General Public License as published
7 * by the Free Software Foundation; either version 3, or (at your 7 * by the Free Software Foundation; either version 3, or (at your
8 * option) any later version. 8 * option) any later version.
9 * 9 *
10 * GNUnet is distributed in the hope that it will be useful, but 10 * GNUnet is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of 11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details. 13 * General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with GNUnet; see the file COPYING. If not, write to the 16 * along with GNUnet; see the file COPYING. If not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
diff --git a/src/regex/test_regex_api.c b/src/regex/test_regex_api.c
index 81627e6e4..a35934c9c 100644
--- a/src/regex/test_regex_api.c
+++ b/src/regex/test_regex_api.c
@@ -84,7 +84,7 @@ end_badly ()
84 * @param put_path Path of the put request. 84 * @param put_path Path of the put request.
85 * @param put_path_length Length of the put_path. 85 * @param put_path_length Length of the put_path.
86 */ 86 */
87static void 87static void
88found_cb (void *cls, 88found_cb (void *cls,
89 const struct GNUNET_PeerIdentity *id, 89 const struct GNUNET_PeerIdentity *id,
90 const struct GNUNET_PeerIdentity *get_path, 90 const struct GNUNET_PeerIdentity *get_path,
@@ -106,7 +106,7 @@ run (void *cls,
106 die_task = 106 die_task =
107 GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, 107 GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT,
108 &end_badly, NULL); 108 &end_badly, NULL);
109 a = GNUNET_REGEX_announce (cfg, 109 a = GNUNET_REGEX_announce (cfg,
110 "my long prefix - hello world(0|1)*", 110 "my long prefix - hello world(0|1)*",
111 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 111 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
112 5), 112 5),
diff --git a/src/regex/test_regex_iterate_api.c b/src/regex/test_regex_iterate_api.c
index 69badb5d8..a86295abf 100644
--- a/src/regex/test_regex_iterate_api.c
+++ b/src/regex/test_regex_iterate_api.c
@@ -60,7 +60,7 @@ struct RegexStringPair
60 60
61 61
62static void 62static void
63key_iterator (void *cls, const struct GNUNET_HashCode *key, 63key_iterator (void *cls, const struct GNUNET_HashCode *key,
64 const char *proof, 64 const char *proof,
65 int accepting, unsigned int num_edges, 65 int accepting, unsigned int num_edges,
66 const struct REGEX_BLOCK_Edge *edges) 66 const struct REGEX_BLOCK_Edge *edges)
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c
index 10259fc99..1859722d8 100644
--- a/src/revocation/gnunet-revocation.c
+++ b/src/revocation/gnunet-revocation.c
@@ -61,7 +61,7 @@ static struct GNUNET_REVOCATION_Query *q;
61 61
62/** 62/**
63 * Handle for revocation. 63 * Handle for revocation.
64 */ 64 */
65static struct GNUNET_REVOCATION_Handle *h; 65static struct GNUNET_REVOCATION_Handle *h;
66 66
67/** 67/**
@@ -71,12 +71,12 @@ static struct GNUNET_IDENTITY_EgoLookup *el;
71 71
72/** 72/**
73 * Our configuration. 73 * Our configuration.
74 */ 74 */
75static const struct GNUNET_CONFIGURATION_Handle *cfg; 75static const struct GNUNET_CONFIGURATION_Handle *cfg;
76 76
77/** 77/**
78 * Number of matching bits required for revocation. 78 * Number of matching bits required for revocation.
79 */ 79 */
80static unsigned long long matching_bits; 80static unsigned long long matching_bits;
81 81
82 82
@@ -178,7 +178,7 @@ print_revocation_result (void *cls,
178/** 178/**
179 * Data needed to perform a revocation. 179 * Data needed to perform a revocation.
180 */ 180 */
181struct RevocationData 181struct RevocationData
182{ 182{
183 /** 183 /**
184 * Public key. 184 * Public key.
@@ -226,7 +226,7 @@ calculate_pow (void *cls,
226 226
227 if ( (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) || 227 if ( (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) ||
228 (0 == (rd->pow % 128) ) ) 228 (0 == (rd->pow % 128) ) )
229 { 229 {
230 if (0 == (rd->pow % 128 * 1024)) 230 if (0 == (rd->pow % 128 * 1024))
231 { 231 {
232 if (0 == (rd->pow % (1024 * 128 * 80))) 232 if (0 == (rd->pow % (1024 * 128 * 80)))
@@ -308,7 +308,7 @@ ego_callback (void *cls,
308 &key); 308 &key);
309 rd = GNUNET_new (struct RevocationData); 309 rd = GNUNET_new (struct RevocationData);
310 if ( (NULL != filename) && 310 if ( (NULL != filename) &&
311 (GNUNET_YES == 311 (GNUNET_YES ==
312 GNUNET_DISK_file_test (filename)) && 312 GNUNET_DISK_file_test (filename)) &&
313 (sizeof (struct RevocationData) == 313 (sizeof (struct RevocationData) ==
314 GNUNET_DISK_fn_read (filename, 314 GNUNET_DISK_fn_read (filename,
@@ -325,10 +325,10 @@ ego_callback (void *cls,
325 revoke_ego); 325 revoke_ego);
326 GNUNET_free (rd); 326 GNUNET_free (rd);
327 return; 327 return;
328 } 328 }
329 } 329 }
330 else 330 else
331 { 331 {
332 GNUNET_REVOCATION_sign_revocation (GNUNET_IDENTITY_ego_get_private_key (ego), 332 GNUNET_REVOCATION_sign_revocation (GNUNET_IDENTITY_ego_get_private_key (ego),
333 &rd->sig); 333 &rd->sig);
334 rd->key = key; 334 rd->key = key;
@@ -362,8 +362,8 @@ ego_callback (void *cls,
362 * @param c configuration 362 * @param c configuration
363 */ 363 */
364static void 364static void
365run (void *cls, 365run (void *cls,
366 char *const *args, 366 char *const *args,
367 const char *cfgfile, 367 const char *cfgfile,
368 const struct GNUNET_CONFIGURATION_Handle *c) 368 const struct GNUNET_CONFIGURATION_Handle *c)
369{ 369{
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c
index c4622279a..7f85301be 100644
--- a/src/revocation/gnunet-service-revocation.c
+++ b/src/revocation/gnunet-service-revocation.c
@@ -34,7 +34,7 @@
34 * - broadcast p2p revocations 34 * - broadcast p2p revocations
35 * - handle p2p connect (trigger SET union) 35 * - handle p2p connect (trigger SET union)
36 * - optimization: avoid sending revocation back to peer that we got it from; 36 * - optimization: avoid sending revocation back to peer that we got it from;
37 * - optimization: have randomized delay in sending revocations to other peers 37 * - optimization: have randomized delay in sending revocations to other peers
38 * to make it rare to traverse each link twice (NSE-style) 38 * to make it rare to traverse each link twice (NSE-style)
39 */ 39 */
40#include "platform.h" 40#include "platform.h"
@@ -83,7 +83,7 @@ static struct GNUNET_SET_Handle *revocation_set;
83/** 83/**
84 * Hash map with all revoked keys, maps the hash of the public key 84 * Hash map with all revoked keys, maps the hash of the public key
85 * to the respective `struct RevokeMessage`. 85 * to the respective `struct RevokeMessage`.
86 */ 86 */
87static struct GNUNET_CONTAINER_MultiHashMap *revocation_map; 87static struct GNUNET_CONTAINER_MultiHashMap *revocation_map;
88 88
89/** 89/**
@@ -147,7 +147,7 @@ verify_revoke_message (const struct RevokeMessage *rm)
147 rm->proof_of_work, 147 rm->proof_of_work,
148 (unsigned int) revocation_work_required)) 148 (unsigned int) revocation_work_required))
149 { 149 {
150 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 150 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
151 "Proof of work invalid: %llu!\n", 151 "Proof of work invalid: %llu!\n",
152 (unsigned long long) 152 (unsigned long long)
153 GNUNET_ntohll (rm->proof_of_work)); 153 GNUNET_ntohll (rm->proof_of_work));
@@ -175,7 +175,7 @@ verify_revoke_message (const struct RevokeMessage *rm)
175 * @param message the message received 175 * @param message the message received
176 */ 176 */
177static void 177static void
178handle_query_message (void *cls, 178handle_query_message (void *cls,
179 struct GNUNET_SERVER_Client *client, 179 struct GNUNET_SERVER_Client *client,
180 const struct GNUNET_MessageHeader *message) 180 const struct GNUNET_MessageHeader *message)
181{ 181{
@@ -188,15 +188,15 @@ handle_query_message (void *cls,
188 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), 188 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
189 &hc); 189 &hc);
190 res = GNUNET_CONTAINER_multihashmap_contains (revocation_map, &hc); 190 res = GNUNET_CONTAINER_multihashmap_contains (revocation_map, &hc);
191 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 191 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
192 (GNUNET_NO == res) 192 (GNUNET_NO == res)
193 ? "Received revocation check for valid key `%s' from client\n" 193 ? "Received revocation check for valid key `%s' from client\n"
194 : "Received revocation check for revoked key `%s' from client\n", 194 : "Received revocation check for revoked key `%s' from client\n",
195 GNUNET_h2s (&hc)); 195 GNUNET_h2s (&hc));
196 qrm.header.size = htons (sizeof (struct QueryResponseMessage)); 196 qrm.header.size = htons (sizeof (struct QueryResponseMessage));
197 qrm.header.type = htons (GNUNET_MESSAGE_TYPE_REVOCATION_QUERY_RESPONSE); 197 qrm.header.type = htons (GNUNET_MESSAGE_TYPE_REVOCATION_QUERY_RESPONSE);
198 qrm.is_valid = htons ((GNUNET_YES == res) ? GNUNET_NO : GNUNET_YES); 198 qrm.is_valid = htons ((GNUNET_YES == res) ? GNUNET_NO : GNUNET_YES);
199 GNUNET_SERVER_notification_context_add (nc, 199 GNUNET_SERVER_notification_context_add (nc,
200 client); 200 client);
201 GNUNET_SERVER_notification_context_unicast (nc, 201 GNUNET_SERVER_notification_context_unicast (nc,
202 client, 202 client,
@@ -228,7 +228,7 @@ do_flood (void *cls,
228 * Publicize revocation message. Stores the message locally in the 228 * Publicize revocation message. Stores the message locally in the
229 * database and passes it to all connected neighbours (and adds it to 229 * database and passes it to all connected neighbours (and adds it to
230 * the set for future connections). 230 * the set for future connections).
231 * 231 *
232 * @param rm message to publicize 232 * @param rm message to publicize
233 * @return #GNUNET_OK on success, #GNUNET_NO if we encountered an error, 233 * @return #GNUNET_OK on success, #GNUNET_NO if we encountered an error,
234 * #GNUNET_SYSERR if the message was malformed 234 * #GNUNET_SYSERR if the message was malformed
@@ -251,12 +251,12 @@ publicize_rm (const struct RevokeMessage *rm)
251 _("Duplicate revocation received from peer. Ignored.\n")); 251 _("Duplicate revocation received from peer. Ignored.\n"));
252 return GNUNET_OK; 252 return GNUNET_OK;
253 } 253 }
254 if (GNUNET_OK != 254 if (GNUNET_OK !=
255 verify_revoke_message (rm)) 255 verify_revoke_message (rm))
256 { 256 {
257 GNUNET_break_op (0); 257 GNUNET_break_op (0);
258 return GNUNET_SYSERR; 258 return GNUNET_SYSERR;
259 } 259 }
260 /* write to disk */ 260 /* write to disk */
261 if (sizeof (struct RevokeMessage) != 261 if (sizeof (struct RevokeMessage) !=
262 GNUNET_DISK_file_write (revocation_db, 262 GNUNET_DISK_file_write (revocation_db,
@@ -294,7 +294,7 @@ publicize_rm (const struct RevokeMessage *rm)
294 return GNUNET_OK; 294 return GNUNET_OK;
295 } 295 }
296 /* flood to neighbours */ 296 /* flood to neighbours */
297 GNUNET_CONTAINER_multipeermap_iterate (peers, 297 GNUNET_CONTAINER_multipeermap_iterate (peers,
298 &do_flood, 298 &do_flood,
299 cp); 299 cp);
300 return GNUNET_OK; 300 return GNUNET_OK;
@@ -309,7 +309,7 @@ publicize_rm (const struct RevokeMessage *rm)
309 * @param message the message received 309 * @param message the message received
310 */ 310 */
311static void 311static void
312handle_revoke_message (void *cls, 312handle_revoke_message (void *cls,
313 struct GNUNET_SERVER_Client *client, 313 struct GNUNET_SERVER_Client *client,
314 const struct GNUNET_MessageHeader *message) 314 const struct GNUNET_MessageHeader *message)
315{ 315{
@@ -317,7 +317,7 @@ handle_revoke_message (void *cls,
317 struct RevocationResponseMessage rrm; 317 struct RevocationResponseMessage rrm;
318 int ret; 318 int ret;
319 319
320 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 320 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
321 "Received REVOKE message from client\n"); 321 "Received REVOKE message from client\n");
322 rm = (const struct RevokeMessage *) message; 322 rm = (const struct RevokeMessage *) message;
323 if (GNUNET_SYSERR == (ret = publicize_rm (rm))) 323 if (GNUNET_SYSERR == (ret = publicize_rm (rm)))
@@ -329,7 +329,7 @@ handle_revoke_message (void *cls,
329 rrm.header.size = htons (sizeof (struct RevocationResponseMessage)); 329 rrm.header.size = htons (sizeof (struct RevocationResponseMessage));
330 rrm.header.type = htons (GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE_RESPONSE); 330 rrm.header.type = htons (GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE_RESPONSE);
331 rrm.is_valid = htons ((GNUNET_OK == ret) ? GNUNET_NO : GNUNET_YES); 331 rrm.is_valid = htons ((GNUNET_OK == ret) ? GNUNET_NO : GNUNET_YES);
332 GNUNET_SERVER_notification_context_add (nc, 332 GNUNET_SERVER_notification_context_add (nc,
333 client); 333 client);
334 GNUNET_SERVER_notification_context_unicast (nc, 334 GNUNET_SERVER_notification_context_unicast (nc,
335 client, 335 client,
@@ -347,13 +347,13 @@ handle_revoke_message (void *cls,
347 * @param peer peer identity this message is from (ignored) 347 * @param peer peer identity this message is from (ignored)
348 */ 348 */
349static int 349static int
350handle_p2p_revoke_message (void *cls, 350handle_p2p_revoke_message (void *cls,
351 const struct GNUNET_PeerIdentity *peer, 351 const struct GNUNET_PeerIdentity *peer,
352 const struct GNUNET_MessageHeader *message) 352 const struct GNUNET_MessageHeader *message)
353{ 353{
354 const struct RevokeMessage *rm; 354 const struct RevokeMessage *rm;
355 355
356 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 356 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
357 "Received REVOKE message from peer\n"); 357 "Received REVOKE message from peer\n");
358 rm = (const struct RevokeMessage *) message; 358 rm = (const struct RevokeMessage *) message;
359 GNUNET_break_op (GNUNET_SYSERR != publicize_rm (rm)); 359 GNUNET_break_op (GNUNET_SYSERR != publicize_rm (rm));
@@ -400,7 +400,7 @@ handle_core_connect (void *cls,
400 * @param peer peer identity this notification is about 400 * @param peer peer identity this notification is about
401 */ 401 */
402static void 402static void
403handle_core_disconnect (void *cls, 403handle_core_disconnect (void *cls,
404 const struct GNUNET_PeerIdentity *peer) 404 const struct GNUNET_PeerIdentity *peer)
405{ 405{
406 struct PeerEntry *pos; 406 struct PeerEntry *pos;
@@ -418,7 +418,7 @@ handle_core_disconnect (void *cls,
418 GNUNET_CONTAINER_multipeermap_remove (peers, peer, 418 GNUNET_CONTAINER_multipeermap_remove (peers, peer,
419 pos)); 419 pos));
420#if 0 420#if 0
421 if (pos->transmit_task != GNUNET_SCHEDULER_NO_TASK) 421 if (pos->transmit_task != GNUNET_SCHEDULER_NO_TASK)
422 { 422 {
423 GNUNET_SCHEDULER_cancel (pos->transmit_task); 423 GNUNET_SCHEDULER_cancel (pos->transmit_task);
424 pos->transmit_task = GNUNET_SCHEDULER_NO_TASK; 424 pos->transmit_task = GNUNET_SCHEDULER_NO_TASK;
@@ -436,7 +436,7 @@ handle_core_disconnect (void *cls,
436 436
437/** 437/**
438 * Free all values in a hash map. 438 * Free all values in a hash map.
439 * 439 *
440 * @param cls NULL 440 * @param cls NULL
441 * @param key the key 441 * @param key the key
442 * @param value value to free 442 * @param value value to free
@@ -506,12 +506,12 @@ shutdown_task (void *cls,
506 * @param identity the public identity of this peer 506 * @param identity the public identity of this peer
507 */ 507 */
508static void 508static void
509core_init (void *cls, 509core_init (void *cls,
510 const struct GNUNET_PeerIdentity *identity) 510 const struct GNUNET_PeerIdentity *identity)
511{ 511{
512 if (NULL == identity) 512 if (NULL == identity)
513 { 513 {
514 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 514 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
515 "Connection to core FAILED!\n"); 515 "Connection to core FAILED!\n");
516 GNUNET_SCHEDULER_shutdown (); 516 GNUNET_SCHEDULER_shutdown ();
517 return; 517 return;
@@ -528,7 +528,7 @@ core_init (void *cls,
528 * @param c configuration to use 528 * @param c configuration to use
529 */ 529 */
530static void 530static void
531run (void *cls, 531run (void *cls,
532 struct GNUNET_SERVER_Handle *server, 532 struct GNUNET_SERVER_Handle *server,
533 const struct GNUNET_CONFIGURATION_Handle *c) 533 const struct GNUNET_CONFIGURATION_Handle *c)
534{ 534{
@@ -562,7 +562,7 @@ run (void *cls,
562 return; 562 return;
563 } 563 }
564 cfg = c; 564 cfg = c;
565 srv = server; 565 srv = server;
566 revocation_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO); 566 revocation_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO);
567 nc = GNUNET_SERVER_notification_context_create (server, 1); 567 nc = GNUNET_SERVER_notification_context_create (server, 1);
568 if (GNUNET_OK != 568 if (GNUNET_OK !=
@@ -588,7 +588,7 @@ run (void *cls,
588 } 588 }
589 revocation_set = GNUNET_SET_create (cfg, 589 revocation_set = GNUNET_SET_create (cfg,
590 GNUNET_SET_OPERATION_UNION); 590 GNUNET_SET_OPERATION_UNION);
591 591
592 revocation_db = GNUNET_DISK_file_open (fn, 592 revocation_db = GNUNET_DISK_file_open (fn,
593 GNUNET_DISK_OPEN_READWRITE | 593 GNUNET_DISK_OPEN_READWRITE |
594 GNUNET_DISK_OPEN_CREATE, 594 GNUNET_DISK_OPEN_CREATE,
@@ -607,10 +607,10 @@ run (void *cls,
607 } 607 }
608 if (GNUNET_OK != 608 if (GNUNET_OK !=
609 GNUNET_DISK_file_size (fn, &left, GNUNET_YES, GNUNET_YES)) 609 GNUNET_DISK_file_size (fn, &left, GNUNET_YES, GNUNET_YES))
610 left = 0; 610 left = 0;
611 while (left > sizeof (struct RevokeMessage)) 611 while (left > sizeof (struct RevokeMessage))
612 { 612 {
613 rm = GNUNET_new (struct RevokeMessage); 613 rm = GNUNET_new (struct RevokeMessage);
614 if (sizeof (struct RevokeMessage) != 614 if (sizeof (struct RevokeMessage) !=
615 GNUNET_DISK_file_read (revocation_db, 615 GNUNET_DISK_file_read (revocation_db,
616 rm, 616 rm,
@@ -632,10 +632,10 @@ run (void *cls,
632 GNUNET_CONTAINER_multihashmap_put (revocation_map, 632 GNUNET_CONTAINER_multihashmap_put (revocation_map,
633 &hc, 633 &hc,
634 rm, 634 rm,
635 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 635 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
636 } 636 }
637 GNUNET_free (fn); 637 GNUNET_free (fn);
638 638
639 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, 639 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
640 NULL); 640 NULL);
641 peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); 641 peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
@@ -668,7 +668,7 @@ run (void *cls,
668 * @return 0 ok, 1 on error 668 * @return 0 ok, 1 on error
669 */ 669 */
670int 670int
671main (int argc, 671main (int argc,
672 char *const *argv) 672 char *const *argv)
673{ 673{
674 return (GNUNET_OK == 674 return (GNUNET_OK ==
@@ -683,7 +683,7 @@ main (int argc,
683/** 683/**
684 * MINIMIZE heap size (way below 128k) since this process doesn't need much. 684 * MINIMIZE heap size (way below 128k) since this process doesn't need much.
685 */ 685 */
686void __attribute__ ((constructor)) 686void __attribute__ ((constructor))
687GNUNET_ARM_memory_init () 687GNUNET_ARM_memory_init ()
688{ 688{
689 mallopt (M_TRIM_THRESHOLD, 4 * 1024); 689 mallopt (M_TRIM_THRESHOLD, 4 * 1024);
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c
index 858649bbd..acc13ba67 100644
--- a/src/revocation/revocation_api.c
+++ b/src/revocation/revocation_api.c
@@ -40,7 +40,7 @@ struct GNUNET_REVOCATION_Query
40 * Connection to the service. 40 * Connection to the service.
41 */ 41 */
42 struct GNUNET_CLIENT_Connection *client; 42 struct GNUNET_CLIENT_Connection *client;
43 43
44 /** 44 /**
45 * Our configuration. 45 * Our configuration.
46 */ 46 */
@@ -196,12 +196,12 @@ GNUNET_REVOCATION_query_cancel (struct GNUNET_REVOCATION_Query *q)
196 */ 196 */
197struct GNUNET_REVOCATION_Handle 197struct GNUNET_REVOCATION_Handle
198{ 198{
199 199
200 /** 200 /**
201 * Connection to the service. 201 * Connection to the service.
202 */ 202 */
203 struct GNUNET_CLIENT_Connection *client; 203 struct GNUNET_CLIENT_Connection *client;
204 204
205 /** 205 /**
206 * Our configuration. 206 * Our configuration.
207 */ 207 */
@@ -265,7 +265,7 @@ handle_revocation_response (void *cls,
265 rrm = (const struct RevocationResponseMessage *) msg; 265 rrm = (const struct RevocationResponseMessage *) msg;
266 h->func (h->func_cls, ntohl (rrm->is_valid)); 266 h->func (h->func_cls, ntohl (rrm->is_valid));
267 GNUNET_REVOCATION_revoke_cancel (h); 267 GNUNET_REVOCATION_revoke_cancel (h);
268 268
269} 269}
270 270
271 271
@@ -337,7 +337,7 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
337 struct GNUNET_REVOCATION_Handle *h; 337 struct GNUNET_REVOCATION_Handle *h;
338 unsigned long long matching_bits; 338 unsigned long long matching_bits;
339 339
340 if ( (GNUNET_OK == 340 if ( (GNUNET_OK ==
341 GNUNET_CONFIGURATION_get_value_number (cfg, 341 GNUNET_CONFIGURATION_get_value_number (cfg,
342 "REVOCATION", 342 "REVOCATION",
343 "WORKBITS", 343 "WORKBITS",
@@ -398,11 +398,11 @@ pow_hash (const void *buf,
398 size_t buf_len, 398 size_t buf_len,
399 struct GNUNET_HashCode *result) 399 struct GNUNET_HashCode *result)
400{ 400{
401 GNUNET_break (0 == 401 GNUNET_break (0 ==
402 gcry_kdf_derive (buf, buf_len, 402 gcry_kdf_derive (buf, buf_len,
403 GCRY_KDF_SCRYPT, 403 GCRY_KDF_SCRYPT,
404 1 /* subalgo */, 404 1 /* subalgo */,
405 "gnunet-revocation-proof-of-work", 405 "gnunet-revocation-proof-of-work",
406 strlen ("gnunet-revocation-proof-of-work"), 406 strlen ("gnunet-revocation-proof-of-work"),
407 2 /* iterations; keep cost of individual op small */, 407 2 /* iterations; keep cost of individual op small */,
408 sizeof (struct GNUNET_HashCode), result)); 408 sizeof (struct GNUNET_HashCode), result));
diff --git a/src/scalarproduct/gnunet-scalarproduct.c b/src/scalarproduct/gnunet-scalarproduct.c
index 5e95742e6..32ed95268 100644
--- a/src/scalarproduct/gnunet-scalarproduct.c
+++ b/src/scalarproduct/gnunet-scalarproduct.c
@@ -77,9 +77,9 @@ static int ret = -1;
77 77
78/** 78/**
79 * Callback called if we are initiating a new computation session 79 * Callback called if we are initiating a new computation session
80 * 80 *
81 * @param cls unused 81 * @param cls unused
82 * @param status if our job was successfully processed 82 * @param status if our job was successfully processed
83 */ 83 */
84static void 84static void
85responder_callback (void *cls, 85responder_callback (void *cls,
@@ -110,14 +110,14 @@ responder_callback (void *cls,
110 110
111/** 111/**
112 * Callback called if we are initiating a new computation session 112 * Callback called if we are initiating a new computation session
113 * 113 *
114 * @param cls unused 114 * @param cls unused
115 * @param key unused 115 * @param key unused
116 * @param peer unused 116 * @param peer unused
117 * @param status if our job was successfully processed 117 * @param status if our job was successfully processed
118 * @param size size of the msg returned 118 * @param size size of the msg returned
119 * @param msg the response we got. 119 * @param msg the response we got.
120 * @param type of the message received 120 * @param type of the message received
121 */ 121 */
122static void 122static void
123requester_callback (void *cls, 123requester_callback (void *cls,
@@ -247,7 +247,7 @@ run (void *cls,
247 LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Need elements to compute the vectorproduct, got none.\n")); 247 LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Need elements to compute the vectorproduct, got none.\n"));
248 return; 248 return;
249 } 249 }
250 250
251 begin = input_elements; 251 begin = input_elements;
252 elements = GNUNET_malloc (sizeof (int32_t) * element_count); 252 elements = GNUNET_malloc (sizeof (int32_t) * element_count);
253 element_count = 0; 253 element_count = 0;
@@ -328,7 +328,7 @@ run (void *cls,
328 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 328 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
329 &shutdown_task, 329 &shutdown_task,
330 NULL); 330 NULL);
331 331
332 ret = 0; 332 ret = 0;
333} 333}
334 334
diff --git a/src/scalarproduct/gnunet-service-scalarproduct.c b/src/scalarproduct/gnunet-service-scalarproduct.c
index e17a3a4d1..b2a84fdb6 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct.c
@@ -66,7 +66,7 @@ enum PeerRole
66 66
67/** 67/**
68 * A scalarproduct session which tracks: 68 * A scalarproduct session which tracks:
69 * 69 *
70 * a request form the client to our final response. 70 * a request form the client to our final response.
71 * or 71 * or
72 * a request from a service to us(service). 72 * a request from a service to us(service).
@@ -93,7 +93,7 @@ struct ServiceSession
93 */ 93 */
94 struct GNUNET_HashCode key; 94 struct GNUNET_HashCode key;
95 95
96 /** 96 /**
97 * state of the session 97 * state of the session
98 */ 98 */
99 enum SessionState state; 99 enum SessionState state;
@@ -127,9 +127,9 @@ struct ServiceSession
127 * already transferred elements (sent/received) for multipart messages, less or equal than used_element_count for 127 * already transferred elements (sent/received) for multipart messages, less or equal than used_element_count for
128 */ 128 */
129 uint32_t transferred_element_count; 129 uint32_t transferred_element_count;
130 130
131 /** 131 /**
132 * how many bytes the mask is long. 132 * how many bytes the mask is long.
133 * just for convenience so we don't have to re-re-re calculate it each time 133 * just for convenience so we don't have to re-re-re calculate it each time
134 */ 134 */
135 uint32_t mask_length; 135 uint32_t mask_length;
@@ -158,14 +158,14 @@ struct ServiceSession
158 * Bob's permutation p of R 158 * Bob's permutation p of R
159 */ 159 */
160 gcry_mpi_t * r; 160 gcry_mpi_t * r;
161 161
162 /** 162 /**
163 * Bob's permutation q of R 163 * Bob's permutation q of R
164 */ 164 */
165 gcry_mpi_t * r_prime; 165 gcry_mpi_t * r_prime;
166 166
167 /** 167 /**
168 * The computed scalar 168 * The computed scalar
169 */ 169 */
170 gcry_mpi_t product; 170 gcry_mpi_t product;
171 171
@@ -245,27 +245,27 @@ static gcry_mpi_t my_lambda;
245static gcry_mpi_t my_offset; 245static gcry_mpi_t my_offset;
246 246
247/** 247/**
248 * Head of our double linked list for client-requests sent to us. 248 * Head of our double linked list for client-requests sent to us.
249 * for all of these elements we calculate a scalar product with a remote peer 249 * for all of these elements we calculate a scalar product with a remote peer
250 * split between service->service and client->service for simplicity 250 * split between service->service and client->service for simplicity
251 */ 251 */
252static struct ServiceSession * from_client_head; 252static struct ServiceSession * from_client_head;
253/** 253/**
254 * Tail of our double linked list for client-requests sent to us. 254 * Tail of our double linked list for client-requests sent to us.
255 * for all of these elements we calculate a scalar product with a remote peer 255 * for all of these elements we calculate a scalar product with a remote peer
256 * split between service->service and client->service for simplicity 256 * split between service->service and client->service for simplicity
257 */ 257 */
258static struct ServiceSession * from_client_tail; 258static struct ServiceSession * from_client_tail;
259 259
260/** 260/**
261 * Head of our double linked list for service-requests sent to us. 261 * Head of our double linked list for service-requests sent to us.
262 * for all of these elements we help the requesting service in calculating a scalar product 262 * for all of these elements we help the requesting service in calculating a scalar product
263 * split between service->service and client->service for simplicity 263 * split between service->service and client->service for simplicity
264 */ 264 */
265static struct ServiceSession * from_service_head; 265static struct ServiceSession * from_service_head;
266 266
267/** 267/**
268 * Tail of our double linked list for service-requests sent to us. 268 * Tail of our double linked list for service-requests sent to us.
269 * for all of these elements we help the requesting service in calculating a scalar product 269 * for all of these elements we help the requesting service in calculating a scalar product
270 * split between service->service and client->service for simplicity 270 * split between service->service and client->service for simplicity
271 */ 271 */
@@ -306,7 +306,7 @@ generate_keyset ()
306 GNUNET_assert (0 == gcry_pk_genkey (&key, gen_params)); 306 GNUNET_assert (0 == gcry_pk_genkey (&key, gen_params));
307 gcry_sexp_release (gen_params); 307 gcry_sexp_release (gen_params);
308 308
309 // get n and d of our publickey as MPI 309 // get n and d of our publickey as MPI
310 tmp_sexp = gcry_sexp_find_token (key, "n", 0); 310 tmp_sexp = gcry_sexp_find_token (key, "n", 0);
311 GNUNET_assert (tmp_sexp); 311 GNUNET_assert (tmp_sexp);
312 my_n = gcry_sexp_nth_mpi (tmp_sexp, 1, GCRYMPI_FMT_USG); 312 my_n = gcry_sexp_nth_mpi (tmp_sexp, 1, GCRYMPI_FMT_USG);
@@ -389,7 +389,7 @@ generate_keyset ()
389 gcry_sexp_release (key); 389 gcry_sexp_release (key);
390 390
391 // offset has to be sufficiently small to allow computation of: 391 // offset has to be sufficiently small to allow computation of:
392 // m1+m2 mod n == (S + a) + (S + b) mod n, 392 // m1+m2 mod n == (S + a) + (S + b) mod n,
393 // if we have more complex operations, this factor needs to be lowered 393 // if we have more complex operations, this factor needs to be lowered
394 my_offset = gcry_mpi_new (KEYBITS / 3); 394 my_offset = gcry_mpi_new (KEYBITS / 3);
395 gcry_mpi_set_bit (my_offset, KEYBITS / 3); 395 gcry_mpi_set_bit (my_offset, KEYBITS / 3);
@@ -420,7 +420,7 @@ adjust (unsigned char *buf, size_t size, size_t target)
420 420
421/** 421/**
422 * encrypts an element using the paillier crypto system 422 * encrypts an element using the paillier crypto system
423 * 423 *
424 * @param c ciphertext (output) 424 * @param c ciphertext (output)
425 * @param m plaintext 425 * @param m plaintext
426 * @param g the public base 426 * @param g the public base
@@ -450,7 +450,7 @@ encrypt_element (gcry_mpi_t c, gcry_mpi_t m, gcry_mpi_t g, gcry_mpi_t n, gcry_mp
450 450
451/** 451/**
452 * decrypts an element using the paillier crypto system 452 * decrypts an element using the paillier crypto system
453 * 453 *
454 * @param m plaintext (output) 454 * @param m plaintext (output)
455 * @param c the ciphertext 455 * @param c the ciphertext
456 * @param mu the modifier to correct encryption 456 * @param mu the modifier to correct encryption
@@ -470,7 +470,7 @@ decrypt_element (gcry_mpi_t m, gcry_mpi_t c, gcry_mpi_t mu, gcry_mpi_t lambda, g
470 470
471/** 471/**
472 * computes the square sum over a vector of a given length. 472 * computes the square sum over a vector of a given length.
473 * 473 *
474 * @param vector the vector to encrypt 474 * @param vector the vector to encrypt
475 * @param length the length of the vector 475 * @param length the length of the vector
476 * @return an MPI value containing the calculated sum, never NULL 476 * @return an MPI value containing the calculated sum, never NULL
@@ -501,7 +501,7 @@ compute_square_sum (gcry_mpi_t * vector, uint32_t length)
501 * Primitive callback for copying over a message, as they 501 * Primitive callback for copying over a message, as they
502 * usually are too complex to be handled in the callback itself. 502 * usually are too complex to be handled in the callback itself.
503 * clears a session-callback, if a session was handed over and the transmit handle was stored 503 * clears a session-callback, if a session was handed over and the transmit handle was stored
504 * 504 *
505 * @param cls the message object 505 * @param cls the message object
506 * @param size the size of the buffer we got 506 * @param size the size of the buffer we got
507 * @param buf the buffer to copy the message to 507 * @param buf the buffer to copy the message to
@@ -559,7 +559,7 @@ do_send_message (void *cls, size_t size, void *buf)
559 559
560/** 560/**
561 * initializes a new vector with fresh MPI values (=0) of a given length 561 * initializes a new vector with fresh MPI values (=0) of a given length
562 * 562 *
563 * @param length of the vector to create 563 * @param length of the vector to create
564 * @return the initialized vector, never NULL 564 * @return the initialized vector, never NULL
565 */ 565 */
@@ -577,7 +577,7 @@ initialize_mpi_vector (uint32_t length)
577 577
578/** 578/**
579 * permutes an MPI vector according to the given permutation vector 579 * permutes an MPI vector according to the given permutation vector
580 * 580 *
581 * @param vector the vector to permuted 581 * @param vector the vector to permuted
582 * @param perm the permutation to use 582 * @param perm the permutation to use
583 * @param length the length of the vectors 583 * @param length the length of the vectors
@@ -596,7 +596,7 @@ permute_vector (gcry_mpi_t * vector,
596 // backup old layout 596 // backup old layout
597 memcpy (tmp, vector, length * sizeof (gcry_mpi_t)); 597 memcpy (tmp, vector, length * sizeof (gcry_mpi_t));
598 598
599 // permute vector according to given 599 // permute vector according to given
600 for (i = 0; i < length; i++) 600 for (i = 0; i < length; i++)
601 vector[i] = tmp[perm[i]]; 601 vector[i] = tmp[perm[i]];
602 602
@@ -605,8 +605,8 @@ permute_vector (gcry_mpi_t * vector,
605 605
606 606
607/** 607/**
608 * Populate a vector with random integer values and convert them to 608 * Populate a vector with random integer values and convert them to
609 * 609 *
610 * @param length the length of the vector we must generate 610 * @param length the length of the vector we must generate
611 * @return an array of MPI values with random values 611 * @return an array of MPI values with random values
612 */ 612 */
@@ -636,12 +636,12 @@ generate_random_vector (uint32_t length)
636 636
637 637
638/** 638/**
639 * Finds a not terminated client/service session in the 639 * Finds a not terminated client/service session in the
640 * given DLL based on session key, element count and state. 640 * given DLL based on session key, element count and state.
641 * 641 *
642 * @param tail - the tail of the DLL 642 * @param tail - the tail of the DLL
643 * @param my - the session to compare it to 643 * @param my - the session to compare it to
644 * @return a pointer to a matching session, 644 * @return a pointer to a matching session,
645 * else NULL 645 * else NULL
646 */ 646 */
647static struct ServiceSession * 647static struct ServiceSession *
@@ -702,9 +702,9 @@ free_session (struct ServiceSession * session)
702 702
703 703
704/** 704/**
705 * A client disconnected. 705 * A client disconnected.
706 * 706 *
707 * Remove the associated session(s), release datastructures 707 * Remove the associated session(s), release datastructures
708 * and cancel pending outgoing transmissions to the client. 708 * and cancel pending outgoing transmissions to the client.
709 * if the session has not yet completed, we also cancel Alice's request to Bob. 709 * if the session has not yet completed, we also cancel Alice's request to Bob.
710 * 710 *
@@ -755,10 +755,10 @@ handle_client_disconnect (void *cls,
755 755
756/** 756/**
757 * Notify the client that the session has succeeded or failed completely. 757 * Notify the client that the session has succeeded or failed completely.
758 * This message gets sent to 758 * This message gets sent to
759 * * alice's client if bob disconnected or to 759 * * alice's client if bob disconnected or to
760 * * bob's client if the operation completed or alice disconnected 760 * * bob's client if the operation completed or alice disconnected
761 * 761 *
762 * @param client_session the associated client session 762 * @param client_session the associated client session
763 * @return GNUNET_NO, if we could not notify the client 763 * @return GNUNET_NO, if we could not notify the client
764 * GNUNET_YES if we notified it. 764 * GNUNET_YES if we notified it.
@@ -777,7 +777,7 @@ prepare_client_end_notification (void * cls,
777 memcpy (&msg->key, &session->key, sizeof (struct GNUNET_HashCode)); 777 memcpy (&msg->key, &session->key, sizeof (struct GNUNET_HashCode));
778 memcpy (&msg->peer, &session->peer, sizeof ( struct GNUNET_PeerIdentity)); 778 memcpy (&msg->peer, &session->peer, sizeof ( struct GNUNET_PeerIdentity));
779 msg->header.size = htons (sizeof (struct GNUNET_SCALARPRODUCT_client_response)); 779 msg->header.size = htons (sizeof (struct GNUNET_SCALARPRODUCT_client_response));
780 // signal error if not signalized, positive result-range field but zero length. 780 // signal error if not signalized, positive result-range field but zero length.
781 msg->product_length = htonl (0); 781 msg->product_length = htonl (0);
782 msg->range = (session->state == FINALIZED) ? 0 : -1; 782 msg->range = (session->state == FINALIZED) ? 0 : -1;
783 783
@@ -807,13 +807,13 @@ prepare_client_end_notification (void * cls,
807 807
808/** 808/**
809 * Bob executes: 809 * Bob executes:
810 * generates the response message to be sent to alice after computing 810 * generates the response message to be sent to alice after computing
811 * the values (1), (2), S and S' 811 * the values (1), (2), S and S'
812 * (1)[]: $E_A(a_{pi(i)}) times E_A(- r_{pi(i)} - b_{pi(i)}) &= E_A(a_{pi(i)} - r_{pi(i)} - b_{pi(i)})$ 812 * (1)[]: $E_A(a_{pi(i)}) times E_A(- r_{pi(i)} - b_{pi(i)}) &= E_A(a_{pi(i)} - r_{pi(i)} - b_{pi(i)})$
813 * (2)[]: $E_A(a_{pi'(i)}) times E_A(- r_{pi'(i)}) &= E_A(a_{pi'(i)} - r_{pi'(i)})$ 813 * (2)[]: $E_A(a_{pi'(i)}) times E_A(- r_{pi'(i)}) &= E_A(a_{pi'(i)} - r_{pi'(i)})$
814 * S: $S := E_A(sum (r_i + b_i)^2)$ 814 * S: $S := E_A(sum (r_i + b_i)^2)$
815 * S': $S' := E_A(sum r_i^2)$ 815 * S': $S' := E_A(sum r_i^2)$
816 * 816 *
817 * @param r (1)[]: $E_A(a_{pi(i)}) times E_A(- r_{pi(i)} - b_{pi(i)}) &= E_A(a_{pi(i)} - r_{pi(i)} - b_{pi(i)})$ 817 * @param r (1)[]: $E_A(a_{pi(i)}) times E_A(- r_{pi(i)} - b_{pi(i)}) &= E_A(a_{pi(i)} - r_{pi(i)} - b_{pi(i)})$
818 * @param r_prime (2)[]: $E_A(a_{pi'(i)}) times E_A(- r_{pi'(i)}) &= E_A(a_{pi'(i)} - r_{pi'(i)})$ 818 * @param r_prime (2)[]: $E_A(a_{pi'(i)}) times E_A(- r_{pi'(i)}) &= E_A(a_{pi'(i)} - r_{pi'(i)})$
819 * @param s S: $S := E_A(sum (r_i + b_i)^2)$ 819 * @param s S: $S := E_A(sum (r_i + b_i)^2)$
@@ -847,7 +847,7 @@ prepare_service_response (gcry_mpi_t s,
847 else { 847 else {
848 request->transferred_element_count = (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - msg_length) / (PAILLIER_ELEMENT_LENGTH * 2); 848 request->transferred_element_count = (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - msg_length) / (PAILLIER_ELEMENT_LENGTH * 2);
849 } 849 }
850 850
851 msg = GNUNET_malloc (msg_length); 851 msg = GNUNET_malloc (msg_length);
852 852
853 msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_BOB_TO_ALICE); 853 msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_BOB_TO_ALICE);
@@ -861,7 +861,7 @@ prepare_service_response (gcry_mpi_t s,
861 element_exported = GNUNET_malloc (PAILLIER_ELEMENT_LENGTH); 861 element_exported = GNUNET_malloc (PAILLIER_ELEMENT_LENGTH);
862 // 4 times the same logics with slight variations. 862 // 4 times the same logics with slight variations.
863 // doesn't really justify having 2 functions for that 863 // doesn't really justify having 2 functions for that
864 // so i put it into blocks to enhance readability 864 // so i put it into blocks to enhance readability
865 // convert s 865 // convert s
866 memset (element_exported, 0, PAILLIER_ELEMENT_LENGTH); 866 memset (element_exported, 0, PAILLIER_ELEMENT_LENGTH);
867 GNUNET_assert (0 == gcry_mpi_print (GCRYMPI_FMT_USG, 867 GNUNET_assert (0 == gcry_mpi_print (GCRYMPI_FMT_USG,
@@ -907,7 +907,7 @@ prepare_service_response (gcry_mpi_t s,
907 memcpy (current, element_exported, PAILLIER_ELEMENT_LENGTH); 907 memcpy (current, element_exported, PAILLIER_ELEMENT_LENGTH);
908 current += PAILLIER_ELEMENT_LENGTH; 908 current += PAILLIER_ELEMENT_LENGTH;
909 } 909 }
910 910
911 GNUNET_free (element_exported); 911 GNUNET_free (element_exported);
912 for (i = 0; i < request->transferred_element_count; i++) 912 for (i = 0; i < request->transferred_element_count; i++)
913 { 913 {
@@ -916,7 +916,7 @@ prepare_service_response (gcry_mpi_t s,
916 } 916 }
917 gcry_mpi_release (s); 917 gcry_mpi_release (s);
918 gcry_mpi_release (s_prime); 918 gcry_mpi_release (s_prime);
919 919
920 request->msg = (struct GNUNET_MessageHeader *) msg; 920 request->msg = (struct GNUNET_MessageHeader *) msg;
921 request->service_transmit_handle = 921 request->service_transmit_handle =
922 GNUNET_MESH_notify_transmit_ready (request->tunnel, 922 GNUNET_MESH_notify_transmit_ready (request->tunnel,
@@ -942,19 +942,19 @@ prepare_service_response (gcry_mpi_t s,
942 else 942 else
943 //singlepart 943 //singlepart
944 request->state = FINALIZED; 944 request->state = FINALIZED;
945 945
946 return GNUNET_OK; 946 return GNUNET_OK;
947} 947}
948 948
949 949
950/** 950/**
951 * executed by bob: 951 * executed by bob:
952 * compute the values 952 * compute the values
953 * (1)[]: $E_A(a_{\pi(i)}) \otimes E_A(- r_{\pi(i)} - b_{\pi(i)}) &= E_A(a_{\pi(i)} - r_{\pi(i)} - b_{\pi(i)})$ 953 * (1)[]: $E_A(a_{\pi(i)}) \otimes E_A(- r_{\pi(i)} - b_{\pi(i)}) &= E_A(a_{\pi(i)} - r_{\pi(i)} - b_{\pi(i)})$
954 * (2)[]: $E_A(a_{\pi'(i)}) \otimes E_A(- r_{\pi'(i)}) &= E_A(a_{\pi'(i)} - r_{\pi'(i)})$ 954 * (2)[]: $E_A(a_{\pi'(i)}) \otimes E_A(- r_{\pi'(i)}) &= E_A(a_{\pi'(i)} - r_{\pi'(i)})$
955 * S: $S := E_A(\sum (r_i + b_i)^2)$ 955 * S: $S := E_A(\sum (r_i + b_i)^2)$
956 * S': $S' := E_A(\sum r_i^2)$ 956 * S': $S' := E_A(\sum r_i^2)$
957 * 957 *
958 * @param request the requesting session + bob's requesting peer 958 * @param request the requesting session + bob's requesting peer
959 * @param response the responding session + bob's client handle 959 * @param response the responding session + bob's client handle
960 * @return GNUNET_SYSERR if the computation failed 960 * @return GNUNET_SYSERR if the computation failed
@@ -1063,7 +1063,7 @@ compute_service_response (struct ServiceSession * request,
1063 r = initialize_mpi_vector (count); 1063 r = initialize_mpi_vector (count);
1064 r_prime = initialize_mpi_vector (count); 1064 r_prime = initialize_mpi_vector (count);
1065 1065
1066 // copy the REFERNCES of a, b and r into aq and bq. we will not change 1066 // copy the REFERNCES of a, b and r into aq and bq. we will not change
1067 // those values, thus we can work with the references 1067 // those values, thus we can work with the references
1068 memcpy (a_pi, request->a, sizeof (gcry_mpi_t) * count); 1068 memcpy (a_pi, request->a, sizeof (gcry_mpi_t) * count);
1069 memcpy (a_pi_prime, request->a, sizeof (gcry_mpi_t) * count); 1069 memcpy (a_pi_prime, request->a, sizeof (gcry_mpi_t) * count);
@@ -1080,7 +1080,7 @@ compute_service_response (struct ServiceSession * request,
1080 1080
1081 // encrypt the element 1081 // encrypt the element
1082 // for the sake of readability I decided to have dedicated permutation 1082 // for the sake of readability I decided to have dedicated permutation
1083 // vectors, which get rid of all the lookups in p/q. 1083 // vectors, which get rid of all the lookups in p/q.
1084 // however, ap/aq are not absolutely necessary but are just abstraction 1084 // however, ap/aq are not absolutely necessary but are just abstraction
1085 // Calculate Kp = E(S + a_pi) (+) E(S - r_pi - b_pi) 1085 // Calculate Kp = E(S + a_pi) (+) E(S - r_pi - b_pi)
1086 for (i = 0; i < count; i++) 1086 for (i = 0; i < count; i++)
@@ -1109,7 +1109,7 @@ compute_service_response (struct ServiceSession * request,
1109 } 1109 }
1110 GNUNET_free (a_pi_prime); 1110 GNUNET_free (a_pi_prime);
1111 GNUNET_free (rand_pi_prime); 1111 GNUNET_free (rand_pi_prime);
1112 1112
1113 request->r = r; 1113 request->r = r;
1114 request->r_prime = r_prime; 1114 request->r_prime = r_prime;
1115 1115
@@ -1157,7 +1157,7 @@ except:
1157 1157
1158/** 1158/**
1159 * Executed by Alice, fills in a service-request message and sends it to the given peer 1159 * Executed by Alice, fills in a service-request message and sends it to the given peer
1160 * 1160 *
1161 * @param session the session associated with this request, then also holds the CORE-handle 1161 * @param session the session associated with this request, then also holds the CORE-handle
1162 * @return #GNUNET_SYSERR if we could not send the message 1162 * @return #GNUNET_SYSERR if we could not send the message
1163 * #GNUNET_NO if the message was too large 1163 * #GNUNET_NO if the message was too large
@@ -1226,7 +1226,7 @@ prepare_service_request (void *cls,
1226 { 1226 {
1227 if (session->transferred_element_count <= j) 1227 if (session->transferred_element_count <= j)
1228 break; //reached end of this message, can't include more 1228 break; //reached end of this message, can't include more
1229 1229
1230 memset(element_exported, 0, PAILLIER_ELEMENT_LENGTH); 1230 memset(element_exported, 0, PAILLIER_ELEMENT_LENGTH);
1231 value = session->vector[i] >= 0 ? session->vector[i] : -session->vector[i]; 1231 value = session->vector[i] >= 0 ? session->vector[i] : -session->vector[i];
1232 1232
@@ -1287,10 +1287,10 @@ prepare_service_request (void *cls,
1287 1287
1288 1288
1289/** 1289/**
1290 * Handler for a client request message. 1290 * Handler for a client request message.
1291 * Can either be type A or B 1291 * Can either be type A or B
1292 * A: request-initiation to compute a scalar product with a peer 1292 * A: request-initiation to compute a scalar product with a peer
1293 * B: response role, keep the values + session and wait for a matching session or process a waiting request 1293 * B: response role, keep the values + session and wait for a matching session or process a waiting request
1294 * 1294 *
1295 * @param cls closure 1295 * @param cls closure
1296 * @param client identification of the client 1296 * @param client identification of the client
@@ -1454,7 +1454,7 @@ handle_client_request (void *cls,
1454 GNUNET_SERVER_client_set_user_context (client, session); 1454 GNUNET_SERVER_client_set_user_context (client, session);
1455 GNUNET_CONTAINER_DLL_insert (from_client_head, from_client_tail, session); 1455 GNUNET_CONTAINER_DLL_insert (from_client_head, from_client_tail, session);
1456 1456
1457 //check if service queue contains a matching request 1457 //check if service queue contains a matching request
1458 requesting_session = find_matching_session (from_service_tail, 1458 requesting_session = find_matching_session (from_service_tail,
1459 &session->key, 1459 &session->key,
1460 session->element_count, 1460 session->element_count,
@@ -1480,7 +1480,7 @@ handle_client_request (void *cls,
1480 1480
1481 1481
1482/** 1482/**
1483 * Function called for inbound tunnels. 1483 * Function called for inbound tunnels.
1484 * 1484 *
1485 * @param cls closure 1485 * @param cls closure
1486 * @param tunnel new handle to the tunnel 1486 * @param tunnel new handle to the tunnel
@@ -1507,8 +1507,8 @@ tunnel_incoming_handler (void *cls,
1507 1507
1508/** 1508/**
1509 * Function called whenever a tunnel is destroyed. Should clean up 1509 * Function called whenever a tunnel is destroyed. Should clean up
1510 * any associated state. 1510 * any associated state.
1511 * 1511 *
1512 * It must NOT call GNUNET_MESH_tunnel_destroy on the tunnel. 1512 * It must NOT call GNUNET_MESH_tunnel_destroy on the tunnel.
1513 * 1513 *
1514 * @param cls closure (set from GNUNET_MESH_connect) 1514 * @param cls closure (set from GNUNET_MESH_connect)
@@ -1561,7 +1561,7 @@ tunnel_destruction_handler (void *cls,
1561 NULL, NULL); 1561 NULL, NULL);
1562 free_session (session); 1562 free_session (session);
1563 1563
1564 // the client has to check if it was waiting for a result 1564 // the client has to check if it was waiting for a result
1565 // or if it was a responder, no point in adding more statefulness 1565 // or if it was a responder, no point in adding more statefulness
1566 if (client_session && (!do_shutdown)) 1566 if (client_session && (!do_shutdown))
1567 { 1567 {
@@ -1576,15 +1576,15 @@ tunnel_destruction_handler (void *cls,
1576 1576
1577/** 1577/**
1578 * Compute our scalar product, done by Alice 1578 * Compute our scalar product, done by Alice
1579 * 1579 *
1580 * @param session - the session associated with this computation 1580 * @param session - the session associated with this computation
1581 * @param kp - (1) from the protocol definition: 1581 * @param kp - (1) from the protocol definition:
1582 * $E_A(a_{\pi(i)}) \otimes E_A(- r_{\pi(i)} - b_{\pi(i)}) &= E_A(a_{\pi(i)} - r_{\pi(i)} - b_{\pi(i)})$ 1582 * $E_A(a_{\pi(i)}) \otimes E_A(- r_{\pi(i)} - b_{\pi(i)}) &= E_A(a_{\pi(i)} - r_{\pi(i)} - b_{\pi(i)})$
1583 * @param kq - (2) from the protocol definition: 1583 * @param kq - (2) from the protocol definition:
1584 * $E_A(a_{\pi'(i)}) \otimes E_A(- r_{\pi'(i)}) &= E_A(a_{\pi'(i)} - r_{\pi'(i)})$ 1584 * $E_A(a_{\pi'(i)}) \otimes E_A(- r_{\pi'(i)}) &= E_A(a_{\pi'(i)} - r_{\pi'(i)})$
1585 * @param s - S from the protocol definition: 1585 * @param s - S from the protocol definition:
1586 * $S := E_A(\sum (r_i + b_i)^2)$ 1586 * $S := E_A(\sum (r_i + b_i)^2)$
1587 * @param stick - S' from the protocol definition: 1587 * @param stick - S' from the protocol definition:
1588 * $S' := E_A(\sum r_i^2)$ 1588 * $S' := E_A(\sum r_i^2)$
1589 * @return product as MPI, never NULL 1589 * @return product as MPI, never NULL
1590 */ 1590 */
@@ -1667,8 +1667,8 @@ compute_scalar_product (struct ServiceSession * session,
1667 1667
1668/** 1668/**
1669 * prepare the response we will send to alice or bobs' clients. 1669 * prepare the response we will send to alice or bobs' clients.
1670 * in Bobs case the product will be NULL. 1670 * in Bobs case the product will be NULL.
1671 * 1671 *
1672 * @param session the session associated with our client. 1672 * @param session the session associated with our client.
1673 */ 1673 */
1674static void 1674static void
@@ -1873,7 +1873,7 @@ handle_service_request (void *cls,
1873 1873
1874 current += pk_length; 1874 current += pk_length;
1875 1875
1876 //check if service queue contains a matching request 1876 //check if service queue contains a matching request
1877 needed_state = CLIENT_RESPONSE_RECEIVED; 1877 needed_state = CLIENT_RESPONSE_RECEIVED;
1878 responder_session = find_matching_session (from_client_tail, 1878 responder_session = find_matching_session (from_client_tail,
1879 &session->key, 1879 &session->key,
diff --git a/src/scalarproduct/scalarproduct.h b/src/scalarproduct/scalarproduct.h
index af2e251e1..18e782ac0 100644
--- a/src/scalarproduct/scalarproduct.h
+++ b/src/scalarproduct/scalarproduct.h
@@ -42,7 +42,7 @@ extern "C"
42#define KEYBITS 2048 42#define KEYBITS 2048
43 43
44/** 44/**
45 * When performing our crypto, we may add two encrypted values with each 45 * When performing our crypto, we may add two encrypted values with each
46 * a maximal length of GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH. 46 * a maximal length of GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH.
47 * thus we can receive a slightly longer element (+1 byte) 47 * thus we can receive a slightly longer element (+1 byte)
48 */ 48 */
@@ -60,7 +60,7 @@ extern "C"
60/////////////////////////////////////////////////////////////////////////////// 60///////////////////////////////////////////////////////////////////////////////
61 61
62/** 62/**
63 * Message type passed from client to service 63 * Message type passed from client to service
64 * to initiate a request or responder role 64 * to initiate a request or responder role
65 */ 65 */
66struct GNUNET_SCALARPRODUCT_client_request 66struct GNUNET_SCALARPRODUCT_client_request
@@ -94,7 +94,7 @@ struct GNUNET_SCALARPRODUCT_client_request
94 * followed by long vector[element_count] | [unsigned char mask[mask_bytes]] 94 * followed by long vector[element_count] | [unsigned char mask[mask_bytes]]
95 */ 95 */
96}; 96};
97 97
98/** 98/**
99 * Message type passed from requesting service Alice to responding service Bob 99 * Message type passed from requesting service Alice to responding service Bob
100 * to initiate a request and make bob participate in our protocol 100 * to initiate a request and make bob participate in our protocol
@@ -109,12 +109,12 @@ struct GNUNET_SCALARPRODUCT_service_request {
109 * how many elements the total message including all multipart msgs contains 109 * how many elements the total message including all multipart msgs contains
110 */ 110 */
111 uint32_t total_element_count GNUNET_PACKED; 111 uint32_t total_element_count GNUNET_PACKED;
112 112
113 /** 113 /**
114 * how many elements are actually included after the mask was applied. 114 * how many elements are actually included after the mask was applied.
115 */ 115 */
116 uint32_t contained_element_count GNUNET_PACKED; 116 uint32_t contained_element_count GNUNET_PACKED;
117 117
118 /** 118 /**
119 * how many bytes the mask has 119 * how many bytes the mask has
120 */ 120 */
@@ -153,7 +153,7 @@ struct GNUNET_SCALARPRODUCT_multipart_message {
153 * how many elements we supply within this message 153 * how many elements we supply within this message
154 */ 154 */
155 uint32_t multipart_element_count GNUNET_PACKED; 155 uint32_t multipart_element_count GNUNET_PACKED;
156 156
157 // followed by vector[multipart_element_count] or k[i][perm] 157 // followed by vector[multipart_element_count] or k[i][perm]
158}; 158};
159 159
@@ -171,12 +171,12 @@ struct GNUNET_SCALARPRODUCT_service_response {
171 * how many elements the session input had 171 * how many elements the session input had
172 */ 172 */
173 uint32_t total_element_count GNUNET_PACKED; 173 uint32_t total_element_count GNUNET_PACKED;
174 174
175 /** 175 /**
176 * how many elements were included after the mask was applied including all multipart msgs. 176 * how many elements were included after the mask was applied including all multipart msgs.
177 */ 177 */
178 uint32_t used_element_count GNUNET_PACKED; 178 uint32_t used_element_count GNUNET_PACKED;
179 179
180 /** 180 /**
181 * how many elements this individual message delivers 181 * how many elements this individual message delivers
182 */ 182 */
@@ -227,7 +227,7 @@ struct GNUNET_SCALARPRODUCT_client_response
227 * followed by product of length product_length (or nothing) 227 * followed by product of length product_length (or nothing)
228 */ 228 */
229}; 229};
230 230
231#ifdef __cplusplus 231#ifdef __cplusplus
232} 232}
233#endif 233#endif
diff --git a/src/scalarproduct/scalarproduct_api.c b/src/scalarproduct/scalarproduct_api.c
index a6d32f9ab..0f8a409cc 100644
--- a/src/scalarproduct/scalarproduct_api.c
+++ b/src/scalarproduct/scalarproduct_api.c
@@ -23,7 +23,7 @@
23 * @brief API for the scalarproduct 23 * @brief API for the scalarproduct
24 * @author Christian Fuchs 24 * @author Christian Fuchs
25 * @author Gaurav Kukreja 25 * @author Gaurav Kukreja
26 * 26 *
27 */ 27 */
28#include "platform.h" 28#include "platform.h"
29#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
@@ -145,9 +145,9 @@ GNUNET_SCALARPRODUCT_cancel (struct GNUNET_SCALARPRODUCT_ComputationHandle * h);
145 145
146 146
147/** 147/**
148 * Handles the RESULT received in reply of prepare_response from the 148 * Handles the RESULT received in reply of prepare_response from the
149 * service 149 * service
150 * 150 *
151 * @param cls Handle to the Master Context 151 * @param cls Handle to the Master Context
152 * @param msg Pointer to the response received 152 * @param msg Pointer to the response received
153 */ 153 */
@@ -163,9 +163,9 @@ process_status_message (void *cls,
163 163
164 164
165/** 165/**
166 * Handles the RESULT received in reply of prepare_response from the 166 * Handles the RESULT received in reply of prepare_response from the
167 * service 167 * service
168 * 168 *
169 * @param cls Handle to the Master Context 169 * @param cls Handle to the Master Context
170 * @param msg Pointer to the response received 170 * @param msg Pointer to the response received
171 */ 171 */
@@ -215,7 +215,7 @@ process_result_message (void *cls,
215 * Called when a response is received from the service. After basic check 215 * Called when a response is received from the service. After basic check
216 * handler in qe->response_proc is called. This functions handles the response 216 * handler in qe->response_proc is called. This functions handles the response
217 * to the client which used the API. 217 * to the client which used the API.
218 * 218 *
219 * @param cls Pointer to the Master Context 219 * @param cls Pointer to the Master Context
220 * @param msg Pointer to the data received in response 220 * @param msg Pointer to the data received in response
221 */ 221 */
@@ -245,7 +245,7 @@ receive_cb (void *cls, const struct GNUNET_MessageHeader *msg)
245 245
246 status = GNUNET_SCALARPRODUCT_Status_Success; 246 status = GNUNET_SCALARPRODUCT_Status_Success;
247 } 247 }
248 248
249 if (qe->cont_datum != NULL) 249 if (qe->cont_datum != NULL)
250 qe->response_proc (qe, msg, status); 250 qe->response_proc (qe, msg, status);
251 251
@@ -256,11 +256,11 @@ receive_cb (void *cls, const struct GNUNET_MessageHeader *msg)
256 256
257/** 257/**
258 * Transmits the request to the VectorProduct Sevice 258 * Transmits the request to the VectorProduct Sevice
259 * 259 *
260 * @param cls Closure 260 * @param cls Closure
261 * @param size Size of the buffer 261 * @param size Size of the buffer
262 * @param buf Pointer to the buffer 262 * @param buf Pointer to the buffer
263 * 263 *
264 * @return Size of the message sent 264 * @return Size of the message sent
265 */ 265 */
266static size_t 266static size_t
@@ -279,7 +279,7 @@ transmit_request (void *cls, size_t size,
279 // notify caller about the error, done here. 279 // notify caller about the error, done here.
280 if (qe->cont_datum != NULL) 280 if (qe->cont_datum != NULL)
281 qe->response_proc (qe, NULL, GNUNET_SCALARPRODUCT_Status_Failure); 281 qe->response_proc (qe, NULL, GNUNET_SCALARPRODUCT_Status_Failure);
282 282
283 GNUNET_SCALARPRODUCT_cancel (cls); 283 GNUNET_SCALARPRODUCT_cancel (cls);
284 return 0; 284 return 0;
285 } 285 }
@@ -307,8 +307,8 @@ transmit_request (void *cls, size_t size,
307 307
308 308
309/** 309/**
310 * Used by Bob's client to cooperate with Alice, 310 * Used by Bob's client to cooperate with Alice,
311 * 311 *
312 * @param h handle to the master context 312 * @param h handle to the master context
313 * @param key Session key - unique to the requesting client 313 * @param key Session key - unique to the requesting client
314 * @param elements Array of elements of the vector 314 * @param elements Array of elements of the vector
@@ -358,7 +358,7 @@ GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle *cfg,
358 h->response_proc = &process_status_message; 358 h->response_proc = &process_status_message;
359 h->cfg = cfg; 359 h->cfg = cfg;
360 memcpy (&h->key, key, sizeof (struct GNUNET_HashCode)); 360 memcpy (&h->key, key, sizeof (struct GNUNET_HashCode));
361 361
362 msg = (struct GNUNET_SCALARPRODUCT_client_request*) GNUNET_malloc (size); 362 msg = (struct GNUNET_SCALARPRODUCT_client_request*) GNUNET_malloc (size);
363 h->msg = msg; 363 h->msg = msg;
364 msg->header.size = htons (size); 364 msg->header.size = htons (size);
@@ -393,7 +393,7 @@ GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle *cfg,
393 393
394/** 394/**
395 * Request by Alice's client for computing a scalar product 395 * Request by Alice's client for computing a scalar product
396 * 396 *
397 * @param h handle to the master context 397 * @param h handle to the master context
398 * @param key Session key - unique to the requesting client 398 * @param key Session key - unique to the requesting client
399 * @param peer PeerID of the other peer 399 * @param peer PeerID of the other peer
@@ -451,7 +451,7 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg,
451 h->response_proc = &process_result_message; 451 h->response_proc = &process_result_message;
452 h->cfg = cfg; 452 h->cfg = cfg;
453 memcpy (&h->key, key, sizeof (struct GNUNET_HashCode)); 453 memcpy (&h->key, key, sizeof (struct GNUNET_HashCode));
454 454
455 msg = (struct GNUNET_SCALARPRODUCT_client_request*) GNUNET_malloc (size); 455 msg = (struct GNUNET_SCALARPRODUCT_client_request*) GNUNET_malloc (size);
456 h->msg = msg; 456 h->msg = msg;
457 msg->header.size = htons (size); 457 msg->header.size = htons (size);
@@ -463,7 +463,7 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg,
463 // copy each element over to the message 463 // copy each element over to the message
464 for (i = 0; i < element_count; i++) 464 for (i = 0; i < element_count; i++)
465 vector[i] = htonl (elements[i]); 465 vector[i] = htonl (elements[i]);
466 466
467 memcpy (&msg->peer, peer, sizeof (struct GNUNET_PeerIdentity)); 467 memcpy (&msg->peer, peer, sizeof (struct GNUNET_PeerIdentity));
468 memcpy (&msg->key, key, sizeof (struct GNUNET_HashCode)); 468 memcpy (&msg->key, key, sizeof (struct GNUNET_HashCode));
469 memcpy (&vector[element_count], mask, mask_bytes); 469 memcpy (&vector[element_count], mask, mask_bytes);
@@ -489,7 +489,7 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg,
489 489
490/** 490/**
491 * Disconnect from the scalarproduct service. 491 * Disconnect from the scalarproduct service.
492 * 492 *
493 * @param h a computation handle to cancel 493 * @param h a computation handle to cancel
494 */ 494 */
495void 495void
diff --git a/src/scalarproduct/scalarproduct_testing.h b/src/scalarproduct/scalarproduct_testing.h
index a386fb0c7..5e7baa235 100644
--- a/src/scalarproduct/scalarproduct_testing.h
+++ b/src/scalarproduct/scalarproduct_testing.h
@@ -17,7 +17,7 @@
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19 */ 19 */
20/** 20/**
21 * @file scalarproduct/scalarproduct_testing.h 21 * @file scalarproduct/scalarproduct_testing.h
22 * @brief VectorProduct testcase common declarations 22 * @brief VectorProduct testcase common declarations
23 * @author Gaurav Kukreja 23 * @author Gaurav Kukreja
@@ -32,14 +32,14 @@
32#ifdef __cplusplus 32#ifdef __cplusplus
33extern "C" { 33extern "C" {
34#endif 34#endif
35 35
36struct GNUNET_SCALARPRODUCT_TESTING_handle 36struct GNUNET_SCALARPRODUCT_TESTING_handle
37{ 37{
38 /** 38 /**
39 * Testing library system handle 39 * Testing library system handle
40 */ 40 */
41 struct GNUNET_TESTING_System *tl_system; 41 struct GNUNET_TESTING_System *tl_system;
42 42
43 /** 43 /**
44 * head DLL of peers 44 * head DLL of peers
45 */ 45 */
@@ -51,7 +51,7 @@ struct GNUNET_SCALARPRODUCT_TESTING_handle
51 struct PeerContext *p_tail; 51 struct PeerContext *p_tail;
52}; 52};
53 53
54struct PeerContext 54struct PeerContext
55{ 55{
56 /** 56 /**
57 * Next element in the DLL 57 * Next element in the DLL
@@ -72,17 +72,17 @@ struct PeerContext
72 * Peer identity 72 * Peer identity
73 */ 73 */
74 struct GNUNET_PeerIdentity id; 74 struct GNUNET_PeerIdentity id;
75 75
76 /** 76 /**
77 * Handle for the peer's ARM process 77 * Handle for the peer's ARM process
78 */ 78 */
79 struct GNUNET_OS_Process *arm_proc; 79 struct GNUNET_OS_Process *arm_proc;
80 80
81 /** 81 /**
82 * Pointer to Vector Product Handle 82 * Pointer to Vector Product Handle
83 */ 83 */
84 struct GNUNET_SCALARPRODUCT_Handle *vh; 84 struct GNUNET_SCALARPRODUCT_Handle *vh;
85 85
86 /** 86 /**
87 * Closure for the callbacks 87 * Closure for the callbacks
88 */ 88 */
@@ -92,23 +92,23 @@ struct PeerContext
92 * An unique number to identify the peer 92 * An unique number to identify the peer
93 */ 93 */
94 unsigned int no; 94 unsigned int no;
95 95
96 /** 96 /**
97 * Peer's configuration 97 * Peer's configuration
98 */ 98 */
99 struct GNUNET_CONFIGURATION_Handle *cfg; 99 struct GNUNET_CONFIGURATION_Handle *cfg;
100 100
101 /** 101 /**
102 * Pointer to the master testing handle 102 * Pointer to the master testing handle
103 */ 103 */
104 struct GNUNET_SCALARPRODUCT_TESTING_handle * vth; 104 struct GNUNET_SCALARPRODUCT_TESTING_handle * vth;
105 105
106 /** 106 /**
107 * Callback when two peers are connected and both have called the connect callback 107 * Callback when two peers are connected and both have called the connect callback
108 * to notify clients about a new peer 108 * to notify clients about a new peer
109 */ 109 */
110 void (*start_cb) (struct PeerContext * p, void *cls); 110 void (*start_cb) (struct PeerContext * p, void *cls);
111 111
112// /** 112// /**
113// * Pointer to function where the test occurs 113// * Pointer to function where the test occurs
114// */ 114// */
diff --git a/src/scalarproduct/test_scalarproduct_api.c b/src/scalarproduct/test_scalarproduct_api.c
index e28074fd4..082723278 100644
--- a/src/scalarproduct/test_scalarproduct_api.c
+++ b/src/scalarproduct/test_scalarproduct_api.c
@@ -19,7 +19,7 @@
19 */ 19 */
20 20
21/** 21/**
22 * Aim of test_scalarproduct_api : This test creates two peers. Peer1 is the 22 * Aim of test_scalarproduct_api : This test creates two peers. Peer1 is the
23 * responder peer, Bob and Peer2 is the initiator peer, Alice. Both peers 23 * responder peer, Bob and Peer2 is the initiator peer, Alice. Both peers
24 * connect to VectorProduct Service, and use the API to issue requests to 24 * connect to VectorProduct Service, and use the API to issue requests to
25 * service. Test passes, when the expected scalar product is received from the 25 * service. Test passes, when the expected scalar product is received from the
@@ -219,7 +219,7 @@ do_close (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
219 219
220/** 220/**
221 * Shutdown a peer 221 * Shutdown a peer
222 * 222 *
223 * @param cls pointer to "struct PeerData" of the peer to be disconnected 223 * @param cls pointer to "struct PeerData" of the peer to be disconnected
224 * @param tc Task Context 224 * @param tc Task Context
225 */ 225 */
@@ -272,7 +272,7 @@ controller_event_cb (void *cls,
272 const struct GNUNET_TESTBED_EventInformation *event) 272 const struct GNUNET_TESTBED_EventInformation *event)
273{ 273{
274 GNUNET_assert (event->type == GNUNET_TESTBED_ET_OPERATION_FINISHED); 274 GNUNET_assert (event->type == GNUNET_TESTBED_ET_OPERATION_FINISHED);
275 275
276 switch (setup_state) 276 switch (setup_state)
277 { 277 {
278 case PEER1_SCALARPRODUCT_CONNECT: 278 case PEER1_SCALARPRODUCT_CONNECT:
@@ -366,7 +366,7 @@ requester_callback (void *cls,
366 { 366 {
367 LOG (GNUNET_ERROR_TYPE_INFO, "Requester Client expected response received!\n"); 367 LOG (GNUNET_ERROR_TYPE_INFO, "Requester Client expected response received!\n");
368 product_len = ntohl(msg->product_length); 368 product_len = ntohl(msg->product_length);
369 369
370 if (0 < product_len) 370 if (0 < product_len)
371 { 371 {
372 gcry_mpi_t result; 372 gcry_mpi_t result;
@@ -383,7 +383,7 @@ requester_callback (void *cls,
383 { 383 {
384 uint16_t i = 0; 384 uint16_t i = 0;
385 385
386 // calculate expected product 386 // calculate expected product
387 gcry_mpi_t expected_result; 387 gcry_mpi_t expected_result;
388 gcry_mpi_t v1; 388 gcry_mpi_t v1;
389 gcry_mpi_t v2; 389 gcry_mpi_t v2;
@@ -424,7 +424,7 @@ requester_callback (void *cls,
424 gcry_mpi_release (v1_v2_prod); 424 gcry_mpi_release (v1_v2_prod);
425 425
426 } 426 }
427 427
428 // compare the result 428 // compare the result
429 if (!gcry_mpi_cmp (expected_result, result)) 429 if (!gcry_mpi_cmp (expected_result, result))
430 { 430 {
@@ -453,7 +453,7 @@ requester_callback (void *cls,
453} 453}
454 454
455/** 455/**
456 * Prepare the message to be sent by peer2 to its scalarproduct service, to 456 * Prepare the message to be sent by peer2 to its scalarproduct service, to
457 * initiate a request to peer1. 457 * initiate a request to peer1.
458 */ 458 */
459static struct GNUNET_SCALARPRODUCT_QueueEntry * 459static struct GNUNET_SCALARPRODUCT_QueueEntry *
@@ -467,9 +467,9 @@ requester_request ()
467 int32_t element; 467 int32_t element;
468 struct GNUNET_SCALARPRODUCT_QueueEntry *qe; 468 struct GNUNET_SCALARPRODUCT_QueueEntry *qe;
469 struct GNUNET_HashCode key; 469 struct GNUNET_HashCode key;
470 470
471 GNUNET_assert (peer2.vh != NULL); 471 GNUNET_assert (peer2.vh != NULL);
472 472
473 GNUNET_CRYPTO_hash (input_key, strlen (input_key), &key); 473 GNUNET_CRYPTO_hash (input_key, strlen (input_key), &key);
474 474
475 /* Read input_elements_peer2, and put in elements_peer2 array */ 475 /* Read input_elements_peer2, and put in elements_peer2 array */
@@ -501,7 +501,7 @@ requester_request ()
501 while (!exit_loop && element_count_peer2 < max_mids); 501 while (!exit_loop && element_count_peer2 < max_mids);
502 GNUNET_assert (elements_peer2 != NULL); 502 GNUNET_assert (elements_peer2 != NULL);
503 GNUNET_assert (element_count_peer2 >= 1); 503 GNUNET_assert (element_count_peer2 >= 1);
504 504
505 /* Read input_mask_peer2 and read in mask_peer2 array */ 505 /* Read input_mask_peer2 and read in mask_peer2 array */
506 mask_length = element_count_peer2 / 8 + (element_count_peer2 % 8 ? 1 : 0); 506 mask_length = element_count_peer2 / 8 + (element_count_peer2 % 8 ? 1 : 0);
507 mask_peer2 = GNUNET_malloc ((element_count_peer2 / 8) + 2); 507 mask_peer2 = GNUNET_malloc ((element_count_peer2 / 8) + 2);
@@ -584,7 +584,7 @@ responder_prepare_response ()
584 int32_t element; 584 int32_t element;
585 struct GNUNET_SCALARPRODUCT_QueueEntry *qe; 585 struct GNUNET_SCALARPRODUCT_QueueEntry *qe;
586 struct GNUNET_HashCode key; 586 struct GNUNET_HashCode key;
587 587
588 GNUNET_CRYPTO_hash (input_key, strlen (input_key), &key); 588 GNUNET_CRYPTO_hash (input_key, strlen (input_key), &key);
589 589
590 /* Read input_elements_peer1, and put in elements_peer1 array */ 590 /* Read input_elements_peer1, and put in elements_peer1 array */
@@ -638,7 +638,7 @@ responder_prepare_response ()
638 638
639/** 639/**
640 * Scheduler task to initiate requester client 640 * Scheduler task to initiate requester client
641 * 641 *
642 * @param cls void* to struct PeerData 642 * @param cls void* to struct PeerData
643 * @param tc Task Context 643 * @param tc Task Context
644 */ 644 */
@@ -653,7 +653,7 @@ request_task(void *cls,
653 653
654/** 654/**
655 * Scheduler task to initiate responder client 655 * Scheduler task to initiate responder client
656 * 656 *
657 * @param cls void* to struct PeerData 657 * @param cls void* to struct PeerData
658 * @param tc Task Context 658 * @param tc Task Context
659 */ 659 */
@@ -661,7 +661,7 @@ static void
661prepare_response_task(void *cls, 661prepare_response_task(void *cls,
662 const struct GNUNET_SCHEDULER_TaskContext 662 const struct GNUNET_SCHEDULER_TaskContext
663 * tc) 663 * tc)
664{ 664{
665 responder_prepare_response(); 665 responder_prepare_response();
666 return; 666 return;
667} 667}
@@ -672,7 +672,7 @@ prepare_response_task(void *cls,
672 * a service. This function is called when GNUNET_TESTBED_operation_done is 672 * a service. This function is called when GNUNET_TESTBED_operation_done is
673 * called for peer->op, which holds the handle for GNUNET_TESTBED_service_connect 673 * called for peer->op, which holds the handle for GNUNET_TESTBED_service_connect
674 * operation. 674 * operation.
675 * 675 *
676 * @param cls closure 676 * @param cls closure
677 * @param op_result service handle returned from the connect adapter 677 * @param op_result service handle returned from the connect adapter
678 */ 678 */
@@ -689,7 +689,7 @@ scalarproduct_da (void *cls, void *op_result)
689/** 689/**
690 * Adapter function called to establish a connection to 690 * Adapter function called to establish a connection to
691 * a service. This function is called to by GNUNET_TESTBED_service_connect. 691 * a service. This function is called to by GNUNET_TESTBED_service_connect.
692 * 692 *
693 * @param cls closure 693 * @param cls closure
694 * @param cfg configuration of the peer to connect to; will be available until 694 * @param cfg configuration of the peer to connect to; will be available until
695 * GNUNET_TESTBED_operation_done() is called on the operation returned 695 * GNUNET_TESTBED_operation_done() is called on the operation returned
@@ -729,7 +729,7 @@ scalarproduct_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
729 GNUNET_SCHEDULER_add_now(&prepare_response_task, &peer1); 729 GNUNET_SCHEDULER_add_now(&prepare_response_task, &peer1);
730 GNUNET_SCHEDULER_add_now(&request_task, &peer2); 730 GNUNET_SCHEDULER_add_now(&request_task, &peer2);
731 } 731 }
732 732
733 return peer2.vh; 733 return peer2.vh;
734 default: 734 default:
735 GNUNET_assert (0); 735 GNUNET_assert (0);
@@ -814,7 +814,7 @@ test_master (void *cls, unsigned int num_peers,
814 GNUNET_TESTBED_PIT_IDENTITY, 814 GNUNET_TESTBED_PIT_IDENTITY,
815 &peerinfo_cb, NULL); 815 &peerinfo_cb, NULL);
816 setup_state = PEER1_GET_IDENTITY; 816 setup_state = PEER1_GET_IDENTITY;
817 817
818 /* Abort task for stopping test on timeout */ 818 /* Abort task for stopping test on timeout */
819 abort_task = 819 abort_task =
820 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 820 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
@@ -842,7 +842,7 @@ main (int argc, char **argv)
842 NUM_PEERS, event_mask, &controller_event_cb, 842 NUM_PEERS, event_mask, &controller_event_cb,
843 NULL, 843 NULL,
844 &test_master, NULL); 844 &test_master, NULL);
845 845
846 if (GNUNET_SYSERR == ok) 846 if (GNUNET_SYSERR == ok)
847 { 847 {
848 LOG (GNUNET_ERROR_TYPE_ERROR, "Test failing due to some error before calling API for request or prepare_response\n"); 848 LOG (GNUNET_ERROR_TYPE_ERROR, "Test failing due to some error before calling API for request or prepare_response\n");
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c
index a339bb993..99deb3b23 100644
--- a/src/set/gnunet-service-set.c
+++ b/src/set/gnunet-service-set.c
@@ -530,7 +530,7 @@ handle_client_iterate (void *cls,
530 const struct GNUNET_MessageHeader *m) 530 const struct GNUNET_MessageHeader *m)
531{ 531{
532 struct Set *set; 532 struct Set *set;
533 533
534 set = set_get (client); 534 set = set_get (client);
535 if (NULL == set) 535 if (NULL == set)
536 { 536 {
@@ -717,7 +717,7 @@ handle_client_add_remove (void *cls,
717 GNUNET_SERVER_receive_done (client, GNUNET_OK); 717 GNUNET_SERVER_receive_done (client, GNUNET_OK);
718 msg = (const struct GNUNET_SET_ElementMessage *) m; 718 msg = (const struct GNUNET_SET_ElementMessage *) m;
719 el.size = ntohs (m->size) - sizeof *msg; 719 el.size = ntohs (m->size) - sizeof *msg;
720 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 720 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
721 "client ins/rem element of size %u\n", el.size); 721 "client ins/rem element of size %u\n", el.size);
722 el.data = &msg[1]; 722 el.data = &msg[1];
723 if (GNUNET_MESSAGE_TYPE_SET_REMOVE == ntohs (m->type)) 723 if (GNUNET_MESSAGE_TYPE_SET_REMOVE == ntohs (m->type))
@@ -829,7 +829,7 @@ handle_client_iter_ack (void *cls,
829 const struct GNUNET_MessageHeader *m) 829 const struct GNUNET_MessageHeader *m)
830{ 830{
831 struct Set *set; 831 struct Set *set;
832 832
833 set = set_get (client); 833 set = set_get (client);
834 if (NULL == set) 834 if (NULL == set)
835 { 835 {
@@ -1023,7 +1023,7 @@ tunnel_new_cb (void *cls,
1023 incoming->tc = GNUNET_new (struct TunnelContext);; 1023 incoming->tc = GNUNET_new (struct TunnelContext);;
1024 incoming->tc->vt = &incoming_vt; 1024 incoming->tc->vt = &incoming_vt;
1025 incoming->tc->op = (struct OperationState *) incoming; 1025 incoming->tc->op = (struct OperationState *) incoming;
1026 incoming->timeout_task = 1026 incoming->timeout_task =
1027 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, incoming_timeout_cb, incoming); 1027 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, incoming_timeout_cb, incoming);
1028 GNUNET_CONTAINER_DLL_insert_tail (incoming_head, incoming_tail, incoming); 1028 GNUNET_CONTAINER_DLL_insert_tail (incoming_head, incoming_tail, incoming);
1029 1029
@@ -1057,7 +1057,7 @@ tunnel_end_cb (void *cls,
1057/** 1057/**
1058 * Functions with this signature are called whenever a message is 1058 * Functions with this signature are called whenever a message is
1059 * received. 1059 * received.
1060 * 1060 *
1061 * Each time the function must call GNUNET_MESH_receive_done on the tunnel 1061 * Each time the function must call GNUNET_MESH_receive_done on the tunnel
1062 * in order to receive the next message. This doesn't need to be immediate: 1062 * in order to receive the next message. This doesn't need to be immediate:
1063 * can be delayed if some processing is done on the message. 1063 * can be delayed if some processing is done on the message.
@@ -1066,7 +1066,7 @@ tunnel_end_cb (void *cls,
1066 * @param tunnel Connection to the other end. 1066 * @param tunnel Connection to the other end.
1067 * @param tunnel_ctx Place to store local state associated with the tunnel. 1067 * @param tunnel_ctx Place to store local state associated with the tunnel.
1068 * @param message The actual message. 1068 * @param message The actual message.
1069 * 1069 *
1070 * @return GNUNET_OK to keep the tunnel open, 1070 * @return GNUNET_OK to keep the tunnel open,
1071 * GNUNET_SYSERR to close it (signal serious error). 1071 * GNUNET_SYSERR to close it (signal serious error).
1072 */ 1072 */
diff --git a/src/set/gnunet-service-set.h b/src/set/gnunet-service-set.h
index 63b743ec4..f26ff3fc3 100644
--- a/src/set/gnunet-service-set.h
+++ b/src/set/gnunet-service-set.h
@@ -275,7 +275,7 @@ struct ElementEntry
275 int removed; 275 int removed;
276 276
277 /** 277 /**
278 * Generation the element was removed by the client. 278 * Generation the element was removed by the client.
279 * Operations of later generations will not consider the element. 279 * Operations of later generations will not consider the element.
280 * Only valid if is_removed is GNUNET_YES. 280 * Only valid if is_removed is GNUNET_YES.
281 */ 281 */
diff --git a/src/set/gnunet-service-set_intersection.c b/src/set/gnunet-service-set_intersection.c
index 2a1cf634b..3082f94b5 100644
--- a/src/set/gnunet-service-set_intersection.c
+++ b/src/set/gnunet-service-set_intersection.c
@@ -175,13 +175,13 @@ struct IntersectionEvaluateOperation
175 * was created. 175 * was created.
176 */ 176 */
177 unsigned int generation_created; 177 unsigned int generation_created;
178 178
179 /** 179 /**
180 * Evaluate operations are held in 180 * Evaluate operations are held in
181 * a linked list. 181 * a linked list.
182 */ 182 */
183 struct IntersectionEvaluateOperation *next; 183 struct IntersectionEvaluateOperation *next;
184 184
185 /** 185 /**
186 * Evaluate operations are held in 186 * Evaluate operations are held in
187 * a linked list. 187 * a linked list.
@@ -224,7 +224,7 @@ struct ElementEntry
224 int removed; 224 int removed;
225 225
226 /** 226 /**
227 * Generation the element was removed by the client. 227 * Generation the element was removed by the client.
228 * Operations of later generations will not consider the element. 228 * Operations of later generations will not consider the element.
229 * Only valid if is_removed is GNUNET_YES. 229 * Only valid if is_removed is GNUNET_YES.
230 */ 230 */
@@ -374,7 +374,7 @@ destroy_key_to_element_iter (void *cls,
374 void *value) 374 void *value)
375{ 375{
376 struct KeyEntry *k = value; 376 struct KeyEntry *k = value;
377 377
378 while (NULL != k) 378 while (NULL != k)
379 { 379 {
380 struct KeyEntry *k_tmp = k; 380 struct KeyEntry *k_tmp = k;
@@ -395,7 +395,7 @@ void
395_GSS_union_operation_destroy (struct UnionEvaluateOperation *eo) 395_GSS_union_operation_destroy (struct UnionEvaluateOperation *eo)
396{ 396{
397 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "destroying union op\n"); 397 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "destroying union op\n");
398 398
399 if (NULL != eo->tunnel) 399 if (NULL != eo->tunnel)
400 { 400 {
401 GNUNET_MESH_tunnel_destroy (eo->tunnel); 401 GNUNET_MESH_tunnel_destroy (eo->tunnel);
@@ -457,7 +457,7 @@ fail_union_operation (struct UnionEvaluateOperation *eo)
457 457
458 458
459/** 459/**
460 * Derive the IBF key from a hash code and 460 * Derive the IBF key from a hash code and
461 * a salt. 461 * a salt.
462 * 462 *
463 * @param src the hash code 463 * @param src the hash code
@@ -863,14 +863,14 @@ decode_and_send (struct UnionEvaluateOperation *eo)
863 next_order++; 863 next_order++;
864 if (next_order <= MAX_IBF_ORDER) 864 if (next_order <= MAX_IBF_ORDER)
865 { 865 {
866 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 866 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
867 "decoding failed, sending larger ibf (size %u)\n", 867 "decoding failed, sending larger ibf (size %u)\n",
868 1<<next_order); 868 1<<next_order);
869 send_ibf (eo, next_order); 869 send_ibf (eo, next_order);
870 } 870 }
871 else 871 else
872 { 872 {
873 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 873 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
874 "set union failed: reached ibf limit\n"); 874 "set union failed: reached ibf limit\n");
875 } 875 }
876 break; 876 break;
@@ -950,7 +950,7 @@ handle_p2p_ibf (void *cls, const struct GNUNET_MessageHeader *mh)
950 fail_union_operation (eo); 950 fail_union_operation (eo);
951 return; 951 return;
952 } 952 }
953 953
954 ibf_read_slice (&msg[1], eo->ibf_buckets_received, buckets_in_message, eo->remote_ibf); 954 ibf_read_slice (&msg[1], eo->ibf_buckets_received, buckets_in_message, eo->remote_ibf);
955 eo->ibf_buckets_received += buckets_in_message; 955 eo->ibf_buckets_received += buckets_in_message;
956 956
@@ -1106,7 +1106,7 @@ peer_done_sent_cb (void *cls)
1106 1106
1107/** 1107/**
1108 * Handle a done message from a remote peer 1108 * Handle a done message from a remote peer
1109 * 1109 *
1110 * @param cls the union operation 1110 * @param cls the union operation
1111 * @param mh the message 1111 * @param mh the message
1112 */ 1112 */
@@ -1160,15 +1160,15 @@ _GSS_intersection_evaluate (struct GNUNET_SET_EvaluateMessage *m, struct Set *se
1160 eo->se = strata_estimator_dup (set->state.i->se); 1160 eo->se = strata_estimator_dup (set->state.i->se);
1161 eo->salt = ntohs (m->salt); 1161 eo->salt = ntohs (m->salt);
1162 eo->app_id = m->app_id; 1162 eo->app_id = m->app_id;
1163 1163
1164 context_msg = GNUNET_MQ_extract_nested_mh (m); 1164 context_msg = GNUNET_MQ_extract_nested_mh (m);
1165 if (NULL != context_msg) 1165 if (NULL != context_msg)
1166 { 1166 {
1167 eo->context_msg = GNUNET_copy_message (context_msg); 1167 eo->context_msg = GNUNET_copy_message (context_msg);
1168 } 1168 }
1169 1169
1170 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1170 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1171 "evaluating intersection operation, (app %s)\n", 1171 "evaluating intersection operation, (app %s)\n",
1172 GNUNET_h2s (&eo->app_id)); 1172 GNUNET_h2s (&eo->app_id));
1173 1173
1174 eo->tc = GNUNET_new (struct TunnelContext); 1174 eo->tc = GNUNET_new (struct TunnelContext);
@@ -1231,7 +1231,7 @@ _GSS_intersection_set_create (void)
1231 struct Set *set; 1231 struct Set *set;
1232 1232
1233 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "intersection set created\n"); 1233 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "intersection set created\n");
1234 1234
1235 set = GNUNET_malloc (sizeof (struct Set) + sizeof (struct IntersectionState)); 1235 set = GNUNET_malloc (sizeof (struct Set) + sizeof (struct IntersectionState));
1236 set->state.i = (struct IntersectionState *) &set[1]; 1236 set->state.i = (struct IntersectionState *) &set[1];
1237 set->operation = GNUNET_SET_OPERATION_INTERSECTION; 1237 set->operation = GNUNET_SET_OPERATION_INTERSECTION;
@@ -1239,7 +1239,7 @@ _GSS_intersection_set_create (void)
1239 * want the hash map to copy them */ 1239 * want the hash map to copy them */
1240 set->state.i->elements = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_YES); 1240 set->state.i->elements = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_YES);
1241 set->state.i->se = strata_estimator_create (SE_STRATA_COUNT, 1241 set->state.i->se = strata_estimator_create (SE_STRATA_COUNT,
1242 SE_IBF_SIZE, SE_IBF_HASH_NUM); 1242 SE_IBF_SIZE, SE_IBF_HASH_NUM);
1243 return set; 1243 return set;
1244} 1244}
1245 1245
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c
index b70436635..436d707d7 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -166,13 +166,13 @@ struct OperationState
166 * belongs to. 166 * belongs to.
167 */ 167 */
168 struct Set *set; 168 struct Set *set;
169 169
170 /** 170 /**
171 * Evaluate operations are held in 171 * Evaluate operations are held in
172 * a linked list. 172 * a linked list.
173 */ 173 */
174 struct OperationState *next; 174 struct OperationState *next;
175 175
176 /** 176 /**
177 * Evaluate operations are held in 177 * Evaluate operations are held in
178 * a linked list. 178 * a linked list.
@@ -273,7 +273,7 @@ destroy_key_to_element_iter (void *cls,
273 void *value) 273 void *value)
274{ 274{
275 struct KeyEntry *k = value; 275 struct KeyEntry *k = value;
276 276
277 while (NULL != k) 277 while (NULL != k)
278 { 278 {
279 struct KeyEntry *k_tmp = k; 279 struct KeyEntry *k_tmp = k;
@@ -374,7 +374,7 @@ fail_union_operation (struct OperationState *eo)
374 374
375 375
376/** 376/**
377 * Derive the IBF key from a hash code and 377 * Derive the IBF key from a hash code and
378 * a salt. 378 * a salt.
379 * 379 *
380 * @param src the hash code 380 * @param src the hash code
@@ -788,7 +788,7 @@ decode_and_send (struct OperationState *eo)
788 prepare_ibf (eo, eo->remote_ibf->size); 788 prepare_ibf (eo, eo->remote_ibf->size);
789 diff_ibf = ibf_dup (eo->local_ibf); 789 diff_ibf = ibf_dup (eo->local_ibf);
790 ibf_subtract (diff_ibf, eo->remote_ibf); 790 ibf_subtract (diff_ibf, eo->remote_ibf);
791 791
792 ibf_destroy (eo->remote_ibf); 792 ibf_destroy (eo->remote_ibf);
793 eo->remote_ibf = NULL; 793 eo->remote_ibf = NULL;
794 794
@@ -826,14 +826,14 @@ decode_and_send (struct OperationState *eo)
826 next_order++; 826 next_order++;
827 if (next_order <= MAX_IBF_ORDER) 827 if (next_order <= MAX_IBF_ORDER)
828 { 828 {
829 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 829 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
830 "decoding failed, sending larger ibf (size %u)\n", 830 "decoding failed, sending larger ibf (size %u)\n",
831 1<<next_order); 831 1<<next_order);
832 send_ibf (eo, next_order); 832 send_ibf (eo, next_order);
833 } 833 }
834 else 834 else
835 { 835 {
836 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 836 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
837 "set union failed: reached ibf limit\n"); 837 "set union failed: reached ibf limit\n");
838 } 838 }
839 break; 839 break;
@@ -862,7 +862,7 @@ decode_and_send (struct OperationState *eo)
862 * so that we don't request it again with the next ibf if decoding fails */ 862 * so that we don't request it again with the next ibf if decoding fails */
863 ev = GNUNET_MQ_msg_header_extra (msg, sizeof (struct IBF_Key), 863 ev = GNUNET_MQ_msg_header_extra (msg, sizeof (struct IBF_Key),
864 GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENT_REQUESTS); 864 GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENT_REQUESTS);
865 865
866 *(struct IBF_Key *) &msg[1] = key; 866 *(struct IBF_Key *) &msg[1] = key;
867 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sending element request\n"); 867 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sending element request\n");
868 GNUNET_MQ_send (eo->mq, ev); 868 GNUNET_MQ_send (eo->mq, ev);
@@ -930,7 +930,7 @@ handle_p2p_ibf (void *cls, const struct GNUNET_MessageHeader *mh)
930 fail_union_operation (eo); 930 fail_union_operation (eo);
931 return; 931 return;
932 } 932 }
933 933
934 ibf_read_slice (&msg[1], eo->ibf_buckets_received, buckets_in_message, eo->remote_ibf); 934 ibf_read_slice (&msg[1], eo->ibf_buckets_received, buckets_in_message, eo->remote_ibf);
935 eo->ibf_buckets_received += buckets_in_message; 935 eo->ibf_buckets_received += buckets_in_message;
936 936
@@ -1080,7 +1080,7 @@ handle_p2p_element_requests (void *cls, const struct GNUNET_MessageHeader *mh)
1080 1080
1081/** 1081/**
1082 * Handle a done message from a remote peer 1082 * Handle a done message from a remote peer
1083 * 1083 *
1084 * @param cls the union operation 1084 * @param cls the union operation
1085 * @param mh the message 1085 * @param mh the message
1086 */ 1086 */
@@ -1139,8 +1139,8 @@ union_evaluate (struct OperationSpecification *spec,
1139 eo->tunnel = tunnel; 1139 eo->tunnel = tunnel;
1140 eo->mq = GNUNET_MESH_mq_create (tunnel); 1140 eo->mq = GNUNET_MESH_mq_create (tunnel);
1141 1141
1142 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1142 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1143 "evaluating union operation, (app %s)\n", 1143 "evaluating union operation, (app %s)\n",
1144 GNUNET_h2s (&eo->spec->app_id)); 1144 GNUNET_h2s (&eo->spec->app_id));
1145 1145
1146 /* we started the operation, thus we have to send the operation request */ 1146 /* we started the operation, thus we have to send the operation request */
@@ -1201,10 +1201,10 @@ union_set_create (void)
1201 struct SetState *set_state; 1201 struct SetState *set_state;
1202 1202
1203 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "union set created\n"); 1203 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "union set created\n");
1204 1204
1205 set_state = GNUNET_new (struct SetState); 1205 set_state = GNUNET_new (struct SetState);
1206 set_state->se = strata_estimator_create (SE_STRATA_COUNT, 1206 set_state->se = strata_estimator_create (SE_STRATA_COUNT,
1207 SE_IBF_SIZE, SE_IBF_HASH_NUM); 1207 SE_IBF_SIZE, SE_IBF_HASH_NUM);
1208 return set_state; 1208 return set_state;
1209} 1209}
1210 1210
diff --git a/src/set/gnunet-set-ibf-profiler.c b/src/set/gnunet-set-ibf-profiler.c
index c3a16d165..577c78cf2 100644
--- a/src/set/gnunet-set-ibf-profiler.c
+++ b/src/set/gnunet-set-ibf-profiler.c
@@ -181,7 +181,7 @@ run (void *cls, char *const *args, const char *cfgfile,
181 for (i = 0; i <= asize + bsize; i++) 181 for (i = 0; i <= asize + bsize; i++)
182 { 182 {
183 res = ibf_decode (ibf_a, &side, &ibf_key); 183 res = ibf_decode (ibf_a, &side, &ibf_key);
184 if (GNUNET_SYSERR == res) 184 if (GNUNET_SYSERR == res)
185 { 185 {
186 printf ("decode failed, %u/%u elements left\n", 186 printf ("decode failed, %u/%u elements left\n",
187 GNUNET_CONTAINER_multihashmap_size (set_a) + GNUNET_CONTAINER_multihashmap_size (set_b), 187 GNUNET_CONTAINER_multihashmap_size (set_a) + GNUNET_CONTAINER_multihashmap_size (set_b),
diff --git a/src/set/gnunet-set-profiler.c b/src/set/gnunet-set-profiler.c
index 20ff5dd0a..f6fdc25cf 100644
--- a/src/set/gnunet-set-profiler.c
+++ b/src/set/gnunet-set-profiler.c
@@ -226,7 +226,7 @@ run (void *cls, char *const *args, const char *cfgfile,
226 226
227 info1.id = "a"; 227 info1.id = "a";
228 info2.id = "b"; 228 info2.id = "b";
229 229
230 info1.sent = GNUNET_CONTAINER_multihashmap_create (num_a+1, GNUNET_NO); 230 info1.sent = GNUNET_CONTAINER_multihashmap_create (num_a+1, GNUNET_NO);
231 info2.sent = GNUNET_CONTAINER_multihashmap_create (num_b+1, GNUNET_NO); 231 info2.sent = GNUNET_CONTAINER_multihashmap_create (num_b+1, GNUNET_NO);
232 common_sent = GNUNET_CONTAINER_multihashmap_create (num_c+1, GNUNET_NO); 232 common_sent = GNUNET_CONTAINER_multihashmap_create (num_c+1, GNUNET_NO);
diff --git a/src/set/ibf.c b/src/set/ibf.c
index 6fe57d11a..3b28e15e1 100644
--- a/src/set/ibf.c
+++ b/src/set/ibf.c
@@ -236,7 +236,7 @@ ibf_decode (struct InvertibleBloomFilter *ibf,
236/** 236/**
237 * Write buckets from an ibf to a buffer. 237 * Write buckets from an ibf to a buffer.
238 * Exactly (IBF_BUCKET_SIZE*ibf->size) bytes are written to buf. 238 * Exactly (IBF_BUCKET_SIZE*ibf->size) bytes are written to buf.
239 * 239 *
240 * @param ibf the ibf to write 240 * @param ibf the ibf to write
241 * @param start with which bucket to start 241 * @param start with which bucket to start
242 * @param count how many buckets to write 242 * @param count how many buckets to write
diff --git a/src/set/ibf.h b/src/set/ibf.h
index a020c713f..1099f6aa2 100644
--- a/src/set/ibf.h
+++ b/src/set/ibf.h
@@ -103,7 +103,7 @@ struct InvertibleBloomFilter
103/** 103/**
104 * Write buckets from an ibf to a buffer. 104 * Write buckets from an ibf to a buffer.
105 * Exactly (IBF_BUCKET_SIZE*ibf->size) bytes are written to buf. 105 * Exactly (IBF_BUCKET_SIZE*ibf->size) bytes are written to buf.
106 * 106 *
107 * @param ibf the ibf to write 107 * @param ibf the ibf to write
108 * @param start with which bucket to start 108 * @param start with which bucket to start
109 * @param count how many buckets to write 109 * @param count how many buckets to write
diff --git a/src/set/set_api.c b/src/set/set_api.c
index 267fe3fc6..cf64e5680 100644
--- a/src/set/set_api.c
+++ b/src/set/set_api.c
@@ -599,7 +599,7 @@ listen_connect (void *cls,
599 599
600/** 600/**
601 * Wait for set operation requests for the given application id 601 * Wait for set operation requests for the given application id
602 * 602 *
603 * @param cfg configuration to use for connecting to 603 * @param cfg configuration to use for connecting to
604 * the set service, needs to be valid for the lifetime of the listen handle 604 * the set service, needs to be valid for the lifetime of the listen handle
605 * @param operation operation we want to listen for 605 * @param operation operation we want to listen for
@@ -650,7 +650,7 @@ GNUNET_SET_listen_cancel (struct GNUNET_SET_ListenHandle *lh)
650 * #GNUNET_SET_listen, as the 'struct GNUNET_SET_Request' becomes invalid 650 * #GNUNET_SET_listen, as the 'struct GNUNET_SET_Request' becomes invalid
651 * afterwards. 651 * afterwards.
652 * Call #GNUNET_SET_conclude to provide the local set to use for the operation, 652 * Call #GNUNET_SET_conclude to provide the local set to use for the operation,
653 * and to begin the exchange with the remote peer. 653 * and to begin the exchange with the remote peer.
654 * 654 *
655 * @param request request to accept 655 * @param request request to accept
656 * @param result_mode specified how results will be returned, 656 * @param result_mode specified how results will be returned,
@@ -729,7 +729,7 @@ GNUNET_SET_operation_cancel (struct GNUNET_SET_OperationHandle *oh)
729 * set information and call the result callback with the 729 * set information and call the result callback with the
730 * result information. 730 * result information.
731 * 731 *
732 * @param oh handle to the set operation 732 * @param oh handle to the set operation
733 * @param set the set to use for the operation 733 * @param set the set to use for the operation
734 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the 734 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the
735 * set is invalid (e.g. the set service crashed) 735 * set is invalid (e.g. the set service crashed)
diff --git a/src/set/test_set_api.c b/src/set/test_set_api.c
index 95334f856..ec5226d50 100644
--- a/src/set/test_set_api.c
+++ b/src/set/test_set_api.c
@@ -216,7 +216,7 @@ test_iter ()
216/** 216/**
217 * Signature of the 'main' function for a (single-peer) testcase that 217 * Signature of the 'main' function for a (single-peer) testcase that
218 * is run using 'GNUNET_TESTING_peer_run'. 218 * is run using 'GNUNET_TESTING_peer_run'.
219 * 219 *
220 * @param cls closure 220 * @param cls closure
221 * @param cfg configuration of the peer that was started 221 * @param cfg configuration of the peer that was started
222 * @param peer identity of the peer that was created 222 * @param peer identity of the peer that was created
diff --git a/src/statistics/gnunet-service-statistics.c b/src/statistics/gnunet-service-statistics.c
index 737ecd7a3..acf2a965f 100644
--- a/src/statistics/gnunet-service-statistics.c
+++ b/src/statistics/gnunet-service-statistics.c
@@ -291,7 +291,7 @@ save ()
291 struct StatsEntry *pos; 291 struct StatsEntry *pos;
292 char *fn; 292 char *fn;
293 struct GNUNET_BIO_WriteHandle *wh; 293 struct GNUNET_BIO_WriteHandle *wh;
294 294
295 uint16_t size; 295 uint16_t size;
296 unsigned long long total; 296 unsigned long long total;
297 297
@@ -716,7 +716,7 @@ handle_watch (void *cls, struct GNUNET_SERVER_Client *client,
716/** 716/**
717 * Actually perform the shutdown. 717 * Actually perform the shutdown.
718 */ 718 */
719static void 719static void
720do_shutdown () 720do_shutdown ()
721{ 721{
722 struct WatchEntry *we; 722 struct WatchEntry *we;
@@ -726,7 +726,7 @@ do_shutdown ()
726 return; 726 return;
727 save (); 727 save ();
728 GNUNET_SERVER_notification_context_destroy (nc); 728 GNUNET_SERVER_notification_context_destroy (nc);
729 nc = NULL; 729 nc = NULL;
730 GNUNET_assert (NULL == client_head); 730 GNUNET_assert (NULL == client_head);
731 while (NULL != (se = start)) 731 while (NULL != (se = start))
732 { 732 {
diff --git a/src/statistics/gnunet-statistics.c b/src/statistics/gnunet-statistics.c
index d05765c4a..857c9bde6 100644
--- a/src/statistics/gnunet-statistics.c
+++ b/src/statistics/gnunet-statistics.c
@@ -166,7 +166,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
166 GNUNET_assert (GNUNET_OK == 166 GNUNET_assert (GNUNET_OK ==
167 GNUNET_STATISTICS_watch_cancel (h, subsystem, name, &printer, h)); 167 GNUNET_STATISTICS_watch_cancel (h, subsystem, name, &printer, h));
168 GNUNET_STATISTICS_destroy (h, GNUNET_NO); 168 GNUNET_STATISTICS_destroy (h, GNUNET_NO);
169 h = NULL; 169 h = NULL;
170} 170}
171 171
172 172
@@ -248,16 +248,16 @@ main_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
248 * 248 *
249 * @param cls closure with our configuration 249 * @param cls closure with our configuration
250 * @param result #GNUNET_YES if the resolver is running 250 * @param result #GNUNET_YES if the resolver is running
251 */ 251 */
252static void 252static void
253resolver_test_task (void *cls, 253resolver_test_task (void *cls,
254 int result) 254 int result)
255{ 255{
256 struct GNUNET_CONFIGURATION_Handle *cfg = cls; 256 struct GNUNET_CONFIGURATION_Handle *cfg = cls;
257 257
258 if (GNUNET_YES != result) 258 if (GNUNET_YES != result)
259 { 259 {
260 FPRINTF (stderr, 260 FPRINTF (stderr,
261 _("Trying to connect to remote host, but service `%s' is not running\n"), "resolver"); 261 _("Trying to connect to remote host, but service `%s' is not running\n"), "resolver");
262 return; 262 return;
263 } 263 }
@@ -272,13 +272,13 @@ resolver_test_task (void *cls,
272 } 272 }
273 else if (65535 <= remote_port) 273 else if (65535 <= remote_port)
274 { 274 {
275 FPRINTF (stderr, 275 FPRINTF (stderr,
276 _("A port has to be between 1 and 65535 to connect to host `%s'\n"), remote_host); 276 _("A port has to be between 1 and 65535 to connect to host `%s'\n"), remote_host);
277 return; 277 return;
278 } 278 }
279 279
280 /* Manipulate configuration */ 280 /* Manipulate configuration */
281 GNUNET_CONFIGURATION_set_value_string (cfg, 281 GNUNET_CONFIGURATION_set_value_string (cfg,
282 "statistics", "UNIXPATH", ""); 282 "statistics", "UNIXPATH", "");
283 GNUNET_CONFIGURATION_set_value_string (cfg, 283 GNUNET_CONFIGURATION_set_value_string (cfg,
284 "statistics", "HOSTNAME", remote_host); 284 "statistics", "HOSTNAME", remote_host);
@@ -312,7 +312,7 @@ run (void *cls, char *const *args, const char *cfgfile,
312 set_value = GNUNET_YES; 312 set_value = GNUNET_YES;
313 } 313 }
314 if (NULL != remote_host) 314 if (NULL != remote_host)
315 GNUNET_CLIENT_service_test ("resolver", cfg, GNUNET_TIME_UNIT_SECONDS, 315 GNUNET_CLIENT_service_test ("resolver", cfg, GNUNET_TIME_UNIT_SECONDS,
316 &resolver_test_task, (void *) cfg); 316 &resolver_test_task, (void *) cfg);
317 else 317 else
318 GNUNET_SCHEDULER_add_now (&main_task, (void *) cfg); 318 GNUNET_SCHEDULER_add_now (&main_task, (void *) cfg);
diff --git a/src/statistics/statistics_api.c b/src/statistics/statistics_api.c
index 7aa109930..cecc1b0f6 100644
--- a/src/statistics/statistics_api.c
+++ b/src/statistics/statistics_api.c
@@ -277,11 +277,11 @@ update_memory_statistics (struct GNUNET_STATISTICS_Handle *h)
277#if HAVE_MALLINFO 277#if HAVE_MALLINFO
278 { 278 {
279 struct mallinfo mi; 279 struct mallinfo mi;
280 280
281 mi = mallinfo(); 281 mi = mallinfo();
282 current_heap_size = mi.uordblks + mi.fordblks; 282 current_heap_size = mi.uordblks + mi.fordblks;
283 } 283 }
284#endif 284#endif
285#if HAVE_GETRUSAGE 285#if HAVE_GETRUSAGE
286 { 286 {
287 struct rusage ru; 287 struct rusage ru;
@@ -289,7 +289,7 @@ update_memory_statistics (struct GNUNET_STATISTICS_Handle *h)
289 if (0 == getrusage (RUSAGE_SELF, &ru)) 289 if (0 == getrusage (RUSAGE_SELF, &ru))
290 { 290 {
291 current_rss = 1024LL * ru.ru_maxrss; 291 current_rss = 1024LL * ru.ru_maxrss;
292 } 292 }
293 } 293 }
294#endif 294#endif
295 if (current_heap_size > h->peak_heap_size) 295 if (current_heap_size > h->peak_heap_size)
@@ -381,12 +381,12 @@ static void
381do_disconnect (struct GNUNET_STATISTICS_Handle *h) 381do_disconnect (struct GNUNET_STATISTICS_Handle *h)
382{ 382{
383 struct GNUNET_STATISTICS_GetHandle *c; 383 struct GNUNET_STATISTICS_GetHandle *c;
384 384
385 if (NULL != h->th) 385 if (NULL != h->th)
386 { 386 {
387 GNUNET_CLIENT_notify_transmit_ready_cancel (h->th); 387 GNUNET_CLIENT_notify_transmit_ready_cancel (h->th);
388 h->th = NULL; 388 h->th = NULL;
389 } 389 }
390 if (NULL != h->client) 390 if (NULL != h->client)
391 { 391 {
392 GNUNET_CLIENT_disconnect (h->client); 392 GNUNET_CLIENT_disconnect (h->client);
@@ -421,10 +421,10 @@ try_connect (struct GNUNET_STATISTICS_Handle *h)
421 return GNUNET_NO; 421 return GNUNET_NO;
422 if (NULL != h->client) 422 if (NULL != h->client)
423 return GNUNET_YES; 423 return GNUNET_YES;
424 h->client = GNUNET_CLIENT_connect ("statistics", h->cfg); 424 h->client = GNUNET_CLIENT_connect ("statistics", h->cfg);
425 if (NULL != h->client) 425 if (NULL != h->client)
426 { 426 {
427 gn = h->action_head; 427 gn = h->action_head;
428 while (NULL != (gh = gn)) 428 while (NULL != (gh = gn))
429 { 429 {
430 gn = gh->next; 430 gn = gh->next;
@@ -601,8 +601,8 @@ process_watch_value (struct GNUNET_STATISTICS_Handle *h,
601 return GNUNET_SYSERR; 601 return GNUNET_SYSERR;
602 } 602 }
603 w = h->watches[wid]; 603 w = h->watches[wid];
604 if (NULL == w) 604 if (NULL == w)
605 return GNUNET_NO; 605 return GNUNET_NO;
606 (void) w->proc (w->proc_cls, w->subsystem, w->name, 606 (void) w->proc (w->proc_cls, w->subsystem, w->name,
607 GNUNET_ntohll (wvm->value), 607 GNUNET_ntohll (wvm->value),
608 0 != (ntohl (wvm->flags) & GNUNET_STATISTICS_PERSIST_BIT)); 608 0 != (ntohl (wvm->flags) & GNUNET_STATISTICS_PERSIST_BIT));
@@ -674,7 +674,7 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg)
674 else 674 else
675 { 675 {
676 h->receiving = GNUNET_NO; 676 h->receiving = GNUNET_NO;
677 } 677 }
678 h->current = NULL; 678 h->current = NULL;
679 schedule_action (h); 679 schedule_action (h);
680 if (NULL != c->cont) 680 if (NULL != c->cont)
@@ -686,7 +686,7 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg)
686 { 686 {
687 do_disconnect (h); 687 do_disconnect (h);
688 reconnect_later (h); 688 reconnect_later (h);
689 return; 689 return;
690 } 690 }
691 /* finally, look for more! */ 691 /* finally, look for more! */
692 LOG (GNUNET_ERROR_TYPE_DEBUG, 692 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -697,12 +697,12 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg)
697 h->backoff = GNUNET_TIME_UNIT_MILLISECONDS; 697 h->backoff = GNUNET_TIME_UNIT_MILLISECONDS;
698 return; 698 return;
699 case GNUNET_MESSAGE_TYPE_STATISTICS_WATCH_VALUE: 699 case GNUNET_MESSAGE_TYPE_STATISTICS_WATCH_VALUE:
700 if (GNUNET_OK != 700 if (GNUNET_OK !=
701 (ret = process_watch_value (h, msg))) 701 (ret = process_watch_value (h, msg)))
702 { 702 {
703 do_disconnect (h); 703 do_disconnect (h);
704 if (GNUNET_NO == ret) 704 if (GNUNET_NO == ret)
705 h->backoff = GNUNET_TIME_UNIT_MILLISECONDS; 705 h->backoff = GNUNET_TIME_UNIT_MILLISECONDS;
706 reconnect_later (h); 706 reconnect_later (h);
707 return; 707 return;
708 } 708 }
@@ -710,7 +710,7 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg)
710 GNUNET_assert (h->watches_size > 0); 710 GNUNET_assert (h->watches_size > 0);
711 GNUNET_CLIENT_receive (h->client, &receive_stats, h, 711 GNUNET_CLIENT_receive (h->client, &receive_stats, h,
712 GNUNET_TIME_UNIT_FOREVER_REL); 712 GNUNET_TIME_UNIT_FOREVER_REL);
713 return; 713 return;
714 default: 714 default:
715 GNUNET_break (0); 715 GNUNET_break (0);
716 do_disconnect (h); 716 do_disconnect (h);
@@ -976,7 +976,7 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first)
976 h->current = NULL; 976 h->current = NULL;
977 } 977 }
978 } 978 }
979 next = h->action_head; 979 next = h->action_head;
980 while (NULL != (pos = next)) 980 while (NULL != (pos = next))
981 { 981 {
982 next = pos->next; 982 next = pos->next;
@@ -1018,7 +1018,7 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first)
1018 for (i = 0; i < h->watches_size; i++) 1018 for (i = 0; i < h->watches_size; i++)
1019 { 1019 {
1020 if (NULL == h->watches[i]) 1020 if (NULL == h->watches[i])
1021 continue; 1021 continue;
1022 GNUNET_free (h->watches[i]->subsystem); 1022 GNUNET_free (h->watches[i]->subsystem);
1023 GNUNET_free (h->watches[i]->name); 1023 GNUNET_free (h->watches[i]->name);
1024 GNUNET_free (h->watches[i]); 1024 GNUNET_free (h->watches[i]);
@@ -1232,7 +1232,7 @@ GNUNET_STATISTICS_watch (struct GNUNET_STATISTICS_Handle *handle,
1232 1232
1233 1233
1234/** 1234/**
1235 * Stop watching statistics from the peer. 1235 * Stop watching statistics from the peer.
1236 * 1236 *
1237 * @param handle identification of the statistics service 1237 * @param handle identification of the statistics service
1238 * @param subsystem limit to the specified subsystem, never NULL 1238 * @param subsystem limit to the specified subsystem, never NULL
@@ -1264,9 +1264,9 @@ GNUNET_STATISTICS_watch_cancel (struct GNUNET_STATISTICS_Handle *handle,
1264 GNUNET_free (w->name); 1264 GNUNET_free (w->name);
1265 GNUNET_free (w->subsystem); 1265 GNUNET_free (w->subsystem);
1266 GNUNET_free (w); 1266 GNUNET_free (w);
1267 handle->watches[i] = NULL; 1267 handle->watches[i] = NULL;
1268 return GNUNET_OK; 1268 return GNUNET_OK;
1269 } 1269 }
1270 } 1270 }
1271 return GNUNET_SYSERR; 1271 return GNUNET_SYSERR;
1272} 1272}
@@ -1305,7 +1305,7 @@ add_setter_action (struct GNUNET_STATISTICS_Handle *h, const char *name,
1305 for (ai = h->action_head; NULL != ai; ai = ai->next) 1305 for (ai = h->action_head; NULL != ai; ai = ai->next)
1306 { 1306 {
1307 if (! ( (0 == strcmp (ai->subsystem, h->subsystem)) && 1307 if (! ( (0 == strcmp (ai->subsystem, h->subsystem)) &&
1308 (0 == strcmp (ai->name, name)) && 1308 (0 == strcmp (ai->name, name)) &&
1309 ( (ACTION_UPDATE == ai->type) || 1309 ( (ACTION_UPDATE == ai->type) ||
1310 (ACTION_SET == ai->type) ) ) ) 1310 (ACTION_SET == ai->type) ) ) )
1311 continue; 1311 continue;
@@ -1351,7 +1351,7 @@ add_setter_action (struct GNUNET_STATISTICS_Handle *h, const char *name,
1351 } 1351 }
1352 ai->timeout = GNUNET_TIME_relative_to_absolute (SET_TRANSMIT_TIMEOUT); 1352 ai->timeout = GNUNET_TIME_relative_to_absolute (SET_TRANSMIT_TIMEOUT);
1353 ai->make_persistent = make_persistent; 1353 ai->make_persistent = make_persistent;
1354 return; 1354 return;
1355 } 1355 }
1356 /* no existing entry matches, create a fresh one */ 1356 /* no existing entry matches, create a fresh one */
1357 ai = GNUNET_malloc (sizeof (struct GNUNET_STATISTICS_GetHandle)); 1357 ai = GNUNET_malloc (sizeof (struct GNUNET_STATISTICS_GetHandle));
diff --git a/src/statistics/test_statistics_api.c b/src/statistics/test_statistics_api.c
index 5fb506ff7..47871fa7b 100644
--- a/src/statistics/test_statistics_api.c
+++ b/src/statistics/test_statistics_api.c
@@ -146,7 +146,7 @@ main (int argc, char *argv_ign[])
146 NULL); 146 NULL);
147 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics"); 147 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics");
148 proc = 148 proc =
149 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, 149 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL,
150 binary, 150 binary,
151 "gnunet-service-statistics", 151 "gnunet-service-statistics",
152 "-c", "test_statistics_api_data.conf", NULL); 152 "-c", "test_statistics_api_data.conf", NULL);
@@ -169,7 +169,7 @@ main (int argc, char *argv_ign[])
169 ok = 1; 169 ok = 1;
170 /* restart to check persistence! */ 170 /* restart to check persistence! */
171 proc = 171 proc =
172 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, 172 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL,
173 binary, 173 binary,
174 "gnunet-service-statistics", 174 "gnunet-service-statistics",
175 "-c", "test_statistics_api_data.conf", NULL); 175 "-c", "test_statistics_api_data.conf", NULL);
diff --git a/src/statistics/test_statistics_api_loop.c b/src/statistics/test_statistics_api_loop.c
index f9a3a3ba6..987b6c57b 100644
--- a/src/statistics/test_statistics_api_loop.c
+++ b/src/statistics/test_statistics_api_loop.c
@@ -93,7 +93,7 @@ main (int argc, char *argv_ign[])
93 93
94 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics"); 94 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics");
95 proc = 95 proc =
96 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 96 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
97 NULL, NULL, 97 NULL, NULL,
98 binary, 98 binary,
99 "gnunet-service-statistics", 99 "gnunet-service-statistics",
diff --git a/src/statistics/test_statistics_api_watch.c b/src/statistics/test_statistics_api_watch.c
index 49cb04ef3..e75cab5f6 100644
--- a/src/statistics/test_statistics_api_watch.c
+++ b/src/statistics/test_statistics_api_watch.c
@@ -20,7 +20,7 @@
20/** 20/**
21 * @file statistics/test_statistics_api_watch.c 21 * @file statistics/test_statistics_api_watch.c
22 * @brief testcase for statistics_api.c watch functions 22 * @brief testcase for statistics_api.c watch functions
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 */ 24 */
25#include "platform.h" 25#include "platform.h"
26#include "gnunet_util_lib.h" 26#include "gnunet_util_lib.h"
@@ -119,7 +119,7 @@ main (int argc, char *argv_ign[])
119 }; 119 };
120 struct GNUNET_OS_Process *proc; 120 struct GNUNET_OS_Process *proc;
121 char *binary; 121 char *binary;
122 122
123 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics"); 123 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics");
124 proc = 124 proc =
125 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, 125 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL,
diff --git a/src/testbed/gnunet-daemon-testbed-blacklist.c b/src/testbed/gnunet-daemon-testbed-blacklist.c
index d14944362..6be43999c 100644
--- a/src/testbed/gnunet-daemon-testbed-blacklist.c
+++ b/src/testbed/gnunet-daemon-testbed-blacklist.c
@@ -22,8 +22,8 @@
22/** 22/**
23 * @file testbed/gnunet-daemon-testbed-blacklist.c 23 * @file testbed/gnunet-daemon-testbed-blacklist.c
24 * @brief daemon to restrict incoming connections from other peers at the 24 * @brief daemon to restrict incoming connections from other peers at the
25 * transport layer of a peer 25 * transport layer of a peer
26 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 26 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
27 */ 27 */
28 28
29#include "platform.h" 29#include "platform.h"
@@ -143,7 +143,7 @@ static int
143check_access (void *cls, const struct GNUNET_PeerIdentity * pid) 143check_access (void *cls, const struct GNUNET_PeerIdentity * pid)
144{ 144{
145 int contains; 145 int contains;
146 146
147 if (NULL != map) 147 if (NULL != map)
148 contains = GNUNET_CONTAINER_multipeermap_contains (map, pid); 148 contains = GNUNET_CONTAINER_multipeermap_contains (map, pid);
149 else 149 else
@@ -167,7 +167,7 @@ setup_ac (const char *fname, const struct GNUNET_CONFIGURATION_Handle *cfg)
167 uint64_t fsize; 167 uint64_t fsize;
168 unsigned int npeers; 168 unsigned int npeers;
169 unsigned int cnt; 169 unsigned int cnt;
170 170
171 GNUNET_assert (GNUNET_OK != GNUNET_DISK_file_size (fname, &fsize, GNUNET_NO, 171 GNUNET_assert (GNUNET_OK != GNUNET_DISK_file_size (fname, &fsize, GNUNET_NO,
172 GNUNET_YES)); 172 GNUNET_YES));
173 if (0 != (fsize % sizeof (struct GNUNET_PeerIdentity))) 173 if (0 != (fsize % sizeof (struct GNUNET_PeerIdentity)))
diff --git a/src/testbed/gnunet-helper-testbed.c b/src/testbed/gnunet-helper-testbed.c
index 95c54d06d..f49789a80 100644
--- a/src/testbed/gnunet-helper-testbed.c
+++ b/src/testbed/gnunet-helper-testbed.c
@@ -24,8 +24,8 @@
24 * gnunet-service-testbed. This binary also receives configuration 24 * gnunet-service-testbed. This binary also receives configuration
25 * from the remove controller which is put in a temporary location 25 * from the remove controller which is put in a temporary location
26 * with ports and paths fixed so that gnunet-service-testbed runs 26 * with ports and paths fixed so that gnunet-service-testbed runs
27 * without any hurdles. 27 * without any hurdles.
28 * 28 *
29 * This helper monitors for three termination events. They are: (1)The 29 * This helper monitors for three termination events. They are: (1)The
30 * stdin of the helper is closed for reading; (2)the helper received 30 * stdin of the helper is closed for reading; (2)the helper received
31 * SIGTERM/SIGINT; (3)the testbed crashed. In case of events 1 and 2 31 * SIGTERM/SIGINT; (3)the testbed crashed. In case of events 1 and 2
@@ -161,13 +161,13 @@ static int status;
161static void 161static void
162shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 162shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
163{ 163{
164 LOG_DEBUG ("Shutting down\n"); 164 LOG_DEBUG ("Shutting down\n");
165 shutdown_task_id = GNUNET_SCHEDULER_NO_TASK; 165 shutdown_task_id = GNUNET_SCHEDULER_NO_TASK;
166 if (NULL != testbed) 166 if (NULL != testbed)
167 { 167 {
168 LOG_DEBUG ("Killing testbed\n"); 168 LOG_DEBUG ("Killing testbed\n");
169 GNUNET_break (0 == GNUNET_OS_process_kill (testbed, SIGTERM)); 169 GNUNET_break (0 == GNUNET_OS_process_kill (testbed, SIGTERM));
170 } 170 }
171 if (GNUNET_SCHEDULER_NO_TASK != read_task_id) 171 if (GNUNET_SCHEDULER_NO_TASK != read_task_id)
172 { 172 {
173 GNUNET_SCHEDULER_cancel (read_task_id); 173 GNUNET_SCHEDULER_cancel (read_task_id);
@@ -194,7 +194,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
194 GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (testbed)); 194 GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (testbed));
195 GNUNET_OS_process_destroy (testbed); 195 GNUNET_OS_process_destroy (testbed);
196 testbed = NULL; 196 testbed = NULL;
197 } 197 }
198 if (NULL != test_system) 198 if (NULL != test_system)
199 { 199 {
200 GNUNET_TESTING_system_destroy (test_system, GNUNET_YES); 200 GNUNET_TESTING_system_destroy (test_system, GNUNET_YES);
@@ -291,7 +291,7 @@ child_death_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
291 GNUNET_break (0); 291 GNUNET_break (0);
292 return; 292 return;
293 } 293 }
294 GNUNET_break (GNUNET_SYSERR != 294 GNUNET_break (GNUNET_SYSERR !=
295 (ret = GNUNET_OS_process_status (testbed, &type, &code))); 295 (ret = GNUNET_OS_process_status (testbed, &type, &code)));
296 if (GNUNET_NO != ret) 296 if (GNUNET_NO != ret)
297 { 297 {
@@ -456,7 +456,7 @@ tokenizer_cb (void *cls, void *client,
456 wc->data = reply; 456 wc->data = reply;
457 write_task_id = 457 write_task_id =
458 GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, stdout_fd, 458 GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, stdout_fd,
459 &write_task, wc); 459 &write_task, wc);
460 child_death_task_id = 460 child_death_task_id =
461 GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, 461 GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
462 GNUNET_DISK_pipe_handle (sigpipe, 462 GNUNET_DISK_pipe_handle (sigpipe,
@@ -534,7 +534,7 @@ run (void *cls, char *const *args, const char *cfgfile,
534 read_task_id = 534 read_task_id =
535 GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, stdin_fd, 535 GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, stdin_fd,
536 &read_task, NULL); 536 &read_task, NULL);
537 shutdown_task_id = 537 shutdown_task_id =
538 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, 538 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
539 NULL); 539 NULL);
540} 540}
@@ -576,7 +576,7 @@ main (int argc, char **argv)
576 int ret; 576 int ret;
577 577
578 status = GNUNET_OK; 578 status = GNUNET_OK;
579 if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, 579 if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO,
580 GNUNET_NO, GNUNET_NO))) 580 GNUNET_NO, GNUNET_NO)))
581 { 581 {
582 GNUNET_break (0); 582 GNUNET_break (0);
diff --git a/src/testbed/gnunet-service-test-barriers.c b/src/testbed/gnunet-service-test-barriers.c
index f22deb57e..efc9d5677 100644
--- a/src/testbed/gnunet-service-test-barriers.c
+++ b/src/testbed/gnunet-service-test-barriers.c
@@ -22,7 +22,7 @@
22 * @file testbed/gnunet-service-test-barriers.c 22 * @file testbed/gnunet-service-test-barriers.c
23 * @brief Daemon acting as a service for testing testbed barriers. It is 23 * @brief Daemon acting as a service for testing testbed barriers. It is
24 * started as a peer service and waits for a barrier to be crossed. 24 * started as a peer service and waits for a barrier to be crossed.
25 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 25 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
26 */ 26 */
27 27
28#include "platform.h" 28#include "platform.h"
@@ -81,7 +81,7 @@ barrier_wait_cb (void *cls, const char *name, int status)
81 * 81 *
82 * @param cls NULL 82 * @param cls NULL
83 * @param tc scheduler task context 83 * @param tc scheduler task context
84 * @return 84 * @return
85 */ 85 */
86static void 86static void
87do_wait (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 87do_wait (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -126,7 +126,7 @@ int main (int argc, char **argv)
126 GNUNET_GETOPT_OPTION_END 126 GNUNET_GETOPT_OPTION_END
127 }; 127 };
128 int ret; 128 int ret;
129 129
130 ret = 130 ret =
131 GNUNET_PROGRAM_run (argc, argv, 131 GNUNET_PROGRAM_run (argc, argv,
132 "test-barriers", "nohelp", options, &run, NULL); 132 "test-barriers", "nohelp", options, &run, NULL);
diff --git a/src/testbed/gnunet-service-testbed-logger.c b/src/testbed/gnunet-service-testbed-logger.c
index c92237ccb..dfa9da52f 100644
--- a/src/testbed/gnunet-service-testbed-logger.c
+++ b/src/testbed/gnunet-service-testbed-logger.c
@@ -230,7 +230,7 @@ logger_run (void *cls, struct GNUNET_SERVER_Handle *server,
230 GNUNET_CONFIGURATION_get_value_filename (cfg, "TESTBED-LOGGER", "DIR", 230 GNUNET_CONFIGURATION_get_value_filename (cfg, "TESTBED-LOGGER", "DIR",
231 &dir)) 231 &dir))
232 { 232 {
233 LOG (GNUNET_ERROR_TYPE_ERROR, "Not logging directory definied. Exiting\n"); 233 LOG (GNUNET_ERROR_TYPE_ERROR, "Not logging directory definied. Exiting\n");
234 GNUNET_SCHEDULER_shutdown (); 234 GNUNET_SCHEDULER_shutdown ();
235 return; 235 return;
236 } 236 }
@@ -272,7 +272,7 @@ main (int argc, char *const *argv)
272{ 272{
273 //sleep (15); /* Debugging */ 273 //sleep (15); /* Debugging */
274 return (GNUNET_OK == 274 return (GNUNET_OK ==
275 GNUNET_SERVICE_run (argc, argv, "testbed-logger", 275 GNUNET_SERVICE_run (argc, argv, "testbed-logger",
276 GNUNET_SERVICE_OPTION_NONE, 276 GNUNET_SERVICE_OPTION_NONE,
277 &logger_run, NULL)) ? 0 : 1; 277 &logger_run, NULL)) ? 0 : 1;
278} 278}
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c
index b9465b2fe..6f806e21b 100644
--- a/src/testbed/gnunet-service-testbed.c
+++ b/src/testbed/gnunet-service-testbed.c
@@ -446,7 +446,7 @@ parse_shared_services (char *ss_str, struct GNUNET_CONFIGURATION_Handle *cfg)
446 (void) memcpy (&slist[n - 1], &ss, \ 446 (void) memcpy (&slist[n - 1], &ss, \
447 sizeof (struct GNUNET_TESTING_SharedService)); \ 447 sizeof (struct GNUNET_TESTING_SharedService)); \
448 } while (0) 448 } while (0)
449 449
450 slist = NULL; 450 slist = NULL;
451 n = 0; 451 n = 0;
452 ss.cfg = cfg; 452 ss.cfg = cfg;
@@ -590,7 +590,7 @@ handle_add_host (void *cls, struct GNUNET_SERVER_Client *client,
590 username_length = ntohs (msg->username_length); 590 username_length = ntohs (msg->username_length);
591 hostname_length = ntohs (msg->hostname_length); 591 hostname_length = ntohs (msg->hostname_length);
592 /* msg must contain hostname */ 592 /* msg must contain hostname */
593 if ((msize <= (sizeof (struct GNUNET_TESTBED_AddHostMessage) + 593 if ((msize <= (sizeof (struct GNUNET_TESTBED_AddHostMessage) +
594 username_length)) 594 username_length))
595 || (0 == hostname_length)) 595 || (0 == hostname_length))
596 { 596 {
@@ -731,7 +731,7 @@ void
731GST_clear_fopcq () 731GST_clear_fopcq ()
732{ 732{
733 struct ForwardedOperationContext *fopc; 733 struct ForwardedOperationContext *fopc;
734 734
735 while (NULL != (fopc = fopcq_head)) 735 while (NULL != (fopc = fopcq_head))
736 { 736 {
737 GNUNET_CONTAINER_DLL_remove (fopcq_head, fopcq_tail, fopc); 737 GNUNET_CONTAINER_DLL_remove (fopcq_head, fopcq_tail, fopc);
@@ -747,7 +747,7 @@ GST_clear_fopcq ()
747 case OP_SHUTDOWN_PEERS: 747 case OP_SHUTDOWN_PEERS:
748 { 748 {
749 struct HandlerContext_ShutdownPeers *hc = fopc->cls; 749 struct HandlerContext_ShutdownPeers *hc = fopc->cls;
750 750
751 GNUNET_assert (0 < hc->nslaves); 751 GNUNET_assert (0 < hc->nslaves);
752 hc->nslaves--; 752 hc->nslaves--;
753 if (0 == hc->nslaves) 753 if (0 == hc->nslaves)
@@ -901,9 +901,9 @@ testbed_run (void *cls, struct GNUNET_SERVER_Handle *server,
901 sizeof (struct GNUNET_TESTBED_ShutdownPeersMessage)}, 901 sizeof (struct GNUNET_TESTBED_ShutdownPeersMessage)},
902 {&GST_handle_peer_reconfigure, NULL, 902 {&GST_handle_peer_reconfigure, NULL,
903 GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER, 0}, 903 GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER, 0},
904 {&GST_handle_barrier_init, NULL, 904 {&GST_handle_barrier_init, NULL,
905 GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT, 0}, 905 GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT, 0},
906 {&GST_handle_barrier_cancel, NULL, 906 {&GST_handle_barrier_cancel, NULL,
907 GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL, 0}, 907 GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL, 0},
908 {&GST_handle_barrier_status, NULL, 908 {&GST_handle_barrier_status, NULL,
909 GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS, 0}, 909 GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS, 0},
diff --git a/src/testbed/gnunet-service-testbed_barriers.c b/src/testbed/gnunet-service-testbed_barriers.c
index bffafd7ae..634f0a07a 100644
--- a/src/testbed/gnunet-service-testbed_barriers.c
+++ b/src/testbed/gnunet-service-testbed_barriers.c
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file testbed/gnunet-service-testbed_barriers.c 22 * @file testbed/gnunet-service-testbed_barriers.c
23 * @brief barrier handling at the testbed controller 23 * @brief barrier handling at the testbed controller
24 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 24 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 */ 25 */
26 26
27#include "gnunet-service-testbed.h" 27#include "gnunet-service-testbed.h"
@@ -200,12 +200,12 @@ struct Barrier
200 * Identifier for the timeout task 200 * Identifier for the timeout task
201 */ 201 */
202 GNUNET_SCHEDULER_TaskIdentifier tout_task; 202 GNUNET_SCHEDULER_TaskIdentifier tout_task;
203 203
204 /** 204 /**
205 * The status of this barrier 205 * The status of this barrier
206 */ 206 */
207 enum GNUNET_TESTBED_BarrierStatus status; 207 enum GNUNET_TESTBED_BarrierStatus status;
208 208
209 /** 209 /**
210 * Number of barriers wrapped in the above DLL 210 * Number of barriers wrapped in the above DLL
211 */ 211 */
@@ -235,7 +235,7 @@ struct Barrier
235 * Quorum percentage to be reached 235 * Quorum percentage to be reached
236 */ 236 */
237 uint8_t quorum; 237 uint8_t quorum;
238 238
239}; 239};
240 240
241 241
@@ -261,7 +261,7 @@ static struct GNUNET_SERVICE_Context *ctx;
261 * @param buf where the callee should write the message 261 * @param buf where the callee should write the message
262 * @return number of bytes written to buf 262 * @return number of bytes written to buf
263 */ 263 */
264static size_t 264static size_t
265transmit_ready_cb (void *cls, size_t size, void *buf) 265transmit_ready_cb (void *cls, size_t size, void *buf)
266{ 266{
267 struct ClientCtx *ctx = cls; 267 struct ClientCtx *ctx = cls;
@@ -276,7 +276,7 @@ transmit_ready_cb (void *cls, size_t size, void *buf)
276 { 276 {
277 GNUNET_assert (NULL != ctx->client); 277 GNUNET_assert (NULL != ctx->client);
278 GNUNET_SERVER_client_drop (ctx->client); 278 GNUNET_SERVER_client_drop (ctx->client);
279 ctx->client = NULL; 279 ctx->client = NULL;
280 return 0; 280 return 0;
281 } 281 }
282 mq = ctx->mq_head; 282 mq = ctx->mq_head;
@@ -306,7 +306,7 @@ queue_message (struct ClientCtx *ctx, struct GNUNET_MessageHeader *msg)
306{ 306{
307 struct MessageQueue *mq; 307 struct MessageQueue *mq;
308 struct GNUNET_SERVER_Client *client = ctx->client; 308 struct GNUNET_SERVER_Client *client = ctx->client;
309 309
310 mq = GNUNET_malloc (sizeof (struct MessageQueue)); 310 mq = GNUNET_malloc (sizeof (struct MessageQueue));
311 mq->msg = msg; 311 mq->msg = msg;
312 LOG_DEBUG ("Queueing message of type %u, size %u for sending\n", 312 LOG_DEBUG ("Queueing message of type %u, size %u for sending\n",
@@ -328,12 +328,12 @@ static void
328cleanup_clientctx (struct ClientCtx *ctx) 328cleanup_clientctx (struct ClientCtx *ctx)
329{ 329{
330 struct MessageQueue *mq; 330 struct MessageQueue *mq;
331 331
332 if (NULL != ctx->client) 332 if (NULL != ctx->client)
333 { 333 {
334 GNUNET_SERVER_client_set_user_context_ (ctx->client, NULL, 0); 334 GNUNET_SERVER_client_set_user_context_ (ctx->client, NULL, 0);
335 GNUNET_SERVER_client_drop (ctx->client); 335 GNUNET_SERVER_client_drop (ctx->client);
336 } 336 }
337 if (NULL != ctx->tx) 337 if (NULL != ctx->tx)
338 GNUNET_SERVER_notify_transmit_ready_cancel (ctx->tx); 338 GNUNET_SERVER_notify_transmit_ready_cancel (ctx->tx);
339 if (NULL != (mq = ctx->mq_head)) 339 if (NULL != (mq = ctx->mq_head))
@@ -356,7 +356,7 @@ static void
356remove_barrier (struct Barrier *barrier) 356remove_barrier (struct Barrier *barrier)
357{ 357{
358 struct ClientCtx *ctx; 358 struct ClientCtx *ctx;
359 359
360 GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (barrier_map, 360 GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (barrier_map,
361 &barrier->hash, 361 &barrier->hash,
362 barrier)); 362 barrier));
@@ -397,7 +397,7 @@ cancel_wrappers (struct Barrier *barrier)
397 * @param name the barrier name 397 * @param name the barrier name
398 * @param status the status of the barrier 398 * @param status the status of the barrier
399 * @param emsg the error message; should be non-NULL for 399 * @param emsg the error message; should be non-NULL for
400 * status=GNUNET_TESTBED_BARRIERSTATUS_ERROR 400 * status=GNUNET_TESTBED_BARRIERSTATUS_ERROR
401 */ 401 */
402static void 402static void
403send_client_status_msg (struct GNUNET_SERVER_Client *client, 403send_client_status_msg (struct GNUNET_SERVER_Client *client,
@@ -431,7 +431,7 @@ send_client_status_msg (struct GNUNET_SERVER_Client *client,
431 * 431 *
432 * @param barrier the corresponding barrier 432 * @param barrier the corresponding barrier
433 * @param emsg the error message; should be non-NULL for 433 * @param emsg the error message; should be non-NULL for
434 * status=GNUNET_TESTBED_BARRIERSTATUS_ERROR 434 * status=GNUNET_TESTBED_BARRIERSTATUS_ERROR
435 */ 435 */
436static void 436static void
437send_barrier_status_msg (struct Barrier *barrier, const char *emsg) 437send_barrier_status_msg (struct Barrier *barrier, const char *emsg)
@@ -464,7 +464,7 @@ handle_barrier_wait (void *cls, struct GNUNET_SERVER_Client *client,
464 struct GNUNET_HashCode key; 464 struct GNUNET_HashCode key;
465 size_t name_len; 465 size_t name_len;
466 uint16_t msize; 466 uint16_t msize;
467 467
468 msize = ntohs (message->size); 468 msize = ntohs (message->size);
469 if (msize <= sizeof (struct GNUNET_TESTBED_BarrierWait)) 469 if (msize <= sizeof (struct GNUNET_TESTBED_BarrierWait))
470 { 470 {
@@ -500,7 +500,7 @@ handle_barrier_wait (void *cls, struct GNUNET_SERVER_Client *client,
500 GNUNET_SERVER_client_keep (client); 500 GNUNET_SERVER_client_keep (client);
501 client_ctx->barrier = barrier; 501 client_ctx->barrier = barrier;
502 GNUNET_CONTAINER_DLL_insert_tail (barrier->head, barrier->tail, client_ctx); 502 GNUNET_CONTAINER_DLL_insert_tail (barrier->head, barrier->tail, client_ctx);
503 GNUNET_SERVER_client_set_user_context (client, client_ctx); 503 GNUNET_SERVER_client_set_user_context (client, client_ctx);
504 } 504 }
505 barrier->nreached++; 505 barrier->nreached++;
506 if ((barrier->num_wbarriers_reached == barrier->num_wbarriers) 506 if ((barrier->num_wbarriers_reached == barrier->num_wbarriers)
@@ -525,7 +525,7 @@ static void
525disconnect_cb (void *cls, struct GNUNET_SERVER_Client *client) 525disconnect_cb (void *cls, struct GNUNET_SERVER_Client *client)
526{ 526{
527 struct ClientCtx *client_ctx; 527 struct ClientCtx *client_ctx;
528 528
529 if (NULL == client) 529 if (NULL == client)
530 return; 530 return;
531 client_ctx = GNUNET_SERVER_client_get_user_context (client, struct ClientCtx); 531 client_ctx = GNUNET_SERVER_client_get_user_context (client, struct ClientCtx);
@@ -554,7 +554,7 @@ GST_barriers_init (struct GNUNET_CONFIGURATION_Handle *cfg)
554 GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN); 554 GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN);
555 srv = GNUNET_SERVICE_get_server (ctx); 555 srv = GNUNET_SERVICE_get_server (ctx);
556 GNUNET_SERVER_add_handlers (srv, message_handlers); 556 GNUNET_SERVER_add_handlers (srv, message_handlers);
557 GNUNET_SERVER_disconnect_notify (srv, &disconnect_cb, NULL); 557 GNUNET_SERVER_disconnect_notify (srv, &disconnect_cb, NULL);
558} 558}
559 559
560 560
@@ -568,7 +568,7 @@ GST_barriers_init (struct GNUNET_CONFIGURATION_Handle *cfg)
568 * iterate, 568 * iterate,
569 * #GNUNET_NO if not. 569 * #GNUNET_NO if not.
570 */ 570 */
571static int 571static int
572barrier_destroy_iterator (void *cls, 572barrier_destroy_iterator (void *cls,
573 const struct GNUNET_HashCode *key, 573 const struct GNUNET_HashCode *key,
574 void *value) 574 void *value)
@@ -612,7 +612,7 @@ GST_barriers_destroy ()
612 * @param emsg if the status were to be GNUNET_SYSERR, this parameter has the 612 * @param emsg if the status were to be GNUNET_SYSERR, this parameter has the
613 * error messsage 613 * error messsage
614 */ 614 */
615static void 615static void
616wbarrier_status_cb (void *cls, const char *name, 616wbarrier_status_cb (void *cls, const char *name,
617 struct GNUNET_TESTBED_Barrier *b_, 617 struct GNUNET_TESTBED_Barrier *b_,
618 enum GNUNET_TESTBED_BarrierStatus status, 618 enum GNUNET_TESTBED_BarrierStatus status,
@@ -679,7 +679,7 @@ static void
679fwd_tout_barrier_init (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 679fwd_tout_barrier_init (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
680{ 680{
681 struct Barrier *barrier = cls; 681 struct Barrier *barrier = cls;
682 682
683 cancel_wrappers (barrier); 683 cancel_wrappers (barrier);
684 barrier->status = GNUNET_TESTBED_BARRIERSTATUS_ERROR; 684 barrier->status = GNUNET_TESTBED_BARRIERSTATUS_ERROR;
685 send_barrier_status_msg (barrier, 685 send_barrier_status_msg (barrier,
@@ -713,7 +713,7 @@ GST_handle_barrier_init (void *cls, struct GNUNET_SERVER_Client *client,
713 size_t name_len; 713 size_t name_len;
714 unsigned int cnt; 714 unsigned int cnt;
715 uint16_t msize; 715 uint16_t msize;
716 716
717 if (NULL == GST_context) 717 if (NULL == GST_context)
718 { 718 {
719 GNUNET_break_op (0); 719 GNUNET_break_op (0);
@@ -741,7 +741,7 @@ GST_handle_barrier_init (void *cls, struct GNUNET_SERVER_Client *client,
741 LOG_DEBUG ("Received BARRIER_INIT for barrier `%s'\n", name); 741 LOG_DEBUG ("Received BARRIER_INIT for barrier `%s'\n", name);
742 if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (barrier_map, &hash)) 742 if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (barrier_map, &hash))
743 { 743 {
744 744
745 send_client_status_msg (client, name, GNUNET_TESTBED_BARRIERSTATUS_ERROR, 745 send_client_status_msg (client, name, GNUNET_TESTBED_BARRIERSTATUS_ERROR,
746 "A barrier with the same name already exists"); 746 "A barrier with the same name already exists");
747 GNUNET_free (name); 747 GNUNET_free (name);
@@ -821,7 +821,7 @@ GST_handle_barrier_cancel (void *cls, struct GNUNET_SERVER_Client *client,
821 GNUNET_break_op (0); 821 GNUNET_break_op (0);
822 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 822 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
823 return; 823 return;
824 } 824 }
825 if (client != GST_context->client) 825 if (client != GST_context->client)
826 { 826 {
827 GNUNET_break_op (0); 827 GNUNET_break_op (0);
@@ -850,7 +850,7 @@ GST_handle_barrier_cancel (void *cls, struct GNUNET_SERVER_Client *client,
850 GNUNET_assert (NULL != barrier); 850 GNUNET_assert (NULL != barrier);
851 cancel_wrappers (barrier); 851 cancel_wrappers (barrier);
852 remove_barrier (barrier); 852 remove_barrier (barrier);
853 GNUNET_SERVER_receive_done (client, GNUNET_OK); 853 GNUNET_SERVER_receive_done (client, GNUNET_OK);
854} 854}
855 855
856 856
@@ -868,20 +868,20 @@ GST_handle_barrier_status (void *cls, struct GNUNET_SERVER_Client *client,
868 const struct GNUNET_MessageHeader *message) 868 const struct GNUNET_MessageHeader *message)
869{ 869{
870 const struct GNUNET_TESTBED_BarrierStatusMsg *msg; 870 const struct GNUNET_TESTBED_BarrierStatusMsg *msg;
871 struct Barrier *barrier; 871 struct Barrier *barrier;
872 struct ClientCtx *client_ctx; 872 struct ClientCtx *client_ctx;
873 const char *name; 873 const char *name;
874 struct GNUNET_HashCode key; 874 struct GNUNET_HashCode key;
875 enum GNUNET_TESTBED_BarrierStatus status; 875 enum GNUNET_TESTBED_BarrierStatus status;
876 uint16_t msize; 876 uint16_t msize;
877 uint16_t name_len; 877 uint16_t name_len;
878 878
879 if (NULL == GST_context) 879 if (NULL == GST_context)
880 { 880 {
881 GNUNET_break_op (0); 881 GNUNET_break_op (0);
882 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 882 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
883 return; 883 return;
884 } 884 }
885 if (client != GST_context->client) 885 if (client != GST_context->client)
886 { 886 {
887 GNUNET_break_op (0); 887 GNUNET_break_op (0);
diff --git a/src/testbed/gnunet-service-testbed_barriers.h b/src/testbed/gnunet-service-testbed_barriers.h
index a96812086..2d6cfd4df 100644
--- a/src/testbed/gnunet-service-testbed_barriers.h
+++ b/src/testbed/gnunet-service-testbed_barriers.h
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file testbed/gnunet-service-testbed_barriers.h 22 * @file testbed/gnunet-service-testbed_barriers.h
23 * @brief Interface for the barrier initialisation handler routine 23 * @brief Interface for the barrier initialisation handler routine
24 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 24 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 */ 25 */
26 26
27#ifndef GNUNET_SERVER_TESTBED_BARRIERS_H_ 27#ifndef GNUNET_SERVER_TESTBED_BARRIERS_H_
diff --git a/src/testbed/gnunet-service-testbed_cache.c b/src/testbed/gnunet-service-testbed_cache.c
index 6a141a252..9db2155fc 100644
--- a/src/testbed/gnunet-service-testbed_cache.c
+++ b/src/testbed/gnunet-service-testbed_cache.c
@@ -352,7 +352,7 @@ close_handles (struct CacheEntry *entry)
352 if (NULL != entry->transport_op) 352 if (NULL != entry->transport_op)
353 { 353 {
354 GNUNET_TESTBED_operation_done (entry->transport_op); 354 GNUNET_TESTBED_operation_done (entry->transport_op);
355 entry->transport_op = NULL; 355 entry->transport_op = NULL;
356 } 356 }
357 if (NULL != entry->core_op) 357 if (NULL != entry->core_op)
358 { 358 {
@@ -610,7 +610,7 @@ oprelease_get_handle_transport (void *cls)
610 * @param my_identity ID of this peer, NULL if we failed 610 * @param my_identity ID of this peer, NULL if we failed
611 */ 611 */
612static void 612static void
613core_startup_cb (void *cls, 613core_startup_cb (void *cls,
614 const struct GNUNET_PeerIdentity *my_identity) 614 const struct GNUNET_PeerIdentity *my_identity)
615{ 615{
616 struct CacheEntry *entry = cls; 616 struct CacheEntry *entry = cls;
@@ -836,7 +836,7 @@ cache_clear_iterator (void *cls, const struct GNUNET_HashCode *key, void *value)
836 GNUNET_assert (NULL != entry); 836 GNUNET_assert (NULL != entry);
837 GNUNET_break (0 == entry->demand); 837 GNUNET_break (0 == entry->demand);
838 LOG_DEBUG ("Clearing entry %u of %u\n", ++ncleared, cache_size); 838 LOG_DEBUG ("Clearing entry %u of %u\n", ++ncleared, cache_size);
839 GNUNET_assert (GNUNET_YES == 839 GNUNET_assert (GNUNET_YES ==
840 GNUNET_CONTAINER_multihashmap_remove (cache, key, value)); 840 GNUNET_CONTAINER_multihashmap_remove (cache, key, value));
841 close_handles (entry); 841 close_handles (entry);
842 GNUNET_free_non_null (entry->hello); 842 GNUNET_free_non_null (entry->hello);
diff --git a/src/testbed/gnunet-service-testbed_connectionpool.c b/src/testbed/gnunet-service-testbed_connectionpool.c
index 80d020111..f4eb73778 100644
--- a/src/testbed/gnunet-service-testbed_connectionpool.c
+++ b/src/testbed/gnunet-service-testbed_connectionpool.c
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file testbed/gnunet-service-testbed_connectionpool.c 22 * @file testbed/gnunet-service-testbed_connectionpool.c
23 * @brief connection pooling for connections to peers' services 23 * @brief connection pooling for connections to peers' services
24 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 24 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 */ 25 */
26 26
27#include "gnunet-service-testbed.h" 27#include "gnunet-service-testbed.h"
@@ -268,7 +268,7 @@ destroy_pooled_connection (struct PooledConnection *entry)
268 if (entry->in_lru) 268 if (entry->in_lru)
269 GNUNET_CONTAINER_DLL_remove (head_lru, tail_lru, entry); 269 GNUNET_CONTAINER_DLL_remove (head_lru, tail_lru, entry);
270 if (entry->in_pool) 270 if (entry->in_pool)
271 GNUNET_assert (GNUNET_OK == 271 GNUNET_assert (GNUNET_OK ==
272 GNUNET_CONTAINER_multihashmap32_remove (map, 272 GNUNET_CONTAINER_multihashmap32_remove (map,
273 entry->index, 273 entry->index,
274 entry)); 274 entry));
@@ -466,7 +466,7 @@ transport_peer_connect_notify_cb (void *cls,
466 const struct GNUNET_PeerIdentity *peer) 466 const struct GNUNET_PeerIdentity *peer)
467{ 467{
468 struct PooledConnection *entry = cls; 468 struct PooledConnection *entry = cls;
469 469
470 peer_connect_notify_cb (entry, peer, GST_CONNECTIONPOOL_SERVICE_TRANSPORT); 470 peer_connect_notify_cb (entry, peer, GST_CONNECTIONPOOL_SERVICE_TRANSPORT);
471} 471}
472 472
@@ -532,7 +532,7 @@ static void
532core_peer_connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer) 532core_peer_connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer)
533{ 533{
534 struct PooledConnection *entry = cls; 534 struct PooledConnection *entry = cls;
535 535
536 peer_connect_notify_cb (entry, peer, GST_CONNECTIONPOOL_SERVICE_CORE); 536 peer_connect_notify_cb (entry, peer, GST_CONNECTIONPOOL_SERVICE_CORE);
537} 537}
538 538
@@ -550,7 +550,7 @@ core_peer_connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer)
550 * @param my_identity ID of this peer, NULL if we failed 550 * @param my_identity ID of this peer, NULL if we failed
551 */ 551 */
552static void 552static void
553core_startup_cb (void *cls, 553core_startup_cb (void *cls,
554 const struct GNUNET_PeerIdentity *my_identity) 554 const struct GNUNET_PeerIdentity *my_identity)
555{ 555{
556 struct PooledConnection *entry = cls; 556 struct PooledConnection *entry = cls;
@@ -642,9 +642,9 @@ cleanup_iterator (void *cls,
642 void *value) 642 void *value)
643{ 643{
644 struct PooledConnection *entry = value; 644 struct PooledConnection *entry = value;
645 645
646 GNUNET_assert (NULL != entry); 646 GNUNET_assert (NULL != entry);
647 GNUNET_assert (GNUNET_OK == 647 GNUNET_assert (GNUNET_OK ==
648 GNUNET_CONTAINER_multihashmap32_remove (map, key, entry)); 648 GNUNET_CONTAINER_multihashmap32_remove (map, key, entry));
649 if (entry->in_lru) 649 if (entry->in_lru)
650 GNUNET_CONTAINER_DLL_remove (head_lru, tail_lru, entry); 650 GNUNET_CONTAINER_DLL_remove (head_lru, tail_lru, entry);
@@ -678,7 +678,7 @@ void
678GST_connection_pool_destroy () 678GST_connection_pool_destroy ()
679{ 679{
680 struct PooledConnection *entry; 680 struct PooledConnection *entry;
681 681
682 if (NULL != map) 682 if (NULL != map)
683 { 683 {
684 GNUNET_assert (GNUNET_SYSERR != 684 GNUNET_assert (GNUNET_SYSERR !=
@@ -776,7 +776,7 @@ GST_connection_pool_get_handle (unsigned int peer_id,
776 { 776 {
777 entry = GNUNET_new (struct PooledConnection); 777 entry = GNUNET_new (struct PooledConnection);
778 entry->index = peer_id32; 778 entry->index = peer_id32;
779 if ((NULL != map) 779 if ((NULL != map)
780 && (GNUNET_CONTAINER_multihashmap32_size (map) < max_size)) 780 && (GNUNET_CONTAINER_multihashmap32_size (map) < max_size))
781 { 781 {
782 GNUNET_assert (GNUNET_OK == 782 GNUNET_assert (GNUNET_OK ==
@@ -859,7 +859,7 @@ GST_connection_pool_get_handle_done (struct GST_ConnectionPool_GetHandle *gh)
859 GNUNET_CONTAINER_DLL_remove (entry->head_notify, entry->head_notify, gh); 859 GNUNET_CONTAINER_DLL_remove (entry->head_notify, entry->head_notify, gh);
860 GNUNET_free (gh); 860 GNUNET_free (gh);
861 gh = NULL; 861 gh = NULL;
862 GNUNET_assert (!entry->in_lru); 862 GNUNET_assert (!entry->in_lru);
863 if ( (!entry->in_pool) && (NULL != map) ) 863 if ( (!entry->in_pool) && (NULL != map) )
864 { 864 {
865 if (GNUNET_YES == GNUNET_CONTAINER_multihashmap32_contains (map, 865 if (GNUNET_YES == GNUNET_CONTAINER_multihashmap32_contains (map,
@@ -871,8 +871,8 @@ GST_connection_pool_get_handle_done (struct GST_ConnectionPool_GetHandle *gh)
871 destroy_pooled_connection (head_lru); 871 destroy_pooled_connection (head_lru);
872 GNUNET_CONTAINER_DLL_remove (head_not_pooled, tail_not_pooled, entry); 872 GNUNET_CONTAINER_DLL_remove (head_not_pooled, tail_not_pooled, entry);
873 GNUNET_assert (GNUNET_OK == 873 GNUNET_assert (GNUNET_OK ==
874 GNUNET_CONTAINER_multihashmap32_put (map, 874 GNUNET_CONTAINER_multihashmap32_put (map,
875 entry->index, 875 entry->index,
876 entry, 876 entry,
877 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 877 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
878 entry->in_pool = GNUNET_YES; 878 entry->in_pool = GNUNET_YES;
diff --git a/src/testbed/gnunet-service-testbed_connectionpool.h b/src/testbed/gnunet-service-testbed_connectionpool.h
index c055b32ac..e2f25cce8 100644
--- a/src/testbed/gnunet-service-testbed_connectionpool.h
+++ b/src/testbed/gnunet-service-testbed_connectionpool.h
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file testbed/gnunet-service-testbed_connectionpool.h 22 * @file testbed/gnunet-service-testbed_connectionpool.h
23 * @brief Interface for connection pooling subroutines 23 * @brief Interface for connection pooling subroutines
24 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 24 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 */ 25 */
26 26
27 27
@@ -78,7 +78,7 @@ GST_connection_pool_destroy ();
78 * @param peer_id the identity of the peer. Will be NULL if ch is NULL. In other 78 * @param peer_id the identity of the peer. Will be NULL if ch is NULL. In other
79 * cases, its value being NULL means that CORE connection has failed. 79 * cases, its value being NULL means that CORE connection has failed.
80 */ 80 */
81typedef void 81typedef void
82(*GST_connection_pool_connection_ready_cb) (void *cls, 82(*GST_connection_pool_connection_ready_cb) (void *cls,
83 struct GNUNET_CORE_Handle * ch, 83 struct GNUNET_CORE_Handle * ch,
84 struct GNUNET_TRANSPORT_Handle * th, 84 struct GNUNET_TRANSPORT_Handle * th,
diff --git a/src/testbed/gnunet-service-testbed_cpustatus.c b/src/testbed/gnunet-service-testbed_cpustatus.c
index 129088c40..4071c7172 100644
--- a/src/testbed/gnunet-service-testbed_cpustatus.c
+++ b/src/testbed/gnunet-service-testbed_cpustatus.c
@@ -318,7 +318,7 @@ updateUsage ()
318 kc = kstat_open (); 318 kc = kstat_open ();
319 if (kc == NULL) 319 if (kc == NULL)
320 { 320 {
321 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kstat_close"); 321 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kstat_close");
322 goto ABORT_KSTAT; 322 goto ABORT_KSTAT;
323 } 323 }
324 324
@@ -633,7 +633,7 @@ get_nproc ()
633 nproc = 0; 633 nproc = 0;
634 while (NULL != (ent = readdir (dir))) 634 while (NULL != (ent = readdir (dir)))
635 { 635 {
636 if((*ent->d_name > '0') && (*ent->d_name <= '9')) 636 if((*ent->d_name > '0') && (*ent->d_name <= '9'))
637 nproc++; 637 nproc++;
638 } 638 }
639 closedir (dir); 639 closedir (dir);
@@ -669,14 +669,14 @@ sample_load_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
669 now = GNUNET_TIME_absolute_get (); 669 now = GNUNET_TIME_absolute_get ();
670 nbs = GNUNET_asprintf (&str, "%llu %d %d %u %u\n", now.abs_value_us / 1000LL / 1000LL, 670 nbs = GNUNET_asprintf (&str, "%llu %d %d %u %u\n", now.abs_value_us / 1000LL / 1000LL,
671 ld_cpu, ld_disk, mem_usage, nproc); 671 ld_cpu, ld_disk, mem_usage, nproc);
672 if (0 < nbs) 672 if (0 < nbs)
673 { 673 {
674 GNUNET_BIO_write (bw, str, nbs); 674 GNUNET_BIO_write (bw, str, nbs);
675 } 675 }
676 else 676 else
677 GNUNET_break (0); 677 GNUNET_break (0);
678 GNUNET_free (str); 678 GNUNET_free (str);
679 679
680 reschedule: 680 reschedule:
681 sample_load_task_id = 681 sample_load_task_id =
682 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 682 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
@@ -696,7 +696,7 @@ GST_stats_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
696 char *stats_dir; 696 char *stats_dir;
697 char *fn; 697 char *fn;
698 size_t len; 698 size_t len;
699 699
700#if MINGW 700#if MINGW
701 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 701 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
702 "Load statistics logging now available for windows\n"); 702 "Load statistics logging now available for windows\n");
@@ -716,7 +716,7 @@ GST_stats_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
716 GNUNET_free (hostname); 716 GNUNET_free (hostname);
717 return; 717 return;
718 } 718 }
719 fn = NULL; 719 fn = NULL;
720 (void) GNUNET_asprintf (&fn, "%s/%.*s-%jd.dat", stats_dir, len, 720 (void) GNUNET_asprintf (&fn, "%s/%.*s-%jd.dat", stats_dir, len,
721 hostname, (intmax_t) getpid()); 721 hostname, (intmax_t) getpid());
722 GNUNET_free (stats_dir); 722 GNUNET_free (stats_dir);
@@ -740,7 +740,7 @@ GST_stats_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
740 initMachCpuStats (); 740 initMachCpuStats ();
741#endif 741#endif
742 updateUsage (); /* initialize */ 742 updateUsage (); /* initialize */
743 743
744} 744}
745 745
746 746
diff --git a/src/testbed/gnunet-service-testbed_links.c b/src/testbed/gnunet-service-testbed_links.c
index 85a4538ef..79166d438 100644
--- a/src/testbed/gnunet-service-testbed_links.c
+++ b/src/testbed/gnunet-service-testbed_links.c
@@ -98,7 +98,7 @@ struct LCFContext
98 * The id of the operation which created this context 98 * The id of the operation which created this context
99 */ 99 */
100 uint64_t operation_id; 100 uint64_t operation_id;
101 101
102 /** 102 /**
103 * should the slave controller start the delegated controller? 103 * should the slave controller start the delegated controller?
104 */ 104 */
@@ -186,7 +186,7 @@ struct Neighbour
186 * The controller handle 186 * The controller handle
187 */ 187 */
188 struct GNUNET_TESTBED_Controller *controller; 188 struct GNUNET_TESTBED_Controller *controller;
189 189
190 /** 190 /**
191 * Operation handle for opening a lateral connection to another controller. 191 * Operation handle for opening a lateral connection to another controller.
192 * Will be NULL if the slave controller is started by this controller 192 * Will be NULL if the slave controller is started by this controller
@@ -217,11 +217,11 @@ struct Neighbour
217 * Is the conn_op inactivated? 217 * Is the conn_op inactivated?
218 */ 218 */
219 unsigned int inactive; 219 unsigned int inactive;
220 220
221 /** 221 /**
222 * The id of the host this controller is running on 222 * The id of the host this controller is running on
223 */ 223 */
224 uint32_t host_id; 224 uint32_t host_id;
225}; 225};
226 226
227 227
@@ -256,7 +256,7 @@ struct NeighbourConnectCtxt
256 * The neighbour to whom connection should be made 256 * The neighbour to whom connection should be made
257 */ 257 */
258 struct Neighbour *n; 258 struct Neighbour *n;
259 259
260 /** 260 /**
261 * The client requesting the connection 261 * The client requesting the connection
262 */ 262 */
@@ -379,7 +379,7 @@ void
379GST_route_list_clear () 379GST_route_list_clear ()
380{ 380{
381 unsigned int id; 381 unsigned int id;
382 382
383 for (id = 0; id < route_list_size; id++) 383 for (id = 0; id < route_list_size; id++)
384 if (NULL != route_list[id]) 384 if (NULL != route_list[id])
385 GNUNET_free (route_list[id]); 385 GNUNET_free (route_list[id]);
@@ -437,7 +437,7 @@ kill_slave (struct Slave *slave)
437 } 437 }
438 if (NULL != slave->rhandle) 438 if (NULL != slave->rhandle)
439 GNUNET_TESTBED_cancel_registration (slave->rhandle); 439 GNUNET_TESTBED_cancel_registration (slave->rhandle);
440 GNUNET_assert (GNUNET_SYSERR != 440 GNUNET_assert (GNUNET_SYSERR !=
441 GNUNET_CONTAINER_multihashmap_iterate (slave->reghost_map, 441 GNUNET_CONTAINER_multihashmap_iterate (slave->reghost_map,
442 reghost_free_iterator, 442 reghost_free_iterator,
443 slave)); 443 slave));
@@ -545,7 +545,7 @@ send_controller_link_response (struct GNUNET_SERVER_Client *client,
545 struct GNUNET_TESTBED_ControllerLinkResponse *msg; 545 struct GNUNET_TESTBED_ControllerLinkResponse *msg;
546 char *xconfig; 546 char *xconfig;
547 size_t config_size; 547 size_t config_size;
548 size_t xconfig_size; 548 size_t xconfig_size;
549 uint16_t msize; 549 uint16_t msize;
550 550
551 GNUNET_assert ((NULL == cfg) || (NULL == emsg)); 551 GNUNET_assert ((NULL == cfg) || (NULL == emsg));
@@ -757,7 +757,7 @@ slave_event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
757 GNUNET_SCHEDULER_cancel (lcf->timeout_task); 757 GNUNET_SCHEDULER_cancel (lcf->timeout_task);
758 if (NULL == event->details.operation_finished.emsg) 758 if (NULL == event->details.operation_finished.emsg)
759 send_controller_link_response (lcf->client, lcf->operation_id, 759 send_controller_link_response (lcf->client, lcf->operation_id,
760 GNUNET_TESTBED_host_get_cfg_ 760 GNUNET_TESTBED_host_get_cfg_
761 (GST_host_list[lcf->delegated_host_id]), 761 (GST_host_list[lcf->delegated_host_id]),
762 NULL); 762 NULL);
763 else 763 else
@@ -855,17 +855,17 @@ trigger_notifications (struct Neighbour *n);
855 * @param tc scheduler task context 855 * @param tc scheduler task context
856 */ 856 */
857static void 857static void
858neighbour_connect_notify_task (void *cls, 858neighbour_connect_notify_task (void *cls,
859 const struct GNUNET_SCHEDULER_TaskContext *tc) 859 const struct GNUNET_SCHEDULER_TaskContext *tc)
860{ 860{
861 struct Neighbour *n = cls; 861 struct Neighbour *n = cls;
862 struct NeighbourConnectNotification *h; 862 struct NeighbourConnectNotification *h;
863 863
864 GNUNET_assert (NULL != (h = n->nl_head)); 864 GNUNET_assert (NULL != (h = n->nl_head));
865 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != n->notify_task); 865 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != n->notify_task);
866 n->notify_task = GNUNET_SCHEDULER_NO_TASK; 866 n->notify_task = GNUNET_SCHEDULER_NO_TASK;
867 GNUNET_assert (NULL != n->controller); 867 GNUNET_assert (NULL != n->controller);
868 GNUNET_CONTAINER_DLL_remove (n->nl_head, n->nl_tail, h); 868 GNUNET_CONTAINER_DLL_remove (n->nl_head, n->nl_tail, h);
869 trigger_notifications (n); 869 trigger_notifications (n);
870 h->cb (h->cb_cls, n->controller); 870 h->cb (h->cb_cls, n->controller);
871 GNUNET_free (h); 871 GNUNET_free (h);
@@ -889,7 +889,7 @@ trigger_notifications (struct Neighbour *n)
889 if (NULL == n->controller) 889 if (NULL == n->controller)
890 return; 890 return;
891 if (GNUNET_SCHEDULER_NO_TASK != n->notify_task) 891 if (GNUNET_SCHEDULER_NO_TASK != n->notify_task)
892 return; 892 return;
893 if (1 == n->inactive) 893 if (1 == n->inactive)
894 { 894 {
895 GNUNET_assert (0 == n->reference_cnt); 895 GNUNET_assert (0 == n->reference_cnt);
@@ -897,7 +897,7 @@ trigger_notifications (struct Neighbour *n)
897 n->inactive = 0; 897 n->inactive = 0;
898 } 898 }
899 n->reference_cnt++; 899 n->reference_cnt++;
900 n->notify_task = 900 n->notify_task =
901 GNUNET_SCHEDULER_add_now (&neighbour_connect_notify_task, n); 901 GNUNET_SCHEDULER_add_now (&neighbour_connect_notify_task, n);
902} 902}
903 903
@@ -913,7 +913,7 @@ static void
913opstart_neighbour_conn (void *cls) 913opstart_neighbour_conn (void *cls)
914{ 914{
915 struct Neighbour *n = cls; 915 struct Neighbour *n = cls;
916 916
917 GNUNET_assert (NULL != n->conn_op); 917 GNUNET_assert (NULL != n->conn_op);
918 GNUNET_assert (NULL == n->controller); 918 GNUNET_assert (NULL == n->controller);
919 LOG_DEBUG ("Opening connection to controller on host %u\n", n->host_id); 919 LOG_DEBUG ("Opening connection to controller on host %u\n", n->host_id);
@@ -999,7 +999,7 @@ GST_neighbour_get_connection_cancel (struct NeighbourConnectNotification *h)
999{ 999{
1000 struct Neighbour *n; 1000 struct Neighbour *n;
1001 int cleanup_task; 1001 int cleanup_task;
1002 1002
1003 n = h->n; 1003 n = h->n;
1004 cleanup_task = (h == n->nl_head) ? GNUNET_YES : GNUNET_NO; 1004 cleanup_task = (h == n->nl_head) ? GNUNET_YES : GNUNET_NO;
1005 GNUNET_CONTAINER_DLL_remove (n->nl_head, n->nl_tail, h); 1005 GNUNET_CONTAINER_DLL_remove (n->nl_head, n->nl_tail, h);
@@ -1121,7 +1121,7 @@ GST_free_nccq ()
1121 * @param tc the scheduler task context 1121 * @param tc the scheduler task context
1122 */ 1122 */
1123static void 1123static void
1124timeout_neighbour_connect (void *cls, 1124timeout_neighbour_connect (void *cls,
1125 const struct GNUNET_SCHEDULER_TaskContext *tc) 1125 const struct GNUNET_SCHEDULER_TaskContext *tc)
1126{ 1126{
1127 struct NeighbourConnectCtxt *ncc = cls; 1127 struct NeighbourConnectCtxt *ncc = cls;
@@ -1233,7 +1233,7 @@ GST_handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
1233 struct Slave *slave; 1233 struct Slave *slave;
1234 struct LinkControllersContext *lcc; 1234 struct LinkControllersContext *lcc;
1235 1235
1236 1236
1237 if (1 != msg->is_subordinate) 1237 if (1 != msg->is_subordinate)
1238 { 1238 {
1239 struct Neighbour *n; 1239 struct Neighbour *n;
@@ -1253,12 +1253,12 @@ GST_handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
1253 ncc->n = n; 1253 ncc->n = n;
1254 ncc->op_id = op_id; 1254 ncc->op_id = op_id;
1255 ncc->client = client; 1255 ncc->client = client;
1256 GNUNET_SERVER_client_keep (client); 1256 GNUNET_SERVER_client_keep (client);
1257 ncc->nh = GST_neighbour_get_connection (n, neighbour_connect_cb, ncc); 1257 ncc->nh = GST_neighbour_get_connection (n, neighbour_connect_cb, ncc);
1258 ncc->timeout_task = GNUNET_SCHEDULER_add_delayed (GST_timeout, 1258 ncc->timeout_task = GNUNET_SCHEDULER_add_delayed (GST_timeout,
1259 &timeout_neighbour_connect, 1259 &timeout_neighbour_connect,
1260 ncc); 1260 ncc);
1261 GNUNET_CONTAINER_DLL_insert_tail (ncc_head, ncc_tail, ncc); 1261 GNUNET_CONTAINER_DLL_insert_tail (ncc_head, ncc_tail, ncc);
1262 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1262 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1263 return; 1263 return;
1264 } 1264 }
@@ -1351,7 +1351,7 @@ GST_free_lcfq ()
1351{ 1351{
1352 struct LCFContextQueue *lcfq; 1352 struct LCFContextQueue *lcfq;
1353 struct LCFContext *lcf; 1353 struct LCFContext *lcf;
1354 1354
1355 if (NULL != lcfq_head) 1355 if (NULL != lcfq_head)
1356 { 1356 {
1357 if (GNUNET_SCHEDULER_NO_TASK != lcf_proc_task_id) 1357 if (GNUNET_SCHEDULER_NO_TASK != lcf_proc_task_id)
diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c
index b98f319a2..55f18d251 100644
--- a/src/testbed/gnunet-service-testbed_oc.c
+++ b/src/testbed/gnunet-service-testbed_oc.c
@@ -89,7 +89,7 @@ enum OverlayConnectContextType
89 * has to be made between local peers 89 * has to be made between local peers
90 */ 90 */
91 OCC_TYPE_LOCAL, 91 OCC_TYPE_LOCAL,
92 92
93 /** 93 /**
94 * Type to be used when the first peer is local and the other peer is on a slave 94 * Type to be used when the first peer is local and the other peer is on a slave
95 * controller started by us 95 * controller started by us
@@ -109,7 +109,7 @@ enum OverlayConnectContextType
109 * contexts 109 * contexts
110 */ 110 */
111struct LocalPeer2Context 111struct LocalPeer2Context
112{ 112{
113 /** 113 /**
114 * The handle for offering the HELLO of the first peer to the second 114 * The handle for offering the HELLO of the first peer to the second
115 * peer. 115 * peer.
@@ -128,20 +128,20 @@ struct LocalPeer2Context
128 * contexts 128 * contexts
129 */ 129 */
130struct RemotePeer2Context 130struct RemotePeer2Context
131{ 131{
132 /** 132 /**
133 * Controller of peer 2; If OCC_TYPE_REMOTE_LATERAL is the type of overlay 133 * Controller of peer 2; If OCC_TYPE_REMOTE_LATERAL is the type of overlay
134 * connection then this can be NULL until the connection to the controller is 134 * connection then this can be NULL until the connection to the controller is
135 * established 135 * established
136 */ 136 */
137 struct GNUNET_TESTBED_Controller *p2c; 137 struct GNUNET_TESTBED_Controller *p2c;
138 138
139 /** 139 /**
140 * Operation context for the suboperation we start to get the identity of the 140 * Operation context for the suboperation we start to get the identity of the
141 * second peer 141 * second peer
142 */ 142 */
143 struct OperationContext *opc; 143 struct OperationContext *opc;
144 144
145 /** 145 /**
146 * Notification handle acquire to connect to a remote controller. Only used 146 * Notification handle acquire to connect to a remote controller. Only used
147 * if the type of overlay connection is OCC_TYPE_REMOTE_LATERAL. 147 * if the type of overlay connection is OCC_TYPE_REMOTE_LATERAL.
@@ -152,7 +152,7 @@ struct RemotePeer2Context
152 * The neighbour handle. Only used if the type of overlay connection is 152 * The neighbour handle. Only used if the type of overlay connection is
153 * OCC_TYPE_REMOTE_LATERAL. 153 * OCC_TYPE_REMOTE_LATERAL.
154 */ 154 */
155 struct Neighbour *p2n; 155 struct Neighbour *p2n;
156}; 156};
157 157
158/** 158/**
@@ -364,7 +364,7 @@ static struct RemoteOverlayConnectCtx *roccq_tail;
364void 364void
365GST_cleanup_focc (struct ForwardedOverlayConnectContext *focc) 365GST_cleanup_focc (struct ForwardedOverlayConnectContext *focc)
366{ 366{
367 GNUNET_SERVER_client_drop (focc->client); 367 GNUNET_SERVER_client_drop (focc->client);
368 GNUNET_free_non_null (focc->orig_msg); 368 GNUNET_free_non_null (focc->orig_msg);
369 GNUNET_free (focc); 369 GNUNET_free (focc);
370} 370}
@@ -535,7 +535,7 @@ cleanup_occ (struct OverlayConnectContext *occ)
535 if (NULL != occ->cgh_p1th) 535 if (NULL != occ->cgh_p1th)
536 GST_cache_get_handle_done (occ->cgh_p1th); 536 GST_cache_get_handle_done (occ->cgh_p1th);
537 GNUNET_assert (NULL != GST_peer_list); 537 GNUNET_assert (NULL != GST_peer_list);
538 GNUNET_assert (occ->peer->reference_cnt > 0); 538 GNUNET_assert (occ->peer->reference_cnt > 0);
539 occ->peer->reference_cnt--; 539 occ->peer->reference_cnt--;
540 if (PEER_EXPIRED (occ->peer)) 540 if (PEER_EXPIRED (occ->peer))
541 GST_destroy_peer (occ->peer); 541 GST_destroy_peer (occ->peer);
@@ -776,7 +776,7 @@ occ_hello_sent_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
776 GNUNET_free_non_null (occ->emsg); 776 GNUNET_free_non_null (occ->emsg);
777 GNUNET_asprintf (&occ->emsg, 777 GNUNET_asprintf (&occ->emsg,
778 "0x%llx: Timeout during TRANSPORT_try_connect() " 778 "0x%llx: Timeout during TRANSPORT_try_connect() "
779 "at peer %4s", occ->op_id, 779 "at peer %4s", occ->op_id,
780 GNUNET_i2s(&occ->other_peer_identity)); 780 GNUNET_i2s(&occ->other_peer_identity));
781 lp2c->tcc.pid = &occ->peer_identity; 781 lp2c->tcc.pid = &occ->peer_identity;
782 lp2c->tcc.op_id = occ->op_id; 782 lp2c->tcc.op_id = occ->op_id;
@@ -798,10 +798,10 @@ send_hello_thru_rocc (struct OverlayConnectContext *occ)
798 char *other_peer_str; 798 char *other_peer_str;
799 uint16_t msize; 799 uint16_t msize;
800 uint16_t hello_size; 800 uint16_t hello_size;
801 801
802 GNUNET_assert (OCC_TYPE_LOCAL != occ->type); 802 GNUNET_assert (OCC_TYPE_LOCAL != occ->type);
803 GNUNET_assert (NULL != occ->hello); 803 GNUNET_assert (NULL != occ->hello);
804 other_peer_str = GNUNET_strdup (GNUNET_i2s (&occ->other_peer_identity)); 804 other_peer_str = GNUNET_strdup (GNUNET_i2s (&occ->other_peer_identity));
805 LOG_DEBUG ("0x%llx: Offering HELLO of %s (size: %u) to %s via Remote " 805 LOG_DEBUG ("0x%llx: Offering HELLO of %s (size: %u) to %s via Remote "
806 "Overlay Request\n", occ->op_id, 806 "Overlay Request\n", occ->op_id,
807 GNUNET_i2s (&occ->peer_identity), ntohs (occ->hello->size), 807 GNUNET_i2s (&occ->peer_identity), ntohs (occ->hello->size),
@@ -848,7 +848,7 @@ send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
848 return; 848 return;
849 } 849 }
850 lp2c = &occ->p2ctx.local; 850 lp2c = &occ->p2ctx.local;
851 other_peer_str = GNUNET_strdup (GNUNET_i2s (&occ->other_peer_identity)); 851 other_peer_str = GNUNET_strdup (GNUNET_i2s (&occ->other_peer_identity));
852 LOG_DEBUG ("0x%llx: Offering HELLO of %s to %s\n", occ->op_id, 852 LOG_DEBUG ("0x%llx: Offering HELLO of %s to %s\n", occ->op_id,
853 GNUNET_i2s (&occ->peer_identity), other_peer_str); 853 GNUNET_i2s (&occ->peer_identity), other_peer_str);
854 GNUNET_free (other_peer_str); 854 GNUNET_free (other_peer_str);
@@ -919,7 +919,7 @@ p2_transport_connect (struct OverlayConnectContext *occ)
919 GNUNET_assert (NULL == occ->cgh_p1th); 919 GNUNET_assert (NULL == occ->cgh_p1th);
920 if (OCC_TYPE_LOCAL == occ->type) 920 if (OCC_TYPE_LOCAL == occ->type)
921 { 921 {
922 GNUNET_assert (NULL != (peer2 = GST_peer_list[occ->other_peer_id])); 922 GNUNET_assert (NULL != (peer2 = GST_peer_list[occ->other_peer_id]));
923 occ->p2ctx.local.tcc.cgh_th = 923 occ->p2ctx.local.tcc.cgh_th =
924 GST_cache_get_handle_transport (occ->other_peer_id, 924 GST_cache_get_handle_transport (occ->other_peer_id,
925 peer2->details.local.cfg, 925 peer2->details.local.cfg,
@@ -1145,7 +1145,7 @@ static void
1145host_registration_comp (void *cls, const char *emsg) 1145host_registration_comp (void *cls, const char *emsg)
1146{ 1146{
1147 struct RegisteredHostContext *rhc = cls; 1147 struct RegisteredHostContext *rhc = cls;
1148 1148
1149 rhc->state = RHC_DONE; 1149 rhc->state = RHC_DONE;
1150 GST_process_next_focc (rhc); 1150 GST_process_next_focc (rhc);
1151} 1151}
@@ -1217,7 +1217,7 @@ register_host (struct Slave *slave, struct GNUNET_TESTBED_Host *host)
1217{ 1217{
1218 struct GNUNET_HashCode hash; 1218 struct GNUNET_HashCode hash;
1219 struct RegisteredHostContext *rhc; 1219 struct RegisteredHostContext *rhc;
1220 1220
1221 rhc = GNUNET_malloc (sizeof (struct RegisteredHostContext)); 1221 rhc = GNUNET_malloc (sizeof (struct RegisteredHostContext));
1222 rhc->reg_host = host; 1222 rhc->reg_host = host;
1223 rhc->host = GST_host_list[slave->host_id]; 1223 rhc->host = GST_host_list[slave->host_id];
@@ -1290,7 +1290,7 @@ forward_overlay_connect (const struct GNUNET_TESTBED_OverlayConnectMessage *msg,
1290 route_to_peer1_host = GST_find_dest_route 1290 route_to_peer1_host = GST_find_dest_route
1291 (peer->details.remote.remote_host_id); 1291 (peer->details.remote.remote_host_id);
1292 GNUNET_assert (NULL != route_to_peer1_host); 1292 GNUNET_assert (NULL != route_to_peer1_host);
1293 if ((NULL != route_to_peer2_host) && 1293 if ((NULL != route_to_peer2_host) &&
1294 (route_to_peer1_host->dest == route_to_peer2_host->dest)) 1294 (route_to_peer1_host->dest == route_to_peer2_host->dest))
1295 goto forward; 1295 goto forward;
1296 /* Peer2 is either with us OR peer1 and peer2 can be reached through 1296 /* Peer2 is either with us OR peer1 and peer2 can be reached through
@@ -1417,17 +1417,17 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
1417 { 1417 {
1418 GNUNET_break (0); 1418 GNUNET_break (0);
1419 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 1419 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
1420 return; 1420 return;
1421 } 1421 }
1422 forward_overlay_connect (msg, client); 1422 forward_overlay_connect (msg, client);
1423 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1423 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1424 return; 1424 return;
1425 } 1425 }
1426 p2n = NULL; 1426 p2n = NULL;
1427 occ = GNUNET_malloc (sizeof (struct OverlayConnectContext)); 1427 occ = GNUNET_malloc (sizeof (struct OverlayConnectContext));
1428 occ->type = OCC_TYPE_LOCAL; 1428 occ->type = OCC_TYPE_LOCAL;
1429 if (!VALID_PEER_ID (p2)) /* May be peer2 is on a another controller */ 1429 if (!VALID_PEER_ID (p2)) /* May be peer2 is on a another controller */
1430 { 1430 {
1431 if (NULL == (p2n = GST_get_neighbour (peer2_host_id))) 1431 if (NULL == (p2n = GST_get_neighbour (peer2_host_id)))
1432 { 1432 {
1433 if (!VALID_HOST_ID (peer2_host_id)) 1433 if (!VALID_HOST_ID (peer2_host_id))
@@ -1455,7 +1455,7 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
1455 occ->client = client; 1455 occ->client = client;
1456 occ->other_peer_id = p2; 1456 occ->other_peer_id = p2;
1457 GST_peer_list[p1]->reference_cnt++; 1457 GST_peer_list[p1]->reference_cnt++;
1458 occ->peer = GST_peer_list[p1]; 1458 occ->peer = GST_peer_list[p1];
1459 occ->op_id = operation_id; 1459 occ->op_id = operation_id;
1460 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == occ->timeout_task); 1460 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == occ->timeout_task);
1461 occ->timeout_task = 1461 occ->timeout_task =
@@ -1466,7 +1466,7 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
1466 GNUNET_asprintf (&occ->emsg, 1466 GNUNET_asprintf (&occ->emsg,
1467 "0x%llx: Timeout while acquiring connection to peer %u's " 1467 "0x%llx: Timeout while acquiring connection to peer %u's "
1468 "host: %u\n", occ->op_id, occ->other_peer_id, peer2_host_id); 1468 "host: %u\n", occ->op_id, occ->other_peer_id, peer2_host_id);
1469 occ->p2ctx.remote.ncn = 1469 occ->p2ctx.remote.ncn =
1470 GST_neighbour_get_connection (p2n, &p2_controller_connect_cb, occ); 1470 GST_neighbour_get_connection (p2n, &p2_controller_connect_cb, occ);
1471 break; 1471 break;
1472 case OCC_TYPE_REMOTE_SLAVE: 1472 case OCC_TYPE_REMOTE_SLAVE:
diff --git a/src/testbed/gnunet-service-testbed_peers.c b/src/testbed/gnunet-service-testbed_peers.c
index 1792373a3..959229543 100644
--- a/src/testbed/gnunet-service-testbed_peers.c
+++ b/src/testbed/gnunet-service-testbed_peers.c
@@ -22,7 +22,7 @@
22/** 22/**
23 * @file testbed/gnunet-service-testbed_peers.c 23 * @file testbed/gnunet-service-testbed_peers.c
24 * @brief implementation of TESTBED service that deals with peer management 24 * @brief implementation of TESTBED service that deals with peer management
25 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 25 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
26 */ 26 */
27 27
28#include "gnunet-service-testbed.h" 28#include "gnunet-service-testbed.h"
@@ -70,12 +70,12 @@ struct ManageServiceContext
70 * The client which requested to manage the peer's service 70 * The client which requested to manage the peer's service
71 */ 71 */
72 struct GNUNET_SERVER_Client *client; 72 struct GNUNET_SERVER_Client *client;
73 73
74 /** 74 /**
75 * The operation id of the associated request 75 * The operation id of the associated request
76 */ 76 */
77 uint64_t op_id; 77 uint64_t op_id;
78 78
79 /** 79 /**
80 * 1 if the service at the peer has to be started; 0 if it has to be stopped 80 * 1 if the service at the peer has to be started; 0 if it has to be stopped
81 */ 81 */
@@ -85,7 +85,7 @@ struct ManageServiceContext
85 * Is this context expired? Do not work on this context if it is set to 85 * Is this context expired? Do not work on this context if it is set to
86 * GNUNET_YES 86 * GNUNET_YES
87 */ 87 */
88 uint8_t expired; 88 uint8_t expired;
89}; 89};
90 90
91 91
@@ -343,7 +343,7 @@ GST_handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client,
343 return; 343 return;
344 } 344 }
345 if (UINT32_MAX == peer_id) 345 if (UINT32_MAX == peer_id)
346 { 346 {
347 GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id), 347 GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
348 "Cannot create peer with given ID"); 348 "Cannot create peer with given ID");
349 GNUNET_SERVER_receive_done (client, GNUNET_OK); 349 GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -793,7 +793,7 @@ prc_stop_cb (void *cls, struct GNUNET_TESTING_Peer *p, int success)
793 struct PeerReconfigureContext *prc = cls; 793 struct PeerReconfigureContext *prc = cls;
794 struct Peer *peer; 794 struct Peer *peer;
795 char *emsg; 795 char *emsg;
796 796
797 GNUNET_assert (VALID_PEER_ID (prc->peer_id)); 797 GNUNET_assert (VALID_PEER_ID (prc->peer_id));
798 peer = GST_peer_list [prc->peer_id]; 798 peer = GST_peer_list [prc->peer_id];
799 GNUNET_assert (GNUNET_NO == peer->is_remote); 799 GNUNET_assert (GNUNET_NO == peer->is_remote);
@@ -815,13 +815,13 @@ prc_stop_cb (void *cls, struct GNUNET_TESTING_Peer *p, int success)
815 } 815 }
816 if (GNUNET_OK != start_peer (peer)) 816 if (GNUNET_OK != start_peer (peer))
817 { 817 {
818 818
819 GST_send_operation_fail_msg (prc->client, prc->op_id, 819 GST_send_operation_fail_msg (prc->client, prc->op_id,
820 "Failed to start reconfigured peer"); 820 "Failed to start reconfigured peer");
821 goto cleanup; 821 goto cleanup;
822 } 822 }
823 GST_send_operation_success_msg (prc->client, prc->op_id); 823 GST_send_operation_success_msg (prc->client, prc->op_id);
824 824
825 cleanup: 825 cleanup:
826 cleanup_prc (prc); 826 cleanup_prc (prc);
827 return; 827 return;
@@ -849,7 +849,7 @@ GST_handle_peer_reconfigure (void *cls, struct GNUNET_SERVER_Client *client,
849 uint64_t op_id; 849 uint64_t op_id;
850 uint32_t peer_id; 850 uint32_t peer_id;
851 uint16_t msize; 851 uint16_t msize;
852 852
853 msize = ntohs (message->size); 853 msize = ntohs (message->size);
854 if (msize <= sizeof (struct GNUNET_TESTBED_PeerReconfigureMessage)) 854 if (msize <= sizeof (struct GNUNET_TESTBED_PeerReconfigureMessage))
855 { 855 {
@@ -907,7 +907,7 @@ GST_handle_peer_reconfigure (void *cls, struct GNUNET_SERVER_Client *client,
907 cfg = GNUNET_TESTBED_extract_config_ (message); 907 cfg = GNUNET_TESTBED_extract_config_ (message);
908 if (NULL == cfg) 908 if (NULL == cfg)
909 { 909 {
910 GNUNET_break (0); 910 GNUNET_break (0);
911 GST_send_operation_fail_msg (client, op_id, "Compression error"); 911 GST_send_operation_fail_msg (client, op_id, "Compression error");
912 GNUNET_SERVER_receive_done (client, GNUNET_OK); 912 GNUNET_SERVER_receive_done (client, GNUNET_OK);
913 return; 913 return;
@@ -916,7 +916,7 @@ GST_handle_peer_reconfigure (void *cls, struct GNUNET_SERVER_Client *client,
916 prc->cfg = cfg; 916 prc->cfg = cfg;
917 prc->peer_id = peer_id; 917 prc->peer_id = peer_id;
918 prc->op_id = op_id; 918 prc->op_id = op_id;
919 prc->client = client; 919 prc->client = client;
920 GNUNET_SERVER_client_keep (client); 920 GNUNET_SERVER_client_keep (client);
921 GNUNET_CONTAINER_DLL_insert_tail (prc_head, prc_tail, prc); 921 GNUNET_CONTAINER_DLL_insert_tail (prc_head, prc_tail, prc);
922 GNUNET_TESTING_peer_stop_async (peer->details.local.peer, prc_stop_cb, prc); 922 GNUNET_TESTING_peer_stop_async (peer->details.local.peer, prc_stop_cb, prc);
@@ -1032,8 +1032,8 @@ arm_ret_string (enum GNUNET_ARM_Result result)
1032 * @param result result of the operation 1032 * @param result result of the operation
1033 */ 1033 */
1034static void 1034static void
1035service_manage_result_cb (void *cls, 1035service_manage_result_cb (void *cls,
1036 enum GNUNET_ARM_RequestStatus rs, 1036 enum GNUNET_ARM_RequestStatus rs,
1037 const char *service, enum GNUNET_ARM_Result result) 1037 const char *service, enum GNUNET_ARM_Result result)
1038{ 1038{
1039 struct ManageServiceContext *mctx = cls; 1039 struct ManageServiceContext *mctx = cls;
@@ -1072,7 +1072,7 @@ service_manage_result_cb (void *cls,
1072 goto ret; 1072 goto ret;
1073 } 1073 }
1074 /* service started successfully */ 1074 /* service started successfully */
1075 1075
1076 ret: 1076 ret:
1077 if (NULL != emsg) 1077 if (NULL != emsg)
1078 { 1078 {
@@ -1107,17 +1107,17 @@ GST_handle_manage_peer_service (void *cls, struct GNUNET_SERVER_Client *client,
1107 uint64_t op_id; 1107 uint64_t op_id;
1108 uint32_t peer_id; 1108 uint32_t peer_id;
1109 uint16_t msize; 1109 uint16_t msize;
1110 1110
1111 1111
1112 msize = ntohs (message->size); 1112 msize = ntohs (message->size);
1113 if (msize <= sizeof (struct GNUNET_TESTBED_ManagePeerServiceMessage)) 1113 if (msize <= sizeof (struct GNUNET_TESTBED_ManagePeerServiceMessage))
1114 { 1114 {
1115 GNUNET_break_op (0); 1115 GNUNET_break_op (0);
1116 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 1116 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
1117 return; 1117 return;
1118 } 1118 }
1119 msg = (const struct GNUNET_TESTBED_ManagePeerServiceMessage *) message; 1119 msg = (const struct GNUNET_TESTBED_ManagePeerServiceMessage *) message;
1120 service = (const char *) &msg[1]; 1120 service = (const char *) &msg[1];
1121 if ('\0' != service[msize - sizeof 1121 if ('\0' != service[msize - sizeof
1122 (struct GNUNET_TESTBED_ManagePeerServiceMessage) - 1]) 1122 (struct GNUNET_TESTBED_ManagePeerServiceMessage) - 1])
1123 { 1123 {
@@ -1129,7 +1129,7 @@ GST_handle_manage_peer_service (void *cls, struct GNUNET_SERVER_Client *client,
1129 { 1129 {
1130 GNUNET_break_op (0); 1130 GNUNET_break_op (0);
1131 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 1131 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
1132 return; 1132 return;
1133 } 1133 }
1134 peer_id = ntohl (msg->peer_id); 1134 peer_id = ntohl (msg->peer_id);
1135 op_id = GNUNET_ntohll (msg->operation_id); 1135 op_id = GNUNET_ntohll (msg->operation_id);
@@ -1247,7 +1247,7 @@ GST_destroy_peers ()
1247 { 1247 {
1248 peer = GST_peer_list[id]; 1248 peer = GST_peer_list[id];
1249 if (NULL == peer) 1249 if (NULL == peer)
1250 continue; 1250 continue;
1251 if (GNUNET_NO == peer->is_remote) 1251 if (GNUNET_NO == peer->is_remote)
1252 { 1252 {
1253 if (GNUNET_YES == peer->details.local.is_running) 1253 if (GNUNET_YES == peer->details.local.is_running)
@@ -1288,7 +1288,7 @@ shutdown_peers_timeout_cb (void *cls,
1288 GNUNET_free (hc); 1288 GNUNET_free (hc);
1289 hc = NULL; 1289 hc = NULL;
1290 } 1290 }
1291 GNUNET_TESTBED_forward_operation_msg_cancel_ (fo_ctxt->opc); 1291 GNUNET_TESTBED_forward_operation_msg_cancel_ (fo_ctxt->opc);
1292 GNUNET_SERVER_client_drop (fo_ctxt->client); 1292 GNUNET_SERVER_client_drop (fo_ctxt->client);
1293 GNUNET_CONTAINER_DLL_remove (fopcq_head, fopcq_tail, fo_ctxt); 1293 GNUNET_CONTAINER_DLL_remove (fopcq_head, fopcq_tail, fo_ctxt);
1294 GNUNET_free (fo_ctxt); 1294 GNUNET_free (fo_ctxt);
@@ -1309,14 +1309,14 @@ shutdown_peers_reply_cb (void *cls,
1309{ 1309{
1310 struct ForwardedOperationContext *fo_ctxt = cls; 1310 struct ForwardedOperationContext *fo_ctxt = cls;
1311 struct HandlerContext_ShutdownPeers *hc; 1311 struct HandlerContext_ShutdownPeers *hc;
1312 1312
1313 hc = fo_ctxt->cls; 1313 hc = fo_ctxt->cls;
1314 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != fo_ctxt->timeout_task); 1314 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != fo_ctxt->timeout_task);
1315 GNUNET_SCHEDULER_cancel (fo_ctxt->timeout_task); 1315 GNUNET_SCHEDULER_cancel (fo_ctxt->timeout_task);
1316 fo_ctxt->timeout_task = GNUNET_SCHEDULER_NO_TASK; 1316 fo_ctxt->timeout_task = GNUNET_SCHEDULER_NO_TASK;
1317 GNUNET_assert (0 < hc->nslaves); 1317 GNUNET_assert (0 < hc->nslaves);
1318 hc->nslaves--; 1318 hc->nslaves--;
1319 if (GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS != 1319 if (GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS !=
1320 ntohs (msg->type)) 1320 ntohs (msg->type))
1321 hc->timeout = GNUNET_YES; 1321 hc->timeout = GNUNET_YES;
1322 if (0 == hc->nslaves) 1322 if (0 == hc->nslaves)
@@ -1398,5 +1398,5 @@ GST_handle_shutdown_peers (void *cls, struct GNUNET_SERVER_Client *client,
1398 GST_send_operation_success_msg (client, op_id); 1398 GST_send_operation_success_msg (client, op_id);
1399 GNUNET_free (hc); 1399 GNUNET_free (hc);
1400 } 1400 }
1401 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1401 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1402} 1402}
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c
index 8d85280fe..c6c472f92 100644
--- a/src/testbed/gnunet-testbed-profiler.c
+++ b/src/testbed/gnunet-testbed-profiler.c
@@ -49,7 +49,7 @@ struct GNUNET_TESTBED_Operation *topology_op;
49/** 49/**
50 * Name of the file with the hosts to run the test over (configuration option). 50 * Name of the file with the hosts to run the test over (configuration option).
51 * It will be NULL if ENABLE_LL is set 51 * It will be NULL if ENABLE_LL is set
52 */ 52 */
53static char *hosts_file; 53static char *hosts_file;
54 54
55/** 55/**
@@ -216,7 +216,7 @@ controller_event_cb (void *cls,
216 * @param links_failed the number of overlay link 216 * @param links_failed the number of overlay link
217 */ 217 */
218static void 218static void
219test_run (void *cls, 219test_run (void *cls,
220 struct GNUNET_TESTBED_RunHandle *h, 220 struct GNUNET_TESTBED_RunHandle *h,
221 unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, 221 unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers,
222 unsigned int links_succeeded, 222 unsigned int links_succeeded,
diff --git a/src/testbed/gnunet_testbed_mpi_spawn.c b/src/testbed/gnunet_testbed_mpi_spawn.c
index c7b7aab0b..a7652cfd8 100644
--- a/src/testbed/gnunet_testbed_mpi_spawn.c
+++ b/src/testbed/gnunet_testbed_mpi_spawn.c
@@ -26,7 +26,7 @@ static int ret;
26static struct GNUNET_OS_Process *child; 26static struct GNUNET_OS_Process *child;
27 27
28/** 28/**
29 * The arguments including the binary to spawn 29 * The arguments including the binary to spawn
30 */ 30 */
31static char **argv2; 31static char **argv2;
32 32
@@ -79,7 +79,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
79 shutdown_task_id = GNUNET_SCHEDULER_NO_TASK; 79 shutdown_task_id = GNUNET_SCHEDULER_NO_TASK;
80 if (0 != child_exit_code) 80 if (0 != child_exit_code)
81 { 81 {
82 LOG (GNUNET_ERROR_TYPE_WARNING, "Child exited with error code: %lu\n", 82 LOG (GNUNET_ERROR_TYPE_WARNING, "Child exited with error code: %lu\n",
83 child_exit_code); 83 child_exit_code);
84 ret = 128 + (int) child_exit_code; 84 ret = 128 + (int) child_exit_code;
85 } 85 }
@@ -101,7 +101,7 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
101 static int hard_kill; 101 static int hard_kill;
102 102
103 GNUNET_assert (NULL != child); 103 GNUNET_assert (NULL != child);
104 terminate_task_id = 104 terminate_task_id =
105 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 105 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
106 &terminate_task, NULL); 106 &terminate_task, NULL);
107 if (0 != hard_kill) 107 if (0 != hard_kill)
@@ -110,7 +110,7 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
110 { 110 {
111 case 1: 111 case 1:
112 case 2: 112 case 2:
113 LOG (GNUNET_ERROR_TYPE_WARNING, 113 LOG (GNUNET_ERROR_TYPE_WARNING,
114 "%d more interrupts needed to send SIGKILL to the child\n", 114 "%d more interrupts needed to send SIGKILL to the child\n",
115 3 - hard_kill); 115 3 - hard_kill);
116 hard_kill++; 116 hard_kill++;
@@ -190,7 +190,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
190 char *hostname; 190 char *hostname;
191 size_t hostname_len; 191 size_t hostname_len;
192 unsigned int nhosts; 192 unsigned int nhosts;
193 193
194 null_cfg = GNUNET_CONFIGURATION_create (); 194 null_cfg = GNUNET_CONFIGURATION_create ();
195 nhosts = GNUNET_TESTBED_hosts_load_from_loadleveler (null_cfg, &hosts); 195 nhosts = GNUNET_TESTBED_hosts_load_from_loadleveler (null_cfg, &hosts);
196 if (0 == nhosts) 196 if (0 == nhosts)
@@ -223,7 +223,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
223 if (NULL == tmpdir) 223 if (NULL == tmpdir)
224 tmpdir = getenv ("TMP"); 224 tmpdir = getenv ("TMP");
225 if (NULL == tmpdir) 225 if (NULL == tmpdir)
226 tmpdir = getenv ("TEMP"); 226 tmpdir = getenv ("TEMP");
227 if (NULL == tmpdir) 227 if (NULL == tmpdir)
228 tmpdir = "/tmp"; 228 tmpdir = "/tmp";
229 (void) GNUNET_asprintf (&fn, "%s/gnunet-testbed-spawn.lock", tmpdir); 229 (void) GNUNET_asprintf (&fn, "%s/gnunet-testbed-spawn.lock", tmpdir);
@@ -304,7 +304,7 @@ main (int argc, char *argv[])
304 GNUNET_break (0); 304 GNUNET_break (0);
305 return 1; 305 return 1;
306 } 306 }
307 if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, 307 if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO,
308 GNUNET_NO, GNUNET_NO))) 308 GNUNET_NO, GNUNET_NO)))
309 { 309 {
310 GNUNET_break (0); 310 GNUNET_break (0);
@@ -321,7 +321,7 @@ main (int argc, char *argv[])
321 argv2 = GNUNET_malloc (sizeof (char *) * argc); 321 argv2 = GNUNET_malloc (sizeof (char *) * argc);
322 for (cnt = 1; cnt < argc; cnt++) 322 for (cnt = 1; cnt < argc; cnt++)
323 argv2[cnt - 1] = argv[cnt]; 323 argv2[cnt - 1] = argv[cnt];
324 GNUNET_SCHEDULER_run (run, NULL); 324 GNUNET_SCHEDULER_run (run, NULL);
325 GNUNET_free (argv2); 325 GNUNET_free (argv2);
326 GNUNET_SIGNAL_handler_uninstall (shc_chld); 326 GNUNET_SIGNAL_handler_uninstall (shc_chld);
327 shc_chld = NULL; 327 shc_chld = NULL;
diff --git a/src/testbed/test_getcwd.c b/src/testbed/test_getcwd.c
index 2b98a56d8..433f65f09 100644
--- a/src/testbed/test_getcwd.c
+++ b/src/testbed/test_getcwd.c
@@ -5,7 +5,7 @@ int main ()
5{ 5{
6 char buf[PATH_MAX]; 6 char buf[PATH_MAX];
7 char *out; 7 char *out;
8 8
9 out = getcwd (buf, PATH_MAX); 9 out = getcwd (buf, PATH_MAX);
10 (void) printf ("CWD: %s\n", out); 10 (void) printf ("CWD: %s\n", out);
11 return 0; 11 return 0;
diff --git a/src/testbed/test_testbed_api.c b/src/testbed/test_testbed_api.c
index 97ca15c5f..47caa06f3 100644
--- a/src/testbed/test_testbed_api.c
+++ b/src/testbed/test_testbed_api.c
@@ -416,7 +416,7 @@ status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg_, int status
416 cp = NULL; 416 cp = NULL;
417 FAIL_TEST (0, return); 417 FAIL_TEST (0, return);
418 return; 418 return;
419 } 419 }
420 event_mask = 0; 420 event_mask = 0;
421 event_mask |= (1L << GNUNET_TESTBED_ET_PEER_START); 421 event_mask |= (1L << GNUNET_TESTBED_ET_PEER_START);
422 event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP); 422 event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP);
diff --git a/src/testbed/test_testbed_api_barriers.c b/src/testbed/test_testbed_api_barriers.c
index 2fbd6ea81..648af792b 100644
--- a/src/testbed/test_testbed_api_barriers.c
+++ b/src/testbed/test_testbed_api_barriers.c
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file testbed/test_testbed_api_barriers.c 22 * @file testbed/test_testbed_api_barriers.c
23 * @brief testcase binary for testing testbed barriers API 23 * @brief testcase binary for testing testbed barriers API
24 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 24 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 */ 25 */
26 26
27#include "platform.h" 27#include "platform.h"
@@ -73,7 +73,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
73 GNUNET_TESTBED_barrier_cancel (barrier); 73 GNUNET_TESTBED_barrier_cancel (barrier);
74 barrier = NULL; 74 barrier = NULL;
75 } 75 }
76 76
77 GNUNET_SCHEDULER_shutdown (); 77 GNUNET_SCHEDULER_shutdown ();
78} 78}
79 79
@@ -99,7 +99,7 @@ barrier_cb (void *cls,
99 const char *emsg) 99 const char *emsg)
100{ 100{
101 static enum GNUNET_TESTBED_BarrierStatus old_status; 101 static enum GNUNET_TESTBED_BarrierStatus old_status;
102 102
103 GNUNET_assert (NULL == cls); 103 GNUNET_assert (NULL == cls);
104 GNUNET_assert (_barrier == barrier); 104 GNUNET_assert (_barrier == barrier);
105 switch (status) 105 switch (status)
@@ -109,14 +109,14 @@ barrier_cb (void *cls,
109 old_status = status; 109 old_status = status;
110 return; 110 return;
111 case GNUNET_TESTBED_BARRIERSTATUS_ERROR: 111 case GNUNET_TESTBED_BARRIERSTATUS_ERROR:
112 LOG (GNUNET_ERROR_TYPE_ERROR, "Barrier initialisation failed: %s", 112 LOG (GNUNET_ERROR_TYPE_ERROR, "Barrier initialisation failed: %s",
113 (NULL == emsg) ? "unknown reason" : emsg); 113 (NULL == emsg) ? "unknown reason" : emsg);
114 barrier = NULL; 114 barrier = NULL;
115 GNUNET_SCHEDULER_shutdown (); 115 GNUNET_SCHEDULER_shutdown ();
116 return; 116 return;
117 case GNUNET_TESTBED_BARRIERSTATUS_CROSSED: 117 case GNUNET_TESTBED_BARRIERSTATUS_CROSSED:
118 LOG (GNUNET_ERROR_TYPE_INFO, "Barrier crossed\n"); 118 LOG (GNUNET_ERROR_TYPE_INFO, "Barrier crossed\n");
119 if (old_status == GNUNET_TESTBED_BARRIERSTATUS_INITIALISED) 119 if (old_status == GNUNET_TESTBED_BARRIERSTATUS_INITIALISED)
120 result = GNUNET_OK; 120 result = GNUNET_OK;
121 barrier = NULL; 121 barrier = NULL;
122 GNUNET_SCHEDULER_shutdown (); 122 GNUNET_SCHEDULER_shutdown ();
@@ -161,7 +161,7 @@ test_master (void *cls,
161 &barrier_cb, NULL); 161 &barrier_cb, NULL);
162 shutdown_task = 162 shutdown_task =
163 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 163 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
164 (GNUNET_TIME_UNIT_SECONDS, 164 (GNUNET_TIME_UNIT_SECONDS,
165 10 * (NUM_PEERS + 1)), 165 10 * (NUM_PEERS + 1)),
166 &do_shutdown, NULL); 166 &do_shutdown, NULL);
167} 167}
@@ -181,7 +181,7 @@ main (int argc, char **argv)
181 result = GNUNET_SYSERR; 181 result = GNUNET_SYSERR;
182 event_mask = 0; 182 event_mask = 0;
183 cfg = GNUNET_CONFIGURATION_create (); 183 cfg = GNUNET_CONFIGURATION_create ();
184 GNUNET_assert (GNUNET_YES == 184 GNUNET_assert (GNUNET_YES ==
185 GNUNET_CONFIGURATION_parse (cfg, 185 GNUNET_CONFIGURATION_parse (cfg,
186 "test_testbed_api_barriers.conf.in")); 186 "test_testbed_api_barriers.conf.in"));
187 if (NULL == getcwd (pwd, PATH_MAX)) 187 if (NULL == getcwd (pwd, PATH_MAX))
@@ -191,7 +191,7 @@ main (int argc, char **argv)
191 GNUNET_CONFIGURATION_set_value_string (cfg, "test-barriers","BINARY", binary); 191 GNUNET_CONFIGURATION_set_value_string (cfg, "test-barriers","BINARY", binary);
192 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_write 192 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_write
193 (cfg, "test_testbed_api_barriers.conf")); 193 (cfg, "test_testbed_api_barriers.conf"));
194 GNUNET_CONFIGURATION_destroy (cfg); 194 GNUNET_CONFIGURATION_destroy (cfg);
195 cfg = NULL; 195 cfg = NULL;
196 GNUNET_free (binary); 196 GNUNET_free (binary);
197 binary = NULL; 197 binary = NULL;
diff --git a/src/testbed/test_testbed_api_hosts.c b/src/testbed/test_testbed_api_hosts.c
index 0c3c17a6b..4d96b2303 100644
--- a/src/testbed/test_testbed_api_hosts.c
+++ b/src/testbed/test_testbed_api_hosts.c
@@ -118,7 +118,7 @@ run (void *cls, char *const *args, const char *cfgfile,
118 { 118 {
119 if (cnt < 3) 119 if (cnt < 3)
120 { 120 {
121 GNUNET_assert (0 == strcmp ("totakura", 121 GNUNET_assert (0 == strcmp ("totakura",
122 GNUNET_TESTBED_host_get_username_ 122 GNUNET_TESTBED_host_get_username_
123 (hosts[cnt]))); 123 (hosts[cnt])));
124 GNUNET_assert (NULL != GNUNET_TESTBED_host_get_hostname (hosts[cnt])); 124 GNUNET_assert (NULL != GNUNET_TESTBED_host_get_hostname (hosts[cnt]));
@@ -126,7 +126,7 @@ run (void *cls, char *const *args, const char *cfgfile,
126 } 126 }
127 if (3 == cnt) 127 if (3 == cnt)
128 { 128 {
129 GNUNET_assert (0 == strcmp ("totakura", 129 GNUNET_assert (0 == strcmp ("totakura",
130 GNUNET_TESTBED_host_get_username_ 130 GNUNET_TESTBED_host_get_username_
131 (hosts[cnt]))); 131 (hosts[cnt])));
132 GNUNET_assert (NULL != GNUNET_TESTBED_host_get_hostname (hosts[cnt])); 132 GNUNET_assert (NULL != GNUNET_TESTBED_host_get_hostname (hosts[cnt]));
@@ -134,7 +134,7 @@ run (void *cls, char *const *args, const char *cfgfile,
134 } 134 }
135 if (4 == cnt) 135 if (4 == cnt)
136 { 136 {
137 GNUNET_assert (0 == strcmp ("totakura", 137 GNUNET_assert (0 == strcmp ("totakura",
138 GNUNET_TESTBED_host_get_username_ 138 GNUNET_TESTBED_host_get_username_
139 (hosts[cnt]))); 139 (hosts[cnt])));
140 GNUNET_assert (0 == strcmp ("asgard.realm", 140 GNUNET_assert (0 == strcmp ("asgard.realm",
diff --git a/src/testbed/test_testbed_api_operations.c b/src/testbed/test_testbed_api_operations.c
index feca147b7..ceae76cd4 100644
--- a/src/testbed/test_testbed_api_operations.c
+++ b/src/testbed/test_testbed_api_operations.c
@@ -296,8 +296,8 @@ step (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
296 case TEST_OP4_STARTED: 296 case TEST_OP4_STARTED:
297 GNUNET_TESTBED_operation_release_ (op4); 297 GNUNET_TESTBED_operation_release_ (op4);
298 break; 298 break;
299 case TEST_OP6_RELEASED: 299 case TEST_OP6_RELEASED:
300 op8 = GNUNET_TESTBED_operation_create_ (&op8, &start_cb, &release_cb); 300 op8 = GNUNET_TESTBED_operation_create_ (&op8, &start_cb, &release_cb);
301 GNUNET_TESTBED_operation_queue_insert2_ (q1, op8, 2); 301 GNUNET_TESTBED_operation_queue_insert2_ (q1, op8, 2);
302 GNUNET_TESTBED_operation_queue_insert2_ (q2, op8, 2); 302 GNUNET_TESTBED_operation_queue_insert2_ (q2, op8, 2);
303 result = TEST_OP8_WAITING; 303 result = TEST_OP8_WAITING;
@@ -311,13 +311,13 @@ step (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
311 case TEST_OP8_INACTIVE_1: 311 case TEST_OP8_INACTIVE_1:
312 GNUNET_TESTBED_operation_activate_ (op8); 312 GNUNET_TESTBED_operation_activate_ (op8);
313 result = TEST_OP8_ACTIVE; 313 result = TEST_OP8_ACTIVE;
314 op9 = GNUNET_TESTBED_operation_create_ (&op9, &start_cb, &release_cb); 314 op9 = GNUNET_TESTBED_operation_create_ (&op9, &start_cb, &release_cb);
315 GNUNET_TESTBED_operation_queue_insert2_ (q1, op9, 1); 315 GNUNET_TESTBED_operation_queue_insert2_ (q1, op9, 1);
316 GNUNET_TESTBED_operation_queue_insert2_ (q2, op9, 1); 316 GNUNET_TESTBED_operation_queue_insert2_ (q2, op9, 1);
317 GNUNET_TESTBED_operation_begin_wait_ (op9); 317 GNUNET_TESTBED_operation_begin_wait_ (op9);
318 step_task = GNUNET_SCHEDULER_add_delayed (STEP_DELAY, &step, NULL); 318 step_task = GNUNET_SCHEDULER_add_delayed (STEP_DELAY, &step, NULL);
319 break; 319 break;
320 case TEST_OP8_ACTIVE: 320 case TEST_OP8_ACTIVE:
321 GNUNET_TESTBED_operation_inactivate_ (op8); 321 GNUNET_TESTBED_operation_inactivate_ (op8);
322 /* op8 should be released by now due to above call */ 322 /* op8 should be released by now due to above call */
323 GNUNET_assert (TEST_OP8_RELEASED == result); 323 GNUNET_assert (TEST_OP8_RELEASED == result);
diff --git a/src/testbed/test_testbed_api_peer_reconfiguration.c b/src/testbed/test_testbed_api_peer_reconfiguration.c
index 7f7bf6473..8ca679c27 100644
--- a/src/testbed/test_testbed_api_peer_reconfiguration.c
+++ b/src/testbed/test_testbed_api_peer_reconfiguration.c
@@ -22,7 +22,7 @@
22 * @file testbed/test_testbed_api_peer_reconfiguration.c 22 * @file testbed/test_testbed_api_peer_reconfiguration.c
23 * @brief testcase for testing GNUNET_TESTBED_peer_manage_service() 23 * @brief testcase for testing GNUNET_TESTBED_peer_manage_service()
24 * implementation 24 * implementation
25 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 25 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
26 */ 26 */
27 27
28#include "platform.h" 28#include "platform.h"
@@ -63,7 +63,7 @@ enum {
63 * Peers have been started 63 * Peers have been started
64 */ 64 */
65 STATE_PEER_STARTED, 65 STATE_PEER_STARTED,
66 66
67 /** 67 /**
68 * Peer has been reconfigured. Test completed successfully 68 * Peer has been reconfigured. Test completed successfully
69 */ 69 */
@@ -97,7 +97,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
97 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Aborting\n"); 97 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Aborting\n");
98 abort_task = GNUNET_SCHEDULER_NO_TASK; 98 abort_task = GNUNET_SCHEDULER_NO_TASK;
99 if (NULL != op) 99 if (NULL != op)
100 { 100 {
101 GNUNET_TESTBED_operation_done (op); 101 GNUNET_TESTBED_operation_done (op);
102 op = NULL; 102 op = NULL;
103 } 103 }
@@ -128,7 +128,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
128 fprintf (stderr, "Operation failed: %s\n", 128 fprintf (stderr, "Operation failed: %s\n",
129 event->details.operation_finished.emsg); 129 event->details.operation_finished.emsg);
130 GNUNET_TESTBED_operation_done (op); 130 GNUNET_TESTBED_operation_done (op);
131 op = NULL; 131 op = NULL;
132 FAIL_TEST (0, return); 132 FAIL_TEST (0, return);
133 } 133 }
134 GNUNET_TESTBED_operation_done (op); 134 GNUNET_TESTBED_operation_done (op);
@@ -152,7 +152,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
152 * failed 152 * failed
153 */ 153 */
154static void 154static void
155test_master (void *cls, 155test_master (void *cls,
156 struct GNUNET_TESTBED_RunHandle *h, 156 struct GNUNET_TESTBED_RunHandle *h,
157 unsigned int num_peers, 157 unsigned int num_peers,
158 struct GNUNET_TESTBED_Peer **peers_, 158 struct GNUNET_TESTBED_Peer **peers_,
diff --git a/src/testbed/test_testbed_api_peers_manage_services.c b/src/testbed/test_testbed_api_peers_manage_services.c
index 29eed3d12..d61c11408 100644
--- a/src/testbed/test_testbed_api_peers_manage_services.c
+++ b/src/testbed/test_testbed_api_peers_manage_services.c
@@ -22,7 +22,7 @@
22 * @file testbed/test_testbed_api_peers_manage_services.c 22 * @file testbed/test_testbed_api_peers_manage_services.c
23 * @brief testcase for testing GNUNET_TESTBED_peer_manage_service() 23 * @brief testcase for testing GNUNET_TESTBED_peer_manage_service()
24 * implementation 24 * implementation
25 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 25 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
26 */ 26 */
27 27
28#include "platform.h" 28#include "platform.h"
@@ -68,7 +68,7 @@ enum {
68 * Peers have been started 68 * Peers have been started
69 */ 69 */
70 STATE_PEERS_STARTED, 70 STATE_PEERS_STARTED,
71 71
72 /** 72 /**
73 * statistics service went down 73 * statistics service went down
74 */ 74 */
@@ -111,7 +111,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
111 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Aborting\n"); 111 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Aborting\n");
112 abort_task = GNUNET_SCHEDULER_NO_TASK; 112 abort_task = GNUNET_SCHEDULER_NO_TASK;
113 if (NULL != op) 113 if (NULL != op)
114 { 114 {
115 GNUNET_TESTBED_operation_done (op); 115 GNUNET_TESTBED_operation_done (op);
116 op = NULL; 116 op = NULL;
117 } 117 }
diff --git a/src/testbed/test_testbed_api_sd.c b/src/testbed/test_testbed_api_sd.c
index d4fa7af84..0748c0ffd 100644
--- a/src/testbed/test_testbed_api_sd.c
+++ b/src/testbed/test_testbed_api_sd.c
@@ -22,7 +22,7 @@
22/** 22/**
23 * @file testbed/testbed_api_sd.c 23 * @file testbed/testbed_api_sd.c
24 * @brief test cases for calculating standard deviation 24 * @brief test cases for calculating standard deviation
25 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 25 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
26 */ 26 */
27 27
28#include "platform.h" 28#include "platform.h"
@@ -58,7 +58,7 @@ run (void *cls, char *const *args, const char *cfgfile,
58 ret = 1; 58 ret = 1;
59 goto err; 59 goto err;
60 } 60 }
61 GNUNET_TESTBED_SD_add_data_ (h, 30); 61 GNUNET_TESTBED_SD_add_data_ (h, 30);
62 if (GNUNET_SYSERR == GNUNET_TESTBED_SD_deviation_factor_ (h, 80, &sd)) 62 if (GNUNET_SYSERR == GNUNET_TESTBED_SD_deviation_factor_ (h, 80, &sd))
63 { 63 {
64 GNUNET_break (0); 64 GNUNET_break (0);
diff --git a/src/testbed/test_testbed_api_statistics.c b/src/testbed/test_testbed_api_statistics.c
index e0f48fcb5..4c27e2982 100644
--- a/src/testbed/test_testbed_api_statistics.c
+++ b/src/testbed/test_testbed_api_statistics.c
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file testbed/test_testbed_api_statistics.c 22 * @file testbed/test_testbed_api_statistics.c
23 * @brief testcase for testing GNUNET_TESTBED_get_statistics() implementation 23 * @brief testcase for testing GNUNET_TESTBED_get_statistics() implementation
24 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 24 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 */ 25 */
26 26
27#include "platform.h" 27#include "platform.h"
@@ -95,7 +95,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
95 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Test timed out -- Aborting\n"); 95 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Test timed out -- Aborting\n");
96 abort_task = GNUNET_SCHEDULER_NO_TASK; 96 abort_task = GNUNET_SCHEDULER_NO_TASK;
97 if (NULL != op) 97 if (NULL != op)
98 { 98 {
99 GNUNET_TESTBED_operation_done (op); 99 GNUNET_TESTBED_operation_done (op);
100 op = NULL; 100 op = NULL;
101 } 101 }
@@ -121,12 +121,12 @@ stats_iterator (void *cls,
121 int is_persistent) 121 int is_persistent)
122{ 122{
123 unsigned int cnt; 123 unsigned int cnt;
124 124
125 FAIL_TEST (cls == dummy_cls, return GNUNET_SYSERR); 125 FAIL_TEST (cls == dummy_cls, return GNUNET_SYSERR);
126 for (cnt = 0; cnt < num_seen_peers; cnt++) 126 for (cnt = 0; cnt < num_seen_peers; cnt++)
127 FAIL_TEST (peer != seen_peers[cnt], return GNUNET_SYSERR); 127 FAIL_TEST (peer != seen_peers[cnt], return GNUNET_SYSERR);
128 FAIL_TEST (NULL != subsystem, return GNUNET_SYSERR); 128 FAIL_TEST (NULL != subsystem, return GNUNET_SYSERR);
129 FAIL_TEST (NULL != name, return GNUNET_SYSERR); 129 FAIL_TEST (NULL != name, return GNUNET_SYSERR);
130 GNUNET_array_append (seen_peers, num_seen_peers, 130 GNUNET_array_append (seen_peers, num_seen_peers,
131 (struct GNUNET_TESTBED_Peer *) peer); 131 (struct GNUNET_TESTBED_Peer *) peer);
132 return GNUNET_SYSERR; 132 return GNUNET_SYSERR;
@@ -151,7 +151,7 @@ op_comp_cb (void *cls,
151 GNUNET_TESTBED_operation_done (op); 151 GNUNET_TESTBED_operation_done (op);
152 op = NULL; 152 op = NULL;
153 GNUNET_SCHEDULER_cancel (abort_task); 153 GNUNET_SCHEDULER_cancel (abort_task);
154 GNUNET_SCHEDULER_shutdown (); 154 GNUNET_SCHEDULER_shutdown ();
155} 155}
156 156
157 157
diff --git a/src/testbed/test_testbed_api_testbed_run.c b/src/testbed/test_testbed_api_testbed_run.c
index b7cff2ec7..30acf268f 100644
--- a/src/testbed/test_testbed_api_testbed_run.c
+++ b/src/testbed/test_testbed_api_testbed_run.c
@@ -107,7 +107,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
107 * failed 107 * failed
108 */ 108 */
109static void 109static void
110test_master (void *cls, 110test_master (void *cls,
111 struct GNUNET_TESTBED_RunHandle *h, 111 struct GNUNET_TESTBED_RunHandle *h,
112 unsigned int num_peers, 112 unsigned int num_peers,
113 struct GNUNET_TESTBED_Peer **peers_, 113 struct GNUNET_TESTBED_Peer **peers_,
diff --git a/src/testbed/test_testbed_logger_api.c b/src/testbed/test_testbed_logger_api.c
index a8ed3d22c..dae972427 100644
--- a/src/testbed/test_testbed_logger_api.c
+++ b/src/testbed/test_testbed_logger_api.c
@@ -142,12 +142,12 @@ iterator_cb (void *cls, struct GNUNET_DISK_DirectoryIterator *di,
142 if ((BSIZE * 2) != fs) /* The file size should be equal to what we 142 if ((BSIZE * 2) != fs) /* The file size should be equal to what we
143 have written */ 143 have written */
144 goto iteration_cont; 144 goto iteration_cont;
145 145
146 cancel = GNUNET_YES; 146 cancel = GNUNET_YES;
147 result = GNUNET_OK; 147 result = GNUNET_OK;
148 148
149 iteration_cont: 149 iteration_cont:
150 if ( (NULL != di) && 150 if ( (NULL != di) &&
151 (GNUNET_YES == GNUNET_DISK_directory_iterator_next (di, cancel)) ) 151 (GNUNET_YES == GNUNET_DISK_directory_iterator_next (di, cancel)) )
152 return; 152 return;
153 shutdown_now (); 153 shutdown_now ();
@@ -193,7 +193,7 @@ do_write (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
193/** 193/**
194 * Signature of the 'main' function for a (single-peer) testcase that 194 * Signature of the 'main' function for a (single-peer) testcase that
195 * is run using 'GNUNET_TESTING_peer_run'. 195 * is run using 'GNUNET_TESTING_peer_run'.
196 * 196 *
197 * @param cls closure 197 * @param cls closure
198 * @param cfg configuration of the peer that was started 198 * @param cfg configuration of the peer that was started
199 * @param peer identity of the peer that was created 199 * @param peer identity of the peer that was created
diff --git a/src/testbed/testbed.h b/src/testbed/testbed.h
index f781eea0d..cb39cc993 100644
--- a/src/testbed/testbed.h
+++ b/src/testbed/testbed.h
@@ -175,7 +175,7 @@ struct GNUNET_TESTBED_ControllerLinkRequest
175 */ 175 */
176struct GNUNET_TESTBED_ControllerLinkResponse 176struct GNUNET_TESTBED_ControllerLinkResponse
177{ 177{
178 178
179 /** 179 /**
180 * Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT 180 * Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT
181 */ 181 */
@@ -453,7 +453,7 @@ struct GNUNET_TESTBED_RemoteOverlayConnectMessage
453 /** 453 /**
454 * To be followed by the HELLO message of A 454 * To be followed by the HELLO message of A
455 */ 455 */
456 struct GNUNET_MessageHeader hello[0]; 456 struct GNUNET_MessageHeader hello[0];
457 // FIXME: we usually do not use this gcc-hack as some 457 // FIXME: we usually do not use this gcc-hack as some
458 // compilers / tools really get messed up by it... 458 // compilers / tools really get messed up by it...
459 459
@@ -763,7 +763,7 @@ struct GNUNET_TESTBED_ManagePeerServiceMessage
763 * set this to 1 to start the service; 0 to stop the service 763 * set this to 1 to start the service; 0 to stop the service
764 */ 764 */
765 uint8_t start; 765 uint8_t start;
766 766
767 /** 767 /**
768 * The NULL-terminated name of the service to start/stop follows here 768 * The NULL-terminated name of the service to start/stop follows here
769 */ 769 */
@@ -830,7 +830,7 @@ struct GNUNET_TESTBED_BarrierStatusMsg
830 * Type is GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS 830 * Type is GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS
831 */ 831 */
832 struct GNUNET_MessageHeader header; 832 struct GNUNET_MessageHeader header;
833 833
834 /** 834 /**
835 * status. Use enumerated values of enum BarrierStatus 835 * status. Use enumerated values of enum BarrierStatus
836 */ 836 */
@@ -840,7 +840,7 @@ struct GNUNET_TESTBED_BarrierStatusMsg
840 * strlen of the barrier name 840 * strlen of the barrier name
841 */ 841 */
842 uint16_t name_len GNUNET_PACKED; 842 uint16_t name_len GNUNET_PACKED;
843 843
844 /** 844 /**
845 * the barrier name (NULL terminated) concatenated with an error message (NULL 845 * the barrier name (NULL terminated) concatenated with an error message (NULL
846 * terminated) if the status were to indicate an error 846 * terminated) if the status were to indicate an error
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index 3539eae03..2ee17c9e0 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -202,7 +202,7 @@ exop_insert (struct GNUNET_TESTBED_Operation *op)
202 202
203 entry = GNUNET_malloc (sizeof (struct ExpireOperationEntry)); 203 entry = GNUNET_malloc (sizeof (struct ExpireOperationEntry));
204 entry->op = op; 204 entry->op = op;
205 GNUNET_CONTAINER_DLL_insert_tail (exop_head, exop_tail, entry); 205 GNUNET_CONTAINER_DLL_insert_tail (exop_head, exop_tail, entry);
206} 206}
207 207
208 208
@@ -281,7 +281,7 @@ opc_search_iterator (void *cls, uint32_t key, void *value)
281{ 281{
282 struct SearchContext *sc = cls; 282 struct SearchContext *sc = cls;
283 struct OperationContext *opc = value; 283 struct OperationContext *opc = value;
284 284
285 GNUNET_assert (NULL != opc); 285 GNUNET_assert (NULL != opc);
286 GNUNET_assert (NULL == sc->opc); 286 GNUNET_assert (NULL == sc->opc);
287 if (opc->id != sc->id) 287 if (opc->id != sc->id)
@@ -307,7 +307,7 @@ find_opc (const struct GNUNET_TESTBED_Controller *c, const uint64_t id)
307 sc.id = id; 307 sc.id = id;
308 sc.opc = NULL; 308 sc.opc = NULL;
309 GNUNET_assert (NULL != c->opc_map); 309 GNUNET_assert (NULL != c->opc_map);
310 if (GNUNET_SYSERR != 310 if (GNUNET_SYSERR !=
311 GNUNET_CONTAINER_multihashmap32_get_multiple (c->opc_map, (uint32_t) id, 311 GNUNET_CONTAINER_multihashmap32_get_multiple (c->opc_map, (uint32_t) id,
312 &opc_search_iterator, &sc)) 312 &opc_search_iterator, &sc))
313 return NULL; 313 return NULL;
@@ -330,7 +330,7 @@ GNUNET_TESTBED_insert_opc_ (struct GNUNET_TESTBED_Controller *c,
330 if (NULL == c->opc_map) 330 if (NULL == c->opc_map)
331 c->opc_map = GNUNET_CONTAINER_multihashmap32_create (256); 331 c->opc_map = GNUNET_CONTAINER_multihashmap32_create (256);
332 GNUNET_assert (GNUNET_OK == 332 GNUNET_assert (GNUNET_OK ==
333 GNUNET_CONTAINER_multihashmap32_put (c->opc_map, 333 GNUNET_CONTAINER_multihashmap32_put (c->opc_map,
334 (uint32_t) opc->id, opc, 334 (uint32_t) opc->id, opc,
335 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); 335 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
336} 336}
@@ -341,7 +341,7 @@ GNUNET_TESTBED_insert_opc_ (struct GNUNET_TESTBED_Controller *c,
341 * given controller 341 * given controller
342 * 342 *
343 * @param c the controller 343 * @param c the controller
344 * @param opc the operation context to remove 344 * @param opc the operation context to remove
345 */ 345 */
346void 346void
347GNUNET_TESTBED_remove_opc_ (const struct GNUNET_TESTBED_Controller *c, 347GNUNET_TESTBED_remove_opc_ (const struct GNUNET_TESTBED_Controller *c,
@@ -465,7 +465,7 @@ handle_opsuccess (struct GNUNET_TESTBED_Controller *c,
465 } 465 }
466 GNUNET_TESTBED_remove_opc_ (opc->c, opc); 466 GNUNET_TESTBED_remove_opc_ (opc->c, opc);
467 opc->state = OPC_STATE_FINISHED; 467 opc->state = OPC_STATE_FINISHED;
468 exop_insert (event.op); 468 exop_insert (event.op);
469 if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED))) 469 if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
470 { 470 {
471 if (NULL != c->cc) 471 if (NULL != c->cc)
@@ -611,7 +611,7 @@ handle_peer_event (struct GNUNET_TESTBED_Controller *c,
611 if (0 != (mask & c->event_mask)) 611 if (0 != (mask & c->event_mask))
612 { 612 {
613 if (NULL != c->cc) 613 if (NULL != c->cc)
614 c->cc (c->cc_cls, &event); 614 c->cc (c->cc_cls, &event);
615 if (GNUNET_NO == exop_check (event.op)) 615 if (GNUNET_NO == exop_check (event.op))
616 return GNUNET_YES; 616 return GNUNET_YES;
617 } 617 }
@@ -689,7 +689,7 @@ handle_peer_conevent (struct GNUNET_TESTBED_Controller *c,
689 c->cc (c->cc_cls, &event); 689 c->cc (c->cc_cls, &event);
690 if (GNUNET_NO == exop_check (event.op)) 690 if (GNUNET_NO == exop_check (event.op))
691 return GNUNET_YES; 691 return GNUNET_YES;
692 } 692 }
693 if (NULL != cb) 693 if (NULL != cb)
694 cb (cb_cls, opc->op, NULL); 694 cb (cb_cls, opc->op, NULL);
695 /* You could have marked the operation as done by now */ 695 /* You could have marked the operation as done by now */
@@ -738,12 +738,12 @@ handle_peer_config (struct GNUNET_TESTBED_Controller *c,
738 GNUNET_assert (NULL != peer); 738 GNUNET_assert (NULL != peer);
739 GNUNET_assert (ntohl (msg->peer_id) == peer->unique_id); 739 GNUNET_assert (ntohl (msg->peer_id) == peer->unique_id);
740 pinfo = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerInformation)); 740 pinfo = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerInformation));
741 pinfo->pit = data->pit; 741 pinfo->pit = data->pit;
742 cb = data->cb; 742 cb = data->cb;
743 cb_cls = data->cb_cls; 743 cb_cls = data->cb_cls;
744 GNUNET_assert (NULL != cb); 744 GNUNET_assert (NULL != cb);
745 GNUNET_free (data); 745 GNUNET_free (data);
746 opc->data = NULL; 746 opc->data = NULL;
747 switch (pinfo->pit) 747 switch (pinfo->pit)
748 { 748 {
749 case GNUNET_TESTBED_PIT_IDENTITY: 749 case GNUNET_TESTBED_PIT_IDENTITY:
@@ -760,7 +760,7 @@ handle_peer_config (struct GNUNET_TESTBED_Controller *c,
760 break; 760 break;
761 } 761 }
762 opc->data = pinfo; 762 opc->data = pinfo;
763 GNUNET_TESTBED_remove_opc_ (opc->c, opc); 763 GNUNET_TESTBED_remove_opc_ (opc->c, opc);
764 opc->state = OPC_STATE_FINISHED; 764 opc->state = OPC_STATE_FINISHED;
765 cb (cb_cls, opc->op, pinfo, NULL); 765 cb (cb_cls, opc->op, pinfo, NULL);
766 /* We dont check whether the operation is marked as done here as the 766 /* We dont check whether the operation is marked as done here as the
@@ -871,7 +871,7 @@ handle_op_fail_event (struct GNUNET_TESTBED_Controller *c,
871 case OP_FORWARDED: 871 case OP_FORWARDED:
872 GNUNET_assert (0); 872 GNUNET_assert (0);
873 case OP_LINK_CONTROLLERS: /* No secondary callback */ 873 case OP_LINK_CONTROLLERS: /* No secondary callback */
874 break; 874 break;
875 case OP_SHUTDOWN_PEERS: 875 case OP_SHUTDOWN_PEERS:
876 { 876 {
877 struct ShutdownPeersData *data; 877 struct ShutdownPeersData *data;
@@ -1156,7 +1156,7 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
1156 msg); 1156 msg);
1157 break; 1157 break;
1158 case GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT: 1158 case GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT:
1159 status = 1159 status =
1160 handle_link_controllers_result (c, 1160 handle_link_controllers_result (c,
1161 (const struct 1161 (const struct
1162 GNUNET_TESTBED_ControllerLinkResponse 1162 GNUNET_TESTBED_ControllerLinkResponse
@@ -1365,7 +1365,7 @@ oprelease_link_controllers (void *cls)
1365 switch (opc->state) 1365 switch (opc->state)
1366 { 1366 {
1367 case OPC_STATE_INIT: 1367 case OPC_STATE_INIT:
1368 GNUNET_free (data->msg); 1368 GNUNET_free (data->msg);
1369 break; 1369 break;
1370 case OPC_STATE_STARTED: 1370 case OPC_STATE_STARTED:
1371 GNUNET_TESTBED_remove_opc_ (opc->c, opc); 1371 GNUNET_TESTBED_remove_opc_ (opc->c, opc);
@@ -1543,7 +1543,7 @@ opc_free_iterator (void *cls, uint32_t key, void *value)
1543 1543
1544 GNUNET_assert (NULL != opc); 1544 GNUNET_assert (NULL != opc);
1545 GNUNET_break (0); 1545 GNUNET_break (0);
1546 GNUNET_assert (GNUNET_YES == 1546 GNUNET_assert (GNUNET_YES ==
1547 GNUNET_CONTAINER_multihashmap32_remove (map, key, value)); 1547 GNUNET_CONTAINER_multihashmap32_remove (map, key, value));
1548 GNUNET_free (opc); 1548 GNUNET_free (opc);
1549 return GNUNET_YES; 1549 return GNUNET_YES;
@@ -1638,7 +1638,7 @@ GNUNET_TESTBED_compress_cfg_ (const struct GNUNET_CONFIGURATION_Handle *cfg,
1638 char *xconfig; 1638 char *xconfig;
1639 size_t size_; 1639 size_t size_;
1640 size_t xsize_; 1640 size_t xsize_;
1641 1641
1642 config = GNUNET_CONFIGURATION_serialize (cfg, &size_); 1642 config = GNUNET_CONFIGURATION_serialize (cfg, &size_);
1643 xsize_ = GNUNET_TESTBED_compress_config_ (config, size_, &xconfig); 1643 xsize_ = GNUNET_TESTBED_compress_config_ (config, size_, &xconfig);
1644 GNUNET_free (config); 1644 GNUNET_free (config);
@@ -1689,7 +1689,7 @@ GNUNET_TESTBED_controller_link (void *op_cls,
1689 uint32_t slave_host_id; 1689 uint32_t slave_host_id;
1690 uint32_t delegated_host_id; 1690 uint32_t delegated_host_id;
1691 uint16_t msg_size; 1691 uint16_t msg_size;
1692 1692
1693 GNUNET_assert (GNUNET_YES == 1693 GNUNET_assert (GNUNET_YES ==
1694 GNUNET_TESTBED_is_host_registered_ (delegated_host, master)); 1694 GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
1695 slave_host_id = 1695 slave_host_id =
@@ -1875,7 +1875,7 @@ GNUNET_TESTBED_create_helper_init_msg_ (const char *trusted_ip,
1875 * cancels the operation, frees its resources and ensures the no event is 1875 * cancels the operation, frees its resources and ensures the no event is
1876 * generated with respect to this operation. Note that however cancelling an 1876 * generated with respect to this operation. Note that however cancelling an
1877 * operation does NOT guarantee that the operation will be fully undone (or that 1877 * operation does NOT guarantee that the operation will be fully undone (or that
1878 * nothing ever happened). 1878 * nothing ever happened).
1879 * 1879 *
1880 * This function MUST be called for every operation to fully remove the 1880 * This function MUST be called for every operation to fully remove the
1881 * operation from the operation queue. After calling this function, if 1881 * operation from the operation queue. After calling this function, if
@@ -1949,11 +1949,11 @@ GNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg)
1949 { 1949 {
1950 const struct GNUNET_TESTBED_AddHostMessage *imsg; 1950 const struct GNUNET_TESTBED_AddHostMessage *imsg;
1951 uint16_t osize; 1951 uint16_t osize;
1952 1952
1953 imsg = (const struct GNUNET_TESTBED_AddHostMessage *) msg; 1953 imsg = (const struct GNUNET_TESTBED_AddHostMessage *) msg;
1954 data_len = (uLong) ntohs (imsg->config_size); 1954 data_len = (uLong) ntohs (imsg->config_size);
1955 osize = sizeof (struct GNUNET_TESTBED_AddHostMessage) + 1955 osize = sizeof (struct GNUNET_TESTBED_AddHostMessage) +
1956 ntohs (imsg->username_length) + ntohs (imsg->hostname_length); 1956 ntohs (imsg->username_length) + ntohs (imsg->hostname_length);
1957 xdata_len = ntohs (imsg->header.size) - osize; 1957 xdata_len = ntohs (imsg->header.size) - osize;
1958 xdata = (const Bytef *) ((const void *) imsg + osize); 1958 xdata = (const Bytef *) ((const void *) imsg + osize);
1959 } 1959 }
@@ -1961,10 +1961,10 @@ GNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg)
1961 case GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT: 1961 case GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT:
1962 { 1962 {
1963 const struct GNUNET_TESTBED_ControllerLinkResponse *imsg; 1963 const struct GNUNET_TESTBED_ControllerLinkResponse *imsg;
1964 1964
1965 imsg = (const struct GNUNET_TESTBED_ControllerLinkResponse *) msg; 1965 imsg = (const struct GNUNET_TESTBED_ControllerLinkResponse *) msg;
1966 data_len = ntohs (imsg->config_size); 1966 data_len = ntohs (imsg->config_size);
1967 xdata_len = ntohs (imsg->header.size) - 1967 xdata_len = ntohs (imsg->header.size) -
1968 sizeof (const struct GNUNET_TESTBED_ControllerLinkResponse); 1968 sizeof (const struct GNUNET_TESTBED_ControllerLinkResponse);
1969 xdata = (const Bytef *) &imsg[1]; 1969 xdata = (const Bytef *) &imsg[1];
1970 } 1970 }
@@ -2077,7 +2077,7 @@ opstart_shutdown_peers (void *cls)
2077 2077
2078 opc->state = OPC_STATE_STARTED; 2078 opc->state = OPC_STATE_STARTED;
2079 msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_ShutdownPeersMessage)); 2079 msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_ShutdownPeersMessage));
2080 msg->header.size = 2080 msg->header.size =
2081 htons (sizeof (struct GNUNET_TESTBED_ShutdownPeersMessage)); 2081 htons (sizeof (struct GNUNET_TESTBED_ShutdownPeersMessage));
2082 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS); 2082 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS);
2083 msg->operation_id = GNUNET_htonll (opc->id); 2083 msg->operation_id = GNUNET_htonll (opc->id);
@@ -2146,7 +2146,7 @@ GNUNET_TESTBED_shutdown_peers (struct GNUNET_TESTBED_Controller *c,
2146 opc->data = data; 2146 opc->data = data;
2147 opc->id = GNUNET_TESTBED_get_next_op_id (c); 2147 opc->id = GNUNET_TESTBED_get_next_op_id (c);
2148 opc->type = OP_SHUTDOWN_PEERS; 2148 opc->type = OP_SHUTDOWN_PEERS;
2149 opc->state = OPC_STATE_INIT; 2149 opc->state = OPC_STATE_INIT;
2150 opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_shutdown_peers, 2150 opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_shutdown_peers,
2151 &oprelease_shutdown_peers); 2151 &oprelease_shutdown_peers);
2152 GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations, 2152 GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations,
diff --git a/src/testbed/testbed_api.h b/src/testbed/testbed_api.h
index 3b6678c56..46a9bc203 100644
--- a/src/testbed/testbed_api.h
+++ b/src/testbed/testbed_api.h
@@ -94,7 +94,7 @@ enum OperationType
94 OP_GET_SLAVE_CONFIG, 94 OP_GET_SLAVE_CONFIG,
95 95
96 /** 96 /**
97 * Stop and destroy all peers 97 * Stop and destroy all peers
98 */ 98 */
99 OP_SHUTDOWN_PEERS, 99 OP_SHUTDOWN_PEERS,
100 100
@@ -320,7 +320,7 @@ GNUNET_TESTBED_insert_opc_ (struct GNUNET_TESTBED_Controller *c,
320 * given controller 320 * given controller
321 * 321 *
322 * @param c the controller 322 * @param c the controller
323 * @param opc the operation context to remove 323 * @param opc the operation context to remove
324 */ 324 */
325void 325void
326GNUNET_TESTBED_remove_opc_ (const struct GNUNET_TESTBED_Controller *c, 326GNUNET_TESTBED_remove_opc_ (const struct GNUNET_TESTBED_Controller *c,
diff --git a/src/testbed/testbed_api_barriers.c b/src/testbed/testbed_api_barriers.c
index 2a197719f..2ec34bb1b 100644
--- a/src/testbed/testbed_api_barriers.c
+++ b/src/testbed/testbed_api_barriers.c
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file testbed/testbed_api_barriers.c 22 * @file testbed/testbed_api_barriers.c
23 * @brief API implementation for testbed barriers 23 * @brief API implementation for testbed barriers
24 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 24 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 */ 25 */
26 26
27#include "platform.h" 27#include "platform.h"
@@ -55,7 +55,7 @@ struct GNUNET_TESTBED_Barrier
55 * The controller handle given while initiliasing this barrier 55 * The controller handle given while initiliasing this barrier
56 */ 56 */
57 struct GNUNET_TESTBED_Controller *c; 57 struct GNUNET_TESTBED_Controller *c;
58 58
59 /** 59 /**
60 * The name of the barrier 60 * The name of the barrier
61 */ 61 */
@@ -70,7 +70,7 @@ struct GNUNET_TESTBED_Barrier
70 * the closure for the above callback 70 * the closure for the above callback
71 */ 71 */
72 void *cls; 72 void *cls;
73 73
74 /** 74 /**
75 * Should the barrier crossed status message be echoed back to the controller? 75 * Should the barrier crossed status message be echoed back to the controller?
76 */ 76 */
@@ -125,15 +125,15 @@ GNUNET_TESTBED_handle_barrier_status_ (struct GNUNET_TESTBED_Controller *c,
125 struct GNUNET_TESTBED_Barrier *barrier; 125 struct GNUNET_TESTBED_Barrier *barrier;
126 char *emsg; 126 char *emsg;
127 const char *name; 127 const char *name;
128 struct GNUNET_HashCode key; 128 struct GNUNET_HashCode key;
129 size_t emsg_len; 129 size_t emsg_len;
130 int status; 130 int status;
131 uint16_t msize; 131 uint16_t msize;
132 uint16_t name_len; 132 uint16_t name_len;
133 133
134 emsg = NULL; 134 emsg = NULL;
135 barrier = NULL; 135 barrier = NULL;
136 msize = ntohs (msg->header.size); 136 msize = ntohs (msg->header.size);
137 name = msg->data; 137 name = msg->data;
138 name_len = ntohs (msg->name_len); 138 name_len = ntohs (msg->name_len);
139 LOG_DEBUG ("Received BARRIER_STATUS msg\n"); 139 LOG_DEBUG ("Received BARRIER_STATUS msg\n");
@@ -219,7 +219,7 @@ GNUNET_TESTBED_barrier_init_ (struct GNUNET_TESTBED_Controller *controller,
219 struct GNUNET_HashCode key; 219 struct GNUNET_HashCode key;
220 size_t name_len; 220 size_t name_len;
221 uint16_t msize; 221 uint16_t msize;
222 222
223 GNUNET_assert (quorum <= 100); 223 GNUNET_assert (quorum <= 100);
224 GNUNET_assert (NULL != cb); 224 GNUNET_assert (NULL != cb);
225 name_len = strlen (name); 225 name_len = strlen (name);
@@ -310,11 +310,11 @@ struct GNUNET_TESTBED_BarrierWaitHandle
310 * The name of the barrier 310 * The name of the barrier
311 */ 311 */
312 char *name; 312 char *name;
313 313
314 /** 314 /**
315 * Then configuration used for the client connection 315 * Then configuration used for the client connection
316 */ 316 */
317 struct GNUNET_CONFIGURATION_Handle *cfg; 317 struct GNUNET_CONFIGURATION_Handle *cfg;
318 318
319 /** 319 /**
320 * The client connection 320 * The client connection
@@ -376,7 +376,7 @@ receive_handler (void *cls, const struct GNUNET_MessageHeader *message)
376 struct GNUNET_TESTBED_BarrierWaitHandle *h = cls; 376 struct GNUNET_TESTBED_BarrierWaitHandle *h = cls;
377 const struct GNUNET_TESTBED_BarrierStatusMsg *msg; 377 const struct GNUNET_TESTBED_BarrierStatusMsg *msg;
378 uint16_t msize; 378 uint16_t msize;
379 379
380 if (NULL == message) 380 if (NULL == message)
381 { 381 {
382 GNUNET_break_op (0); 382 GNUNET_break_op (0);
@@ -386,13 +386,13 @@ receive_handler (void *cls, const struct GNUNET_MessageHeader *message)
386 { 386 {
387 GNUNET_break_op (0); 387 GNUNET_break_op (0);
388 goto fail; 388 goto fail;
389 } 389 }
390 msize = ntohs (message->size); 390 msize = ntohs (message->size);
391 if (msize <= sizeof (struct GNUNET_TESTBED_BarrierStatusMsg)) 391 if (msize <= sizeof (struct GNUNET_TESTBED_BarrierStatusMsg))
392 { 392 {
393 GNUNET_break_op (0); 393 GNUNET_break_op (0);
394 goto fail; 394 goto fail;
395 } 395 }
396 msg = (const struct GNUNET_TESTBED_BarrierStatusMsg *) message; 396 msg = (const struct GNUNET_TESTBED_BarrierStatusMsg *) message;
397 switch (ntohs (msg->status)) 397 switch (ntohs (msg->status))
398 { 398 {
@@ -432,7 +432,7 @@ transmit_notify (void *cls, size_t size, void *buf)
432{ 432{
433 struct GNUNET_TESTBED_BarrierWaitHandle *h = cls; 433 struct GNUNET_TESTBED_BarrierWaitHandle *h = cls;
434 uint16_t msize; 434 uint16_t msize;
435 435
436 h->tx = NULL; 436 h->tx = NULL;
437 if ((0 == size) || (NULL == buf)) 437 if ((0 == size) || (NULL == buf))
438 { 438 {
@@ -507,7 +507,7 @@ GNUNET_TESTBED_barrier_wait (const char *name,
507 msg->header.size = htons (msize); 507 msg->header.size = htons (msize);
508 (void) memcpy (msg->name, name, name_len); 508 (void) memcpy (msg->name, name, name_len);
509 h->msg = &msg->header; 509 h->msg = &msg->header;
510 h->tx = 510 h->tx =
511 GNUNET_CLIENT_notify_transmit_ready (h->conn, msize, 511 GNUNET_CLIENT_notify_transmit_ready (h->conn, msize,
512 GNUNET_TIME_UNIT_FOREVER_REL, 512 GNUNET_TIME_UNIT_FOREVER_REL,
513 GNUNET_NO, 513 GNUNET_NO,
diff --git a/src/testbed/testbed_api_barriers.h b/src/testbed/testbed_api_barriers.h
index 89aa56ca5..708b2db04 100644
--- a/src/testbed/testbed_api_barriers.h
+++ b/src/testbed/testbed_api_barriers.h
@@ -22,7 +22,7 @@
22 * @file testbed/testbed_api_barriers.h 22 * @file testbed/testbed_api_barriers.h
23 * @brief interface for barriers API function that are used internally (not 23 * @brief interface for barriers API function that are used internally (not
24 * exposed as user API) 24 * exposed as user API)
25 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 25 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
26 */ 26 */
27 27
28#include "gnunet_testbed_service.h" 28#include "gnunet_testbed_service.h"
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c
index e8417c0d8..51bd632c7 100644
--- a/src/testbed/testbed_api_hosts.c
+++ b/src/testbed/testbed_api_hosts.c
@@ -318,7 +318,7 @@ GNUNET_TESTBED_host_replace_cfg_ (struct GNUNET_TESTBED_Host *host,
318 */ 318 */
319struct GNUNET_TESTBED_Host * 319struct GNUNET_TESTBED_Host *
320GNUNET_TESTBED_host_create_with_id (uint32_t id, const char *hostname, 320GNUNET_TESTBED_host_create_with_id (uint32_t id, const char *hostname,
321 const char *username, 321 const char *username,
322 const struct GNUNET_CONFIGURATION_Handle 322 const struct GNUNET_CONFIGURATION_Handle
323 *cfg, 323 *cfg,
324 uint16_t port) 324 uint16_t port)
@@ -338,7 +338,7 @@ GNUNET_TESTBED_host_create_with_id (uint32_t id, const char *hostname,
338 host->port = (0 == port) ? 22 : port; 338 host->port = (0 == port) ? 22 : port;
339 host->cfg = GNUNET_CONFIGURATION_dup (cfg); 339 host->cfg = GNUNET_CONFIGURATION_dup (cfg);
340 host->opq_parallel_overlay_connect_operations = 340 host->opq_parallel_overlay_connect_operations =
341 GNUNET_TESTBED_operation_queue_create_ (OPERATION_QUEUE_TYPE_ADAPTIVE, 341 GNUNET_TESTBED_operation_queue_create_ (OPERATION_QUEUE_TYPE_ADAPTIVE,
342 UINT_MAX); 342 UINT_MAX);
343 new_size = host_list_size; 343 new_size = host_list_size;
344 while (id >= new_size) 344 while (id >= new_size)
@@ -371,7 +371,7 @@ GNUNET_TESTBED_host_create (const char *hostname, const char *username,
371 static uint32_t uid_generator; 371 static uint32_t uid_generator;
372 372
373 if (NULL == hostname) 373 if (NULL == hostname)
374 return GNUNET_TESTBED_host_create_with_id (0, hostname, username, 374 return GNUNET_TESTBED_host_create_with_id (0, hostname, username,
375 cfg, port); 375 cfg, port);
376 return GNUNET_TESTBED_host_create_with_id (++uid_generator, hostname, 376 return GNUNET_TESTBED_host_create_with_id (++uid_generator, hostname,
377 username, cfg, port); 377 username, cfg, port);
@@ -398,7 +398,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
398 //struct GNUNET_TESTBED_Host **host_array; 398 //struct GNUNET_TESTBED_Host **host_array;
399 struct GNUNET_TESTBED_Host *starting_host; 399 struct GNUNET_TESTBED_Host *starting_host;
400 char *data; 400 char *data;
401 char *buf; 401 char *buf;
402 char *username; 402 char *username;
403 char *hostname; 403 char *hostname;
404 regex_t rex; 404 regex_t rex;
@@ -417,12 +417,12 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
417 } 417 }
418 if (GNUNET_OK != 418 if (GNUNET_OK !=
419 GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES)) 419 GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES))
420 fs = 0; 420 fs = 0;
421 if (0 == fs) 421 if (0 == fs)
422 { 422 {
423 LOG (GNUNET_ERROR_TYPE_WARNING, _("Hosts file %s has no data\n"), filename); 423 LOG (GNUNET_ERROR_TYPE_WARNING, _("Hosts file %s has no data\n"), filename);
424 return 0; 424 return 0;
425 } 425 }
426 data = GNUNET_malloc (fs); 426 data = GNUNET_malloc (fs);
427 if (fs != GNUNET_DISK_fn_read (filename, data, fs)) 427 if (fs != GNUNET_DISK_fn_read (filename, data, fs))
428 { 428 {
@@ -440,9 +440,9 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
440 "^(([[:alnum:]]+)@)?" /* username */ 440 "^(([[:alnum:]]+)@)?" /* username */
441 "([[:alnum:]]+[-[:alnum:]_\\.]+)" /* hostname */ 441 "([[:alnum:]]+[-[:alnum:]_\\.]+)" /* hostname */
442 "(:([[:digit:]]{1,5}))?", /* port */ 442 "(:([[:digit:]]{1,5}))?", /* port */
443 REG_EXTENDED | REG_ICASE)); 443 REG_EXTENDED | REG_ICASE));
444 while (offset < (fs - 1)) 444 while (offset < (fs - 1))
445 { 445 {
446 offset++; 446 offset++;
447 if (((data[offset] == '\n')) && (buf != &data[offset])) 447 if (((data[offset] == '\n')) && (buf != &data[offset]))
448 { 448 {
@@ -469,7 +469,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
469 } 469 }
470 if (-1 != pmatch[5].rm_so) 470 if (-1 != pmatch[5].rm_so)
471 { 471 {
472 (void) SSCANF (buf + pmatch[5].rm_so, "%5hd", &port); 472 (void) SSCANF (buf + pmatch[5].rm_so, "%5hd", &port);
473 } 473 }
474 size = pmatch[3].rm_eo - pmatch[3].rm_so; 474 size = pmatch[3].rm_eo - pmatch[3].rm_so;
475 hostname = GNUNET_malloc (size + 1); 475 hostname = GNUNET_malloc (size + 1);
@@ -489,7 +489,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
489 (void) GNUNET_TESTBED_host_create (hostname, username, cfg, port); 489 (void) GNUNET_TESTBED_host_create (hostname, username, cfg, port);
490 count++; 490 count++;
491 GNUNET_free_non_null (username); 491 GNUNET_free_non_null (username);
492 GNUNET_free (hostname); 492 GNUNET_free (hostname);
493 buf = &data[offset + 1]; 493 buf = &data[offset + 1];
494 } 494 }
495 else if ((data[offset] == '\n') || (data[offset] == '\0')) 495 else if ((data[offset] == '\n') || (data[offset] == '\0'))
@@ -516,7 +516,7 @@ const char *
516simple_resolve (const char *host) 516simple_resolve (const char *host)
517{ 517{
518 struct addrinfo *res; 518 struct addrinfo *res;
519 const struct sockaddr_in *in_addr; 519 const struct sockaddr_in *in_addr;
520 char *hostip; 520 char *hostip;
521 struct addrinfo hint; 521 struct addrinfo hint;
522 unsigned int rc; 522 unsigned int rc;
@@ -566,13 +566,13 @@ GNUNET_TESTBED_hosts_load_from_loadleveler (const struct
566 struct GNUNET_TESTBED_Host ***hosts) 566 struct GNUNET_TESTBED_Host ***hosts)
567{ 567{
568#if !ENABLE_LL 568#if !ENABLE_LL
569 LOG (GNUNET_ERROR_TYPE_ERROR, 569 LOG (GNUNET_ERROR_TYPE_ERROR,
570 _("The function %s is only available when compiled with (--with-ll)\n"), 570 _("The function %s is only available when compiled with (--with-ll)\n"),
571 __func__); 571 __func__);
572 GNUNET_assert (0); 572 GNUNET_assert (0);
573#else 573#else
574 const char *hostfile; 574 const char *hostfile;
575 575
576 if (NULL == (hostfile = getenv ("MP_SAVEHOSTFILE"))) 576 if (NULL == (hostfile = getenv ("MP_SAVEHOSTFILE")))
577 { 577 {
578 GNUNET_break (0); 578 GNUNET_break (0);
@@ -930,7 +930,7 @@ gen_rsh_suffix_args (const char * const *append_args)
930 } 930 }
931 if (NULL != append_args) 931 if (NULL != append_args)
932 { 932 {
933 for (append_cnt = 0; NULL != append_args[append_cnt]; append_cnt++) 933 for (append_cnt = 0; NULL != append_args[append_cnt]; append_cnt++)
934 GNUNET_array_append (rshell_args, cnt, GNUNET_strdup (append_args[append_cnt])); 934 GNUNET_array_append (rshell_args, cnt, GNUNET_strdup (append_args[append_cnt]));
935 } 935 }
936 GNUNET_array_append (rshell_args, cnt, NULL); 936 GNUNET_array_append (rshell_args, cnt, NULL);
@@ -1070,7 +1070,7 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip,
1070 static char *const binary_argv[] = { 1070 static char *const binary_argv[] = {
1071 HELPER_TESTBED_BINARY, NULL 1071 HELPER_TESTBED_BINARY, NULL
1072 }; 1072 };
1073 1073
1074 GNUNET_assert (NULL != host); 1074 GNUNET_assert (NULL != host);
1075 GNUNET_assert (NULL != (cfg = GNUNET_TESTBED_host_get_cfg_ (host))); 1075 GNUNET_assert (NULL != (cfg = GNUNET_TESTBED_host_get_cfg_ (host)));
1076 hostname = NULL; 1076 hostname = NULL;
@@ -1118,7 +1118,7 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip,
1118 argstr = GNUNET_strdup (""); 1118 argstr = GNUNET_strdup ("");
1119 for (cnt = 0; NULL != cp->helper_argv[cnt]; cnt++) 1119 for (cnt = 0; NULL != cp->helper_argv[cnt]; cnt++)
1120 { 1120 {
1121 aux = argstr; 1121 aux = argstr;
1122 GNUNET_assert (0 < GNUNET_asprintf (&argstr, "%s %s", aux, cp->helper_argv[cnt])); 1122 GNUNET_assert (0 < GNUNET_asprintf (&argstr, "%s %s", aux, cp->helper_argv[cnt]));
1123 GNUNET_free (aux); 1123 GNUNET_free (aux);
1124 } 1124 }
@@ -1334,7 +1334,7 @@ GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host,
1334 "HELPER_BINARY_PATH", 1334 "HELPER_BINARY_PATH",
1335 &stat_args[1])) 1335 &stat_args[1]))
1336 stat_args[1] = 1336 stat_args[1] =
1337 GNUNET_OS_get_libexec_binary_path (HELPER_TESTBED_BINARY); 1337 GNUNET_OS_get_libexec_binary_path (HELPER_TESTBED_BINARY);
1338 GNUNET_asprintf (&port, "%u", host->port); 1338 GNUNET_asprintf (&port, "%u", host->port);
1339 rsh_args = gen_rsh_args (port, hostname, host->username); 1339 rsh_args = gen_rsh_args (port, hostname, host->username);
1340 GNUNET_free (port); 1340 GNUNET_free (port);
@@ -1523,12 +1523,12 @@ GNUNET_TESTBED_cancel_registration (struct GNUNET_TESTBED_HostRegistrationHandle
1523 * 1523 *
1524 * @param h the host handle 1524 * @param h the host handle
1525 * @param op the operation to queue in the given host's parally overlay connect 1525 * @param op the operation to queue in the given host's parally overlay connect
1526 * queue 1526 * queue
1527 */ 1527 */
1528void 1528void
1529GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h, 1529GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h,
1530 struct GNUNET_TESTBED_Operation *op) 1530 struct GNUNET_TESTBED_Operation *op)
1531{ 1531{
1532 GNUNET_TESTBED_operation_queue_insert_ 1532 GNUNET_TESTBED_operation_queue_insert_
1533 (h->opq_parallel_overlay_connect_operations, op); 1533 (h->opq_parallel_overlay_connect_operations, op);
1534} 1534}
diff --git a/src/testbed/testbed_api_hosts.h b/src/testbed/testbed_api_hosts.h
index a1cbb5b88..f83ffd148 100644
--- a/src/testbed/testbed_api_hosts.h
+++ b/src/testbed/testbed_api_hosts.h
@@ -156,10 +156,10 @@ GNUNET_TESTBED_is_host_registered_ (const struct GNUNET_TESTBED_Host *host,
156 * 156 *
157 * @param h the host handle 157 * @param h the host handle
158 * @param op the operation to queue in the given host's parally overlay connect 158 * @param op the operation to queue in the given host's parally overlay connect
159 * queue 159 * queue
160 */ 160 */
161void 161void
162GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h, 162GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h,
163 struct GNUNET_TESTBED_Operation *op); 163 struct GNUNET_TESTBED_Operation *op);
164 164
165 165
diff --git a/src/testbed/testbed_api_operations.c b/src/testbed/testbed_api_operations.c
index ce715785f..e3e9bb83d 100644
--- a/src/testbed/testbed_api_operations.c
+++ b/src/testbed/testbed_api_operations.c
@@ -115,7 +115,7 @@ struct FeedbackCtx
115 * Head for DLL of time slots which are free to be allocated to operations 115 * Head for DLL of time slots which are free to be allocated to operations
116 */ 116 */
117 struct TimeSlot *alloc_head; 117 struct TimeSlot *alloc_head;
118 118
119 /** 119 /**
120 * Tail for DLL of time slots which are free to be allocated to operations 120 * Tail for DLL of time slots which are free to be allocated to operations
121 */ 121 */
@@ -131,7 +131,7 @@ struct FeedbackCtx
131 * Number of time slots filled so far 131 * Number of time slots filled so far
132 */ 132 */
133 unsigned int tslots_filled; 133 unsigned int tslots_filled;
134 134
135 /** 135 /**
136 * Bound on the maximum number of operations which can be active 136 * Bound on the maximum number of operations which can be active
137 */ 137 */
@@ -267,7 +267,7 @@ struct ReadyQueueEntry
267 * next ptr for DLL 267 * next ptr for DLL
268 */ 268 */
269 struct ReadyQueueEntry *next; 269 struct ReadyQueueEntry *next;
270 270
271 /** 271 /**
272 * prev ptr for DLL 272 * prev ptr for DLL
273 */ 273 */
@@ -407,7 +407,7 @@ remove_queue_entry (struct GNUNET_TESTBED_Operation *op, unsigned int index)
407{ 407{
408 struct OperationQueue *opq; 408 struct OperationQueue *opq;
409 struct QueueEntry *entry; 409 struct QueueEntry *entry;
410 410
411 opq = op->queues[index]; 411 opq = op->queues[index];
412 entry = op->qentries[index]; 412 entry = op->qentries[index];
413 switch (op->state) 413 switch (op->state)
@@ -445,7 +445,7 @@ change_state (struct GNUNET_TESTBED_Operation *op, enum OperationState state)
445 struct OperationQueue *opq; 445 struct OperationQueue *opq;
446 unsigned int cnt; 446 unsigned int cnt;
447 unsigned int s; 447 unsigned int s;
448 448
449 GNUNET_assert (OP_STATE_INIT != state); 449 GNUNET_assert (OP_STATE_INIT != state);
450 GNUNET_assert (NULL != op->queues); 450 GNUNET_assert (NULL != op->queues);
451 GNUNET_assert (NULL != op->nres); 451 GNUNET_assert (NULL != op->nres);
@@ -459,7 +459,7 @@ change_state (struct GNUNET_TESTBED_Operation *op, enum OperationState state)
459 entry->op = op; 459 entry->op = op;
460 entry->nres = op->nres[cnt]; 460 entry->nres = op->nres[cnt];
461 s = cnt; 461 s = cnt;
462 GNUNET_array_append (op->qentries, s, entry); 462 GNUNET_array_append (op->qentries, s, entry);
463 } 463 }
464 else 464 else
465 { 465 {
@@ -498,7 +498,7 @@ change_state (struct GNUNET_TESTBED_Operation *op, enum OperationState state)
498 */ 498 */
499static void 499static void
500rq_remove (struct GNUNET_TESTBED_Operation *op) 500rq_remove (struct GNUNET_TESTBED_Operation *op)
501{ 501{
502 GNUNET_assert (NULL != op->rq_entry); 502 GNUNET_assert (NULL != op->rq_entry);
503 GNUNET_CONTAINER_DLL_remove (rq_head, rq_tail, op->rq_entry); 503 GNUNET_CONTAINER_DLL_remove (rq_head, rq_tail, op->rq_entry);
504 GNUNET_free (op->rq_entry); 504 GNUNET_free (op->rq_entry);
@@ -650,7 +650,7 @@ decide_capacity (struct OperationQueue *opq,
650 } 650 }
651 651
652 ret: 652 ret:
653 GNUNET_free_non_null (evict_entries); 653 GNUNET_free_non_null (evict_entries);
654 if (NULL != ops_) 654 if (NULL != ops_)
655 *ops_ = ops; 655 *ops_ = ops;
656 else 656 else
@@ -680,12 +680,12 @@ merge_ops (struct GNUNET_TESTBED_Operation ***old,
680 unsigned int i; 680 unsigned int i;
681 unsigned int j; 681 unsigned int j;
682 unsigned int n_cur; 682 unsigned int n_cur;
683 683
684 GNUNET_assert (NULL != old); 684 GNUNET_assert (NULL != old);
685 n_cur = *n_old; 685 n_cur = *n_old;
686 cur = *old; 686 cur = *old;
687 for (i = 0; i < n_new; i++) 687 for (i = 0; i < n_new; i++)
688 { 688 {
689 for (j = 0; j < *n_old; j++) 689 for (j = 0; j < *n_old; j++)
690 { 690 {
691 if (new[i] == cur[j]) 691 if (new[i] == cur[j])
@@ -698,7 +698,7 @@ merge_ops (struct GNUNET_TESTBED_Operation ***old,
698 *old = cur; 698 *old = cur;
699 *n_old = n_cur; 699 *n_old = n_cur;
700} 700}
701 701
702 702
703 703
704/** 704/**
@@ -732,12 +732,12 @@ check_readiness (struct GNUNET_TESTBED_Operation *op)
732 if (NULL == ops) 732 if (NULL == ops)
733 continue; 733 continue;
734 merge_ops (&evict_ops, &n_evict_ops, ops, n_ops); 734 merge_ops (&evict_ops, &n_evict_ops, ops, n_ops);
735 GNUNET_free (ops); 735 GNUNET_free (ops);
736 } 736 }
737 if (NULL != evict_ops) 737 if (NULL != evict_ops)
738 { 738 {
739 for (i = 0; i < n_evict_ops; i++) 739 for (i = 0; i < n_evict_ops; i++)
740 GNUNET_TESTBED_operation_release_ (evict_ops[i]); 740 GNUNET_TESTBED_operation_release_ (evict_ops[i]);
741 GNUNET_free (evict_ops); 741 GNUNET_free (evict_ops);
742 evict_ops = NULL; 742 evict_ops = NULL;
743 /* Evicting the operations should schedule this operation */ 743 /* Evicting the operations should schedule this operation */
@@ -767,7 +767,7 @@ defer (struct GNUNET_TESTBED_Operation *op)
767 for (i = 0; i < op->nqueues; i++) 767 for (i = 0; i < op->nqueues; i++)
768 { 768 {
769 GNUNET_assert (op->queues[i]->active >= op->nres[i]); 769 GNUNET_assert (op->queues[i]->active >= op->nres[i]);
770 op->queues[i]->active -= op->nres[i]; 770 op->queues[i]->active -= op->nres[i];
771 } 771 }
772 change_state (op, OP_STATE_WAITING); 772 change_state (op, OP_STATE_WAITING);
773} 773}
@@ -809,7 +809,7 @@ cleanup_tslots (struct OperationQueue *queue)
809 * Cleansup the existing timing slots and sets new timing slots in the given 809 * Cleansup the existing timing slots and sets new timing slots in the given
810 * queue to accommodate given number of max active operations. 810 * queue to accommodate given number of max active operations.
811 * 811 *
812 * @param queue the queue 812 * @param queue the queue
813 * @param n the number of maximum active operations. If n is greater than the 813 * @param n the number of maximum active operations. If n is greater than the
814 * maximum limit set while creating the queue, then the minimum of these two 814 * maximum limit set while creating the queue, then the minimum of these two
815 * will be selected as n 815 * will be selected as n
@@ -820,7 +820,7 @@ adaptive_queue_set_max_active (struct OperationQueue *queue, unsigned int n)
820 struct FeedbackCtx *fctx = queue->fctx; 820 struct FeedbackCtx *fctx = queue->fctx;
821 struct TimeSlot *tslot; 821 struct TimeSlot *tslot;
822 unsigned int cnt; 822 unsigned int cnt;
823 823
824 cleanup_tslots (queue); 824 cleanup_tslots (queue);
825 n = GNUNET_MIN (n ,fctx->max_active_bound); 825 n = GNUNET_MIN (n ,fctx->max_active_bound);
826 fctx->tslots_freeptr = GNUNET_malloc (n * sizeof (struct TimeSlot)); 826 fctx->tslots_freeptr = GNUNET_malloc (n * sizeof (struct TimeSlot));
@@ -872,7 +872,7 @@ adapt_parallelism (struct OperationQueue *queue)
872 return; 872 return;
873 } 873 }
874 avg = GNUNET_TIME_relative_divide (avg, nvals); 874 avg = GNUNET_TIME_relative_divide (avg, nvals);
875 if (GNUNET_SYSERR == 875 if (GNUNET_SYSERR ==
876 GNUNET_TESTBED_SD_deviation_factor_ (fctx->sd, 876 GNUNET_TESTBED_SD_deviation_factor_ (fctx->sd,
877 (unsigned int) avg.rel_value_us, 877 (unsigned int) avg.rel_value_us,
878 &sd)) 878 &sd))
@@ -923,14 +923,14 @@ update_tslots (struct GNUNET_TESTBED_Operation *op)
923 struct GNUNET_TIME_Relative t; 923 struct GNUNET_TIME_Relative t;
924 struct TimeSlot *tslot; 924 struct TimeSlot *tslot;
925 struct FeedbackCtx *fctx; 925 struct FeedbackCtx *fctx;
926 926
927 t = GNUNET_TIME_absolute_get_duration (op->tstart); 927 t = GNUNET_TIME_absolute_get_duration (op->tstart);
928 while (NULL != (tslot = op->tslots_head)) /* update time slots */ 928 while (NULL != (tslot = op->tslots_head)) /* update time slots */
929 { 929 {
930 queue = tslot->queue; 930 queue = tslot->queue;
931 fctx = queue->fctx; 931 fctx = queue->fctx;
932 GNUNET_CONTAINER_DLL_remove (op->tslots_head, op->tslots_tail, tslot); 932 GNUNET_CONTAINER_DLL_remove (op->tslots_head, op->tslots_tail, tslot);
933 tslot->op = NULL; 933 tslot->op = NULL;
934 GNUNET_CONTAINER_DLL_insert_tail (fctx->alloc_head, fctx->alloc_tail, 934 GNUNET_CONTAINER_DLL_insert_tail (fctx->alloc_head, fctx->alloc_tail,
935 tslot); 935 tslot);
936 if (op->failed) 936 if (op->failed)
@@ -1011,7 +1011,7 @@ void
1011GNUNET_TESTBED_operation_queue_destroy_ (struct OperationQueue *queue) 1011GNUNET_TESTBED_operation_queue_destroy_ (struct OperationQueue *queue)
1012{ 1012{
1013 struct FeedbackCtx *fctx; 1013 struct FeedbackCtx *fctx;
1014 1014
1015 GNUNET_break (GNUNET_YES == is_queue_empty (queue)); 1015 GNUNET_break (GNUNET_YES == is_queue_empty (queue));
1016 if (OPERATION_QUEUE_TYPE_ADAPTIVE == queue->type) 1016 if (OPERATION_QUEUE_TYPE_ADAPTIVE == queue->type)
1017 { 1017 {
@@ -1205,7 +1205,7 @@ GNUNET_TESTBED_operation_activate_ (struct GNUNET_TESTBED_Operation *op)
1205void 1205void
1206GNUNET_TESTBED_operation_release_ (struct GNUNET_TESTBED_Operation *op) 1206GNUNET_TESTBED_operation_release_ (struct GNUNET_TESTBED_Operation *op)
1207{ 1207{
1208 struct QueueEntry *entry; 1208 struct QueueEntry *entry;
1209 struct OperationQueue *opq; 1209 struct OperationQueue *opq;
1210 unsigned int i; 1210 unsigned int i;
1211 1211
@@ -1221,19 +1221,19 @@ GNUNET_TESTBED_operation_release_ (struct GNUNET_TESTBED_Operation *op)
1221 if (OP_STATE_ACTIVE == op->state) 1221 if (OP_STATE_ACTIVE == op->state)
1222 update_tslots (op); 1222 update_tslots (op);
1223 GNUNET_assert (NULL != op->queues); 1223 GNUNET_assert (NULL != op->queues);
1224 GNUNET_assert (NULL != op->qentries); 1224 GNUNET_assert (NULL != op->qentries);
1225 for (i = 0; i < op->nqueues; i++) 1225 for (i = 0; i < op->nqueues; i++)
1226 { 1226 {
1227 entry = op->qentries[i]; 1227 entry = op->qentries[i];
1228 remove_queue_entry (op, i); 1228 remove_queue_entry (op, i);
1229 opq = op->queues[i]; 1229 opq = op->queues[i];
1230 switch (op->state) 1230 switch (op->state)
1231 { 1231 {
1232 case OP_STATE_INIT: 1232 case OP_STATE_INIT:
1233 case OP_STATE_INACTIVE: 1233 case OP_STATE_INACTIVE:
1234 GNUNET_assert (0); 1234 GNUNET_assert (0);
1235 break; 1235 break;
1236 case OP_STATE_WAITING: 1236 case OP_STATE_WAITING:
1237 break; 1237 break;
1238 case OP_STATE_ACTIVE: 1238 case OP_STATE_ACTIVE:
1239 case OP_STATE_READY: 1239 case OP_STATE_READY:
@@ -1242,7 +1242,7 @@ GNUNET_TESTBED_operation_release_ (struct GNUNET_TESTBED_Operation *op)
1242 opq->active -= entry->nres; 1242 opq->active -= entry->nres;
1243 recheck_waiting (opq); 1243 recheck_waiting (opq);
1244 break; 1244 break;
1245 } 1245 }
1246 GNUNET_free (entry); 1246 GNUNET_free (entry);
1247 } 1247 }
1248 GNUNET_free_non_null (op->qentries); 1248 GNUNET_free_non_null (op->qentries);
diff --git a/src/testbed/testbed_api_peers.c b/src/testbed/testbed_api_peers.c
index 9b21bfb3a..5d55e3ef6 100644
--- a/src/testbed/testbed_api_peers.c
+++ b/src/testbed/testbed_api_peers.c
@@ -105,7 +105,7 @@ opstart_peer_create (void *cls)
105 size_t xc_size; 105 size_t xc_size;
106 uint16_t msize; 106 uint16_t msize;
107 107
108 GNUNET_assert (OP_PEER_CREATE == opc->type); 108 GNUNET_assert (OP_PEER_CREATE == opc->type);
109 GNUNET_assert (NULL != data); 109 GNUNET_assert (NULL != data);
110 GNUNET_assert (NULL != data->peer); 110 GNUNET_assert (NULL != data->peer);
111 opc->state = OPC_STATE_STARTED; 111 opc->state = OPC_STATE_STARTED;
@@ -464,7 +464,7 @@ opstart_peer_reconfigure (void *cls)
464 char *xconfig; 464 char *xconfig;
465 size_t xc_size; 465 size_t xc_size;
466 uint16_t msize; 466 uint16_t msize;
467 467
468 opc->state = OPC_STATE_STARTED; 468 opc->state = OPC_STATE_STARTED;
469 GNUNET_assert (NULL != data); 469 GNUNET_assert (NULL != data);
470 xc_size = GNUNET_TESTBED_compress_config_ (data->config, data->cfg_size, 470 xc_size = GNUNET_TESTBED_compress_config_ (data->config, data->cfg_size,
@@ -472,7 +472,7 @@ opstart_peer_reconfigure (void *cls)
472 GNUNET_free (data->config); 472 GNUNET_free (data->config);
473 data->config = NULL; 473 data->config = NULL;
474 GNUNET_assert (xc_size <= UINT16_MAX); 474 GNUNET_assert (xc_size <= UINT16_MAX);
475 msize = (uint16_t) xc_size + 475 msize = (uint16_t) xc_size +
476 sizeof (struct GNUNET_TESTBED_PeerReconfigureMessage); 476 sizeof (struct GNUNET_TESTBED_PeerReconfigureMessage);
477 msg = GNUNET_realloc (xconfig, msize); 477 msg = GNUNET_realloc (xconfig, msize);
478 (void) memmove (&msg[1], msg, xc_size); 478 (void) memmove (&msg[1], msg, xc_size);
@@ -498,7 +498,7 @@ oprelease_peer_reconfigure (void *cls)
498{ 498{
499 struct OperationContext *opc = cls; 499 struct OperationContext *opc = cls;
500 struct PeerReconfigureData *data = opc->data; 500 struct PeerReconfigureData *data = opc->data;
501 501
502 switch (opc->state) 502 switch (opc->state)
503 { 503 {
504 case OPC_STATE_INIT: 504 case OPC_STATE_INIT:
@@ -508,7 +508,7 @@ oprelease_peer_reconfigure (void *cls)
508 case OPC_STATE_STARTED: 508 case OPC_STATE_STARTED:
509 GNUNET_TESTBED_remove_opc_ (opc->c, opc); 509 GNUNET_TESTBED_remove_opc_ (opc->c, opc);
510 break; 510 break;
511 case OPC_STATE_FINISHED: 511 case OPC_STATE_FINISHED:
512 break; 512 break;
513 } 513 }
514 GNUNET_free (opc); 514 GNUNET_free (opc);
@@ -874,15 +874,15 @@ opstart_manage_service (void *cls)
874 struct OperationContext *opc = cls; 874 struct OperationContext *opc = cls;
875 struct ManageServiceData *data = opc->data; 875 struct ManageServiceData *data = opc->data;
876 struct GNUNET_TESTBED_ManagePeerServiceMessage *msg; 876 struct GNUNET_TESTBED_ManagePeerServiceMessage *msg;
877 877
878 GNUNET_assert (NULL != data); 878 GNUNET_assert (NULL != data);
879 msg = GNUNET_malloc (data->msize); 879 msg = GNUNET_malloc (data->msize);
880 msg->header.size = htons (data->msize); 880 msg->header.size = htons (data->msize);
881 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE); 881 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE);
882 msg->peer_id = htonl (data->peer->unique_id); 882 msg->peer_id = htonl (data->peer->unique_id);
883 msg->operation_id = GNUNET_htonll (opc->id); 883 msg->operation_id = GNUNET_htonll (opc->id);
884 msg->start = (uint8_t) data->start; 884 msg->start = (uint8_t) data->start;
885 (void) memcpy (&msg[1], data->service_name, data->msize 885 (void) memcpy (&msg[1], data->service_name, data->msize
886 - sizeof (struct GNUNET_TESTBED_ManagePeerServiceMessage)); 886 - sizeof (struct GNUNET_TESTBED_ManagePeerServiceMessage));
887 GNUNET_free (data->service_name); 887 GNUNET_free (data->service_name);
888 data->service_name = NULL; 888 data->service_name = NULL;
diff --git a/src/testbed/testbed_api_peers.h b/src/testbed/testbed_api_peers.h
index 7416e1f05..2dbce8ef7 100644
--- a/src/testbed/testbed_api_peers.h
+++ b/src/testbed/testbed_api_peers.h
@@ -255,13 +255,13 @@ struct OverlayConnectData
255 255
256struct ManageServiceData { 256struct ManageServiceData {
257 GNUNET_TESTBED_OperationCompletionCallback cb; 257 GNUNET_TESTBED_OperationCompletionCallback cb;
258 258
259 void *cb_cls; 259 void *cb_cls;
260 260
261 struct GNUNET_TESTBED_Peer *peer; 261 struct GNUNET_TESTBED_Peer *peer;
262 262
263 char *service_name; 263 char *service_name;
264 264
265 unsigned int start; 265 unsigned int start;
266 266
267 uint16_t msize; 267 uint16_t msize;
diff --git a/src/testbed/testbed_api_sd.c b/src/testbed/testbed_api_sd.c
index 62f358de9..7a1da6b80 100644
--- a/src/testbed/testbed_api_sd.c
+++ b/src/testbed/testbed_api_sd.c
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file testbed/testbed_api_sd.c 22 * @file testbed/testbed_api_sd.c
23 * @brief functions to calculate standard deviation 23 * @brief functions to calculate standard deviation
24 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 24 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 */ 25 */
26 26
27#include "platform.h" 27#include "platform.h"
diff --git a/src/testbed/testbed_api_sd.h b/src/testbed/testbed_api_sd.h
index b3e19c0bd..577522d07 100644
--- a/src/testbed/testbed_api_sd.h
+++ b/src/testbed/testbed_api_sd.h
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file testbed/testbed_api_sd.h 22 * @file testbed/testbed_api_sd.h
23 * @brief functions to calculate standard deviation 23 * @brief functions to calculate standard deviation
24 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 24 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 */ 25 */
26 26
27#ifndef TESTBED_API_SD_H 27#ifndef TESTBED_API_SD_H
diff --git a/src/testbed/testbed_api_statistics.c b/src/testbed/testbed_api_statistics.c
index dbbb99e4a..5fa0750e3 100644
--- a/src/testbed/testbed_api_statistics.c
+++ b/src/testbed/testbed_api_statistics.c
@@ -95,7 +95,7 @@ struct GetStatsContext
95 * The task for calling the continuation callback 95 * The task for calling the continuation callback
96 */ 96 */
97 GNUNET_SCHEDULER_TaskIdentifier call_completion_task_id; 97 GNUNET_SCHEDULER_TaskIdentifier call_completion_task_id;
98 98
99 /** 99 /**
100 * The number of peers present in the peers array. This number also 100 * The number of peers present in the peers array. This number also
101 * represents the number of service connect operations in the ops array 101 * represents the number of service connect operations in the ops array
@@ -180,7 +180,7 @@ op_done_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
180 180
181 sc = peer_sc->sc; 181 sc = peer_sc->sc;
182 peer_sc->op_done_task_id = GNUNET_SCHEDULER_NO_TASK; 182 peer_sc->op_done_task_id = GNUNET_SCHEDULER_NO_TASK;
183 op = &sc->ops[peer_sc->peer_index]; 183 op = &sc->ops[peer_sc->peer_index];
184 GNUNET_assert (NULL != *op); 184 GNUNET_assert (NULL != *op);
185 GNUNET_TESTBED_operation_done (*op); 185 GNUNET_TESTBED_operation_done (*op);
186 *op = NULL; 186 *op = NULL;
@@ -202,7 +202,7 @@ iteration_completion_cb (void *cls, int success)
202 202
203 GNUNET_break (GNUNET_OK == success); 203 GNUNET_break (GNUNET_OK == success);
204 sc = peer_sc->sc; 204 sc = peer_sc->sc;
205 peer_sc->get_handle = NULL; 205 peer_sc->get_handle = NULL;
206 sc->num_completed++; 206 sc->num_completed++;
207 peer_sc->op_done_task_id = GNUNET_SCHEDULER_add_now (&op_done_task, peer_sc); 207 peer_sc->op_done_task_id = GNUNET_SCHEDULER_add_now (&op_done_task, peer_sc);
208 if (sc->num_completed == sc->num_peers) 208 if (sc->num_completed == sc->num_peers)
@@ -239,7 +239,7 @@ iterator_cb (void *cls, const char *subsystem,
239 LOG_DEBUG ("Peer %u: [%s,%s] -> %lu\n", peer_sc->peer_index, 239 LOG_DEBUG ("Peer %u: [%s,%s] -> %lu\n", peer_sc->peer_index,
240 subsystem, name, (unsigned long) value); 240 subsystem, name, (unsigned long) value);
241 ret = sc->proc (sc->cb_cls, peer, 241 ret = sc->proc (sc->cb_cls, peer,
242 subsystem, name, value, is_persistent); 242 subsystem, name, value, is_persistent);
243 if (GNUNET_SYSERR == ret) 243 if (GNUNET_SYSERR == ret)
244 LOG_DEBUG ("Aborting iteration for peer %u\n", peer_sc->peer_index); 244 LOG_DEBUG ("Aborting iteration for peer %u\n", peer_sc->peer_index);
245 return ret; 245 return ret;
@@ -283,11 +283,11 @@ service_connect_comp (void *cls,
283 * from GNUNET_TESTBED_service_connect() 283 * from GNUNET_TESTBED_service_connect()
284 * @return service handle to return in 'op_result', NULL on error 284 * @return service handle to return in 'op_result', NULL on error
285 */ 285 */
286static void * 286static void *
287statistics_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) 287statistics_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
288{ 288{
289 struct PeerGetStatsContext *peer_sc = cls; 289 struct PeerGetStatsContext *peer_sc = cls;
290 290
291 LOG_DEBUG ("Connecting to statistics service of peer %u\n", 291 LOG_DEBUG ("Connecting to statistics service of peer %u\n",
292 peer_sc->peer_index); 292 peer_sc->peer_index);
293 return GNUNET_STATISTICS_create ("<testbed-api>", cfg); 293 return GNUNET_STATISTICS_create ("<testbed-api>", cfg);
@@ -300,7 +300,7 @@ statistics_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
300 * @param cls the PeerGetStatsContext 300 * @param cls the PeerGetStatsContext
301 * @param op_result service handle returned from the connect adapter 301 * @param op_result service handle returned from the connect adapter
302 */ 302 */
303static void 303static void
304statistics_da (void *cls, void *op_result) 304statistics_da (void *cls, void *op_result)
305{ 305{
306 struct PeerGetStatsContext *peer_sc = cls; 306 struct PeerGetStatsContext *peer_sc = cls;
@@ -331,7 +331,7 @@ opstart_get_stats (void *cls)
331 unsigned int peer; 331 unsigned int peer;
332 332
333 LOG_DEBUG ("Starting get_statistics operation\n"); 333 LOG_DEBUG ("Starting get_statistics operation\n");
334 sc->ops = GNUNET_malloc (sc->num_peers * 334 sc->ops = GNUNET_malloc (sc->num_peers *
335 sizeof (struct GNUNET_TESTBED_Operation *)); 335 sizeof (struct GNUNET_TESTBED_Operation *));
336 for (peer = 0; peer < sc->num_peers; peer++) 336 for (peer = 0; peer < sc->num_peers; peer++)
337 { 337 {
@@ -343,7 +343,7 @@ opstart_get_stats (void *cls)
343 peer_sc = GNUNET_malloc (sizeof (struct PeerGetStatsContext)); 343 peer_sc = GNUNET_malloc (sizeof (struct PeerGetStatsContext));
344 peer_sc->sc = sc; 344 peer_sc->sc = sc;
345 peer_sc->peer_index = peer; 345 peer_sc->peer_index = peer;
346 sc->ops[peer] = 346 sc->ops[peer] =
347 GNUNET_TESTBED_service_connect (sc, sc->peers[peer], "statistics", 347 GNUNET_TESTBED_service_connect (sc, sc->peers[peer], "statistics",
348 &service_connect_comp, 348 &service_connect_comp,
349 peer_sc, 349 peer_sc,
@@ -364,7 +364,7 @@ oprelease_get_stats (void *cls)
364{ 364{
365 struct GetStatsContext *sc = cls; 365 struct GetStatsContext *sc = cls;
366 unsigned int peer; 366 unsigned int peer;
367 367
368 LOG_DEBUG ("Cleaning up get_statistics operation\n"); 368 LOG_DEBUG ("Cleaning up get_statistics operation\n");
369 if (GNUNET_SCHEDULER_NO_TASK != sc->call_completion_task_id) 369 if (GNUNET_SCHEDULER_NO_TASK != sc->call_completion_task_id)
370 GNUNET_SCHEDULER_cancel (sc->call_completion_task_id); 370 GNUNET_SCHEDULER_cancel (sc->call_completion_task_id);
@@ -383,7 +383,7 @@ oprelease_get_stats (void *cls)
383 GNUNET_free_non_null (sc->subsystem); 383 GNUNET_free_non_null (sc->subsystem);
384 GNUNET_free_non_null (sc->name); 384 GNUNET_free_non_null (sc->name);
385 GNUNET_free (sc); 385 GNUNET_free (sc);
386 if (GNUNET_YES == 386 if (GNUNET_YES ==
387 GNUNET_TESTBED_operation_queue_destroy_empty_ (no_wait_queue)) 387 GNUNET_TESTBED_operation_queue_destroy_empty_ (no_wait_queue))
388 no_wait_queue = NULL; 388 no_wait_queue = NULL;
389} 389}
@@ -415,7 +415,7 @@ GNUNET_TESTBED_get_statistics (unsigned int num_peers,
415 GNUNET_assert (NULL != proc); 415 GNUNET_assert (NULL != proc);
416 GNUNET_assert (NULL != cont); 416 GNUNET_assert (NULL != cont);
417 if (NULL == no_wait_queue) 417 if (NULL == no_wait_queue)
418 no_wait_queue = GNUNET_TESTBED_operation_queue_create_ 418 no_wait_queue = GNUNET_TESTBED_operation_queue_create_
419 (OPERATION_QUEUE_TYPE_FIXED, UINT_MAX); 419 (OPERATION_QUEUE_TYPE_FIXED, UINT_MAX);
420 sc = GNUNET_malloc (sizeof (struct GetStatsContext)); 420 sc = GNUNET_malloc (sizeof (struct GetStatsContext));
421 sc->peers = peers; 421 sc->peers = peers;
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c
index 2f5fc70e8..2d420c3e3 100644
--- a/src/testbed/testbed_api_testbed.c
+++ b/src/testbed/testbed_api_testbed.c
@@ -338,7 +338,7 @@ struct GNUNET_TESTBED_RunHandle
338 */ 338 */
339static uint32_t 339static uint32_t
340rcop_key (void *rcop) 340rcop_key (void *rcop)
341{ 341{
342 return * ((uint32_t *) &rcop); 342 return * ((uint32_t *) &rcop);
343} 343}
344 344
@@ -397,10 +397,10 @@ static struct RunContextOperation *
397search_rcop (struct GNUNET_TESTBED_RunHandle *rc, struct GNUNET_TESTBED_Operation *op) 397search_rcop (struct GNUNET_TESTBED_RunHandle *rc, struct GNUNET_TESTBED_Operation *op)
398{ 398{
399 struct SearchContext sc; 399 struct SearchContext sc;
400 400
401 sc.query = op; 401 sc.query = op;
402 sc.result = NULL; 402 sc.result = NULL;
403 if (GNUNET_SYSERR == 403 if (GNUNET_SYSERR ==
404 GNUNET_CONTAINER_multihashmap32_get_multiple (rc->rcop_map, 404 GNUNET_CONTAINER_multihashmap32_get_multiple (rc->rcop_map,
405 rcop_key (op), 405 rcop_key (op),
406 &search_iterator, 406 &search_iterator,
@@ -481,7 +481,7 @@ cleanup (void *cls)
481 481
482 482
483/** 483/**
484 * Iterator for cleaning up elements from rcop_map 484 * Iterator for cleaning up elements from rcop_map
485 * 485 *
486 * @param cls the RunContext 486 * @param cls the RunContext
487 * @param key the 32-bit key 487 * @param key the 32-bit key
@@ -546,7 +546,7 @@ rc_cleanup_operations (struct GNUNET_TESTBED_RunHandle *rc)
546 rc->topology_operation = NULL; 546 rc->topology_operation = NULL;
547 } 547 }
548 /* cancel any exiting operations */ 548 /* cancel any exiting operations */
549 GNUNET_assert (GNUNET_SYSERR != 549 GNUNET_assert (GNUNET_SYSERR !=
550 GNUNET_CONTAINER_multihashmap32_iterate (rc->rcop_map, 550 GNUNET_CONTAINER_multihashmap32_iterate (rc->rcop_map,
551 &rcop_cleanup_iterator, 551 &rcop_cleanup_iterator,
552 rc)); 552 rc));
@@ -568,7 +568,7 @@ cancel_interrupt_task (struct GNUNET_TESTBED_RunHandle *rc)
568 568
569/** 569/**
570 * This callback will be called when all the operations are completed 570 * This callback will be called when all the operations are completed
571 * (done/cancelled) 571 * (done/cancelled)
572 * 572 *
573 * @param cls run context 573 * @param cls run context
574 */ 574 */
@@ -624,9 +624,9 @@ interrupt (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
624 /* reschedule */ 624 /* reschedule */
625 rc->interrupt_task = GNUNET_SCHEDULER_add_delayed 625 rc->interrupt_task = GNUNET_SCHEDULER_add_delayed
626 (GNUNET_TIME_UNIT_FOREVER_REL, &interrupt, rc); 626 (GNUNET_TIME_UNIT_FOREVER_REL, &interrupt, rc);
627 rc_cleanup_operations (rc); 627 rc_cleanup_operations (rc);
628 if ( (GNUNET_NO == rc->shutdown) 628 if ( (GNUNET_NO == rc->shutdown)
629 && (NULL != c) 629 && (NULL != c)
630 && (0 != (size = GNUNET_CONTAINER_multihashmap32_size (c->opc_map)))) 630 && (0 != (size = GNUNET_CONTAINER_multihashmap32_size (c->opc_map))))
631 { 631 {
632 LOG (GNUNET_ERROR_TYPE_WARNING, "Shutdown postponed as there are " 632 LOG (GNUNET_ERROR_TYPE_WARNING, "Shutdown postponed as there are "
@@ -917,7 +917,7 @@ call_cc:
917 { 917 {
918 unsigned long long number; 918 unsigned long long number;
919 unsigned int cap; 919 unsigned int cap;
920 GNUNET_assert (GNUNET_OK == 920 GNUNET_assert (GNUNET_OK ==
921 GNUNET_CONFIGURATION_get_value_number (rc->cfg, TESTBED_CONFIG_SECTION, 921 GNUNET_CONFIGURATION_get_value_number (rc->cfg, TESTBED_CONFIG_SECTION,
922 SCALE_FREE_CAP, 922 SCALE_FREE_CAP,
923 &number)); 923 &number));
@@ -1199,7 +1199,7 @@ static void
1199timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1199timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1200{ 1200{
1201 struct GNUNET_TESTBED_RunHandle *rc = cls; 1201 struct GNUNET_TESTBED_RunHandle *rc = cls;
1202 1202
1203 rc->timeout_task = GNUNET_SCHEDULER_NO_TASK; 1203 rc->timeout_task = GNUNET_SCHEDULER_NO_TASK;
1204 LOG (GNUNET_ERROR_TYPE_ERROR, _("Shutting down testbed due to timeout while setup.\n")); 1204 LOG (GNUNET_ERROR_TYPE_ERROR, _("Shutting down testbed due to timeout while setup.\n"));
1205 GNUNET_SCHEDULER_shutdown (); 1205 GNUNET_SCHEDULER_shutdown ();
@@ -1246,7 +1246,7 @@ GNUNET_TESTBED_run (const char *host_filename,
1246{ 1246{
1247 struct GNUNET_TESTBED_RunHandle *rc; 1247 struct GNUNET_TESTBED_RunHandle *rc;
1248 char *topology; 1248 char *topology;
1249 struct CompatibilityCheckContext *hc; 1249 struct CompatibilityCheckContext *hc;
1250 struct GNUNET_TIME_Relative timeout; 1250 struct GNUNET_TIME_Relative timeout;
1251 unsigned long long number; 1251 unsigned long long number;
1252 unsigned int hid; 1252 unsigned int hid;
diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c
index d506ee7e3..b1b96ed56 100644
--- a/src/testbed/testbed_api_topology.c
+++ b/src/testbed/testbed_api_topology.c
@@ -89,7 +89,7 @@ struct RetryListEntry
89 * the prev pointer for the DLL 89 * the prev pointer for the DLL
90 */ 90 */
91 struct RetryListEntry *prev; 91 struct RetryListEntry *prev;
92 92
93 /** 93 /**
94 * The link to be retired 94 * The link to be retired
95 */ 95 */
@@ -136,7 +136,7 @@ struct TopologyContext
136 * DLL tail for retry list 136 * DLL tail for retry list
137 */ 137 */
138 struct RetryListEntry *rl_tail; 138 struct RetryListEntry *rl_tail;
139 139
140 /** 140 /**
141 * The number of peers 141 * The number of peers
142 */ 142 */
@@ -292,7 +292,7 @@ overlay_link_completed (void *cls, struct GNUNET_TESTBED_Operation *op,
292 tc->nlinks = 0; 292 tc->nlinks = 0;
293 while (NULL != (retry_entry = tc->rl_head)) 293 while (NULL != (retry_entry = tc->rl_head))
294 { 294 {
295 link = retry_entry->link; 295 link = retry_entry->link;
296 link->op = 296 link->op =
297 GNUNET_TESTBED_overlay_connect (tc->op_cls, &overlay_link_completed, 297 GNUNET_TESTBED_overlay_connect (tc->op_cls, &overlay_link_completed,
298 link, tc->peers[link->A], 298 link, tc->peers[link->A],
@@ -609,7 +609,7 @@ gen_scale_free (struct TopologyContext *tc, uint16_t cap, uint8_t m)
609 unsigned int redo_threshold; 609 unsigned int redo_threshold;
610 610
611 links = 0; 611 links = 0;
612 etaboff = 0; 612 etaboff = 0;
613 tc->link_array_size = tc->num_peers * m; 613 tc->link_array_size = tc->num_peers * m;
614 tc->link_array = GNUNET_malloc_large (sizeof (struct OverlayLink) * 614 tc->link_array = GNUNET_malloc_large (sizeof (struct OverlayLink) *
615 tc->link_array_size); 615 tc->link_array_size);
@@ -657,7 +657,7 @@ gen_scale_free (struct TopologyContext *tc, uint16_t cap, uint8_t m)
657 goto redo; 657 goto redo;
658 make_link (&tc->link_array[links + cnt], random_peer, peer, tc); 658 make_link (&tc->link_array[links + cnt], random_peer, peer, tc);
659 deg[random_peer]++; 659 deg[random_peer]++;
660 deg[peer]++; 660 deg[peer]++;
661 used[cnt] = random_peer; 661 used[cnt] = random_peer;
662 } 662 }
663 for (cnt = 0; cnt < GNUNET_MIN (peer, m); cnt++) 663 for (cnt = 0; cnt < GNUNET_MIN (peer, m); cnt++)
@@ -672,7 +672,7 @@ gen_scale_free (struct TopologyContext *tc, uint16_t cap, uint8_t m)
672 GNUNET_free (deg); 672 GNUNET_free (deg);
673 GNUNET_assert (links <= tc->link_array_size); 673 GNUNET_assert (links <= tc->link_array_size);
674 tc->link_array_size = links; 674 tc->link_array_size = links;
675 tc->link_array = 675 tc->link_array =
676 GNUNET_realloc (tc->link_array, 676 GNUNET_realloc (tc->link_array,
677 sizeof (struct OverlayLink) * tc->link_array_size); 677 sizeof (struct OverlayLink) * tc->link_array_size);
678} 678}
@@ -982,7 +982,7 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
982 { 982 {
983 uint16_t cap; 983 uint16_t cap;
984 uint8_t m; 984 uint8_t m;
985 985
986 cap = (uint16_t) va_arg (va, unsigned int); 986 cap = (uint16_t) va_arg (va, unsigned int);
987 m = (uint8_t) va_arg (va, unsigned int); 987 m = (uint8_t) va_arg (va, unsigned int);
988 gen_scale_free (tc, cap, m); 988 gen_scale_free (tc, cap, m);
@@ -1074,7 +1074,7 @@ GNUNET_TESTBED_overlay_configure_topology (void *op_cls,
1074 GNUNET_assert (topo < GNUNET_TESTBED_TOPOLOGY_OPTION_END); 1074 GNUNET_assert (topo < GNUNET_TESTBED_TOPOLOGY_OPTION_END);
1075 va_start (vargs, topo); 1075 va_start (vargs, topo);
1076 op = GNUNET_TESTBED_overlay_configure_topology_va (op_cls, num_peers, peers, 1076 op = GNUNET_TESTBED_overlay_configure_topology_va (op_cls, num_peers, peers,
1077 max_connections, 1077 max_connections,
1078 comp_cb, comp_cb_cls, 1078 comp_cb, comp_cb_cls,
1079 topo, 1079 topo,
1080 vargs); 1080 vargs);
diff --git a/src/testbed/testbed_logger_api.c b/src/testbed/testbed_logger_api.c
index c520b1062..562902218 100644
--- a/src/testbed/testbed_logger_api.c
+++ b/src/testbed/testbed_logger_api.c
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file testbed/testbed_logger_api.c 22 * @file testbed/testbed_logger_api.c
23 * @brief Client-side routines for communicating with the tesbted logger service 23 * @brief Client-side routines for communicating with the tesbted logger service
24 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 24 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 */ 25 */
26 26
27#include "platform.h" 27#include "platform.h"
@@ -158,7 +158,7 @@ static void
158cancel_timeout_flush (struct GNUNET_TESTBED_LOGGER_Handle *h) 158cancel_timeout_flush (struct GNUNET_TESTBED_LOGGER_Handle *h)
159{ 159{
160 GNUNET_SCHEDULER_cancel (h->timeout_flush_task); 160 GNUNET_SCHEDULER_cancel (h->timeout_flush_task);
161 h->timeout_flush_task = GNUNET_SCHEDULER_NO_TASK; 161 h->timeout_flush_task = GNUNET_SCHEDULER_NO_TASK;
162} 162}
163 163
164 164
@@ -310,7 +310,7 @@ dispatch_buffer (struct GNUNET_TESTBED_LOGGER_Handle *h)
310 msg = GNUNET_realloc (h->buf, msize); 310 msg = GNUNET_realloc (h->buf, msize);
311 h->buf = NULL; 311 h->buf = NULL;
312 memmove (&msg[1], msg, h->bs); 312 memmove (&msg[1], msg, h->bs);
313 h->bs = 0; 313 h->bs = 0;
314 msg->type = htons (GNUNET_MESSAGE_TYPE_TESTBED_LOGGER_MSG); 314 msg->type = htons (GNUNET_MESSAGE_TYPE_TESTBED_LOGGER_MSG);
315 msg->size = htons (msize); 315 msg->size = htons (msize);
316 queue_message (h, msg); 316 queue_message (h, msg);
@@ -329,7 +329,7 @@ GNUNET_TESTBED_LOGGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
329{ 329{
330 struct GNUNET_TESTBED_LOGGER_Handle *h; 330 struct GNUNET_TESTBED_LOGGER_Handle *h;
331 struct GNUNET_CLIENT_Connection *client; 331 struct GNUNET_CLIENT_Connection *client;
332 332
333 client = GNUNET_CLIENT_connect ("testbed-logger", cfg); 333 client = GNUNET_CLIENT_connect ("testbed-logger", cfg);
334 if (NULL == client) 334 if (NULL == client)
335 return NULL; 335 return NULL;
@@ -374,7 +374,7 @@ GNUNET_TESTBED_LOGGER_disconnect (struct GNUNET_TESTBED_LOGGER_Handle *h)
374void 374void
375GNUNET_TESTBED_LOGGER_write (struct GNUNET_TESTBED_LOGGER_Handle *h, 375GNUNET_TESTBED_LOGGER_write (struct GNUNET_TESTBED_LOGGER_Handle *h,
376 const void *data, size_t size) 376 const void *data, size_t size)
377{ 377{
378 size_t fit_size; 378 size_t fit_size;
379 379
380 GNUNET_assert (0 != size); 380 GNUNET_assert (0 != size);
@@ -445,7 +445,7 @@ GNUNET_TESTBED_LOGGER_flush (struct GNUNET_TESTBED_LOGGER_Handle *h,
445 h->cb = cb; 445 h->cb = cb;
446 h->cb_cls = cb_cls; 446 h->cb_cls = cb_cls;
447 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->timeout_flush_task); 447 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->timeout_flush_task);
448 h->timeout_flush_task = 448 h->timeout_flush_task =
449 GNUNET_SCHEDULER_add_delayed (timeout, &timeout_flush, h); 449 GNUNET_SCHEDULER_add_delayed (timeout, &timeout_flush, h);
450 if (NULL == h->buf) 450 if (NULL == h->buf)
451 { 451 {
diff --git a/src/testing/gnunet-testing.c b/src/testing/gnunet-testing.c
index 37d6f9888..1cec948a2 100644
--- a/src/testing/gnunet-testing.c
+++ b/src/testing/gnunet-testing.c
@@ -197,7 +197,7 @@ create_hostkeys (const unsigned int no)
197 * Removes the temporary file. 197 * Removes the temporary file.
198 * 198 *
199 * @param cls unused 199 * @param cls unused
200 * @param tc scheduler context 200 * @param tc scheduler context
201 */ 201 */
202static void 202static void
203cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 203cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -221,10 +221,10 @@ cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
221 221
222 222
223/** 223/**
224 * Called whenever we can read stdin non-blocking 224 * Called whenever we can read stdin non-blocking
225 * 225 *
226 * @param cls unused 226 * @param cls unused
227 * @param tc scheduler context 227 * @param tc scheduler context
228 */ 228 */
229static void 229static void
230stdin_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 230stdin_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -259,7 +259,7 @@ stdin_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
259 break; 259 break;
260 } 260 }
261 tid = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, fh, 261 tid = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, fh,
262 &stdin_cb, NULL); 262 &stdin_cb, NULL);
263} 263}
264 264
265 265
@@ -282,7 +282,7 @@ testing_main (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
282 GNUNET_SCHEDULER_shutdown (); 282 GNUNET_SCHEDULER_shutdown ();
283 return; 283 return;
284 } 284 }
285 if (GNUNET_SYSERR == 285 if (GNUNET_SYSERR ==
286 GNUNET_CONFIGURATION_write ((struct GNUNET_CONFIGURATION_Handle *) cfg, 286 GNUNET_CONFIGURATION_write ((struct GNUNET_CONFIGURATION_Handle *) cfg,
287 tmpfilename)) 287 tmpfilename))
288 { 288 {
@@ -322,7 +322,7 @@ run_no_scheduler (void *cls, char *const *args, const char *cfgfile,
322 { 322 {
323 if (create_no > 0) 323 if (create_no > 0)
324 { 324 {
325 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 325 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
326 "Creating %u configuration files based on template `%s'\n", create_no, create_cfg_template); 326 "Creating %u configuration files based on template `%s'\n", create_no, create_cfg_template);
327 ret = create_unique_cfgs (create_cfg_template, create_no); 327 ret = create_unique_cfgs (create_cfg_template, create_no);
328 } 328 }
diff --git a/src/testing/test_testing_peerstartup.c b/src/testing/test_testing_peerstartup.c
index 3bae6a9ca..b871ed1e3 100644
--- a/src/testing/test_testing_peerstartup.c
+++ b/src/testing/test_testing_peerstartup.c
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file testing/test_testing_new_peerstartup.c 22 * @file testing/test_testing_new_peerstartup.c
23 * @brief test case for testing peer startup and shutdown using new testing 23 * @brief test case for testing peer startup and shutdown using new testing
24 * library 24 * library
25 * @author Sree Harsha Totakura 25 * @author Sree Harsha Totakura
26 */ 26 */
27 27
@@ -46,7 +46,7 @@ struct TestingContext
46 * The testing system 46 * The testing system
47 */ 47 */
48 struct GNUNET_TESTING_System *system; 48 struct GNUNET_TESTING_System *system;
49 49
50 /** 50 /**
51 * The peer which has been started by the testing system 51 * The peer which has been started by the testing system
52 */ 52 */
@@ -69,7 +69,7 @@ static void
69do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 69do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
70{ 70{
71 struct TestingContext *test_ctx = cls; 71 struct TestingContext *test_ctx = cls;
72 72
73 GNUNET_assert (NULL != test_ctx); 73 GNUNET_assert (NULL != test_ctx);
74 if (NULL != test_ctx->peer) 74 if (NULL != test_ctx->peer)
75 { 75 {
@@ -96,14 +96,14 @@ run (void *cls, char *const *args, const char *cfgfile,
96 struct GNUNET_PeerIdentity id; 96 struct GNUNET_PeerIdentity id;
97 97
98 test_ctx = GNUNET_malloc (sizeof (struct TestingContext)); 98 test_ctx = GNUNET_malloc (sizeof (struct TestingContext));
99 test_ctx->system = 99 test_ctx->system =
100 GNUNET_TESTING_system_create ("test-gnunet-testing", 100 GNUNET_TESTING_system_create ("test-gnunet-testing",
101 "127.0.0.1", NULL, NULL); 101 "127.0.0.1", NULL, NULL);
102 emsg = NULL; 102 emsg = NULL;
103 if (NULL == test_ctx->system) 103 if (NULL == test_ctx->system)
104 goto end; 104 goto end;
105 test_ctx->cfg = GNUNET_CONFIGURATION_dup (cfg); 105 test_ctx->cfg = GNUNET_CONFIGURATION_dup (cfg);
106 test_ctx->peer = 106 test_ctx->peer =
107 GNUNET_TESTING_peer_configure (test_ctx->system, 107 GNUNET_TESTING_peer_configure (test_ctx->system,
108 test_ctx->cfg, 108 test_ctx->cfg,
109 0, &id, &emsg); 109 0, &id, &emsg);
diff --git a/src/testing/test_testing_peerstartup2.c b/src/testing/test_testing_peerstartup2.c
index 8bc6396d3..a4bdd4d65 100644
--- a/src/testing/test_testing_peerstartup2.c
+++ b/src/testing/test_testing_peerstartup2.c
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file testing/test_testing_new_peerstartup.c 22 * @file testing/test_testing_new_peerstartup.c
23 * @brief test case for testing peer startup and shutdown using new testing 23 * @brief test case for testing peer startup and shutdown using new testing
24 * library 24 * library
25 * @author Sree Harsha Totakura 25 * @author Sree Harsha Totakura
26 */ 26 */
27 27
@@ -42,7 +42,7 @@
42 } \ 42 } \
43 } \ 43 } \
44 } while (0) \ 44 } while (0) \
45 45
46 46
47/** 47/**
48 * The status of the test 48 * The status of the test
@@ -58,7 +58,7 @@ struct TestingContext
58 * The testing system 58 * The testing system
59 */ 59 */
60 struct GNUNET_TESTING_System *system; 60 struct GNUNET_TESTING_System *system;
61 61
62 /** 62 /**
63 * The peer which has been started by the testing system 63 * The peer which has been started by the testing system
64 */ 64 */
@@ -94,7 +94,7 @@ do_shutdown2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
94 if (NULL != test_ctx->system) 94 if (NULL != test_ctx->system)
95 GNUNET_TESTING_system_destroy (test_ctx->system, GNUNET_YES); 95 GNUNET_TESTING_system_destroy (test_ctx->system, GNUNET_YES);
96 GNUNET_free (test_ctx); 96 GNUNET_free (test_ctx);
97 97
98} 98}
99 99
100 100
@@ -143,7 +143,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
143 GNUNET_assert (NULL != test_ctx); 143 GNUNET_assert (NULL != test_ctx);
144 if (NULL != test_ctx->peer) 144 if (NULL != test_ctx->peer)
145 { 145 {
146 FAIL_TEST (GNUNET_OK == 146 FAIL_TEST (GNUNET_OK ==
147 GNUNET_TESTING_peer_stop_async (test_ctx->peer, 147 GNUNET_TESTING_peer_stop_async (test_ctx->peer,
148 &peer_status_cb, 148 &peer_status_cb,
149 test_ctx)); 149 test_ctx));
@@ -165,14 +165,14 @@ run (void *cls, char *const *args, const char *cfgfile,
165 struct GNUNET_PeerIdentity id; 165 struct GNUNET_PeerIdentity id;
166 166
167 test_ctx = GNUNET_malloc (sizeof (struct TestingContext)); 167 test_ctx = GNUNET_malloc (sizeof (struct TestingContext));
168 test_ctx->system = 168 test_ctx->system =
169 GNUNET_TESTING_system_create ("test-gnunet-testing", 169 GNUNET_TESTING_system_create ("test-gnunet-testing",
170 "127.0.0.1", NULL, NULL); 170 "127.0.0.1", NULL, NULL);
171 emsg = NULL; 171 emsg = NULL;
172 if (NULL == test_ctx->system) 172 if (NULL == test_ctx->system)
173 goto end; 173 goto end;
174 test_ctx->cfg = GNUNET_CONFIGURATION_dup (cfg); 174 test_ctx->cfg = GNUNET_CONFIGURATION_dup (cfg);
175 test_ctx->peer = 175 test_ctx->peer =
176 GNUNET_TESTING_peer_configure (test_ctx->system, 176 GNUNET_TESTING_peer_configure (test_ctx->system,
177 test_ctx->cfg, 177 test_ctx->cfg,
178 0, &id, &emsg); 178 0, &id, &emsg);
@@ -185,7 +185,7 @@ run (void *cls, char *const *args, const char *cfgfile,
185 if (GNUNET_OK != GNUNET_TESTING_peer_start (test_ctx->peer)) 185 if (GNUNET_OK != GNUNET_TESTING_peer_start (test_ctx->peer))
186 goto end; 186 goto end;
187 test_ctx->state = PEER_STARTED; 187 test_ctx->state = PEER_STARTED;
188 FAIL_TEST (GNUNET_OK == 188 FAIL_TEST (GNUNET_OK ==
189 GNUNET_TESTING_peer_stop_async (test_ctx->peer, 189 GNUNET_TESTING_peer_stop_async (test_ctx->peer,
190 &peer_status_cb, 190 &peer_status_cb,
191 test_ctx)); 191 test_ctx));
@@ -193,7 +193,7 @@ run (void *cls, char *const *args, const char *cfgfile,
193 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 193 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
194 &do_shutdown, test_ctx); 194 &do_shutdown, test_ctx);
195 return; 195 return;
196 196
197 end: 197 end:
198 FAIL_TEST (0); 198 FAIL_TEST (0);
199 GNUNET_SCHEDULER_add_now (&do_shutdown, test_ctx); 199 GNUNET_SCHEDULER_add_now (&do_shutdown, test_ctx);
diff --git a/src/testing/test_testing_sharedservices.c b/src/testing/test_testing_sharedservices.c
index 305b2b21b..5b5bc0a24 100644
--- a/src/testing/test_testing_sharedservices.c
+++ b/src/testing/test_testing_sharedservices.c
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file testing/test_testing_sharedservices.c 22 * @file testing/test_testing_sharedservices.c
23 * @brief test case for testing service sharing among peers started by testing 23 * @brief test case for testing service sharing among peers started by testing
24 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 24 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 */ 25 */
26 26
27#include "platform.h" 27#include "platform.h"
@@ -47,7 +47,7 @@ struct TestingContext
47 * The testing system 47 * The testing system
48 */ 48 */
49 struct GNUNET_TESTING_System *system; 49 struct GNUNET_TESTING_System *system;
50 50
51 /** 51 /**
52 * The peer which has been started by the testing system 52 * The peer which has been started by the testing system
53 */ 53 */
@@ -81,7 +81,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
81 continue; 81 continue;
82 (void) GNUNET_TESTING_peer_stop (peer); 82 (void) GNUNET_TESTING_peer_stop (peer);
83 GNUNET_TESTING_peer_destroy (peer); 83 GNUNET_TESTING_peer_destroy (peer);
84 } 84 }
85 if (NULL != test_ctx->cfg) 85 if (NULL != test_ctx->cfg)
86 GNUNET_CONFIGURATION_destroy (test_ctx->cfg); 86 GNUNET_CONFIGURATION_destroy (test_ctx->cfg);
87 if (NULL != test_ctx->system) 87 if (NULL != test_ctx->system)
@@ -108,7 +108,7 @@ run (void *cls, char *const *args, const char *cfgfile,
108 unsigned int cnt; 108 unsigned int cnt;
109 109
110 test_ctx = GNUNET_malloc (sizeof (struct TestingContext)); 110 test_ctx = GNUNET_malloc (sizeof (struct TestingContext));
111 test_ctx->system = 111 test_ctx->system =
112 GNUNET_TESTING_system_create ("test-gnunet-testing", 112 GNUNET_TESTING_system_create ("test-gnunet-testing",
113 "127.0.0.1", NULL, ss); 113 "127.0.0.1", NULL, ss);
114 emsg = NULL; 114 emsg = NULL;
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 10d25637e..600c53c1a 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -149,7 +149,7 @@ struct GNUNET_TESTING_System
149 * by one for each configured peer. Even if peers are destroyed, 149 * by one for each configured peer. Even if peers are destroyed,
150 * we never re-use path counters. 150 * we never re-use path counters.
151 */ 151 */
152 uint32_t path_counter; 152 uint32_t path_counter;
153 153
154 /** 154 /**
155 * The number of hostkeys 155 * The number of hostkeys
@@ -185,13 +185,13 @@ struct GNUNET_TESTING_Peer
185 185
186 /** 186 /**
187 * Binary to be executed during 'GNUNET_TESTING_peer_start'. 187 * Binary to be executed during 'GNUNET_TESTING_peer_start'.
188 * Typically 'gnunet-service-arm' (but can be set to a 188 * Typically 'gnunet-service-arm' (but can be set to a
189 * specific service by 'GNUNET_TESTING_service_run' if 189 * specific service by 'GNUNET_TESTING_service_run' if
190 * necessary). 190 * necessary).
191 */ 191 */
192 char *main_binary; 192 char *main_binary;
193 char *args; 193 char *args;
194 194
195 /** 195 /**
196 * Handle to the running binary of the service, NULL if the 196 * Handle to the running binary of the service, NULL if the
197 * peer/service is currently not running. 197 * peer/service is currently not running.
@@ -215,14 +215,14 @@ struct GNUNET_TESTING_Peer
215 215
216 /** 216 /**
217 * The callback to call asynchronously when a peer is stopped 217 * The callback to call asynchronously when a peer is stopped
218 */ 218 */
219 GNUNET_TESTING_PeerStopCallback cb; 219 GNUNET_TESTING_PeerStopCallback cb;
220 220
221 /** 221 /**
222 * The closure for the above callback 222 * The closure for the above callback
223 */ 223 */
224 void *cb_cls; 224 void *cb_cls;
225 225
226 /** 226 /**
227 * The cached identity of this peer. Will be populated on call to 227 * The cached identity of this peer. Will be populated on call to
228 * GNUNET_TESTING_peer_get_identity() 228 * GNUNET_TESTING_peer_get_identity()
@@ -260,7 +260,7 @@ struct GNUNET_TESTING_Peer
260static int 260static int
261hostkeys_load (struct GNUNET_TESTING_System *system) 261hostkeys_load (struct GNUNET_TESTING_System *system)
262{ 262{
263 uint64_t fs; 263 uint64_t fs;
264 char *data_dir; 264 char *data_dir;
265 char *filename; 265 char *filename;
266 struct GNUNET_DISK_FileHandle *fd; 266 struct GNUNET_DISK_FileHandle *fd;
@@ -268,7 +268,7 @@ hostkeys_load (struct GNUNET_TESTING_System *system)
268 GNUNET_assert (NULL == system->hostkeys_data); 268 GNUNET_assert (NULL == system->hostkeys_data);
269 data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); 269 data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
270 GNUNET_asprintf (&filename, "%s/testing_hostkeys.ecc", data_dir); 270 GNUNET_asprintf (&filename, "%s/testing_hostkeys.ecc", data_dir);
271 GNUNET_free (data_dir); 271 GNUNET_free (data_dir);
272 272
273 if (GNUNET_YES != GNUNET_DISK_file_test (filename)) 273 if (GNUNET_YES != GNUNET_DISK_file_test (filename))
274 { 274 {
@@ -278,7 +278,7 @@ hostkeys_load (struct GNUNET_TESTING_System *system)
278 return GNUNET_SYSERR; 278 return GNUNET_SYSERR;
279 } 279 }
280 /* Check hostkey file size, read entire thing into memory */ 280 /* Check hostkey file size, read entire thing into memory */
281 if (GNUNET_OK != 281 if (GNUNET_OK !=
282 GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES)) 282 GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES))
283 fs = 0; 283 fs = 0;
284 if (0 == fs) 284 if (0 == fs)
@@ -558,7 +558,7 @@ GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system,
558 * @param system system to use for reservation tracking 558 * @param system system to use for reservation tracking
559 * @return 0 if no free port was available 559 * @return 0 if no free port was available
560 */ 560 */
561uint16_t 561uint16_t
562GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system) 562GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system)
563{ 563{
564 struct GNUNET_NETWORK_Handle *socket; 564 struct GNUNET_NETWORK_Handle *socket;
@@ -576,7 +576,7 @@ GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system)
576 /* 576 /*
577 FIXME: Instead of using getaddrinfo we should try to determine the port 577 FIXME: Instead of using getaddrinfo we should try to determine the port
578 status by the following heurestics. 578 status by the following heurestics.
579 579
580 On systems which support both IPv4 and IPv6, only ports open on both 580 On systems which support both IPv4 and IPv6, only ports open on both
581 address families are considered open. 581 address families are considered open.
582 On system with either IPv4 or IPv6. A port is considered open if it's 582 On system with either IPv4 or IPv6. A port is considered open if it's
@@ -683,7 +683,7 @@ GNUNET_TESTING_release_port (struct GNUNET_TESTING_System *system,
683 * faster peer startup. This function can be used to 683 * faster peer startup. This function can be used to
684 * access the n-th key of those pre-created hostkeys; note 684 * access the n-th key of those pre-created hostkeys; note
685 * that these keys are ONLY useful for testing and not 685 * that these keys are ONLY useful for testing and not
686 * secure as the private keys are part of the public 686 * secure as the private keys are part of the public
687 * GNUnet source code. 687 * GNUnet source code.
688 * 688 *
689 * This is primarily a helper function used internally 689 * This is primarily a helper function used internally
@@ -699,9 +699,9 @@ struct GNUNET_CRYPTO_EccPrivateKey *
699GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, 699GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
700 uint32_t key_number, 700 uint32_t key_number,
701 struct GNUNET_PeerIdentity *id) 701 struct GNUNET_PeerIdentity *id)
702{ 702{
703 struct GNUNET_CRYPTO_EccPrivateKey *private_key; 703 struct GNUNET_CRYPTO_EccPrivateKey *private_key;
704 704
705 if ((NULL == id) || (NULL == system->hostkeys_data)) 705 if ((NULL == id) || (NULL == system->hostkeys_data))
706 return NULL; 706 return NULL;
707 if (key_number >= system->total_hostkeys) 707 if (key_number >= system->total_hostkeys)
@@ -709,13 +709,13 @@ GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
709 LOG (GNUNET_ERROR_TYPE_ERROR, 709 LOG (GNUNET_ERROR_TYPE_ERROR,
710 _("Key number %u does not exist\n"), key_number); 710 _("Key number %u does not exist\n"), key_number);
711 return NULL; 711 return NULL;
712 } 712 }
713 private_key = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey); 713 private_key = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey);
714 memcpy (private_key, 714 memcpy (private_key,
715 system->hostkeys_data + 715 system->hostkeys_data +
716 (key_number * GNUNET_TESTING_HOSTKEYFILESIZE), 716 (key_number * GNUNET_TESTING_HOSTKEYFILESIZE),
717 GNUNET_TESTING_HOSTKEYFILESIZE); 717 GNUNET_TESTING_HOSTKEYFILESIZE);
718 GNUNET_CRYPTO_ecc_key_get_public_for_signature (private_key, 718 GNUNET_CRYPTO_ecc_key_get_public_for_signature (private_key,
719 &id->public_key); 719 &id->public_key);
720 return private_key; 720 return private_key;
721} 721}
@@ -731,7 +731,7 @@ struct UpdateContext
731 * The system for which we are building configurations 731 * The system for which we are building configurations
732 */ 732 */
733 struct GNUNET_TESTING_System *system; 733 struct GNUNET_TESTING_System *system;
734 734
735 /** 735 /**
736 * The configuration we are building 736 * The configuration we are building
737 */ 737 */
@@ -865,7 +865,7 @@ static void
865update_config_sections (void *cls, 865update_config_sections (void *cls,
866 const char *section) 866 const char *section)
867{ 867{
868 struct UpdateContext *uc = cls; 868 struct UpdateContext *uc = cls;
869 char **ikeys; 869 char **ikeys;
870 char *val; 870 char *val;
871 char *ptr; 871 char *ptr;
@@ -874,7 +874,7 @@ update_config_sections (void *cls,
874 char *ACCEPT_FROM_key; 874 char *ACCEPT_FROM_key;
875 uint16_t ikeys_cnt; 875 uint16_t ikeys_cnt;
876 uint16_t key; 876 uint16_t key;
877 877
878 ikeys_cnt = 0; 878 ikeys_cnt = 0;
879 val = NULL; 879 val = NULL;
880 /* Ignore certain options from sections. See 880 /* Ignore certain options from sections. See
@@ -882,8 +882,8 @@ update_config_sections (void *cls,
882 if (GNUNET_YES == GNUNET_CONFIGURATION_have_value (uc->cfg, section, 882 if (GNUNET_YES == GNUNET_CONFIGURATION_have_value (uc->cfg, section,
883 "TESTING_IGNORE_KEYS")) 883 "TESTING_IGNORE_KEYS"))
884 { 884 {
885 GNUNET_assert 885 GNUNET_assert
886 (GNUNET_YES == 886 (GNUNET_YES ==
887 GNUNET_CONFIGURATION_get_value_string (uc->cfg, section, 887 GNUNET_CONFIGURATION_get_value_string (uc->cfg, section,
888 "TESTING_IGNORE_KEYS", &val)); 888 "TESTING_IGNORE_KEYS", &val));
889 ptr = val; 889 ptr = val;
@@ -915,10 +915,10 @@ update_config_sections (void *cls,
915 (GNUNET_YES == GNUNET_CONFIGURATION_have_value (uc->cfg, section, 915 (GNUNET_YES == GNUNET_CONFIGURATION_have_value (uc->cfg, section,
916 "ADVERTISED_PORT"))) 916 "ADVERTISED_PORT")))
917 { 917 {
918 if (GNUNET_OK == 918 if (GNUNET_OK ==
919 GNUNET_CONFIGURATION_get_value_string (uc->cfg, section, "PORT", &ptr)) 919 GNUNET_CONFIGURATION_get_value_string (uc->cfg, section, "PORT", &ptr))
920 { 920 {
921 GNUNET_CONFIGURATION_set_value_string (uc->cfg, section, 921 GNUNET_CONFIGURATION_set_value_string (uc->cfg, section,
922 "ADVERTISED_PORT", ptr); 922 "ADVERTISED_PORT", ptr);
923 GNUNET_free (ptr); 923 GNUNET_free (ptr);
924 } 924 }
@@ -935,11 +935,11 @@ update_config_sections (void *cls,
935 GNUNET_free (ikeys); 935 GNUNET_free (ikeys);
936 } 936 }
937 GNUNET_free_non_null (val); 937 GNUNET_free_non_null (val);
938 ACCEPT_FROM_key = "ACCEPT_FROM"; 938 ACCEPT_FROM_key = "ACCEPT_FROM";
939 if ((NULL != uc->system->trusted_ip) && 939 if ((NULL != uc->system->trusted_ip) &&
940 (NULL != strstr (uc->system->trusted_ip, ":"))) /* IPv6 in use */ 940 (NULL != strstr (uc->system->trusted_ip, ":"))) /* IPv6 in use */
941 ACCEPT_FROM_key = "ACCEPT_FROM6"; 941 ACCEPT_FROM_key = "ACCEPT_FROM6";
942 if (GNUNET_OK != 942 if (GNUNET_OK !=
943 GNUNET_CONFIGURATION_get_value_string (uc->cfg, section, ACCEPT_FROM_key, 943 GNUNET_CONFIGURATION_get_value_string (uc->cfg, section, ACCEPT_FROM_key,
944 &orig_allowed_hosts)) 944 &orig_allowed_hosts))
945 { 945 {
@@ -953,7 +953,7 @@ update_config_sections (void *cls,
953 GNUNET_free (orig_allowed_hosts); 953 GNUNET_free (orig_allowed_hosts);
954 GNUNET_CONFIGURATION_set_value_string (uc->cfg, section, ACCEPT_FROM_key, 954 GNUNET_CONFIGURATION_set_value_string (uc->cfg, section, ACCEPT_FROM_key,
955 allowed_hosts); 955 allowed_hosts);
956 GNUNET_free (allowed_hosts); 956 GNUNET_free (allowed_hosts);
957} 957}
958 958
959static struct SharedServiceInstance * 959static struct SharedServiceInstance *
@@ -969,9 +969,9 @@ associate_shared_service (struct GNUNET_TESTING_System *system,
969 ss->n_peers++; 969 ss->n_peers++;
970 if ( ((0 == ss->share) && (NULL == ss->instances)) 970 if ( ((0 == ss->share) && (NULL == ss->instances))
971 || 971 ||
972 ( (0 != ss->share) 972 ( (0 != ss->share)
973 && (ss->n_instances < ((ss->n_peers + ss->share - 1) / ss->share)) ) ) 973 && (ss->n_instances < ((ss->n_peers + ss->share - 1) / ss->share)) ) )
974 { 974 {
975 i = GNUNET_malloc (sizeof (struct SharedServiceInstance)); 975 i = GNUNET_malloc (sizeof (struct SharedServiceInstance));
976 i->ss = ss; 976 i->ss = ss;
977 (void) GNUNET_asprintf (&service_home, "%s/shared/%s/%u", 977 (void) GNUNET_asprintf (&service_home, "%s/shared/%s/%u",
@@ -1009,7 +1009,7 @@ associate_shared_service (struct GNUNET_TESTING_System *system,
1009 GNUNET_assert (0 < ss->n_instances); 1009 GNUNET_assert (0 < ss->n_instances);
1010 i = ss->instances[ss->n_instances - 1]; 1010 i = ss->instances[ss->n_instances - 1];
1011 } 1011 }
1012 GNUNET_CONFIGURATION_iterate_section_values(ss->cfg, ss->sname, 1012 GNUNET_CONFIGURATION_iterate_section_values(ss->cfg, ss->sname,
1013 &cfg_copy_iterator, cfg); 1013 &cfg_copy_iterator, cfg);
1014 GNUNET_CONFIGURATION_set_value_string (cfg, ss->sname, "UNIXPATH", 1014 GNUNET_CONFIGURATION_set_value_string (cfg, ss->sname, "UNIXPATH",
1015 i->unix_sock); 1015 i->unix_sock);
@@ -1044,7 +1044,7 @@ GNUNET_TESTING_configuration_create_ (struct GNUNET_TESTING_System *system,
1044 unsigned int *nports) 1044 unsigned int *nports)
1045{ 1045{
1046 struct UpdateContext uc; 1046 struct UpdateContext uc;
1047 char *default_config; 1047 char *default_config;
1048 1048
1049 uc.system = system; 1049 uc.system = system;
1050 uc.cfg = cfg; 1050 uc.cfg = cfg;
@@ -1066,7 +1066,7 @@ GNUNET_TESTING_configuration_create_ (struct GNUNET_TESTING_System *system,
1066 /* allow connections to services from system trusted_ip host */ 1066 /* allow connections to services from system trusted_ip host */
1067 GNUNET_CONFIGURATION_iterate_sections (cfg, &update_config_sections, &uc); 1067 GNUNET_CONFIGURATION_iterate_sections (cfg, &update_config_sections, &uc);
1068 /* enable loopback-based connections between peers */ 1068 /* enable loopback-based connections between peers */
1069 GNUNET_CONFIGURATION_set_value_string (cfg, 1069 GNUNET_CONFIGURATION_set_value_string (cfg,
1070 "nat", 1070 "nat",
1071 "USE_LOCALADDR", "YES"); 1071 "USE_LOCALADDR", "YES");
1072 GNUNET_free (uc.service_home); 1072 GNUNET_free (uc.service_home);
@@ -1107,14 +1107,14 @@ GNUNET_TESTING_configuration_create (struct GNUNET_TESTING_System *system,
1107 1107
1108/** 1108/**
1109 * Configure a GNUnet peer. GNUnet must be installed on the local 1109 * Configure a GNUnet peer. GNUnet must be installed on the local
1110 * system and available in the PATH. 1110 * system and available in the PATH.
1111 * 1111 *
1112 * @param system system to use to coordinate resource usage 1112 * @param system system to use to coordinate resource usage
1113 * @param cfg configuration to use; will be UPDATED (to reflect needed 1113 * @param cfg configuration to use; will be UPDATED (to reflect needed
1114 * changes in port numbers and paths) 1114 * changes in port numbers and paths)
1115 * @param key_number number of the hostkey to use for the peer 1115 * @param key_number number of the hostkey to use for the peer
1116 * @param id identifier for the daemon, will be set, can be NULL 1116 * @param id identifier for the daemon, will be set, can be NULL
1117 * @param emsg set to freshly allocated error message (set to NULL on success), 1117 * @param emsg set to freshly allocated error message (set to NULL on success),
1118 * can be NULL 1118 * can be NULL
1119 * @return handle to the peer, NULL on error 1119 * @return handle to the peer, NULL on error
1120 */ 1120 */
@@ -1136,7 +1136,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
1136 struct SharedService *ss; 1136 struct SharedService *ss;
1137 struct SharedServiceInstance **ss_instances; 1137 struct SharedServiceInstance **ss_instances;
1138 unsigned int cnt; 1138 unsigned int cnt;
1139 unsigned int nports; 1139 unsigned int nports;
1140 1140
1141 ports = NULL; 1141 ports = NULL;
1142 nports = 0; 1142 nports = 0;
@@ -1147,7 +1147,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
1147 { 1147 {
1148 GNUNET_asprintf (&emsg_, 1148 GNUNET_asprintf (&emsg_,
1149 _("You attempted to create a testbed with more than %u hosts. Please precompute more hostkeys first.\n"), 1149 _("You attempted to create a testbed with more than %u hosts. Please precompute more hostkeys first.\n"),
1150 (unsigned int) system->total_hostkeys); 1150 (unsigned int) system->total_hostkeys);
1151 goto err_ret; 1151 goto err_ret;
1152 } 1152 }
1153 pk = NULL; 1153 pk = NULL;
@@ -1158,13 +1158,13 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
1158 _("Failed to initialize hostkey for peer %u\n"), 1158 _("Failed to initialize hostkey for peer %u\n"),
1159 (unsigned int) key_number); 1159 (unsigned int) key_number);
1160 goto err_ret; 1160 goto err_ret;
1161 } 1161 }
1162 if (NULL != pk) 1162 if (NULL != pk)
1163 GNUNET_free (pk); 1163 GNUNET_free (pk);
1164 if (GNUNET_NO == 1164 if (GNUNET_NO ==
1165 GNUNET_CONFIGURATION_have_value (cfg, "PEER", "PRIVATE_KEY")) 1165 GNUNET_CONFIGURATION_have_value (cfg, "PEER", "PRIVATE_KEY"))
1166 { 1166 {
1167 GNUNET_asprintf (&emsg_, 1167 GNUNET_asprintf (&emsg_,
1168 _("PRIVATE_KEY option in PEER section missing in configuration\n")); 1168 _("PRIVATE_KEY option in PEER section missing in configuration\n"));
1169 goto err_ret; 1169 goto err_ret;
1170 } 1170 }
@@ -1182,13 +1182,13 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
1182 "(not enough free ports?)\n")); 1182 "(not enough free ports?)\n"));
1183 goto err_ret; 1183 goto err_ret;
1184 } 1184 }
1185 GNUNET_assert (GNUNET_OK == 1185 GNUNET_assert (GNUNET_OK ==
1186 GNUNET_CONFIGURATION_get_value_filename (cfg, "PEER", 1186 GNUNET_CONFIGURATION_get_value_filename (cfg, "PEER",
1187 "PRIVATE_KEY", 1187 "PRIVATE_KEY",
1188 &hostkey_filename)); 1188 &hostkey_filename));
1189 fd = GNUNET_DISK_file_open (hostkey_filename, 1189 fd = GNUNET_DISK_file_open (hostkey_filename,
1190 GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, 1190 GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE,
1191 GNUNET_DISK_PERM_USER_READ 1191 GNUNET_DISK_PERM_USER_READ
1192 | GNUNET_DISK_PERM_USER_WRITE); 1192 | GNUNET_DISK_PERM_USER_WRITE);
1193 if (NULL == fd) 1193 if (NULL == fd)
1194 { 1194 {
@@ -1199,7 +1199,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
1199 } 1199 }
1200 GNUNET_free (hostkey_filename); 1200 GNUNET_free (hostkey_filename);
1201 if (GNUNET_TESTING_HOSTKEYFILESIZE != 1201 if (GNUNET_TESTING_HOSTKEYFILESIZE !=
1202 GNUNET_DISK_file_write (fd, system->hostkeys_data 1202 GNUNET_DISK_file_write (fd, system->hostkeys_data
1203 + (key_number * GNUNET_TESTING_HOSTKEYFILESIZE), 1203 + (key_number * GNUNET_TESTING_HOSTKEYFILESIZE),
1204 GNUNET_TESTING_HOSTKEYFILESIZE)) 1204 GNUNET_TESTING_HOSTKEYFILESIZE))
1205 { 1205 {
@@ -1219,17 +1219,17 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
1219 ss_instances[cnt] = associate_shared_service (system, ss, cfg); 1219 ss_instances[cnt] = associate_shared_service (system, ss, cfg);
1220 if (NULL == ss_instances[cnt]) 1220 if (NULL == ss_instances[cnt])
1221 goto err_ret; 1221 goto err_ret;
1222 } 1222 }
1223 GNUNET_assert (GNUNET_OK == 1223 GNUNET_assert (GNUNET_OK ==
1224 GNUNET_CONFIGURATION_get_value_string 1224 GNUNET_CONFIGURATION_get_value_string
1225 (cfg, "PATHS", "DEFAULTCONFIG", &config_filename)); 1225 (cfg, "PATHS", "DEFAULTCONFIG", &config_filename));
1226 if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg, config_filename)) 1226 if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg, config_filename))
1227 { 1227 {
1228 GNUNET_asprintf (&emsg_, 1228 GNUNET_asprintf (&emsg_,
1229 _("Failed to write configuration file `%s' for peer %u: %s\n"), 1229 _("Failed to write configuration file `%s' for peer %u: %s\n"),
1230 config_filename, 1230 config_filename,
1231 (unsigned int) key_number, 1231 (unsigned int) key_number,
1232 STRERROR (errno)); 1232 STRERROR (errno));
1233 GNUNET_free (config_filename); 1233 GNUNET_free (config_filename);
1234 goto err_ret; 1234 goto err_ret;
1235 } 1235 }
@@ -1289,7 +1289,7 @@ GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer,
1289 1289
1290 1290
1291/** 1291/**
1292 * Start the peer. 1292 * Start the peer.
1293 * 1293 *
1294 * @param peer peer to start 1294 * @param peer peer to start
1295 * @return GNUNET_OK on success, GNUNET_SYSERR on error (i.e. peer already running) 1295 * @return GNUNET_OK on success, GNUNET_SYSERR on error (i.e. peer already running)
@@ -1304,7 +1304,7 @@ GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer)
1304 { 1304 {
1305 GNUNET_break (0); 1305 GNUNET_break (0);
1306 return GNUNET_SYSERR; 1306 return GNUNET_SYSERR;
1307 } 1307 }
1308 GNUNET_assert (NULL != peer->cfgfile); 1308 GNUNET_assert (NULL != peer->cfgfile);
1309 for (cnt = 0; cnt < peer->system->n_shared_services; cnt++) 1309 for (cnt = 0; cnt < peer->system->n_shared_services; cnt++)
1310 { 1310 {
@@ -1314,7 +1314,7 @@ GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer)
1314 return GNUNET_SYSERR; 1314 return GNUNET_SYSERR;
1315 i->n_refs++; 1315 i->n_refs++;
1316 } 1316 }
1317 peer->main_process = GNUNET_OS_start_process (PIPE_CONTROL, 1317 peer->main_process = GNUNET_OS_start_process (PIPE_CONTROL,
1318 GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 1318 GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
1319 NULL, NULL, 1319 NULL, NULL,
1320 peer->main_binary, 1320 peer->main_binary,
@@ -1377,7 +1377,7 @@ GNUNET_TESTING_peer_service_start (struct GNUNET_TESTING_Peer *peer,
1377 * @return GNUNET_OK upon successfully queuing the service stop request; 1377 * @return GNUNET_OK upon successfully queuing the service stop request;
1378 * GNUNET_SYSERR upon error 1378 * GNUNET_SYSERR upon error
1379 */ 1379 */
1380int 1380int
1381GNUNET_TESTING_peer_service_stop (struct GNUNET_TESTING_Peer *peer, 1381GNUNET_TESTING_peer_service_stop (struct GNUNET_TESTING_Peer *peer,
1382 const char *service_name, 1382 const char *service_name,
1383 struct GNUNET_TIME_Relative timeout, 1383 struct GNUNET_TIME_Relative timeout,
@@ -1386,13 +1386,13 @@ GNUNET_TESTING_peer_service_stop (struct GNUNET_TESTING_Peer *peer,
1386{ 1386{
1387 if (NULL == peer->ah) 1387 if (NULL == peer->ah)
1388 return GNUNET_SYSERR; 1388 return GNUNET_SYSERR;
1389 GNUNET_ARM_request_service_stop (peer->ah, 1389 GNUNET_ARM_request_service_stop (peer->ah,
1390 service_name, 1390 service_name,
1391 timeout, 1391 timeout,
1392 cont, cont_cls); 1392 cont, cont_cls);
1393 return GNUNET_OK; 1393 return GNUNET_OK;
1394} 1394}
1395 1395
1396 1396
1397/** 1397/**
1398 * Sends SIGTERM to the peer's main process 1398 * Sends SIGTERM to the peer's main process
@@ -1451,7 +1451,7 @@ GNUNET_TESTING_peer_wait (struct GNUNET_TESTING_Peer *peer)
1451 1451
1452 1452
1453/** 1453/**
1454 * Stop the peer. 1454 * Stop the peer.
1455 * 1455 *
1456 * @param peer peer to stop 1456 * @param peer peer to stop
1457 * @return GNUNET_OK on success, GNUNET_SYSERR on error 1457 * @return GNUNET_OK on success, GNUNET_SYSERR on error
@@ -1475,7 +1475,7 @@ GNUNET_TESTING_peer_stop (struct GNUNET_TESTING_Peer *peer)
1475 * GNUNET_SYSERR on error. 1475 * GNUNET_SYSERR on error.
1476 */ 1476 */
1477static void 1477static void
1478disconn_status (void *cls, 1478disconn_status (void *cls,
1479 int connected) 1479 int connected)
1480{ 1480{
1481 struct GNUNET_TESTING_Peer *peer = cls; 1481 struct GNUNET_TESTING_Peer *peer = cls;
@@ -1514,7 +1514,7 @@ GNUNET_TESTING_peer_stop_async (struct GNUNET_TESTING_Peer *peer,
1514 void *cb_cls) 1514 void *cb_cls)
1515{ 1515{
1516 if (NULL == peer->main_process) 1516 if (NULL == peer->main_process)
1517 return GNUNET_SYSERR; 1517 return GNUNET_SYSERR;
1518 peer->ah = GNUNET_ARM_connect (peer->cfg, &disconn_status, peer); 1518 peer->ah = GNUNET_ARM_connect (peer->cfg, &disconn_status, peer);
1519 if (NULL == peer->ah) 1519 if (NULL == peer->ah)
1520 return GNUNET_SYSERR; 1520 return GNUNET_SYSERR;
@@ -1535,7 +1535,7 @@ GNUNET_TESTING_peer_stop_async (struct GNUNET_TESTING_Peer *peer,
1535 */ 1535 */
1536void 1536void
1537GNUNET_TESTING_peer_stop_async_cancel (struct GNUNET_TESTING_Peer *peer) 1537GNUNET_TESTING_peer_stop_async_cancel (struct GNUNET_TESTING_Peer *peer)
1538{ 1538{
1539 GNUNET_assert (NULL != peer->ah); 1539 GNUNET_assert (NULL != peer->ah);
1540 GNUNET_ARM_disconnect_and_free (peer->ah); 1540 GNUNET_ARM_disconnect_and_free (peer->ah);
1541 peer->ah = NULL; 1541 peer->ah = NULL;
@@ -1618,7 +1618,7 @@ struct ServiceContext
1618 * Callback to signal service startup 1618 * Callback to signal service startup
1619 */ 1619 */
1620 GNUNET_TESTING_TestMain tm; 1620 GNUNET_TESTING_TestMain tm;
1621 1621
1622 /** 1622 /**
1623 * The peer in which the service is run. 1623 * The peer in which the service is run.
1624 */ 1624 */
@@ -1719,7 +1719,7 @@ GNUNET_TESTING_service_run (const char *testdir,
1719 GNUNET_free (libexec_binary); 1719 GNUNET_free (libexec_binary);
1720 GNUNET_free (binary); 1720 GNUNET_free (binary);
1721 if (GNUNET_OK != GNUNET_TESTING_peer_start (peer)) 1721 if (GNUNET_OK != GNUNET_TESTING_peer_start (peer))
1722 { 1722 {
1723 GNUNET_TESTING_peer_destroy (peer); 1723 GNUNET_TESTING_peer_destroy (peer);
1724 GNUNET_CONFIGURATION_destroy (cfg); 1724 GNUNET_CONFIGURATION_destroy (cfg);
1725 GNUNET_TESTING_system_destroy (system, GNUNET_YES); 1725 GNUNET_TESTING_system_destroy (system, GNUNET_YES);
@@ -1749,14 +1749,14 @@ GNUNET_TESTING_service_run (const char *testdir,
1749 * Sometimes we use the binary name to determine which specific 1749 * Sometimes we use the binary name to determine which specific
1750 * test to run. In those cases, the string after the last "_" 1750 * test to run. In those cases, the string after the last "_"
1751 * in 'argv[0]' specifies a string that determines the configuration 1751 * in 'argv[0]' specifies a string that determines the configuration
1752 * file or plugin to use. 1752 * file or plugin to use.
1753 * 1753 *
1754 * This function returns the respective substring, taking care 1754 * This function returns the respective substring, taking care
1755 * of issues such as binaries ending in '.exe' on W32. 1755 * of issues such as binaries ending in '.exe' on W32.
1756 * 1756 *
1757 * @param argv0 the name of the binary 1757 * @param argv0 the name of the binary
1758 * @return string between the last '_' and the '.exe' (or the end of the string), 1758 * @return string between the last '_' and the '.exe' (or the end of the string),
1759 * NULL if argv0 has no '_' 1759 * NULL if argv0 has no '_'
1760 */ 1760 */
1761char * 1761char *
1762GNUNET_TESTING_get_testname_from_underscore (const char *argv0) 1762GNUNET_TESTING_get_testname_from_underscore (const char *argv0)
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c
index 5b59995a9..761986d68 100644
--- a/src/topology/gnunet-daemon-topology.c
+++ b/src/topology/gnunet-daemon-topology.c
@@ -61,7 +61,7 @@
61 61
62/** 62/**
63 * For how long do we blacklist anyone under any cirumstances at most after a failed connection 63 * For how long do we blacklist anyone under any cirumstances at most after a failed connection
64 * attempt? This is the absolute maximum, regardless of what the calculation based on 64 * attempt? This is the absolute maximum, regardless of what the calculation based on
65 * exponential back-off returns. 65 * exponential back-off returns.
66 */ 66 */
67#define GREYLIST_AFTER_ATTEMPT_MAX GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 1) 67#define GREYLIST_AFTER_ATTEMPT_MAX GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 1)
@@ -981,7 +981,7 @@ process_peer (void *cls, const struct GNUNET_PeerIdentity *peer,
981 * @param my_id ID of this peer, NULL if we failed 981 * @param my_id ID of this peer, NULL if we failed
982 */ 982 */
983static void 983static void
984core_init (void *cls, 984core_init (void *cls,
985 const struct GNUNET_PeerIdentity *my_id) 985 const struct GNUNET_PeerIdentity *my_id)
986{ 986{
987 if (NULL == my_id) 987 if (NULL == my_id)
@@ -993,10 +993,10 @@ core_init (void *cls,
993 return; 993 return;
994 } 994 }
995 my_identity = *my_id; 995 my_identity = *my_id;
996 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 996 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
997 "I am peer `%s'\n", 997 "I am peer `%s'\n",
998 GNUNET_i2s (my_id)); 998 GNUNET_i2s (my_id));
999 peerinfo_notify = GNUNET_PEERINFO_notify (cfg, GNUNET_NO, 999 peerinfo_notify = GNUNET_PEERINFO_notify (cfg, GNUNET_NO,
1000 &process_peer, NULL); 1000 &process_peer, NULL);
1001} 1001}
1002 1002
diff --git a/src/topology/test_gnunet_daemon_topology.c b/src/topology/test_gnunet_daemon_topology.c
index f78fa5bf0..c880dad9e 100644
--- a/src/topology/test_gnunet_daemon_topology.c
+++ b/src/topology/test_gnunet_daemon_topology.c
@@ -39,7 +39,7 @@ static unsigned int connect_left;
39 39
40 40
41static void 41static void
42notify_connect_complete (void *cls, 42notify_connect_complete (void *cls,
43 struct GNUNET_TESTBED_Operation *op, 43 struct GNUNET_TESTBED_Operation *op,
44 const char *emsg) 44 const char *emsg)
45{ 45{
@@ -63,7 +63,7 @@ notify_connect_complete (void *cls,
63 63
64static void 64static void
65do_connect (void *cls, 65do_connect (void *cls,
66 struct GNUNET_TESTBED_RunHandle *h, 66 struct GNUNET_TESTBED_RunHandle *h,
67 unsigned int num_peers, 67 unsigned int num_peers,
68 struct GNUNET_TESTBED_Peer **peers, 68 struct GNUNET_TESTBED_Peer **peers,
69 unsigned int links_succeeded, 69 unsigned int links_succeeded,
diff --git a/src/transport/gnunet-helper-transport-bluetooth.c b/src/transport/gnunet-helper-transport-bluetooth.c
index cc8a6484e..343aacd19 100644
--- a/src/transport/gnunet-helper-transport-bluetooth.c
+++ b/src/transport/gnunet-helper-transport-bluetooth.c
@@ -35,7 +35,7 @@
35 #include <bluetooth/sdp.h> 35 #include <bluetooth/sdp.h>
36 #include <bluetooth/sdp_lib.h> 36 #include <bluetooth/sdp_lib.h>
37 #include <errno.h> 37 #include <errno.h>
38 #include <linux/if.h> 38 #include <linux/if.h>
39 #include <stdio.h> 39 #include <stdio.h>
40 #include <stdlib.h> 40 #include <stdlib.h>
41 #include <sys/ioctl.h> 41 #include <sys/ioctl.h>
@@ -82,7 +82,7 @@
82 UINT8 mac[MAC_ADDR_SIZE]; 82 UINT8 mac[MAC_ADDR_SIZE];
83 }; 83 };
84 84
85 /** 85 /**
86 * The UUID used for the SDP service. 86 * The UUID used for the SDP service.
87 * {31191E56-FA7E-4517-870E-71B86BBCC52F} 87 * {31191E56-FA7E-4517-870E-71B86BBCC52F}
88 */ 88 */
@@ -110,7 +110,7 @@ struct HardwareInfos
110 #ifdef MINGW 110 #ifdef MINGW
111 /** 111 /**
112 * socket handle 112 * socket handle
113 */ 113 */
114 struct GNUNET_NETWORK_Handle *handle; 114 struct GNUNET_NETWORK_Handle *handle;
115 115
116 /** 116 /**
@@ -127,7 +127,7 @@ struct HardwareInfos
127 * MAC address of our own bluetooth interface. 127 * MAC address of our own bluetooth interface.
128 */ 128 */
129 struct GNUNET_TRANSPORT_WLAN_MacAddress pl_mac; 129 struct GNUNET_TRANSPORT_WLAN_MacAddress pl_mac;
130 130
131 /** 131 /**
132 * SDP session 132 * SDP session
133 */ 133 */
@@ -151,7 +151,7 @@ struct SendBuffer
151 * destination? Always smaller than 'size'. 151 * destination? Always smaller than 'size'.
152 */ 152 */
153 size_t pos; 153 size_t pos;
154 154
155 /** 155 /**
156 * Buffered data; twice the maximum allowed message size as we add some 156 * Buffered data; twice the maximum allowed message size as we add some
157 * headers. 157 * headers.
@@ -161,13 +161,13 @@ struct SendBuffer
161 161
162#ifdef LINUX 162#ifdef LINUX
163 /** 163 /**
164 * Devices buffer used to keep a list with all the discoverable devices in 164 * Devices buffer used to keep a list with all the discoverable devices in
165 * order to send them HELLO messages one by one when it receive a broadcast message. 165 * order to send them HELLO messages one by one when it receive a broadcast message.
166 */ 166 */
167 struct BroadcastMessages 167 struct BroadcastMessages
168 { 168 {
169 /* List with the discoverable devices' addresses */ 169 /* List with the discoverable devices' addresses */
170 bdaddr_t devices[MAX_PORTS]; 170 bdaddr_t devices[MAX_PORTS];
171 171
172 /* List with the open sockets */ 172 /* List with the open sockets */
173 int fds[MAX_PORTS]; 173 int fds[MAX_PORTS];
@@ -175,7 +175,7 @@ struct SendBuffer
175 175
176 /* The number of the devices */ 176 /* The number of the devices */
177 int size; 177 int size;
178 178
179 /* The current position */ 179 /* The current position */
180 int pos; 180 int pos;
181 181
@@ -207,7 +207,7 @@ static struct SendBuffer write_pout;
207static struct SendBuffer write_std; 207static struct SendBuffer write_std;
208 208
209 209
210/* ****** this are the same functions as the ones used in gnunet-helper-transport-wlan.c ****** */ 210/* ****** this are the same functions as the ones used in gnunet-helper-transport-wlan.c ****** */
211 211
212/** 212/**
213 * To what multiple do we align messages? 8 byte should suffice for everyone 213 * To what multiple do we align messages? 8 byte should suffice for everyone
@@ -228,7 +228,7 @@ static struct SendBuffer write_std;
228 * @param cls closure 228 * @param cls closure
229 * @param message the actual message 229 * @param message the actual message
230 */ 230 */
231typedef void (*MessageTokenizerCallback) (void *cls, 231typedef void (*MessageTokenizerCallback) (void *cls,
232 const struct 232 const struct
233 GNUNET_MessageHeader * 233 GNUNET_MessageHeader *
234 message); 234 message);
@@ -301,7 +301,7 @@ mst_create (MessageTokenizerCallback cb,
301 ret->cb = cb; 301 ret->cb = cb;
302 ret->cb_cls = cb_cls; 302 ret->cb_cls = cb_cls;
303 ret->pos = 0; 303 ret->pos = 0;
304 304
305 return ret; 305 return ret;
306} 306}
307 307
@@ -602,7 +602,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
602 if (((crc) & 0xFF) == buf[0] && ((crc >> 8) & 0xFF) == buf[1] && 602 if (((crc) & 0xFF) == buf[0] && ((crc >> 8) & 0xFF) == buf[1] &&
603 ((crc >> 16) & 0xFF) == buf[2] && ((crc >> 24) & 0xFF) == buf[3]) 603 ((crc >> 16) & 0xFF) == buf[2] && ((crc >> 24) & 0xFF) == buf[3])
604 return 0; 604 return 0;
605 return 1; 605 return 1;
606} 606}
607 607
608 608
@@ -613,7 +613,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
613 /** 613 /**
614 * Function used to get the code of last error and to print the type of error. 614 * Function used to get the code of last error and to print the type of error.
615 */ 615 */
616 static void 616 static void
617 print_last_error() 617 print_last_error()
618 { 618 {
619 LPVOID lpMsgBuf = NULL; 619 LPVOID lpMsgBuf = NULL;
@@ -644,9 +644,9 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
644 /** 644 /**
645 * Function used to convert the GUID. 645 * Function used to convert the GUID.
646 * @param bytes the GUID represented as a char array 646 * @param bytes the GUID represented as a char array
647 * @param uuid pointer to the GUID 647 * @param uuid pointer to the GUID
648 */ 648 */
649 static void 649 static void
650 convert_guid(char *bytes, GUID * uuid) 650 convert_guid(char *bytes, GUID * uuid)
651 { 651 {
652 int i; 652 int i;
@@ -664,16 +664,16 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
664#ifdef LINUX 664#ifdef LINUX
665 /** 665 /**
666 * Function for assigning a port number 666 * Function for assigning a port number
667 * 667 *
668 * @param socket the socket used to bind 668 * @param socket the socket used to bind
669 * @param addr pointer to the rfcomm address 669 * @param addr pointer to the rfcomm address
670 * @return 0 on success 670 * @return 0 on success
671 */ 671 */
672 static int 672 static int
673 bind_socket (int socket, struct sockaddr_rc *addr) 673 bind_socket (int socket, struct sockaddr_rc *addr)
674 { 674 {
675 int port, status; 675 int port, status;
676 676
677 /* Bind every possible port (from 0 to 30) and stop when binding doesn't fail */ 677 /* Bind every possible port (from 0 to 30) and stop when binding doesn't fail */
678 //FIXME : it should start from port 1, but on my computer it doesn't work :) 678 //FIXME : it should start from port 1, but on my computer it doesn't work :)
679 for (port = 3; port <= 30; port++) 679 for (port = 3; port <= 30; port++)
@@ -683,8 +683,8 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
683 if (status == 0) 683 if (status == 0)
684 return 0; 684 return 0;
685 } 685 }
686 686
687 return -1; 687 return -1;
688 } 688 }
689#endif 689#endif
690 690
@@ -696,7 +696,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
696 * @return 0 on success 696 * @return 0 on success
697 */ 697 */
698 static int 698 static int
699 register_service (struct HardwareInfos *dev) 699 register_service (struct HardwareInfos *dev)
700 { 700 {
701 /* advertise the service */ 701 /* advertise the service */
702 CSADDR_INFO addr_info; 702 CSADDR_INFO addr_info;
@@ -746,7 +746,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
746 wqs.lpcsaBuffer = &addr_info ; 746 wqs.lpcsaBuffer = &addr_info ;
747 wqs.lpBlob = 0; 747 wqs.lpBlob = 0;
748 748
749 if (SOCKET_ERROR == WSASetService (&wqs , RNRSERVICE_REGISTER, 0)) 749 if (SOCKET_ERROR == WSASetService (&wqs , RNRSERVICE_REGISTER, 0))
750 { 750 {
751 fprintf (stderr, "Failed to register the SDP service: "); 751 fprintf (stderr, "Failed to register the SDP service: ");
752 print_last_error(); 752 print_last_error();
@@ -768,7 +768,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
768 * @return 0 on success 768 * @return 0 on success
769 */ 769 */
770 static int 770 static int
771 register_service (struct HardwareInfos *dev, int rc_channel) 771 register_service (struct HardwareInfos *dev, int rc_channel)
772 { 772 {
773 /** 773 /**
774 * 1. initializations 774 * 1. initializations
@@ -779,17 +779,17 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
779 * 6. register the service record to the local SDP server 779 * 6. register the service record to the local SDP server
780 * 7. cleanup 780 * 7. cleanup
781 */ 781 */
782 uint8_t svc_uuid_int[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 782 uint8_t svc_uuid_int[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
783 dev->pl_mac.mac[5], dev->pl_mac.mac[4], dev->pl_mac.mac[3], 783 dev->pl_mac.mac[5], dev->pl_mac.mac[4], dev->pl_mac.mac[3],
784 dev->pl_mac.mac[2], dev->pl_mac.mac[1], dev->pl_mac.mac[0]}; 784 dev->pl_mac.mac[2], dev->pl_mac.mac[1], dev->pl_mac.mac[0]};
785 const char *service_dsc = "Bluetooth plugin services"; 785 const char *service_dsc = "Bluetooth plugin services";
786 const char *service_prov = "GNUnet provider"; 786 const char *service_prov = "GNUnet provider";
787 uuid_t root_uuid, rfcomm_uuid, svc_uuid; 787 uuid_t root_uuid, rfcomm_uuid, svc_uuid;
788 sdp_list_t *root_list = 0, *rfcomm_list = 0, *proto_list = 0, 788 sdp_list_t *root_list = 0, *rfcomm_list = 0, *proto_list = 0,
789 *access_proto_list = 0, *svc_list = 0; 789 *access_proto_list = 0, *svc_list = 0;
790 sdp_record_t *record = 0; 790 sdp_record_t *record = 0;
791 sdp_data_t *channel = 0; 791 sdp_data_t *channel = 0;
792 792
793 record = sdp_record_alloc(); 793 record = sdp_record_alloc();
794 794
795 /* Set the general service ID */ 795 /* Set the general service ID */
@@ -799,8 +799,8 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
799 sdp_set_service_id (record, svc_uuid); 799 sdp_set_service_id (record, svc_uuid);
800 800
801 /* Make the service record publicly browsable */ 801 /* Make the service record publicly browsable */
802 sdp_uuid16_create (&root_uuid, PUBLIC_BROWSE_GROUP); 802 sdp_uuid16_create (&root_uuid, PUBLIC_BROWSE_GROUP);
803 root_list = sdp_list_append (0, &root_uuid); 803 root_list = sdp_list_append (0, &root_uuid);
804 sdp_set_browse_groups (record, root_list); 804 sdp_set_browse_groups (record, root_list);
805 805
806 /* Register the RFCOMM channel */ 806 /* Register the RFCOMM channel */
@@ -816,10 +816,10 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
816 816
817 /* Set the name, provider, and description */ 817 /* Set the name, provider, and description */
818 sdp_set_info_attr (record, dev->iface, service_prov, service_dsc); 818 sdp_set_info_attr (record, dev->iface, service_prov, service_dsc);
819 819
820 /* Connect to the local SDP server */ 820 /* Connect to the local SDP server */
821 dev->session = sdp_connect (BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY); 821 dev->session = sdp_connect (BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY);
822 822
823 if (!dev->session) 823 if (!dev->session)
824 { 824 {
825 fprintf (stderr, "Failed to connect to the SDP server on interface `%.*s': %s\n", 825 fprintf (stderr, "Failed to connect to the SDP server on interface `%.*s': %s\n",
@@ -827,7 +827,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
827 //FIXME exit? 827 //FIXME exit?
828 return 1; 828 return 1;
829 } 829 }
830 830
831 /* Register the service record */ 831 /* Register the service record */
832 if (sdp_record_register (dev->session, record, 0) < 0) 832 if (sdp_record_register (dev->session, record, 0) < 0)
833 { 833 {
@@ -836,23 +836,23 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
836 //FIXME exit? 836 //FIXME exit?
837 return 1; 837 return 1;
838 } 838 }
839 839
840 /* Cleanup */ 840 /* Cleanup */
841 sdp_data_free (channel); 841 sdp_data_free (channel);
842 sdp_list_free (root_list, 0); 842 sdp_list_free (root_list, 0);
843 sdp_list_free (rfcomm_list, 0); 843 sdp_list_free (rfcomm_list, 0);
844 sdp_list_free (proto_list, 0); 844 sdp_list_free (proto_list, 0);
845 sdp_list_free (access_proto_list, 0); 845 sdp_list_free (access_proto_list, 0);
846 sdp_list_free (svc_list, 0); 846 sdp_list_free (svc_list, 0);
847 sdp_record_free (record); 847 sdp_record_free (record);
848 848
849 return 0; 849 return 0;
850 } 850 }
851#endif 851#endif
852 852
853#ifdef MINGW 853#ifdef MINGW
854 /** 854 /**
855 * Function for searching and browsing for a service. This will return the 855 * Function for searching and browsing for a service. This will return the
856 * port number on which the service is running. 856 * port number on which the service is running.
857 * 857 *
858 * @param dest target address 858 * @param dest target address
@@ -869,16 +869,16 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
869 GUID guid; 869 GUID guid;
870 unsigned char uuid[] = GNUNET_BLUETOOTH_SDP_UUID; 870 unsigned char uuid[] = GNUNET_BLUETOOTH_SDP_UUID;
871 convert_guid ((char *) uuid, &guid); 871 convert_guid ((char *) uuid, &guid);
872 872
873 wqs = (WSAQUERYSET*)malloc (wqs_len); 873 wqs = (WSAQUERYSET*)malloc (wqs_len);
874 ZeroMemory (wqs, wqs_len); 874 ZeroMemory (wqs, wqs_len);
875 875
876 wqs->dwSize = sizeof (WSAQUERYSET) ; 876 wqs->dwSize = sizeof (WSAQUERYSET) ;
877 wqs->lpServiceClassId = &guid; 877 wqs->lpServiceClassId = &guid;
878 wqs->dwNameSpace = NS_BTH; 878 wqs->dwNameSpace = NS_BTH;
879 wqs->dwNumberOfCsAddrs = 0; 879 wqs->dwNumberOfCsAddrs = 0;
880 wqs->lpszContext = (LPSTR)dest; 880 wqs->lpszContext = (LPSTR)dest;
881 881
882 if (SOCKET_ERROR == WSALookupServiceBegin (wqs, LUP_FLUSHCACHE | LUP_RETURN_ALL, &h)) 882 if (SOCKET_ERROR == WSALookupServiceBegin (wqs, LUP_FLUSHCACHE | LUP_RETURN_ALL, &h))
883 { 883 {
884 if (GetLastError() == WSASERVICE_NOT_FOUND) 884 if (GetLastError() == WSASERVICE_NOT_FOUND)
@@ -894,14 +894,14 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
894 return -1; 894 return -1;
895 } 895 }
896 } 896 }
897 897
898 /* search the sdp service */ 898 /* search the sdp service */
899 while (!done) 899 while (!done)
900 { 900 {
901 if (SOCKET_ERROR == WSALookupServiceNext (h, LUP_FLUSHCACHE | LUP_RETURN_ALL, &wqs_len, wqs)) 901 if (SOCKET_ERROR == WSALookupServiceNext (h, LUP_FLUSHCACHE | LUP_RETURN_ALL, &wqs_len, wqs))
902 { 902 {
903 int error = WSAGetLastError(); 903 int error = WSAGetLastError();
904 904
905 switch (error) 905 switch (error)
906 { 906 {
907 case WSAEFAULT: 907 case WSAEFAULT:
@@ -927,15 +927,15 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
927 channel = ((SOCKADDR_BTH*)wqs->lpcsaBuffer->RemoteAddr.lpSockaddr)->port; 927 channel = ((SOCKADDR_BTH*)wqs->lpcsaBuffer->RemoteAddr.lpSockaddr)->port;
928 } 928 }
929 } 929 }
930 930
931 free (wqs) ; 931 free (wqs) ;
932 WSALookupServiceEnd (h); 932 WSALookupServiceEnd (h);
933 933
934 return channel; 934 return channel;
935 } 935 }
936#else 936#else
937 /** 937 /**
938 * Function used for searching and browsing for a service. This will return the 938 * Function used for searching and browsing for a service. This will return the
939 * port number on which the service is running. 939 * port number on which the service is running.
940 * 940 *
941 * @param dev pointer to the device struct 941 * @param dev pointer to the device struct
@@ -943,17 +943,17 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
943 * @return channel 943 * @return channel
944 */ 944 */
945 static int 945 static int
946 get_channel(struct HardwareInfos *dev, bdaddr_t dest) 946 get_channel(struct HardwareInfos *dev, bdaddr_t dest)
947 { 947 {
948 /** 948 /**
949 * 1. detect all nearby devices 949 * 1. detect all nearby devices
950 * 2. for each device: 950 * 2. for each device:
951 * 2.1. connect to the SDP server running 951 * 2.1. connect to the SDP server running
952 * 2.2. get a list of service records with the specific UUID 952 * 2.2. get a list of service records with the specific UUID
953 * 2.3. for each service record get a list of the protocol sequences and get 953 * 2.3. for each service record get a list of the protocol sequences and get
954 * the port number 954 * the port number
955 */ 955 */
956 uint8_t svc_uuid_int[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 956 uint8_t svc_uuid_int[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
957 dest.b[5], dest.b[4], dest.b[3], 957 dest.b[5], dest.b[4], dest.b[3],
958 dest.b[2], dest.b[1], dest.b[0]}; 958 dest.b[2], dest.b[1], dest.b[0]};
959 sdp_session_t *session = 0; 959 sdp_session_t *session = 0;
@@ -961,21 +961,21 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
961 uuid_t svc_uuid; 961 uuid_t svc_uuid;
962 uint32_t range = 0x0000ffff; 962 uint32_t range = 0x0000ffff;
963 uint8_t channel = -1; 963 uint8_t channel = -1;
964 964
965 /* Connect to the local SDP server */ 965 /* Connect to the local SDP server */
966 session = sdp_connect (BDADDR_ANY, &dest, 0); 966 session = sdp_connect (BDADDR_ANY, &dest, 0);
967 if (!session) 967 if (!session)
968 { 968 {
969 fprintf (stderr, "Failed to connect to the SDP server on interface `%.*s': %s\n", 969 fprintf (stderr, "Failed to connect to the SDP server on interface `%.*s': %s\n",
970 IFNAMSIZ, dev->iface, strerror (errno)); 970 IFNAMSIZ, dev->iface, strerror (errno));
971 return -1; 971 return -1;
972 } 972 }
973 973
974 sdp_uuid128_create (&svc_uuid, &svc_uuid_int); 974 sdp_uuid128_create (&svc_uuid, &svc_uuid_int);
975 search_list = sdp_list_append (0, &svc_uuid); 975 search_list = sdp_list_append (0, &svc_uuid);
976 attrid_list = sdp_list_append (0, &range); 976 attrid_list = sdp_list_append (0, &range);
977 977
978 if (sdp_service_search_attr_req (session, search_list, 978 if (sdp_service_search_attr_req (session, search_list,
979 SDP_ATTR_REQ_RANGE, attrid_list, &response_list) == 0) 979 SDP_ATTR_REQ_RANGE, attrid_list, &response_list) == 0)
980 { 980 {
981 for (it = response_list; it; it = it->next) 981 for (it = response_list; it; it = it->next)
@@ -990,24 +990,24 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
990 sdp_record_free (record); 990 sdp_record_free (record);
991 } 991 }
992 } 992 }
993 993
994 sdp_list_free (search_list, 0); 994 sdp_list_free (search_list, 0);
995 sdp_list_free (attrid_list, 0); 995 sdp_list_free (attrid_list, 0);
996 sdp_list_free (response_list, 0); 996 sdp_list_free (response_list, 0);
997 997
998 sdp_close (session); 998 sdp_close (session);
999 999
1000 if (channel == -1) 1000 if (channel == -1)
1001 fprintf (stderr, "Failed to find the listening channel for interface `%.*s': %s\n", 1001 fprintf (stderr, "Failed to find the listening channel for interface `%.*s': %s\n",
1002 IFNAMSIZ, dev->iface, strerror (errno)); 1002 IFNAMSIZ, dev->iface, strerror (errno));
1003 1003
1004 return channel; 1004 return channel;
1005 } 1005 }
1006#endif 1006#endif
1007 1007
1008/** 1008/**
1009 * Read from the socket and put the result into the buffer for transmission to 'stdout'. 1009 * Read from the socket and put the result into the buffer for transmission to 'stdout'.
1010 * 1010 *
1011 * @param sock file descriptor for reading 1011 * @param sock file descriptor for reading
1012 * @param buf buffer to read to; first bytes will be the 'struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame', 1012 * @param buf buffer to read to; first bytes will be the 'struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame',
1013 * followed by the actual payload 1013 * followed by the actual payload
@@ -1015,18 +1015,18 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
1015 * @param ri where to write radiotap_rx info 1015 * @param ri where to write radiotap_rx info
1016 * @return number of bytes written to 'buf' 1016 * @return number of bytes written to 'buf'
1017 */ 1017 */
1018static ssize_t 1018static ssize_t
1019read_from_the_socket (void *sock, 1019read_from_the_socket (void *sock,
1020 unsigned char *buf, size_t buf_size, 1020 unsigned char *buf, size_t buf_size,
1021 struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *ri) 1021 struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *ri)
1022{ 1022{
1023 unsigned char tmpbuf[buf_size]; 1023 unsigned char tmpbuf[buf_size];
1024 ssize_t count; 1024 ssize_t count;
1025 1025
1026 #ifdef MINGW 1026 #ifdef MINGW
1027 count = GNUNET_NETWORK_socket_recv ((struct GNUNET_NETWORK_Handle *)sock, tmpbuf, buf_size); 1027 count = GNUNET_NETWORK_socket_recv ((struct GNUNET_NETWORK_Handle *)sock, tmpbuf, buf_size);
1028 #else 1028 #else
1029 count = read (*((int *)sock), tmpbuf, buf_size); 1029 count = read (*((int *)sock), tmpbuf, buf_size);
1030 #endif 1030 #endif
1031 1031
1032 if (0 > count) 1032 if (0 > count)
@@ -1041,11 +1041,11 @@ read_from_the_socket (void *sock,
1041 1041
1042 return -1; 1042 return -1;
1043 } 1043 }
1044 1044
1045 #ifdef LINUX 1045 #ifdef LINUX
1046 /* Get the channel used */ 1046 /* Get the channel used */
1047 int len; 1047 int len;
1048 struct sockaddr_rc rc_addr = { 0 }; 1048 struct sockaddr_rc rc_addr = { 0 };
1049 1049
1050 memset (&rc_addr, 0, sizeof (rc_addr)); 1050 memset (&rc_addr, 0, sizeof (rc_addr));
1051 len = sizeof (rc_addr); 1051 len = sizeof (rc_addr);
@@ -1064,9 +1064,9 @@ read_from_the_socket (void *sock,
1064 { 1064 {
1065 count -= sizeof(uint32_t); 1065 count -= sizeof(uint32_t);
1066 } 1066 }
1067 1067
1068 memcpy (buf, tmpbuf, count); 1068 memcpy (buf, tmpbuf, count);
1069 1069
1070 return count; 1070 return count;
1071} 1071}
1072 1072
@@ -1078,7 +1078,7 @@ read_from_the_socket (void *sock,
1078 */ 1078 */
1079static int 1079static int
1080open_device (struct HardwareInfos *dev) 1080open_device (struct HardwareInfos *dev)
1081{ 1081{
1082 #ifdef MINGW 1082 #ifdef MINGW
1083 SOCKADDR_BTH addr; 1083 SOCKADDR_BTH addr;
1084 1084
@@ -1113,30 +1113,30 @@ open_device (struct HardwareInfos *dev)
1113 fprintf (stderr, "Failed to register a service: "); 1113 fprintf (stderr, "Failed to register a service: ");
1114 print_last_error(); 1114 print_last_error();
1115 return 1; 1115 return 1;
1116 } 1116 }
1117 #else 1117 #else
1118 int i, dev_id = -1, fd_hci; 1118 int i, dev_id = -1, fd_hci;
1119 struct 1119 struct
1120 { 1120 {
1121 struct hci_dev_list_req list; 1121 struct hci_dev_list_req list;
1122 struct hci_dev_req dev[HCI_MAX_DEV]; 1122 struct hci_dev_req dev[HCI_MAX_DEV];
1123 } request; //used for detecting the local devices 1123 } request; //used for detecting the local devices
1124 struct sockaddr_rc rc_addr = { 0 }; //used for binding 1124 struct sockaddr_rc rc_addr = { 0 }; //used for binding
1125 1125
1126 /* Initialize the neighbour structure */ 1126 /* Initialize the neighbour structure */
1127 neighbours.dev_id = -1; 1127 neighbours.dev_id = -1;
1128 for (i = 0; i < MAX_PORTS; i++) 1128 for (i = 0; i < MAX_PORTS; i++)
1129 neighbours.fds[i] = -1; 1129 neighbours.fds[i] = -1;
1130 1130
1131 /* Open a HCI socket */ 1131 /* Open a HCI socket */
1132 fd_hci = socket (AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); 1132 fd_hci = socket (AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
1133 1133
1134 if (fd_hci < 0) 1134 if (fd_hci < 0)
1135 { 1135 {
1136 fprintf (stderr, "Failed to create HCI socket: %s\n", strerror (errno)); 1136 fprintf (stderr, "Failed to create HCI socket: %s\n", strerror (errno));
1137 return -1; 1137 return -1;
1138 } 1138 }
1139 1139
1140 memset (&request, 0, sizeof(request)); 1140 memset (&request, 0, sizeof(request));
1141 request.list.dev_num = HCI_MAX_DEV; 1141 request.list.dev_num = HCI_MAX_DEV;
1142 1142
@@ -1146,7 +1146,7 @@ open_device (struct HardwareInfos *dev)
1146 IFNAMSIZ, dev->iface, strerror (errno)); 1146 IFNAMSIZ, dev->iface, strerror (errno));
1147 return 1; 1147 return 1;
1148 } 1148 }
1149 1149
1150 /* Search for a device with dev->iface name */ 1150 /* Search for a device with dev->iface name */
1151 for (i = 0; i < request.list.dev_num; i++) 1151 for (i = 0; i < request.list.dev_num; i++)
1152 { 1152 {
@@ -1155,23 +1155,23 @@ open_device (struct HardwareInfos *dev)
1155 memset (&dev_info, 0, sizeof(struct hci_dev_info)); 1155 memset (&dev_info, 0, sizeof(struct hci_dev_info));
1156 dev_info.dev_id = request.dev[i].dev_id; 1156 dev_info.dev_id = request.dev[i].dev_id;
1157 strncpy (dev_info.name, dev->iface, IFNAMSIZ); 1157 strncpy (dev_info.name, dev->iface, IFNAMSIZ);
1158 1158
1159 if (ioctl (fd_hci, HCIGETDEVINFO, (void *) &dev_info)) 1159 if (ioctl (fd_hci, HCIGETDEVINFO, (void *) &dev_info))
1160 { 1160 {
1161 fprintf (stderr, "ioctl(HCIGETDEVINFO) on interface `%.*s' failed: %s\n", 1161 fprintf (stderr, "ioctl(HCIGETDEVINFO) on interface `%.*s' failed: %s\n",
1162 IFNAMSIZ, dev->iface, strerror (errno)); 1162 IFNAMSIZ, dev->iface, strerror (errno));
1163 return 1; 1163 return 1;
1164 } 1164 }
1165 1165
1166 if (strcmp (dev_info.name, dev->iface) == 0) 1166 if (strcmp (dev_info.name, dev->iface) == 0)
1167 { 1167 {
1168 1168
1169 dev_id = dev_info.dev_id; //the device was found 1169 dev_id = dev_info.dev_id; //the device was found
1170 /** 1170 /**
1171 * Copy the MAC address to the device structure 1171 * Copy the MAC address to the device structure
1172 */ 1172 */
1173 memcpy (&dev->pl_mac, &dev_info.bdaddr, sizeof (bdaddr_t)); 1173 memcpy (&dev->pl_mac, &dev_info.bdaddr, sizeof (bdaddr_t));
1174 1174
1175 /* Check if the interface is up */ 1175 /* Check if the interface is up */
1176 if (hci_test_bit (HCI_UP, (void *) &dev_info.flags) == 0) 1176 if (hci_test_bit (HCI_UP, (void *) &dev_info.flags) == 0)
1177 { 1177 {
@@ -1183,55 +1183,55 @@ open_device (struct HardwareInfos *dev)
1183 return 1; 1183 return 1;
1184 } 1184 }
1185 } 1185 }
1186 1186
1187 /* Check if the device is discoverable */ 1187 /* Check if the device is discoverable */
1188 if (hci_test_bit (HCI_PSCAN, (void *) &dev_info.flags) == 0 || 1188 if (hci_test_bit (HCI_PSCAN, (void *) &dev_info.flags) == 0 ||
1189 hci_test_bit (HCI_ISCAN, (void *) &dev_info.flags) == 0) 1189 hci_test_bit (HCI_ISCAN, (void *) &dev_info.flags) == 0)
1190 { 1190 {
1191 /* Set interface Page Scan and Inqury Scan ON */ 1191 /* Set interface Page Scan and Inqury Scan ON */
1192 struct hci_dev_req dev_req; 1192 struct hci_dev_req dev_req;
1193 1193
1194 memset (&dev_req, 0, sizeof (dev_req)); 1194 memset (&dev_req, 0, sizeof (dev_req));
1195 dev_req.dev_id = dev_info.dev_id; 1195 dev_req.dev_id = dev_info.dev_id;
1196 dev_req.dev_opt = SCAN_PAGE | SCAN_INQUIRY; 1196 dev_req.dev_opt = SCAN_PAGE | SCAN_INQUIRY;
1197 1197
1198 if (ioctl (fd_hci, HCISETSCAN, (unsigned long) &dev_req)) 1198 if (ioctl (fd_hci, HCISETSCAN, (unsigned long) &dev_req))
1199 { 1199 {
1200 fprintf (stderr, "ioctl(HCISETSCAN) on interface `%.*s' failed: %s\n", 1200 fprintf (stderr, "ioctl(HCISETSCAN) on interface `%.*s' failed: %s\n",
1201 IFNAMSIZ, dev->iface, strerror (errno)); 1201 IFNAMSIZ, dev->iface, strerror (errno));
1202 return 1; 1202 return 1;
1203 } 1203 }
1204 1204
1205 } 1205 }
1206 break; 1206 break;
1207 } 1207 }
1208 1208
1209 } 1209 }
1210 1210
1211 /* Check if the interface was not found */ 1211 /* Check if the interface was not found */
1212 if (dev_id == -1) 1212 if (dev_id == -1)
1213 { 1213 {
1214 fprintf (stderr, "The interface %s was not found\n", dev->iface); 1214 fprintf (stderr, "The interface %s was not found\n", dev->iface);
1215 return 1; 1215 return 1;
1216 } 1216 }
1217 1217
1218 /* Close the hci socket */ 1218 /* Close the hci socket */
1219 (void) close(fd_hci); 1219 (void) close(fd_hci);
1220 1220
1221 1221
1222 1222
1223 /* Bind the rfcomm socket to the interface */ 1223 /* Bind the rfcomm socket to the interface */
1224 memset (&rc_addr, 0, sizeof (rc_addr)); 1224 memset (&rc_addr, 0, sizeof (rc_addr));
1225 rc_addr.rc_family = AF_BLUETOOTH; 1225 rc_addr.rc_family = AF_BLUETOOTH;
1226 rc_addr.rc_bdaddr = *BDADDR_ANY; 1226 rc_addr.rc_bdaddr = *BDADDR_ANY;
1227 1227
1228 if (bind_socket (dev->fd_rfcomm, &rc_addr) != 0) 1228 if (bind_socket (dev->fd_rfcomm, &rc_addr) != 0)
1229 { 1229 {
1230 fprintf (stderr, "Failed to bind interface `%.*s': %s\n", IFNAMSIZ, 1230 fprintf (stderr, "Failed to bind interface `%.*s': %s\n", IFNAMSIZ,
1231 dev->iface, strerror (errno)); 1231 dev->iface, strerror (errno));
1232 return 1; 1232 return 1;
1233 } 1233 }
1234 1234
1235 /* Register a SDP service */ 1235 /* Register a SDP service */
1236 if (register_service (dev, rc_addr.rc_channel) != 0) 1236 if (register_service (dev, rc_addr.rc_channel) != 0)
1237 { 1237 {
@@ -1239,7 +1239,7 @@ open_device (struct HardwareInfos *dev)
1239 dev->iface, strerror (errno)); 1239 dev->iface, strerror (errno));
1240 return 1; 1240 return 1;
1241 } 1241 }
1242 1242
1243 /* Switch socket in listening mode */ 1243 /* Switch socket in listening mode */
1244 if (listen (dev->fd_rfcomm, 5) == -1) //FIXME: probably we need a bigger number 1244 if (listen (dev->fd_rfcomm, 5) == -1) //FIXME: probably we need a bigger number
1245 { 1245 {
@@ -1247,7 +1247,7 @@ open_device (struct HardwareInfos *dev)
1247 dev->iface, strerror (errno)); 1247 dev->iface, strerror (errno));
1248 return 1; 1248 return 1;
1249 } 1249 }
1250 1250
1251 #endif 1251 #endif
1252 1252
1253 return 0; 1253 return 0;
@@ -1266,7 +1266,7 @@ static void
1266mac_set (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *taIeeeHeader, 1266mac_set (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *taIeeeHeader,
1267 const struct HardwareInfos *dev) 1267 const struct HardwareInfos *dev)
1268{ 1268{
1269 taIeeeHeader->frame_control = htons (IEEE80211_FC0_TYPE_DATA); 1269 taIeeeHeader->frame_control = htons (IEEE80211_FC0_TYPE_DATA);
1270 taIeeeHeader->addr3 = mac_bssid_gnunet; 1270 taIeeeHeader->addr3 = mac_bssid_gnunet;
1271 1271
1272 #ifdef MINGW 1272 #ifdef MINGW
@@ -1292,13 +1292,13 @@ mac_set (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *taIeeeHeader,
1292 struct stat sbuf; 1292 struct stat sbuf;
1293 int ret; 1293 int ret;
1294 1294
1295 ret = snprintf (strbuf, sizeof (strbuf), 1295 ret = snprintf (strbuf, sizeof (strbuf),
1296 "/sys/class/bluetooth/%s/subsystem", 1296 "/sys/class/bluetooth/%s/subsystem",
1297 iface); 1297 iface);
1298 if ((ret < 0) || (ret >= sizeof (strbuf)) || (0 != stat (strbuf, &sbuf))) 1298 if ((ret < 0) || (ret >= sizeof (strbuf)) || (0 != stat (strbuf, &sbuf)))
1299 { 1299 {
1300 fprintf (stderr, 1300 fprintf (stderr,
1301 "Did not find 802.15.1 interface `%s'. Exiting.\n", 1301 "Did not find 802.15.1 interface `%s'. Exiting.\n",
1302 iface); 1302 iface);
1303 exit (1); 1303 exit (1);
1304 } 1304 }
@@ -1354,12 +1354,12 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1354 sendsize = ntohs (hdr->size); 1354 sendsize = ntohs (hdr->size);
1355 if ( (sendsize < 1355 if ( (sendsize <
1356 sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)) || 1356 sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)) ||
1357 (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)) ) 1357 (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)) )
1358 { 1358 {
1359 fprintf (stderr, "Received malformed message\n"); 1359 fprintf (stderr, "Received malformed message\n");
1360 exit (1); 1360 exit (1);
1361 } 1361 }
1362 sendsize -= (sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) - 1362 sendsize -= (sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) -
1363 sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame)); 1363 sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame));
1364 if (MAXLINE < sendsize) 1364 if (MAXLINE < sendsize)
1365 { 1365 {
@@ -1373,7 +1373,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1373 /* payload contains MAC address, but we don't trust it, so we'll 1373 /* payload contains MAC address, but we don't trust it, so we'll
1374 * overwrite it with OUR MAC address to prevent mischief */ 1374 * overwrite it with OUR MAC address to prevent mischief */
1375 mac_set (blueheader, dev); 1375 mac_set (blueheader, dev);
1376 memcpy (&blueheader->addr1, &header->frame.addr1, 1376 memcpy (&blueheader->addr1, &header->frame.addr1,
1377 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); 1377 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
1378 write_pout.size = sendsize; 1378 write_pout.size = sendsize;
1379} 1379}
@@ -1386,19 +1386,19 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1386 * @param dev pointer to the socket which was added to the set 1386 * @param dev pointer to the socket which was added to the set
1387 * @return 0 on success 1387 * @return 0 on success
1388 */ 1388 */
1389 static int 1389 static int
1390 send_broadcast (struct HardwareInfos *dev, int *sendsocket) 1390 send_broadcast (struct HardwareInfos *dev, int *sendsocket)
1391 { 1391 {
1392 int new_device = 0; 1392 int new_device = 0;
1393 int loops = 0; 1393 int loops = 0;
1394 1394
1395 search_for_devices: 1395 search_for_devices:
1396 if ((neighbours.size == neighbours.pos && new_device == 1) || neighbours.size == 0) 1396 if ((neighbours.size == neighbours.pos && new_device == 1) || neighbours.size == 0)
1397 { 1397 {
1398 inquiry_devices: //skip the conditions and force a inquiry for new devices 1398 inquiry_devices: //skip the conditions and force a inquiry for new devices
1399 { 1399 {
1400 /** 1400 /**
1401 * It means that I sent HELLO messages to all the devices from the list and I should search 1401 * It means that I sent HELLO messages to all the devices from the list and I should search
1402 * for new ones or that this is the first time when I do a search. 1402 * for new ones or that this is the first time when I do a search.
1403 */ 1403 */
1404 inquiry_info *devices = NULL; 1404 inquiry_info *devices = NULL;
@@ -1415,17 +1415,17 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1415 if (neighbours.dev_id == -1) 1415 if (neighbours.dev_id == -1)
1416 { 1416 {
1417 char addr[19] = { 0 }; //the device MAC address 1417 char addr[19] = { 0 }; //the device MAC address
1418 1418
1419 ba2str ((bdaddr_t *) &dev->pl_mac, addr); 1419 ba2str ((bdaddr_t *) &dev->pl_mac, addr);
1420 neighbours.dev_id = hci_devid (addr); 1420 neighbours.dev_id = hci_devid (addr);
1421 if (neighbours.dev_id < 0) 1421 if (neighbours.dev_id < 0)
1422 { 1422 {
1423 fprintf (stderr, "Failed to get the device id for interface %.*s : %s\n", IFNAMSIZ, 1423 fprintf (stderr, "Failed to get the device id for interface %.*s : %s\n", IFNAMSIZ,
1424 dev->iface, strerror (errno)); 1424 dev->iface, strerror (errno));
1425 return 1; 1425 return 1;
1426 } 1426 }
1427 } 1427 }
1428 1428
1429 devices = malloc (max_responses * sizeof (inquiry_info)); 1429 devices = malloc (max_responses * sizeof (inquiry_info));
1430 if (devices == NULL) 1430 if (devices == NULL)
1431 { 1431 {
@@ -1433,23 +1433,23 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1433 dev->iface); 1433 dev->iface);
1434 return 1; 1434 return 1;
1435 } 1435 }
1436 1436
1437 responses = hci_inquiry (neighbours.dev_id, 8, max_responses, NULL, &devices, IREQ_CACHE_FLUSH); 1437 responses = hci_inquiry (neighbours.dev_id, 8, max_responses, NULL, &devices, IREQ_CACHE_FLUSH);
1438 if (responses < 0) 1438 if (responses < 0)
1439 { 1439 {
1440 fprintf (stderr, "Failed to inquiry on interface %.*s\n", IFNAMSIZ, dev->iface); 1440 fprintf (stderr, "Failed to inquiry on interface %.*s\n", IFNAMSIZ, dev->iface);
1441 return 1; 1441 return 1;
1442 } 1442 }
1443 1443
1444 fprintf (stderr, "LOG : Found %d devices\n", responses); //FIXME delete it after debugging stage 1444 fprintf (stderr, "LOG : Found %d devices\n", responses); //FIXME delete it after debugging stage
1445 1445
1446 if (responses == 0) 1446 if (responses == 0)
1447 { 1447 {
1448 fprintf (stderr, "LOG : No devices discoverable\n"); 1448 fprintf (stderr, "LOG : No devices discoverable\n");
1449 return 1; 1449 return 1;
1450 } 1450 }
1451 1451
1452 for (i = 0; i < responses; i++) 1452 for (i = 0; i < responses; i++)
1453 { 1453 {
1454 int j; 1454 int j;
1455 int found = 0; 1455 int found = 0;
@@ -1461,11 +1461,11 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1461 dev->iface); 1461 dev->iface);
1462 return 2; 1462 return 2;
1463 } 1463 }
1464 1464
1465 /* Search if the address already exists on the list */ 1465 /* Search if the address already exists on the list */
1466 for (j = 0; j < neighbours.size; j++) 1466 for (j = 0; j < neighbours.size; j++)
1467 { 1467 {
1468 if (memcmp (&(devices + i)->bdaddr, &(neighbours.devices[j]), sizeof (bdaddr_t)) == 0) 1468 if (memcmp (&(devices + i)->bdaddr, &(neighbours.devices[j]), sizeof (bdaddr_t)) == 0)
1469 { 1469 {
1470 found = 1; 1470 found = 1;
1471 fprintf (stderr, "LOG : the device already exists on the list\n"); //FIXME debugging message 1471 fprintf (stderr, "LOG : the device already exists on the list\n"); //FIXME debugging message
@@ -1481,12 +1481,12 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1481 fprintf (stderr, "LOG : %s was added to the list\n", addr); //FIXME debugging message 1481 fprintf (stderr, "LOG : %s was added to the list\n", addr); //FIXME debugging message
1482 memcpy (&(neighbours.devices[neighbours.size++]), &(devices + i)->bdaddr, sizeof (bdaddr_t)); 1482 memcpy (&(neighbours.devices[neighbours.size++]), &(devices + i)->bdaddr, sizeof (bdaddr_t));
1483 } 1483 }
1484 } 1484 }
1485 1485
1486 free (devices); 1486 free (devices);
1487 } 1487 }
1488 } 1488 }
1489 1489
1490 int connection_successful = 0; 1490 int connection_successful = 0;
1491 struct sockaddr_rc addr_rc = { 0 }; 1491 struct sockaddr_rc addr_rc = { 0 };
1492 int errno_copy = 0; 1492 int errno_copy = 0;
@@ -1501,9 +1501,9 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1501 1501
1502 memset (&addr_rc.rc_bdaddr, 0, sizeof (addr_rc.rc_bdaddr)); 1502 memset (&addr_rc.rc_bdaddr, 0, sizeof (addr_rc.rc_bdaddr));
1503 memcpy (&addr_rc.rc_bdaddr, &(neighbours.devices[neighbours.pos]), sizeof (addr_rc.rc_bdaddr)); 1503 memcpy (&addr_rc.rc_bdaddr, &(neighbours.devices[neighbours.pos]), sizeof (addr_rc.rc_bdaddr));
1504 1504
1505 addr_rc.rc_channel = get_channel (dev, addr_rc.rc_bdaddr); 1505 addr_rc.rc_channel = get_channel (dev, addr_rc.rc_bdaddr);
1506 1506
1507 *sendsocket = socket (AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); 1507 *sendsocket = socket (AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
1508 if (connect (*sendsocket, (struct sockaddr *)&addr_rc, sizeof (addr_rc)) == 0) 1508 if (connect (*sendsocket, (struct sockaddr *)&addr_rc, sizeof (addr_rc)) == 0)
1509 { 1509 {
@@ -1549,7 +1549,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1549 neighbours.pos += 1; 1549 neighbours.pos += 1;
1550 } 1550 }
1551 } 1551 }
1552 1552
1553 /* Cycle on the list */ 1553 /* Cycle on the list */
1554 if (neighbours.pos == neighbours.size) 1554 if (neighbours.pos == neighbours.size)
1555 { 1555 {
@@ -1564,14 +1564,14 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1564 } 1564 }
1565 } 1565 }
1566 /* If a new device wasn't found, search an old one */ 1566 /* If a new device wasn't found, search an old one */
1567 if (connection_successful == 0) 1567 if (connection_successful == 0)
1568 { 1568 {
1569 int loop_check = neighbours.pos; 1569 int loop_check = neighbours.pos;
1570 while (neighbours.fds[neighbours.pos] == -1) 1570 while (neighbours.fds[neighbours.pos] == -1)
1571 { 1571 {
1572 if (neighbours.pos == neighbours.size) 1572 if (neighbours.pos == neighbours.size)
1573 neighbours.pos = 0; 1573 neighbours.pos = 0;
1574 1574
1575 if (neighbours.pos == loop_check) 1575 if (neighbours.pos == loop_check)
1576 { 1576 {
1577 if (errno_copy == ECONNREFUSED) 1577 if (errno_copy == ECONNREFUSED)
@@ -1599,7 +1599,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1599 1599
1600/** 1600/**
1601 * Main function of the helper. This code accesses a bluetooth interface 1601 * Main function of the helper. This code accesses a bluetooth interface
1602 * forwards traffic in both directions between the bluetooth interface and 1602 * forwards traffic in both directions between the bluetooth interface and
1603 * stdin/stdout of this process. Error messages are written to stderr. 1603 * stdin/stdout of this process. Error messages are written to stderr.
1604 * 1604 *
1605 * @param argc number of arguments, must be 2 1605 * @param argc number of arguments, must be 2
@@ -1611,7 +1611,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1611int 1611int
1612main (int argc, char *argv[]) 1612main (int argc, char *argv[])
1613{ 1613{
1614#ifdef LINUX 1614#ifdef LINUX
1615 struct HardwareInfos dev; 1615 struct HardwareInfos dev;
1616 char readbuf[MAXLINE]; 1616 char readbuf[MAXLINE];
1617 int maxfd; 1617 int maxfd;
@@ -1632,7 +1632,7 @@ main (int argc, char *argv[])
1632 return 254; 1632 return 254;
1633 } 1633 }
1634 #else 1634 #else
1635 if (0 != seteuid (0)) 1635 if (0 != seteuid (0))
1636 { 1636 {
1637 fprintf (stderr, "Failed to seteuid back to root: %s\n", strerror (errno)); 1637 fprintf (stderr, "Failed to seteuid back to root: %s\n", strerror (errno));
1638 return 254; 1638 return 254;
@@ -1710,15 +1710,15 @@ main (int argc, char *argv[])
1710 memcpy (write_std.buf, &macmsg, sizeof (macmsg)); 1710 memcpy (write_std.buf, &macmsg, sizeof (macmsg));
1711 write_std.size = sizeof (macmsg); 1711 write_std.size = sizeof (macmsg);
1712 } 1712 }
1713 1713
1714 1714
1715 stdin_mst = mst_create (&stdin_send_hw, &dev); 1715 stdin_mst = mst_create (&stdin_send_hw, &dev);
1716 stdin_open = 1; 1716 stdin_open = 1;
1717 1717
1718 /** 1718 /**
1719 * TODO : I should make the time out of a mac endpoint smaller and check if the rate 1719 * TODO : I should make the time out of a mac endpoint smaller and check if the rate
1720 * from get_wlan_header (plugin_transport_bluetooth.c) is correct. 1720 * from get_wlan_header (plugin_transport_bluetooth.c) is correct.
1721 */ 1721 */
1722 while (1) 1722 while (1)
1723 { 1723 {
1724 maxfd = -1; 1724 maxfd = -1;
@@ -1737,7 +1737,7 @@ main (int argc, char *argv[])
1737 maxfd = MAX (maxfd, dev.fd_rfcomm); 1737 maxfd = MAX (maxfd, dev.fd_rfcomm);
1738 } 1738 }
1739 1739
1740 for (i = 0; i < crt_rfds; i++) // it can receive messages from multiple devices 1740 for (i = 0; i < crt_rfds; i++) // it can receive messages from multiple devices
1741 { 1741 {
1742 FD_SET (rfds_list[i], &rfds); 1742 FD_SET (rfds_list[i], &rfds);
1743 maxfd = MAX (maxfd, rfds_list[i]); 1743 maxfd = MAX (maxfd, rfds_list[i]);
@@ -1749,22 +1749,22 @@ main (int argc, char *argv[])
1749 maxfd = MAX (maxfd, STDOUT_FILENO); 1749 maxfd = MAX (maxfd, STDOUT_FILENO);
1750 } 1750 }
1751 if (0 < write_pout.size) //it can send messages only to one device per loop 1751 if (0 < write_pout.size) //it can send messages only to one device per loop
1752 { 1752 {
1753 struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *frame; 1753 struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *frame;
1754 /* Get the destination address */ 1754 /* Get the destination address */
1755 frame = (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) write_pout.buf; 1755 frame = (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) write_pout.buf;
1756 1756
1757 if (memcmp (&frame->addr1, &dev.pl_mac, 1757 if (memcmp (&frame->addr1, &dev.pl_mac,
1758 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)) == 0) 1758 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)) == 0)
1759 { 1759 {
1760 broadcast = 1; 1760 broadcast = 1;
1761 memset (&write_pout, 0, sizeof (write_pout)); //clear the buffer 1761 memset (&write_pout, 0, sizeof (write_pout)); //clear the buffer
1762 } 1762 }
1763 else if (memcmp (&frame->addr1, &broadcast_address, 1763 else if (memcmp (&frame->addr1, &broadcast_address,
1764 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)) == 0) 1764 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)) == 0)
1765 { 1765 {
1766 fprintf (stderr, "LOG : %s has a broadcast message (pos %d, size %d)\n", dev.iface, neighbours.pos, neighbours.size); //FIXME: debugging message 1766 fprintf (stderr, "LOG : %s has a broadcast message (pos %d, size %d)\n", dev.iface, neighbours.pos, neighbours.size); //FIXME: debugging message
1767 1767
1768 if (send_broadcast(&dev, &sendsocket) != 0) //if the searching wasn't successful don't get stuck on the select stage 1768 if (send_broadcast(&dev, &sendsocket) != 0) //if the searching wasn't successful don't get stuck on the select stage
1769 { 1769 {
1770 broadcast = 1; 1770 broadcast = 1;
@@ -1776,15 +1776,15 @@ main (int argc, char *argv[])
1776 FD_SET (sendsocket, &wfds); 1776 FD_SET (sendsocket, &wfds);
1777 maxfd = MAX (maxfd, sendsocket); 1777 maxfd = MAX (maxfd, sendsocket);
1778 } 1778 }
1779 } 1779 }
1780 else 1780 else
1781 { 1781 {
1782 int found = 0; 1782 int found = 0;
1783 int pos = 0; 1783 int pos = 0;
1784 /* Search if the address already exists on the list */ 1784 /* Search if the address already exists on the list */
1785 for (i = 0; i < neighbours.size; i++) 1785 for (i = 0; i < neighbours.size; i++)
1786 { 1786 {
1787 if (memcmp (&frame->addr1, &(neighbours.devices[i]), sizeof (bdaddr_t)) == 0) 1787 if (memcmp (&frame->addr1, &(neighbours.devices[i]), sizeof (bdaddr_t)) == 0)
1788 { 1788 {
1789 pos = i; 1789 pos = i;
1790 if (neighbours.fds[i] != -1) 1790 if (neighbours.fds[i] != -1)
@@ -1802,24 +1802,24 @@ main (int argc, char *argv[])
1802 { 1802 {
1803 int status; 1803 int status;
1804 struct sockaddr_rc addr = { 0 }; 1804 struct sockaddr_rc addr = { 0 };
1805 1805
1806 fprintf (stderr, "LOG : %s has a new message for %.2X:%.2X:%.2X:%.2X:%.2X:%.2X which isn't on the broadcast list\n", dev.iface, 1806 fprintf (stderr, "LOG : %s has a new message for %.2X:%.2X:%.2X:%.2X:%.2X:%.2X which isn't on the broadcast list\n", dev.iface,
1807 frame->addr1.mac[5], frame->addr1.mac[4], frame->addr1.mac[3], 1807 frame->addr1.mac[5], frame->addr1.mac[4], frame->addr1.mac[3],
1808 frame->addr1.mac[2], frame->addr1.mac[1], frame->addr1.mac[0]); //FIXME: debugging message 1808 frame->addr1.mac[2], frame->addr1.mac[1], frame->addr1.mac[0]); //FIXME: debugging message
1809 1809
1810 sendsocket = socket (AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); 1810 sendsocket = socket (AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
1811 1811
1812 if (sendsocket < 0) 1812 if (sendsocket < 0)
1813 { 1813 {
1814 fprintf (stderr, "Failed to create a RFCOMM socket (sending stage): %s\n", 1814 fprintf (stderr, "Failed to create a RFCOMM socket (sending stage): %s\n",
1815 strerror (errno)); 1815 strerror (errno));
1816 return -1; 1816 return -1;
1817 } 1817 }
1818 1818
1819 memcpy (&addr.rc_bdaddr, &frame->addr1, sizeof (bdaddr_t)); 1819 memcpy (&addr.rc_bdaddr, &frame->addr1, sizeof (bdaddr_t));
1820 addr.rc_family = AF_BLUETOOTH; 1820 addr.rc_family = AF_BLUETOOTH;
1821 addr.rc_channel = get_channel (&dev, addr.rc_bdaddr); 1821 addr.rc_channel = get_channel (&dev, addr.rc_bdaddr);
1822 1822
1823 int tries = 0; 1823 int tries = 0;
1824 connect_retry: 1824 connect_retry:
1825 status = connect (sendsocket, (struct sockaddr *) &addr, sizeof (addr)); 1825 status = connect (sendsocket, (struct sockaddr *) &addr, sizeof (addr));
@@ -1843,7 +1843,7 @@ main (int argc, char *argv[])
1843 memset (&write_pout, 0, sizeof (write_pout)); 1843 memset (&write_pout, 0, sizeof (write_pout));
1844 broadcast = 1; 1844 broadcast = 1;
1845 } 1845 }
1846 1846
1847 } 1847 }
1848 else 1848 else
1849 { 1849 {
@@ -1902,19 +1902,19 @@ main (int argc, char *argv[])
1902 write_std.size = 0; 1902 write_std.size = 0;
1903 } 1903 }
1904 fprintf (stderr, "LOG : %s sends a message to STDOUT\n", dev.iface); //FIXME: debugging message 1904 fprintf (stderr, "LOG : %s sends a message to STDOUT\n", dev.iface); //FIXME: debugging message
1905 1905
1906 } 1906 }
1907 if (sendsocket != -1) 1907 if (sendsocket != -1)
1908 { 1908 {
1909 if (FD_ISSET (sendsocket , &wfds)) 1909 if (FD_ISSET (sendsocket , &wfds))
1910 { 1910 {
1911 ssize_t ret = 1911 ssize_t ret =
1912 write (sendsocket, write_pout.buf + write_std.pos, 1912 write (sendsocket, write_pout.buf + write_std.pos,
1913 write_pout.size - write_pout.pos); 1913 write_pout.size - write_pout.pos);
1914 if (0 > ret) //FIXME should I first check the error type? 1914 if (0 > ret) //FIXME should I first check the error type?
1915 { 1915 {
1916 fprintf (stderr, "Failed to write to bluetooth device: %s. Closing the socket!\n", 1916 fprintf (stderr, "Failed to write to bluetooth device: %s. Closing the socket!\n",
1917 strerror (errno)); 1917 strerror (errno));
1918 for (i = 0; i < neighbours.size; i++) 1918 for (i = 0; i < neighbours.size; i++)
1919 { 1919 {
1920 if (neighbours.fds[i] == sendsocket) 1920 if (neighbours.fds[i] == sendsocket)
@@ -1925,7 +1925,7 @@ main (int argc, char *argv[])
1925 } 1925 }
1926 } 1926 }
1927 /* Remove the message */ 1927 /* Remove the message */
1928 memset (&write_pout.buf + write_std.pos, 0, (write_pout.size - write_pout.pos)); 1928 memset (&write_pout.buf + write_std.pos, 0, (write_pout.size - write_pout.pos));
1929 write_pout.pos = 0 ; 1929 write_pout.pos = 0 ;
1930 write_pout.size = 0; 1930 write_pout.size = 0;
1931 } 1931 }
@@ -1940,7 +1940,7 @@ main (int argc, char *argv[])
1940 (unsigned int) write_pout.size); 1940 (unsigned int) write_pout.size);
1941 break; 1941 break;
1942 } 1942 }
1943 1943
1944 if (write_pout.pos == write_pout.size) 1944 if (write_pout.pos == write_pout.size)
1945 { 1945 {
1946 write_pout.pos = 0; 1946 write_pout.pos = 0;
@@ -1956,14 +1956,14 @@ main (int argc, char *argv[])
1956 { 1956 {
1957 if (i == STDIN_FILENO) 1957 if (i == STDIN_FILENO)
1958 { 1958 {
1959 ssize_t ret = 1959 ssize_t ret =
1960 read (i, readbuf, sizeof (readbuf)); 1960 read (i, readbuf, sizeof (readbuf));
1961 if (0 > ret) 1961 if (0 > ret)
1962 { 1962 {
1963 fprintf (stderr, 1963 fprintf (stderr,
1964 "Read error from STDIN: %s\n", 1964 "Read error from STDIN: %s\n",
1965 strerror (errno)); 1965 strerror (errno));
1966 break; 1966 break;
1967 } 1967 }
1968 if (0 == ret) 1968 if (0 == ret)
1969 { 1969 {
@@ -1975,18 +1975,18 @@ main (int argc, char *argv[])
1975 mst_receive (stdin_mst, readbuf, ret); 1975 mst_receive (stdin_mst, readbuf, ret);
1976 fprintf (stderr, "LOG : %s receives a message from STDIN\n", dev.iface); //FIXME: debugging message 1976 fprintf (stderr, "LOG : %s receives a message from STDIN\n", dev.iface); //FIXME: debugging message
1977 } 1977 }
1978 } 1978 }
1979 else if (i == dev.fd_rfcomm) 1979 else if (i == dev.fd_rfcomm)
1980 { 1980 {
1981 int readsocket; 1981 int readsocket;
1982 struct sockaddr_rc addr = { 0 }; 1982 struct sockaddr_rc addr = { 0 };
1983 unsigned int opt = sizeof (addr); 1983 unsigned int opt = sizeof (addr);
1984 1984
1985 readsocket = accept (dev.fd_rfcomm, (struct sockaddr *) &addr, &opt); 1985 readsocket = accept (dev.fd_rfcomm, (struct sockaddr *) &addr, &opt);
1986 fprintf(stderr, "LOG : %s accepts a message\n", dev.iface); //FIXME: debugging message 1986 fprintf(stderr, "LOG : %s accepts a message\n", dev.iface); //FIXME: debugging message
1987 if (readsocket == -1) 1987 if (readsocket == -1)
1988 { 1988 {
1989 fprintf (stderr, "Failed to accept a connection on interface: %.*s\n", IFNAMSIZ, 1989 fprintf (stderr, "Failed to accept a connection on interface: %.*s\n", IFNAMSIZ,
1990 strerror (errno)); 1990 strerror (errno));
1991 break; 1991 break;
1992 } 1992 }
@@ -1994,7 +1994,7 @@ main (int argc, char *argv[])
1994 { 1994 {
1995 FD_SET (readsocket, &rfds); 1995 FD_SET (readsocket, &rfds);
1996 maxfd = MAX (maxfd, readsocket); 1996 maxfd = MAX (maxfd, readsocket);
1997 1997
1998 if (crt_rfds < MAX_PORTS) 1998 if (crt_rfds < MAX_PORTS)
1999 rfds_list[crt_rfds++] = readsocket; 1999 rfds_list[crt_rfds++] = readsocket;
2000 else 2000 else
@@ -2004,19 +2004,19 @@ main (int argc, char *argv[])
2004 break; 2004 break;
2005 } 2005 }
2006 } 2006 }
2007 2007
2008 } 2008 }
2009 else 2009 else
2010 { 2010 {
2011 struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *rrm; 2011 struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *rrm;
2012 ssize_t ret; 2012 ssize_t ret;
2013 fprintf (stderr, "LOG : %s reads something from the socket\n", dev.iface);//FIXME : debugging message 2013 fprintf (stderr, "LOG : %s reads something from the socket\n", dev.iface);//FIXME : debugging message
2014 rrm = (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) write_std.buf; 2014 rrm = (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) write_std.buf;
2015 ret = 2015 ret =
2016 read_from_the_socket ((void *)&i, (unsigned char *) &rrm->frame, 2016 read_from_the_socket ((void *)&i, (unsigned char *) &rrm->frame,
2017 sizeof (write_std.buf) 2017 sizeof (write_std.buf)
2018 - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) 2018 - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)
2019 + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame), 2019 + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame),
2020 rrm); 2020 rrm);
2021 if (0 >= ret) 2021 if (0 >= ret)
2022 { 2022 {
@@ -2041,8 +2041,8 @@ main (int argc, char *argv[])
2041 } 2041 }
2042 if ((0 < ret) && (0 == mac_test (&rrm->frame, &dev))) 2042 if ((0 < ret) && (0 == mac_test (&rrm->frame, &dev)))
2043 { 2043 {
2044 write_std.size = ret 2044 write_std.size = ret
2045 + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) 2045 + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)
2046 - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame); 2046 - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame);
2047 rrm->header.size = htons (write_std.size); 2047 rrm->header.size = htons (write_std.size);
2048 rrm->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER); 2048 rrm->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER);
@@ -2058,7 +2058,7 @@ main (int argc, char *argv[])
2058 sdp_close (dev.session); 2058 sdp_close (dev.session);
2059 (void) close (dev.fd_rfcomm); 2059 (void) close (dev.fd_rfcomm);
2060 (void) close (sendsocket); 2060 (void) close (sendsocket);
2061 2061
2062 for (i = 0; i < crt_rfds; i++) 2062 for (i = 0; i < crt_rfds; i++)
2063 (void) close (rfds_list[i]); 2063 (void) close (rfds_list[i]);
2064 2064
@@ -2079,13 +2079,13 @@ main (int argc, char *argv[])
2079 struct MessageStreamTokenizer *stdin_mst; 2079 struct MessageStreamTokenizer *stdin_mst;
2080 2080
2081 /* check the handles */ 2081 /* check the handles */
2082 if (stdin_handle == INVALID_HANDLE_VALUE) 2082 if (stdin_handle == INVALID_HANDLE_VALUE)
2083 { 2083 {
2084 fprintf (stderr, "Failed to get the stdin handle\n"); 2084 fprintf (stderr, "Failed to get the stdin handle\n");
2085 ExitProcess (2); 2085 ExitProcess (2);
2086 } 2086 }
2087 2087
2088 if (stdout_handle == INVALID_HANDLE_VALUE) 2088 if (stdout_handle == INVALID_HANDLE_VALUE)
2089 { 2089 {
2090 fprintf (stderr, "Failed to get the stdout handle\n"); 2090 fprintf (stderr, "Failed to get the stdout handle\n");
2091 ExitProcess (2); 2091 ExitProcess (2);
@@ -2111,7 +2111,7 @@ main (int argc, char *argv[])
2111 } 2111 }
2112 2112
2113 2113
2114 if (open_device (&dev) == -1) 2114 if (open_device (&dev) == -1)
2115 { 2115 {
2116 fprintf (stderr, "Failed to open the device\n"); 2116 fprintf (stderr, "Failed to open the device\n");
2117 print_last_error(); 2117 print_last_error();
@@ -2121,21 +2121,21 @@ main (int argc, char *argv[])
2121 print_last_error(); 2121 print_last_error();
2122 } 2122 }
2123 ExitProcess (2); 2123 ExitProcess (2);
2124 } 2124 }
2125 2125
2126 if (GNUNET_OK != GNUNET_NETWORK_socket_set_blocking (dev.handle, 1) ) 2126 if (GNUNET_OK != GNUNET_NETWORK_socket_set_blocking (dev.handle, 1) )
2127 { 2127 {
2128 fprintf (stderr, "Failed to change the socket mode\n"); 2128 fprintf (stderr, "Failed to change the socket mode\n");
2129 ExitProcess (2); 2129 ExitProcess (2);
2130 } 2130 }
2131 2131
2132 memset (&write_std, 0, sizeof (write_std)); 2132 memset (&write_std, 0, sizeof (write_std));
2133 memset (&write_pout, 0, sizeof (write_pout)); 2133 memset (&write_pout, 0, sizeof (write_pout));
2134 stdin_open = 1; 2134 stdin_open = 1;
2135 2135
2136 rfds = GNUNET_NETWORK_fdset_create (); 2136 rfds = GNUNET_NETWORK_fdset_create ();
2137 wfds = GNUNET_NETWORK_fdset_create (); 2137 wfds = GNUNET_NETWORK_fdset_create ();
2138 2138
2139 /* Send MAC address of the bluetooth interface to STDOUT first */ 2139 /* Send MAC address of the bluetooth interface to STDOUT first */
2140 { 2140 {
2141 struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg; 2141 struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg;
@@ -2146,9 +2146,9 @@ main (int argc, char *argv[])
2146 memcpy (write_std.buf, &macmsg, sizeof (macmsg)); 2146 memcpy (write_std.buf, &macmsg, sizeof (macmsg));
2147 write_std.size = sizeof (macmsg); 2147 write_std.size = sizeof (macmsg);
2148 } 2148 }
2149 2149
2150 2150
2151 stdin_mst = mst_create (&stdin_send_hw, &dev); 2151 stdin_mst = mst_create (&stdin_send_hw, &dev);
2152 stdin_open = 1; 2152 stdin_open = 1;
2153 2153
2154 int pos = 0; 2154 int pos = 0;
@@ -2161,13 +2161,13 @@ main (int argc, char *argv[])
2161 stdin_pos = -1; 2161 stdin_pos = -1;
2162 stdout_pos = -1; 2162 stdout_pos = -1;
2163 sendsocket = NULL; //FIXME ???memleaks 2163 sendsocket = NULL; //FIXME ???memleaks
2164 2164
2165 GNUNET_NETWORK_fdset_zero (rfds); 2165 GNUNET_NETWORK_fdset_zero (rfds);
2166 if ((0 == write_pout.size) && (1 == stdin_open)) 2166 if ((0 == write_pout.size) && (1 == stdin_open))
2167 { 2167 {
2168 stdin_pos = pos; 2168 stdin_pos = pos;
2169 pos +=1; 2169 pos +=1;
2170 GNUNET_NETWORK_fdset_handle_set (rfds, (struct GNUNET_DISK_FileHandle*) &stdin_handle); 2170 GNUNET_NETWORK_fdset_handle_set (rfds, (struct GNUNET_DISK_FileHandle*) &stdin_handle);
2171 } 2171 }
2172 2172
2173 if (0 == write_std.size) 2173 if (0 == write_std.size)
@@ -2175,7 +2175,7 @@ main (int argc, char *argv[])
2175 pos += 1; 2175 pos += 1;
2176 GNUNET_NETWORK_fdset_set (rfds, dev.handle); 2176 GNUNET_NETWORK_fdset_set (rfds, dev.handle);
2177 } 2177 }
2178 2178
2179 for (i = 0; i < crt_rfds; i++) 2179 for (i = 0; i < crt_rfds; i++)
2180 { 2180 {
2181 pos += 1; 2181 pos += 1;
@@ -2189,34 +2189,34 @@ main (int argc, char *argv[])
2189 GNUNET_NETWORK_fdset_handle_set (wfds, (struct GNUNET_DISK_FileHandle*) &stdout_handle); 2189 GNUNET_NETWORK_fdset_handle_set (wfds, (struct GNUNET_DISK_FileHandle*) &stdout_handle);
2190 // printf ("%s\n", write_std.buf); 2190 // printf ("%s\n", write_std.buf);
2191 // memset (write_std.buf, 0, write_std.size); 2191 // memset (write_std.buf, 0, write_std.size);
2192 // write_std.size = 0; 2192 // write_std.size = 0;
2193 } 2193 }
2194 2194
2195 if (0 < write_pout.size) 2195 if (0 < write_pout.size)
2196 { 2196 {
2197 if (strcmp (argv[1], "ff:ff:ff:ff:ff:ff") == 0) { 2197 if (strcmp (argv[1], "ff:ff:ff:ff:ff:ff") == 0) {
2198 fprintf(stderr, "LOG: BROADCAST! Skipping the message\n"); 2198 fprintf(stderr, "LOG: BROADCAST! Skipping the message\n");
2199 // skip the message 2199 // skip the message
2200 broadcast = 1; 2200 broadcast = 1;
2201 memset (write_pout.buf, 0, write_pout.size); 2201 memset (write_pout.buf, 0, write_pout.size);
2202 write_pout.size = 0; 2202 write_pout.size = 0;
2203 } 2203 }
2204 else 2204 else
2205 { 2205 {
2206 SOCKADDR_BTH addr; 2206 SOCKADDR_BTH addr;
2207 fprintf (stderr, "LOG : has a new message for %s\n", argv[1]); 2207 fprintf (stderr, "LOG : has a new message for %s\n", argv[1]);
2208 sendsocket = GNUNET_NETWORK_socket_create (AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM); 2208 sendsocket = GNUNET_NETWORK_socket_create (AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
2209 2209
2210 if (sendsocket == NULL) 2210 if (sendsocket == NULL)
2211 { 2211 {
2212 fprintf (stderr, "Failed to create RFCOMM socket: \n"); 2212 fprintf (stderr, "Failed to create RFCOMM socket: \n");
2213 print_last_error(); 2213 print_last_error();
2214 ExitProcess (2); 2214 ExitProcess (2);
2215 } 2215 }
2216 2216
2217 memset (&addr, 0, sizeof (addr)); 2217 memset (&addr, 0, sizeof (addr));
2218 //addr.addressFamily = AF_BTH; 2218 //addr.addressFamily = AF_BTH;
2219 if (SOCKET_ERROR == 2219 if (SOCKET_ERROR ==
2220 WSAStringToAddress (argv[1], AF_BTH, NULL, (LPSOCKADDR) &addr, &addr_len)) 2220 WSAStringToAddress (argv[1], AF_BTH, NULL, (LPSOCKADDR) &addr, &addr_len))
2221 { 2221 {
2222 fprintf (stderr, "Failed to translate the address: "); 2222 fprintf (stderr, "Failed to translate the address: ");
@@ -2250,7 +2250,7 @@ main (int argc, char *argv[])
2250 } 2250 }
2251 } 2251 }
2252 } 2252 }
2253 2253
2254 if (broadcast == 0) 2254 if (broadcast == 0)
2255 { 2255 {
2256 int retval = GNUNET_NETWORK_socket_select (rfds, wfds, NULL, GNUNET_TIME_relative_get_forever_()); 2256 int retval = GNUNET_NETWORK_socket_select (rfds, wfds, NULL, GNUNET_TIME_relative_get_forever_());
@@ -2279,7 +2279,7 @@ main (int argc, char *argv[])
2279 fprintf (stderr, "Failed to write to STDOUT\n"); 2279 fprintf (stderr, "Failed to write to STDOUT\n");
2280 ExitProcess (2); 2280 ExitProcess (2);
2281 } 2281 }
2282 2282
2283 write_std.pos += ret; 2283 write_std.pos += ret;
2284 if (write_std.pos == write_std.size) 2284 if (write_std.pos == write_std.size)
2285 { 2285 {
@@ -2292,9 +2292,9 @@ main (int argc, char *argv[])
2292 if (GNUNET_NETWORK_fdset_isset (wfds, sendsocket)) 2292 if (GNUNET_NETWORK_fdset_isset (wfds, sendsocket))
2293 { 2293 {
2294 ssize_t ret; 2294 ssize_t ret;
2295 ret = GNUNET_NETWORK_socket_send (sendsocket, write_pout.buf + write_pout.pos, 2295 ret = GNUNET_NETWORK_socket_send (sendsocket, write_pout.buf + write_pout.pos,
2296 write_pout.size - write_pout.pos); 2296 write_pout.size - write_pout.pos);
2297 2297
2298 if (GNUNET_SYSERR == ret) 2298 if (GNUNET_SYSERR == ret)
2299 { 2299 {
2300 fprintf (stderr, "Failed to send to the socket. Closing the socket. Error: \n"); 2300 fprintf (stderr, "Failed to send to the socket. Closing the socket. Error: \n");
@@ -2317,22 +2317,22 @@ main (int argc, char *argv[])
2317 (unsigned int) write_pout.size); 2317 (unsigned int) write_pout.size);
2318 break; 2318 break;
2319 } 2319 }
2320 2320
2321 if (write_pout.pos == write_pout.size) 2321 if (write_pout.pos == write_pout.size)
2322 { 2322 {
2323 write_pout.pos = 0; 2323 write_pout.pos = 0;
2324 write_pout.size = 0; 2324 write_pout.size = 0;
2325 2325
2326 } 2326 }
2327 fprintf(stderr, "LOG : sends a message to a DEVICE\n"); //FIXME: debugging message 2327 fprintf(stderr, "LOG : sends a message to a DEVICE\n"); //FIXME: debugging message
2328 } 2328 }
2329 } 2329 }
2330 } 2330 }
2331 2331
2332 //if (GNUNET_NETWORK_fdset_isset (rfds, (struct GNUNET_NETWORK_Handle*)&stdin_handle)) 2332 //if (GNUNET_NETWORK_fdset_isset (rfds, (struct GNUNET_NETWORK_Handle*)&stdin_handle))
2333 if (retval == stdin_pos) 2333 if (retval == stdin_pos)
2334 { 2334 {
2335 //ssize_t ret; 2335 //ssize_t ret;
2336 //ret = GNUNET_NETWORK_socket_recv ((struct GNUNET_NETWORK_Handle *)&stdin_handle, readbuf, sizeof (write_pout.buf)); 2336 //ret = GNUNET_NETWORK_socket_recv ((struct GNUNET_NETWORK_Handle *)&stdin_handle, readbuf, sizeof (write_pout.buf));
2337 //ret = read (STDIN_FILENO, readbuf, sizeof (readbuf)); 2337 //ret = read (STDIN_FILENO, readbuf, sizeof (readbuf));
2338 DWORD ret; 2338 DWORD ret;
@@ -2356,7 +2356,7 @@ main (int argc, char *argv[])
2356 { 2356 {
2357 fprintf (stderr, "LOG: accepting connection\n"); 2357 fprintf (stderr, "LOG: accepting connection\n");
2358 struct GNUNET_NETWORK_Handle *readsocket; 2358 struct GNUNET_NETWORK_Handle *readsocket;
2359 readsocket = GNUNET_NETWORK_socket_accept (dev.handle, (LPSOCKADDR)&acc_addr, &addr_len); 2359 readsocket = GNUNET_NETWORK_socket_accept (dev.handle, (LPSOCKADDR)&acc_addr, &addr_len);
2360 if (readsocket == NULL) 2360 if (readsocket == NULL)
2361 { 2361 {
2362 fprintf (stderr, "Accept error %d: ", GetLastError()); 2362 fprintf (stderr, "Accept error %d: ", GetLastError());
@@ -2386,14 +2386,14 @@ main (int argc, char *argv[])
2386 { 2386 {
2387 if (GNUNET_NETWORK_fdset_isset (rfds, rfds_list[i])) 2387 if (GNUNET_NETWORK_fdset_isset (rfds, rfds_list[i]))
2388 { 2388 {
2389 struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *rrm; 2389 struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *rrm;
2390 ssize_t ret; 2390 ssize_t ret;
2391 fprintf (stderr, "LOG: reading something from the socket\n");//FIXME : debugging message 2391 fprintf (stderr, "LOG: reading something from the socket\n");//FIXME : debugging message
2392 rrm = (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) write_std.buf; 2392 rrm = (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) write_std.buf;
2393 ret = read_from_the_socket (rfds_list[i], (unsigned char *) &rrm->frame, 2393 ret = read_from_the_socket (rfds_list[i], (unsigned char *) &rrm->frame,
2394 sizeof (write_std.buf) 2394 sizeof (write_std.buf)
2395 - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) 2395 - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)
2396 + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame), 2396 + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame),
2397 rrm); 2397 rrm);
2398 if (0 >= ret) 2398 if (0 >= ret)
2399 { 2399 {
@@ -2408,22 +2408,22 @@ main (int argc, char *argv[])
2408 fprintf (stderr, "Read error from raw socket: "); 2408 fprintf (stderr, "Read error from raw socket: ");
2409 print_last_error(); 2409 print_last_error();
2410 break; 2410 break;
2411 2411
2412 } 2412 }
2413 if ((0 < ret) && (0 == mac_test (&rrm->frame, &dev))) 2413 if ((0 < ret) && (0 == mac_test (&rrm->frame, &dev)))
2414 { 2414 {
2415 write_std.size = ret 2415 write_std.size = ret
2416 + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) 2416 + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)
2417 - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame); 2417 - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame);
2418 rrm->header.size = htons (write_std.size); 2418 rrm->header.size = htons (write_std.size);
2419 rrm->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER); 2419 rrm->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER);
2420 } 2420 }
2421 break; 2421 break;
2422 } 2422 }
2423 } 2423 }
2424 } 2424 }
2425 } 2425 }
2426 2426
2427 mst_destroy (stdin_mst); 2427 mst_destroy (stdin_mst);
2428 stdin_mst = NULL; 2428 stdin_mst = NULL;
2429 2429
diff --git a/src/transport/gnunet-helper-transport-wlan-dummy.c b/src/transport/gnunet-helper-transport-wlan-dummy.c
index 610b3a4c4..d07b1f8f6 100644
--- a/src/transport/gnunet-helper-transport-wlan-dummy.c
+++ b/src/transport/gnunet-helper-transport-wlan-dummy.c
@@ -238,7 +238,7 @@ main (int argc, char *argv[])
238 erg = mkfifo (FIFO_FILE1, 0666); 238 erg = mkfifo (FIFO_FILE1, 0666);
239 if ( (0 != erg) && (EEXIST != errno) ) 239 if ( (0 != erg) && (EEXIST != errno) )
240 FPRINTF (stderr, "Error in mkfifo(%s): %s\n", FIFO_FILE1, 240 FPRINTF (stderr, "Error in mkfifo(%s): %s\n", FIFO_FILE1,
241 strerror (errno)); 241 strerror (errno));
242 } 242 }
243 } 243 }
244 else 244 else
diff --git a/src/transport/gnunet-helper-transport-wlan.c b/src/transport/gnunet-helper-transport-wlan.c
index 7f472b3be..ce385b45b 100644
--- a/src/transport/gnunet-helper-transport-wlan.c
+++ b/src/transport/gnunet-helper-transport-wlan.c
@@ -140,15 +140,15 @@
140#include "plugin_transport_wlan.h" 140#include "plugin_transport_wlan.h"
141 141
142/** 142/**
143 * Packet format type for the messages we receive from 143 * Packet format type for the messages we receive from
144 * the kernel. This is for Ethernet 10Mbps format (no 144 * the kernel. This is for Ethernet 10Mbps format (no
145 * performance information included). 145 * performance information included).
146 */ 146 */
147#define ARPHRD_ETHER 1 147#define ARPHRD_ETHER 1
148 148
149 149
150/** 150/**
151 * Packet format type for the messages we receive from 151 * Packet format type for the messages we receive from
152 * the kernel. This is for plain messages (with no 152 * the kernel. This is for plain messages (with no
153 * performance information included). 153 * performance information included).
154 */ 154 */
@@ -156,13 +156,13 @@
156 156
157 157
158/** 158/**
159 * Packet format type for the messages we receive from 159 * Packet format type for the messages we receive from
160 * the kernel. This is for the PRISM format. 160 * the kernel. This is for the PRISM format.
161 */ 161 */
162#define ARPHRD_IEEE80211_PRISM 802 162#define ARPHRD_IEEE80211_PRISM 802
163 163
164/** 164/**
165 * Packet format type for the messages we receive from 165 * Packet format type for the messages we receive from
166 * the kernel. This is for messages with a 166 * the kernel. This is for messages with a
167 * 'struct Ieee80211RadiotapHeader' (see below). 167 * 'struct Ieee80211RadiotapHeader' (see below).
168 */ 168 */
@@ -195,35 +195,35 @@
195 * Drivers appear to use a 64bit counter to hold mactime internal 195 * Drivers appear to use a 64bit counter to hold mactime internal
196 * the then fill the prism header with the lower 32 bits 196 * the then fill the prism header with the lower 32 bits
197 */ 197 */
198#define PRISM_DID_MACTIME 0x2041 198#define PRISM_DID_MACTIME 0x2041
199 199
200/** 200/**
201 * Channel element 201 * Channel element
202 */ 202 */
203#define PRISM_DID_CHANNEL 0x3041 203#define PRISM_DID_CHANNEL 0x3041
204 204
205/** 205/**
206 * Signal element. Should be the signal strength in dbm, some people 206 * Signal element. Should be the signal strength in dbm, some people
207 * suggest that instead "100 - (strength in dbm)" is used (to make this 207 * suggest that instead "100 - (strength in dbm)" is used (to make this
208 * a positive integer). 208 * a positive integer).
209 */ 209 */
210#define PRISM_DID_SIGNAL 0x6041 210#define PRISM_DID_SIGNAL 0x6041
211 211
212/** 212/**
213 * Noise element 213 * Noise element
214 */ 214 */
215#define PRISM_DID_NOISE 0x7041 215#define PRISM_DID_NOISE 0x7041
216 216
217/** 217/**
218 * Rate element, in units/multiples of 500Khz 218 * Rate element, in units/multiples of 500Khz
219 */ 219 */
220#define PRISM_DID_RATE 0x8041 220#define PRISM_DID_RATE 0x8041
221 221
222 222
223/** 223/**
224 * Value is set (supplied) 224 * Value is set (supplied)
225 */ 225 */
226#define PRISM_STATUS_OK 0 226#define PRISM_STATUS_OK 0
227 227
228/** 228/**
229 * Value not supplied. 229 * Value not supplied.
@@ -240,24 +240,24 @@ struct PrismValue
240 * This has a different ID for each parameter, see 240 * This has a different ID for each parameter, see
241 * PRISM_DID_* constants. 241 * PRISM_DID_* constants.
242 */ 242 */
243 uint32_t did; 243 uint32_t did;
244 244
245 /** 245 /**
246 * See PRISM_STATUS_*-constants. Note that they are unusual: 0 = set; 1 = not set 246 * See PRISM_STATUS_*-constants. Note that they are unusual: 0 = set; 1 = not set
247 */ 247 */
248 uint16_t status; 248 uint16_t status;
249 249
250 /** 250 /**
251 * length of data (which is always a uint32_t, but presumably this can be used 251 * length of data (which is always a uint32_t, but presumably this can be used
252 * to specify that fewer bytes are used (with values in 'len' from 0-4). We 252 * to specify that fewer bytes are used (with values in 'len' from 0-4). We
253 * ignore this field. 253 * ignore this field.
254 */ 254 */
255 uint16_t len; 255 uint16_t len;
256 256
257 /** 257 /**
258 * The data value 258 * The data value
259 */ 259 */
260 uint32_t data; 260 uint32_t data;
261 261
262} __attribute__ ((packed)); 262} __attribute__ ((packed));
263 263
@@ -271,11 +271,11 @@ struct PrismHeader
271 * We expect this to be a PRISM_MSGCODE_*. 271 * We expect this to be a PRISM_MSGCODE_*.
272 */ 272 */
273 uint32_t msgcode; 273 uint32_t msgcode;
274 274
275 /** 275 /**
276 * The length of the entire header. 276 * The length of the entire header.
277 */ 277 */
278 uint32_t msglen; 278 uint32_t msglen;
279 279
280 /** 280 /**
281 * Name of the device that captured the packet. 281 * Name of the device that captured the packet.
@@ -402,7 +402,7 @@ enum RadiotapType
402 */ 402 */
403 IEEE80211_RADIOTAP_DBM_TX_POWER = 10, 403 IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
404 404
405 /** 405 /**
406 * IEEE80211_RADIOTAP_ANTENNA uint8_t antenna index 406 * IEEE80211_RADIOTAP_ANTENNA uint8_t antenna index
407 * 407 *
408 * Unitless indication of the Rx/Tx antenna for this packet. 408 * Unitless indication of the Rx/Tx antenna for this packet.
@@ -433,10 +433,10 @@ enum RadiotapType
433 */ 433 */
434 IEEE80211_RADIOTAP_RX_FLAGS = 14, 434 IEEE80211_RADIOTAP_RX_FLAGS = 14,
435 435
436 /** 436 /**
437 * IEEE80211_RADIOTAP_TX_FLAGS __le16 bitmap 437 * IEEE80211_RADIOTAP_TX_FLAGS __le16 bitmap
438 * 438 *
439 * Properties of transmitted frames. See flags defined below. 439 * Properties of transmitted frames. See flags defined below.
440 */ 440 */
441 IEEE80211_RADIOTAP_TX_FLAGS = 15, 441 IEEE80211_RADIOTAP_TX_FLAGS = 15,
442 442
@@ -462,7 +462,7 @@ enum RadiotapType
462}; 462};
463 463
464/** 464/**
465 * Bitmask indicating an extension of the bitmask is used. 465 * Bitmask indicating an extension of the bitmask is used.
466 * (Mask corresponding to IEEE80211_RADIOTAP_EXT). 466 * (Mask corresponding to IEEE80211_RADIOTAP_EXT).
467 */ 467 */
468#define IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK (1 << IEEE80211_RADIOTAP_EXT) 468#define IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK (1 << IEEE80211_RADIOTAP_EXT)
@@ -487,7 +487,7 @@ enum RadiotapType
487 * 487 *
488 * Frame was sent/received with short preamble 488 * Frame was sent/received with short preamble
489 */ 489 */
490#define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 490#define IEEE80211_RADIOTAP_F_SHORTPRE 0x02
491 491
492/** 492/**
493 * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get 493 * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get
@@ -497,7 +497,7 @@ enum RadiotapType
497 * 497 *
498 * Frame was sent/received with WEP encryption 498 * Frame was sent/received with WEP encryption
499 */ 499 */
500#define IEEE80211_RADIOTAP_F_WEP 0x04 500#define IEEE80211_RADIOTAP_F_WEP 0x04
501 501
502/** 502/**
503 * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get 503 * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get
@@ -507,7 +507,7 @@ enum RadiotapType
507 * 507 *
508 * Frame was sent/received with fragmentation 508 * Frame was sent/received with fragmentation
509 */ 509 */
510#define IEEE80211_RADIOTAP_F_FRAG 0x08 510#define IEEE80211_RADIOTAP_F_FRAG 0x08
511 511
512/** 512/**
513 * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get 513 * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get
@@ -517,7 +517,7 @@ enum RadiotapType
517 * 517 *
518 * Frame includes FCS (CRC at the end that needs to be removeD). 518 * Frame includes FCS (CRC at the end that needs to be removeD).
519 */ 519 */
520#define IEEE80211_RADIOTAP_F_FCS 0x10 520#define IEEE80211_RADIOTAP_F_FCS 0x10
521 521
522/** 522/**
523 * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get 523 * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get
@@ -528,32 +528,32 @@ enum RadiotapType
528 * Frame has padding between 802.11 header and payload 528 * Frame has padding between 802.11 header and payload
529 * (to 32-bit boundary) 529 * (to 32-bit boundary)
530 */ 530 */
531#define IEEE80211_RADIOTAP_F_DATAPAD 0x20 531#define IEEE80211_RADIOTAP_F_DATAPAD 0x20
532 532
533 533
534/** 534/**
535 * For IEEE80211_RADIOTAP_RX_FLAGS: 535 * For IEEE80211_RADIOTAP_RX_FLAGS:
536 * frame failed crc check 536 * frame failed crc check
537 */ 537 */
538#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 538#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001
539 539
540/** 540/**
541 * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct RadiotapTransmissionHeader'): 541 * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct RadiotapTransmissionHeader'):
542 * failed due to excessive retries 542 * failed due to excessive retries
543 */ 543 */
544#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 544#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001
545 545
546/** 546/**
547 * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct RadiotapTransmissionHeader'): 547 * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct RadiotapTransmissionHeader'):
548 * used cts 'protection' 548 * used cts 'protection'
549 */ 549 */
550#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 550#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002
551 551
552/** 552/**
553 * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct RadiotapTransmissionHeader'): 553 * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct RadiotapTransmissionHeader'):
554 * used rts/cts handshake 554 * used rts/cts handshake
555 */ 555 */
556#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 556#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004
557 557
558/** 558/**
559 * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct RadiotapTransmissionHeader'): 559 * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct RadiotapTransmissionHeader'):
@@ -563,7 +563,7 @@ enum RadiotapType
563 563
564/** 564/**
565 * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct RadiotapTransmissionHeader'): 565 * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct RadiotapTransmissionHeader'):
566 * sequence number handled by userspace 566 * sequence number handled by userspace
567 */ 567 */
568#define IEEE80211_RADIOTAP_F_TX_NOSEQ 0x0010 568#define IEEE80211_RADIOTAP_F_TX_NOSEQ 0x0010
569 569
@@ -591,7 +591,7 @@ struct Ieee80211RadiotapHeader
591 uint8_t it_version; 591 uint8_t it_version;
592 592
593 /** 593 /**
594 * Padding. Set to 0. 594 * Padding. Set to 0.
595 */ 595 */
596 uint8_t it_pad; 596 uint8_t it_pad;
597 597
@@ -611,7 +611,7 @@ struct Ieee80211RadiotapHeader
611 611
612 612
613/** 613/**
614 * Format of the header we need to prepend to messages to be sent to the 614 * Format of the header we need to prepend to messages to be sent to the
615 * Kernel. 615 * Kernel.
616 */ 616 */
617struct RadiotapTransmissionHeader 617struct RadiotapTransmissionHeader
@@ -752,7 +752,7 @@ struct SendBuffer
752 * destination? Always smaller than 'size'. 752 * destination? Always smaller than 'size'.
753 */ 753 */
754 size_t pos; 754 size_t pos;
755 755
756 /** 756 /**
757 * Buffered data; twice the maximum allowed message size as we add some 757 * Buffered data; twice the maximum allowed message size as we add some
758 * headers. 758 * headers.
@@ -794,7 +794,7 @@ static struct SendBuffer write_std;
794 * @param cls closure 794 * @param cls closure
795 * @param message the actual message 795 * @param message the actual message
796 */ 796 */
797typedef void (*MessageTokenizerCallback) (void *cls, 797typedef void (*MessageTokenizerCallback) (void *cls,
798 const struct 798 const struct
799 GNUNET_MessageHeader * 799 GNUNET_MessageHeader *
800 message); 800 message);
@@ -1059,7 +1059,7 @@ mst_destroy (struct MessageStreamTokenizer *mst)
1059 */ 1059 */
1060static int 1060static int
1061ieee80211_radiotap_iterator_init (struct Ieee80211RadiotapHeaderIterator *iterator, 1061ieee80211_radiotap_iterator_init (struct Ieee80211RadiotapHeaderIterator *iterator,
1062 const struct Ieee80211RadiotapHeader *radiotap_header, 1062 const struct Ieee80211RadiotapHeader *radiotap_header,
1063 size_t max_length) 1063 size_t max_length)
1064{ 1064{
1065 if ( (iterator == NULL) || 1065 if ( (iterator == NULL) ||
@@ -1204,26 +1204,26 @@ ieee80211_radiotap_iterator_next (struct Ieee80211RadiotapHeaderIterator *iterat
1204 /* need padding (by 'wanted_alignment - unalignment') */ 1204 /* need padding (by 'wanted_alignment - unalignment') */
1205 iterator->arg_index += wanted_alignment - unalignment; 1205 iterator->arg_index += wanted_alignment - unalignment;
1206 } 1206 }
1207 1207
1208 /* 1208 /*
1209 * this is what we will return to user, but we need to 1209 * this is what we will return to user, but we need to
1210 * move on first so next call has something fresh to test 1210 * move on first so next call has something fresh to test
1211 */ 1211 */
1212 iterator->this_arg_index = iterator->arg_index; 1212 iterator->this_arg_index = iterator->arg_index;
1213 iterator->this_arg = iterator->arg; 1213 iterator->this_arg = iterator->arg;
1214 1214
1215 /* internally move on the size of this arg (using lower nybble from 1215 /* internally move on the size of this arg (using lower nybble from
1216 the table) */ 1216 the table) */
1217 iterator->arg += rt_sizes[iterator->arg_index] & 0x0f; 1217 iterator->arg += rt_sizes[iterator->arg_index] & 0x0f;
1218 1218
1219 /* 1219 /*
1220 * check for insanity where we are given a bitmap that 1220 * check for insanity where we are given a bitmap that
1221 * claims to have more arg content than the length of the 1221 * claims to have more arg content than the length of the
1222 * radiotap section. We will normally end up equalling this 1222 * radiotap section. We will normally end up equalling this
1223 * max_length on the last arg, never exceeding it. 1223 * max_length on the last arg, never exceeding it.
1224 */ 1224 */
1225 if ((((void *) iterator->arg) - ((void *) iterator->rtheader)) > iterator->max_length) 1225 if ((((void *) iterator->arg) - ((void *) iterator->rtheader)) > iterator->max_length)
1226 return -1; 1226 return -1;
1227 } 1227 }
1228 1228
1229 /* Now, move on to next bit / next entry */ 1229 /* Now, move on to next bit / next entry */
@@ -1245,7 +1245,7 @@ ieee80211_radiotap_iterator_next (struct Ieee80211RadiotapHeaderIterator *iterat
1245 } 1245 }
1246 } 1246 }
1247 else 1247 else
1248 { 1248 {
1249 /* just try the next bit (while loop will move on) */ 1249 /* just try the next bit (while loop will move on) */
1250 iterator->bitmap_shifter >>= 1; 1250 iterator->bitmap_shifter >>= 1;
1251 } 1251 }
@@ -1364,7 +1364,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
1364 if (((crc) & 0xFF) == buf[0] && ((crc >> 8) & 0xFF) == buf[1] && 1364 if (((crc) & 0xFF) == buf[0] && ((crc >> 8) & 0xFF) == buf[1] &&
1365 ((crc >> 16) & 0xFF) == buf[2] && ((crc >> 24) & 0xFF) == buf[3]) 1365 ((crc >> 16) & 0xFF) == buf[2] && ((crc >> 24) & 0xFF) == buf[3])
1366 return 0; 1366 return 0;
1367 return 1; 1367 return 1;
1368} 1368}
1369 1369
1370 1370
@@ -1431,7 +1431,7 @@ linux_get_channel (const struct HardwareInfos *dev)
1431 * @return number of bytes written to 'buf' 1431 * @return number of bytes written to 'buf'
1432 */ 1432 */
1433static ssize_t 1433static ssize_t
1434linux_read (struct HardwareInfos *dev, 1434linux_read (struct HardwareInfos *dev,
1435 unsigned char *buf, size_t buf_size, 1435 unsigned char *buf, size_t buf_size,
1436 struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *ri) 1436 struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *ri)
1437{ 1437{
@@ -1452,7 +1452,7 @@ linux_read (struct HardwareInfos *dev,
1452 return -1; 1452 return -1;
1453 } 1453 }
1454 1454
1455 memset (ri, 0, sizeof (*ri)); 1455 memset (ri, 0, sizeof (*ri));
1456 switch (dev->arptype_in) 1456 switch (dev->arptype_in)
1457 { 1457 {
1458 case ARPHRD_IEEE80211_PRISM: 1458 case ARPHRD_IEEE80211_PRISM:
@@ -1511,7 +1511,7 @@ linux_read (struct HardwareInfos *dev,
1511 break; 1511 break;
1512 } 1512 }
1513 } 1513 }
1514 } 1514 }
1515 if ( (n < 8) || (n >= caplen) ) 1515 if ( (n < 8) || (n >= caplen) )
1516 return 0; /* invalid format */ 1516 return 0; /* invalid format */
1517 } 1517 }
@@ -1540,7 +1540,7 @@ linux_read (struct HardwareInfos *dev,
1540 if (!got_signal) 1540 if (!got_signal)
1541 { 1541 {
1542 ri->ri_power = * ((int8_t*) iterator.this_arg); 1542 ri->ri_power = * ((int8_t*) iterator.this_arg);
1543 got_signal = 1; 1543 got_signal = 1;
1544 } 1544 }
1545 break; 1545 break;
1546 case IEEE80211_RADIOTAP_DB_ANTSIGNAL: 1546 case IEEE80211_RADIOTAP_DB_ANTSIGNAL:
@@ -1594,7 +1594,7 @@ linux_read (struct HardwareInfos *dev,
1594 break; 1594 break;
1595 } /* end of 'switch' */ 1595 } /* end of 'switch' */
1596 } /* end of the 'while' loop */ 1596 } /* end of the 'while' loop */
1597 } 1597 }
1598 break; 1598 break;
1599 case ARPHRD_IEEE80211: 1599 case ARPHRD_IEEE80211:
1600 n = 0; /* no header */ 1600 n = 0; /* no header */
@@ -1607,7 +1607,7 @@ linux_read (struct HardwareInfos *dev,
1607 tmpbuf + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame), 1607 tmpbuf + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame),
1608 caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4 /* 4 byte FCS */); 1608 caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4 /* 4 byte FCS */);
1609 return caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4; 1609 return caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4;
1610 } 1610 }
1611 default: 1611 default:
1612 errno = ENOTSUP; /* unsupported format */ 1612 errno = ENOTSUP; /* unsupported format */
1613 return -1; 1613 return -1;
@@ -1617,8 +1617,8 @@ linux_read (struct HardwareInfos *dev,
1617 ri->ri_channel = linux_get_channel (dev); 1617 ri->ri_channel = linux_get_channel (dev);
1618 1618
1619 /* detect CRC32 at the end, even if the flag wasn't set and remove it */ 1619 /* detect CRC32 at the end, even if the flag wasn't set and remove it */
1620 if ( (0 == fcs_removed) && 1620 if ( (0 == fcs_removed) &&
1621 (0 == check_crc_buf_osdep (tmpbuf + n, caplen - sizeof (uint32_t))) ) 1621 (0 == check_crc_buf_osdep (tmpbuf + n, caplen - sizeof (uint32_t))) )
1622 { 1622 {
1623 /* NOTE: this heuristic can of course fail if there happens to 1623 /* NOTE: this heuristic can of course fail if there happens to
1624 be a matching checksum at the end. Would be good to have 1624 be a matching checksum at the end. Would be good to have
@@ -1751,9 +1751,9 @@ open_device_raw (struct HardwareInfos *dev)
1751 setsockopt (dev->fd_raw, SOL_PACKET, PACKET_ADD_MEMBERSHIP, &mr, 1751 setsockopt (dev->fd_raw, SOL_PACKET, PACKET_ADD_MEMBERSHIP, &mr,
1752 sizeof (mr))) 1752 sizeof (mr)))
1753 { 1753 {
1754 fprintf (stderr, 1754 fprintf (stderr,
1755 "Failed to enable promiscuous mode on interface `%.*s'\n", 1755 "Failed to enable promiscuous mode on interface `%.*s'\n",
1756 IFNAMSIZ, 1756 IFNAMSIZ,
1757 dev->iface); 1757 dev->iface);
1758 return 1; 1758 return 1;
1759 } 1759 }
@@ -1775,13 +1775,13 @@ test_wlan_interface (const char *iface)
1775 struct stat sbuf; 1775 struct stat sbuf;
1776 int ret; 1776 int ret;
1777 1777
1778 ret = snprintf (strbuf, sizeof (strbuf), 1778 ret = snprintf (strbuf, sizeof (strbuf),
1779 "/sys/class/net/%s/phy80211/subsystem", 1779 "/sys/class/net/%s/phy80211/subsystem",
1780 iface); 1780 iface);
1781 if ((ret < 0) || (ret >= sizeof (strbuf)) || (0 != stat (strbuf, &sbuf))) 1781 if ((ret < 0) || (ret >= sizeof (strbuf)) || (0 != stat (strbuf, &sbuf)))
1782 { 1782 {
1783 fprintf (stderr, 1783 fprintf (stderr,
1784 "Did not find 802.11 interface `%s'. Exiting.\n", 1784 "Did not find 802.11 interface `%s'. Exiting.\n",
1785 iface); 1785 iface);
1786 exit (1); 1786 exit (1);
1787 } 1787 }
@@ -1852,7 +1852,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1852 sendsize = ntohs (hdr->size); 1852 sendsize = ntohs (hdr->size);
1853 if ( (sendsize < 1853 if ( (sendsize <
1854 sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)) || 1854 sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)) ||
1855 (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)) ) 1855 (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)) )
1856 { 1856 {
1857 fprintf (stderr, "Received malformed message\n"); 1857 fprintf (stderr, "Received malformed message\n");
1858 exit (1); 1858 exit (1);
@@ -1870,10 +1870,10 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1870 case ARPHRD_IEEE80211_FULL: 1870 case ARPHRD_IEEE80211_FULL:
1871 case ARPHRD_IEEE80211: 1871 case ARPHRD_IEEE80211:
1872 rtheader.header.it_version = 0; 1872 rtheader.header.it_version = 0;
1873 rtheader.header.it_pad = 0; 1873 rtheader.header.it_pad = 0;
1874 rtheader.header.it_len = GNUNET_htole16 (sizeof (rtheader)); 1874 rtheader.header.it_len = GNUNET_htole16 (sizeof (rtheader));
1875 rtheader.header.it_present = GNUNET_htole16 (IEEE80211_RADIOTAP_OUR_TRANSMISSION_HEADER_MASK); 1875 rtheader.header.it_present = GNUNET_htole16 (IEEE80211_RADIOTAP_OUR_TRANSMISSION_HEADER_MASK);
1876 rtheader.rate = header->rate; 1876 rtheader.rate = header->rate;
1877 rtheader.pad1 = 0; 1877 rtheader.pad1 = 0;
1878 rtheader.txflags = GNUNET_htole16 (IEEE80211_RADIOTAP_F_TX_NOACK | IEEE80211_RADIOTAP_F_TX_NOSEQ); 1878 rtheader.txflags = GNUNET_htole16 (IEEE80211_RADIOTAP_F_TX_NOACK | IEEE80211_RADIOTAP_F_TX_NOSEQ);
1879 memcpy (write_pout.buf, &rtheader, sizeof (rtheader)); 1879 memcpy (write_pout.buf, &rtheader, sizeof (rtheader));
@@ -1934,7 +1934,7 @@ main (int argc, char *argv[])
1934 return 254; 1934 return 254;
1935 } 1935 }
1936#else 1936#else
1937 if (0 != seteuid (0)) 1937 if (0 != seteuid (0))
1938 { 1938 {
1939 fprintf (stderr, "Failed to seteuid back to root: %s\n", strerror (errno)); 1939 fprintf (stderr, "Failed to seteuid back to root: %s\n", strerror (errno));
1940 return 254; 1940 return 254;
@@ -2012,9 +2012,9 @@ main (int argc, char *argv[])
2012 memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); 2012 memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
2013 memcpy (write_std.buf, &macmsg, sizeof (macmsg)); 2013 memcpy (write_std.buf, &macmsg, sizeof (macmsg));
2014 write_std.size = sizeof (macmsg); 2014 write_std.size = sizeof (macmsg);
2015 } 2015 }
2016 2016
2017 stdin_mst = mst_create (&stdin_send_hw, &dev); 2017 stdin_mst = mst_create (&stdin_send_hw, &dev);
2018 stdin_open = 1; 2018 stdin_open = 1;
2019 while (1) 2019 while (1)
2020 { 2020 {
@@ -2071,7 +2071,7 @@ main (int argc, char *argv[])
2071 if (FD_ISSET (dev.fd_raw, &wfds)) 2071 if (FD_ISSET (dev.fd_raw, &wfds))
2072 { 2072 {
2073 ssize_t ret = 2073 ssize_t ret =
2074 write (dev.fd_raw, write_pout.buf + write_std.pos, 2074 write (dev.fd_raw, write_pout.buf + write_std.pos,
2075 write_pout.size - write_pout.pos); 2075 write_pout.size - write_pout.pos);
2076 if (0 > ret) 2076 if (0 > ret)
2077 { 2077 {
@@ -2097,7 +2097,7 @@ main (int argc, char *argv[])
2097 2097
2098 if (FD_ISSET (STDIN_FILENO, &rfds)) 2098 if (FD_ISSET (STDIN_FILENO, &rfds))
2099 { 2099 {
2100 ssize_t ret = 2100 ssize_t ret =
2101 read (STDIN_FILENO, readbuf, sizeof (readbuf)); 2101 read (STDIN_FILENO, readbuf, sizeof (readbuf));
2102 if (0 > ret) 2102 if (0 > ret)
2103 { 2103 {
@@ -2120,9 +2120,9 @@ main (int argc, char *argv[])
2120 rrm = (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) write_std.buf; 2120 rrm = (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) write_std.buf;
2121 ret = 2121 ret =
2122 linux_read (&dev, (unsigned char *) &rrm->frame, 2122 linux_read (&dev, (unsigned char *) &rrm->frame,
2123 sizeof (write_std.buf) 2123 sizeof (write_std.buf)
2124 - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) 2124 - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)
2125 + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame), 2125 + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame),
2126 rrm); 2126 rrm);
2127 if (0 > ret) 2127 if (0 > ret)
2128 { 2128 {
@@ -2131,8 +2131,8 @@ main (int argc, char *argv[])
2131 } 2131 }
2132 if ((0 < ret) && (0 == mac_test (&rrm->frame, &dev))) 2132 if ((0 < ret) && (0 == mac_test (&rrm->frame, &dev)))
2133 { 2133 {
2134 write_std.size = ret 2134 write_std.size = ret
2135 + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) 2135 + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)
2136 - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame); 2136 - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame);
2137 rrm->header.size = htons (write_std.size); 2137 rrm->header.size = htons (write_std.size);
2138 rrm->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER); 2138 rrm->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER);
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 3adf5b35d..ba88d71f4 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -281,7 +281,7 @@ GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
281end: 281end:
282 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 282 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
283 "Allowing receive from peer %s to continue in %s\n", 283 "Allowing receive from peer %s to continue in %s\n",
284 GNUNET_i2s (peer), 284 GNUNET_i2s (peer),
285 GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES)); 285 GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES));
286 return ret; 286 return ret;
287} 287}
diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c
index 628943a42..8f45a19b8 100644
--- a/src/transport/gnunet-service-transport_blacklist.c
+++ b/src/transport/gnunet-service-transport_blacklist.c
@@ -244,7 +244,7 @@ client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client)
244 * @param option name of the option 244 * @param option name of the option
245 * @param value value of the option 245 * @param value value of the option
246 */ 246 */
247static void 247static void
248blacklist_cfg_iter (void *cls, const char *section, 248blacklist_cfg_iter (void *cls, const char *section,
249 const char *option, 249 const char *option,
250 const char *value) 250 const char *value)
@@ -255,10 +255,10 @@ blacklist_cfg_iter (void *cls, const char *section,
255 char *pos; 255 char *pos;
256 256
257 if (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (option, 257 if (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (option,
258 strlen (option), 258 strlen (option),
259 &peer.public_key)) 259 &peer.public_key))
260 return; 260 return;
261 261
262 if ((NULL == value) || (0 == strcmp(value, ""))) 262 if ((NULL == value) || (0 == strcmp(value, "")))
263 { 263 {
264 /* Blacklist whole peer */ 264 /* Blacklist whole peer */
@@ -295,9 +295,9 @@ read_blacklist_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg,
295 char cfg_sect[512]; 295 char cfg_sect[512];
296 unsigned int res = 0; 296 unsigned int res = 0;
297 297
298 GNUNET_snprintf (cfg_sect, 298 GNUNET_snprintf (cfg_sect,
299 sizeof (cfg_sect), 299 sizeof (cfg_sect),
300 "transport-blacklist-%s", 300 "transport-blacklist-%s",
301 GNUNET_i2s_full (my_id)); 301 GNUNET_i2s_full (my_id));
302 GNUNET_CONFIGURATION_iterate_section_values (cfg, cfg_sect, &blacklist_cfg_iter, &res); 302 GNUNET_CONFIGURATION_iterate_section_values (cfg, cfg_sect, &blacklist_cfg_iter, &res);
303 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 303 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -636,7 +636,7 @@ GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer,
636 blacklist = 636 blacklist =
637 GNUNET_CONTAINER_multipeermap_create (TRANSPORT_BLACKLIST_HT_SIZE, 637 GNUNET_CONTAINER_multipeermap_create (TRANSPORT_BLACKLIST_HT_SIZE,
638 GNUNET_NO); 638 GNUNET_NO);
639 639
640 GNUNET_CONTAINER_multipeermap_put (blacklist, peer, 640 GNUNET_CONTAINER_multipeermap_put (blacklist, peer,
641 transport, 641 transport,
642 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 642 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
@@ -653,7 +653,7 @@ GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer,
653 * @return #GNUNET_OK if the entry does not match, #GNUNET_NO if it matches 653 * @return #GNUNET_OK if the entry does not match, #GNUNET_NO if it matches
654 */ 654 */
655static int 655static int
656test_blacklisted (void *cls, 656test_blacklisted (void *cls,
657 const struct GNUNET_PeerIdentity *key, 657 const struct GNUNET_PeerIdentity *key,
658 void *value) 658 void *value)
659{ 659{
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index 5817bd2c2..b3f108675 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -978,7 +978,7 @@ clients_handle_address_iterate (void *cls, struct GNUNET_SERVER_Client *client,
978 setup_monitoring_client (client, &msg->peer); 978 setup_monitoring_client (client, &msg->peer);
979 else 979 else
980 GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0, 980 GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0,
981 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE); 981 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE);
982 GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL); 982 GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL);
983} 983}
984 984
diff --git a/src/transport/gnunet-service-transport_hello.c b/src/transport/gnunet-service-transport_hello.c
index 0347d67a5..a53e26f95 100644
--- a/src/transport/gnunet-service-transport_hello.c
+++ b/src/transport/gnunet-service-transport_hello.c
@@ -171,7 +171,7 @@ refresh_hello_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
171 friend_only = GNUNET_HELLO_is_friend_only (our_hello); 171 friend_only = GNUNET_HELLO_is_friend_only (our_hello);
172 GNUNET_free (our_hello); 172 GNUNET_free (our_hello);
173 our_hello = GNUNET_HELLO_create (&GST_my_identity.public_key, 173 our_hello = GNUNET_HELLO_create (&GST_my_identity.public_key,
174 &address_generator, 174 &address_generator,
175 &gc, friend_only); 175 &gc, friend_only);
176 GNUNET_assert (NULL != our_hello); 176 GNUNET_assert (NULL != our_hello);
177 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 177 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -215,7 +215,7 @@ GST_hello_start (int friend_only, GST_HelloCallback cb, void *cb_cls)
215{ 215{
216 hello_cb = cb; 216 hello_cb = cb;
217 hello_cb_cls = cb_cls; 217 hello_cb_cls = cb_cls;
218 our_hello = GNUNET_HELLO_create (&GST_my_identity.public_key, 218 our_hello = GNUNET_HELLO_create (&GST_my_identity.public_key,
219 NULL, NULL, friend_only); 219 NULL, NULL, friend_only);
220 GNUNET_assert (NULL != our_hello); 220 GNUNET_assert (NULL != our_hello);
221 refresh_hello (); 221 refresh_hello ();
diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c
index 7762d1811..1b708cb70 100644
--- a/src/transport/gnunet-service-transport_manipulation.c
+++ b/src/transport/gnunet-service-transport_manipulation.c
@@ -336,7 +336,7 @@ GST_manipulation_set_metric (void *cls, struct GNUNET_SERVER_Client *client,
336 tmp->metrics[c][c2] = UINT32_MAX; 336 tmp->metrics[c][c2] = UINT32_MAX;
337 } 337 }
338 } 338 }
339 GNUNET_CONTAINER_multipeermap_put (man_handle.peers, 339 GNUNET_CONTAINER_multipeermap_put (man_handle.peers,
340 &tm->peer, tmp, 340 &tm->peer, tmp,
341 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); 341 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
342 } 342 }
@@ -581,64 +581,64 @@ GST_manipulation_init (const struct GNUNET_CONFIGURATION_Handle *GST_cfg)
581{ 581{
582 unsigned long long tmp; 582 unsigned long long tmp;
583 struct GNUNET_TIME_Relative delay; 583 struct GNUNET_TIME_Relative delay;
584 584
585 if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg, 585 if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg,
586 "transport", 586 "transport",
587 "MANIPULATE_DISTANCE_IN", 587 "MANIPULATE_DISTANCE_IN",
588 &tmp)) && 588 &tmp)) &&
589 (tmp > 0) ) 589 (tmp > 0) )
590 { 590 {
591 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 591 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
592 "Setting inbound distance_in to %llu\n", 592 "Setting inbound distance_in to %llu\n",
593 (unsigned long long) tmp); 593 (unsigned long long) tmp);
594 set_metric (&man_handle.general, TM_RECEIVE, GNUNET_ATS_QUALITY_NET_DISTANCE, tmp); 594 set_metric (&man_handle.general, TM_RECEIVE, GNUNET_ATS_QUALITY_NET_DISTANCE, tmp);
595 } 595 }
596 596
597 if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg, 597 if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg,
598 "transport", 598 "transport",
599 "MANIPULATE_DISTANCE_OUT", 599 "MANIPULATE_DISTANCE_OUT",
600 &tmp)) && 600 &tmp)) &&
601 (tmp > 0) ) 601 (tmp > 0) )
602 { 602 {
603 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 603 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
604 "Setting outbound distance_in to %llu\n", 604 "Setting outbound distance_in to %llu\n",
605 (unsigned long long) tmp); 605 (unsigned long long) tmp);
606 set_metric (&man_handle.general, TM_SEND, 606 set_metric (&man_handle.general, TM_SEND,
607 GNUNET_ATS_QUALITY_NET_DISTANCE, tmp); 607 GNUNET_ATS_QUALITY_NET_DISTANCE, tmp);
608 } 608 }
609 609
610 if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (GST_cfg, 610 if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (GST_cfg,
611 "transport", 611 "transport",
612 "MANIPULATE_DELAY_IN", 612 "MANIPULATE_DELAY_IN",
613 &delay)) && 613 &delay)) &&
614 (delay.rel_value_us > 0) ) 614 (delay.rel_value_us > 0) )
615 { 615 {
616 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 616 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
617 "Delaying inbound traffic for %s\n", 617 "Delaying inbound traffic for %s\n",
618 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); 618 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
619 set_metric (&man_handle.general, TM_RECEIVE, 619 set_metric (&man_handle.general, TM_RECEIVE,
620 GNUNET_ATS_QUALITY_NET_DELAY, 620 GNUNET_ATS_QUALITY_NET_DELAY,
621 delay.rel_value_us); 621 delay.rel_value_us);
622 } 622 }
623 if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (GST_cfg, 623 if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (GST_cfg,
624 "transport", 624 "transport",
625 "MANIPULATE_DELAY_OUT", 625 "MANIPULATE_DELAY_OUT",
626 &delay)) && 626 &delay)) &&
627 (delay.rel_value_us > 0) ) 627 (delay.rel_value_us > 0) )
628 { 628 {
629 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 629 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
630 "Delaying outbound traffic for %s\n", 630 "Delaying outbound traffic for %s\n",
631 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); 631 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
632 set_metric (&man_handle.general, 632 set_metric (&man_handle.general,
633 TM_SEND, 633 TM_SEND,
634 GNUNET_ATS_QUALITY_NET_DELAY, 634 GNUNET_ATS_QUALITY_NET_DELAY,
635 delay.rel_value_us); 635 delay.rel_value_us);
636 } 636 }
637 man_handle.peers = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); 637 man_handle.peers = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
638} 638}
639 639
640 640
641static int 641static int
642free_tmps (void *cls, 642free_tmps (void *cls,
643 const struct GNUNET_PeerIdentity *key, 643 const struct GNUNET_PeerIdentity *key,
644 void *value) 644 void *value)
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 90f45f126..0cffe0aeb 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -79,7 +79,7 @@
79#define SETUP_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15) 79#define SETUP_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15)
80 80
81/** 81/**
82 * How long are we willing to wait for a successful reconnect if 82 * How long are we willing to wait for a successful reconnect if
83 * an existing connection went down? Much shorter than the 83 * an existing connection went down? Much shorter than the
84 * usual SETUP_CONNECTION_TIMEOUT as we do not inform the 84 * usual SETUP_CONNECTION_TIMEOUT as we do not inform the
85 * higher layers about the disconnect during this period. 85 * higher layers about the disconnect during this period.
@@ -271,7 +271,7 @@ GNUNET_NETWORK_STRUCT_BEGIN
271 * setup a connection/session for data exchange. A 'SESSION_CONNECT' 271 * setup a connection/session for data exchange. A 'SESSION_CONNECT'
272 * should be answered with a 'SESSION_CONNECT_ACK' with the same body 272 * should be answered with a 'SESSION_CONNECT_ACK' with the same body
273 * to confirm. A 'SESSION_CONNECT_ACK' should then be followed with 273 * to confirm. A 'SESSION_CONNECT_ACK' should then be followed with
274 * a 'SESSION_ACK'. Once the 'SESSION_ACK' is received, both peers 274 * a 'SESSION_ACK'. Once the 'SESSION_ACK' is received, both peers
275 * should be connected. 275 * should be connected.
276 */ 276 */
277struct SessionConnectMessage 277struct SessionConnectMessage
@@ -298,7 +298,7 @@ struct SessionConnectMessage
298 298
299/** 299/**
300 * Message we send to the other peer to notify him that we intentionally 300 * Message we send to the other peer to notify him that we intentionally
301 * are disconnecting (to reduce timeouts). This is just a friendly 301 * are disconnecting (to reduce timeouts). This is just a friendly
302 * notification, peers must not rely on always receiving disconnect 302 * notification, peers must not rely on always receiving disconnect
303 * messages. 303 * messages.
304 */ 304 */
@@ -448,8 +448,8 @@ struct MessageQueue
448 * and set the 'send_connect_ack' to 2. If we then receive a 448 * and set the 'send_connect_ack' to 2. If we then receive a
449 * 'SESSION_ACK', we go to 'S_CONNECTED' (and reset 'send_connect_ack' 449 * 'SESSION_ACK', we go to 'S_CONNECTED' (and reset 'send_connect_ack'
450 * to 0). 450 * to 0).
451 * 451 *
452 */ 452 */
453enum State 453enum State
454{ 454{
455 /** 455 /**
@@ -525,7 +525,7 @@ enum State
525 */ 525 */
526 S_CONNECTED_SWITCHING_BLACKLIST, 526 S_CONNECTED_SWITCHING_BLACKLIST,
527 527
528 /** 528 /**
529 * We have some primary connection, but ATS suggested we switch 529 * We have some primary connection, but ATS suggested we switch
530 * to some alternative; we now sent a CONNECT message for the 530 * to some alternative; we now sent a CONNECT message for the
531 * alternative session to the other peer and waiting for a 531 * alternative session to the other peer and waiting for a
@@ -589,7 +589,7 @@ struct NeighbourAddress
589 * Did we tell ATS that this is our 'active' address? 589 * Did we tell ATS that this is our 'active' address?
590 */ 590 */
591 int ats_active; 591 int ats_active;
592 592
593}; 593};
594 594
595 595
@@ -644,7 +644,7 @@ struct NeighbourMapEntry
644 struct GNUNET_TIME_Absolute keep_alive_time; 644 struct GNUNET_TIME_Absolute keep_alive_time;
645 645
646 /** 646 /**
647 * At what time did we sent the last keep-alive message? Used 647 * At what time did we sent the last keep-alive message? Used
648 * to calculate round-trip time ("latency"). 648 * to calculate round-trip time ("latency").
649 */ 649 */
650 struct GNUNET_TIME_Absolute last_keep_alive_time; 650 struct GNUNET_TIME_Absolute last_keep_alive_time;
@@ -713,7 +713,7 @@ struct NeighbourMapEntry
713 */ 713 */
714struct BlackListCheckContext 714struct BlackListCheckContext
715{ 715{
716 716
717 /** 717 /**
718 * We keep blacklist checks in a DLL. 718 * We keep blacklist checks in a DLL.
719 */ 719 */
@@ -954,7 +954,7 @@ set_address (struct NeighbourAddress *na,
954 int is_active) 954 int is_active)
955{ 955{
956 struct GNUNET_TRANSPORT_PluginFunctions *papi; 956 struct GNUNET_TRANSPORT_PluginFunctions *papi;
957 if (NULL == (papi = GST_plugins_find (address->transport_name))) 957 if (NULL == (papi = GST_plugins_find (address->transport_name)))
958 { 958 {
959 GNUNET_break (0); 959 GNUNET_break (0);
960 return; 960 return;
@@ -976,17 +976,17 @@ set_address (struct NeighbourAddress *na,
976 /* FIXME: is this the right place to set quotas? */ 976 /* FIXME: is this the right place to set quotas? */
977 GST_neighbours_set_incoming_quota (&address->peer, bandwidth_in); 977 GST_neighbours_set_incoming_quota (&address->peer, bandwidth_in);
978 send_outbound_quota (&address->peer, bandwidth_out); 978 send_outbound_quota (&address->peer, bandwidth_out);
979 } 979 }
980 return; 980 return;
981 } 981 }
982 free_address (na); 982 free_address (na);
983 if (NULL == session) 983 if (NULL == session)
984 session = papi->get_session (papi->cls, address); 984 session = papi->get_session (papi->cls, address);
985 if (NULL == session) 985 if (NULL == session)
986 { 986 {
987 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 987 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
988 "Failed to obtain new session for peer `%s' and address '%s'\n", 988 "Failed to obtain new session for peer `%s' and address '%s'\n",
989 GNUNET_i2s (&address->peer), GST_plugins_a2s (address)); 989 GNUNET_i2s (&address->peer), GST_plugins_a2s (address));
990 GNUNET_ATS_address_destroyed (GST_ats, address, NULL); 990 GNUNET_ATS_address_destroyed (GST_ats, address, NULL);
991 return; 991 return;
992 } 992 }
@@ -1037,8 +1037,8 @@ free_neighbour (struct NeighbourMapEntry *n, int keep_sessions)
1037 least internally we need to get clean... */ 1037 least internally we need to get clean... */
1038 if (GNUNET_YES == test_connected (n)) 1038 if (GNUNET_YES == test_connected (n))
1039 { 1039 {
1040 GNUNET_STATISTICS_set (GST_stats, 1040 GNUNET_STATISTICS_set (GST_stats,
1041 gettext_noop ("# peers connected"), 1041 gettext_noop ("# peers connected"),
1042 --neighbours_connected, 1042 --neighbours_connected,
1043 GNUNET_NO); 1043 GNUNET_NO);
1044 disconnect_notify_cb (callback_cls, &n->id); 1044 disconnect_notify_cb (callback_cls, &n->id);
@@ -1226,7 +1226,7 @@ send_disconnect (struct NeighbourMapEntry *n)
1226static void 1226static void
1227disconnect_neighbour (struct NeighbourMapEntry *n) 1227disconnect_neighbour (struct NeighbourMapEntry *n)
1228{ 1228{
1229 /* depending on state, notify neighbour and/or upper layers of this peer 1229 /* depending on state, notify neighbour and/or upper layers of this peer
1230 about disconnect */ 1230 about disconnect */
1231 switch (n->state) 1231 switch (n->state)
1232 { 1232 {
@@ -1238,7 +1238,7 @@ disconnect_neighbour (struct NeighbourMapEntry *n)
1238 free_neighbour (n, GNUNET_NO); 1238 free_neighbour (n, GNUNET_NO);
1239 return; 1239 return;
1240 case S_CONNECT_SENT: 1240 case S_CONNECT_SENT:
1241 send_disconnect (n); 1241 send_disconnect (n);
1242 n->state = S_DISCONNECT; 1242 n->state = S_DISCONNECT;
1243 break; 1243 break;
1244 case S_CONNECT_RECV_BLACKLIST_INBOUND: 1244 case S_CONNECT_RECV_BLACKLIST_INBOUND:
@@ -1250,9 +1250,9 @@ disconnect_neighbour (struct NeighbourMapEntry *n)
1250 return; 1250 return;
1251 case S_CONNECT_RECV_ACK: 1251 case S_CONNECT_RECV_ACK:
1252 /* we DID ACK the other peer's request, must send DISCONNECT */ 1252 /* we DID ACK the other peer's request, must send DISCONNECT */
1253 send_disconnect (n); 1253 send_disconnect (n);
1254 n->state = S_DISCONNECT; 1254 n->state = S_DISCONNECT;
1255 break; 1255 break;
1256 case S_CONNECTED: 1256 case S_CONNECTED:
1257 case S_RECONNECT_BLACKLIST: 1257 case S_RECONNECT_BLACKLIST:
1258 case S_RECONNECT_SENT: 1258 case S_RECONNECT_SENT:
@@ -1261,8 +1261,8 @@ disconnect_neighbour (struct NeighbourMapEntry *n)
1261 /* we are currently connected, need to send disconnect and do 1261 /* we are currently connected, need to send disconnect and do
1262 internal notifications and update statistics */ 1262 internal notifications and update statistics */
1263 send_disconnect (n); 1263 send_disconnect (n);
1264 GNUNET_STATISTICS_set (GST_stats, 1264 GNUNET_STATISTICS_set (GST_stats,
1265 gettext_noop ("# peers connected"), 1265 gettext_noop ("# peers connected"),
1266 --neighbours_connected, 1266 --neighbours_connected,
1267 GNUNET_NO); 1267 GNUNET_NO);
1268 disconnect_notify_cb (callback_cls, &n->id); 1268 disconnect_notify_cb (callback_cls, &n->id);
@@ -1326,7 +1326,7 @@ transmit_send_continuation (void *cls,
1326 n->is_active = NULL; 1326 n->is_active = NULL;
1327 if (GNUNET_SCHEDULER_NO_TASK != n->task) 1327 if (GNUNET_SCHEDULER_NO_TASK != n->task)
1328 GNUNET_SCHEDULER_cancel (n->task); 1328 GNUNET_SCHEDULER_cancel (n->task);
1329 n->task = GNUNET_SCHEDULER_add_now (&master_task, n); 1329 n->task = GNUNET_SCHEDULER_add_now (&master_task, n);
1330 } 1330 }
1331 if (bytes_in_send_queue < mq->message_buf_size) 1331 if (bytes_in_send_queue < mq->message_buf_size)
1332 { 1332 {
@@ -1355,7 +1355,7 @@ transmit_send_continuation (void *cls,
1355 gettext_noop 1355 gettext_noop
1356 ("# transmission failures for messages to other peers"), 1356 ("# transmission failures for messages to other peers"),
1357 1, GNUNET_NO); 1357 1, GNUNET_NO);
1358 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1358 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1359 "Sending message to `%s' of type %u was a %s\n", 1359 "Sending message to `%s' of type %u was a %s\n",
1360 GNUNET_i2s (receiver), 1360 GNUNET_i2s (receiver),
1361 ntohs (((struct GNUNET_MessageHeader *) mq->message_buf)->type), 1361 ntohs (((struct GNUNET_MessageHeader *) mq->message_buf)->type),
@@ -1389,7 +1389,7 @@ try_transmission_to_peer (struct NeighbourMapEntry *n)
1389 GNUNET_break (0); 1389 GNUNET_break (0);
1390 return; 1390 return;
1391 } 1391 }
1392 if ((0 == n->primary_address.address->address_length) && 1392 if ((0 == n->primary_address.address->address_length) &&
1393 (NULL == n->primary_address.session)) 1393 (NULL == n->primary_address.session))
1394 { 1394 {
1395 /* no address, why are we here? */ 1395 /* no address, why are we here? */
@@ -1399,7 +1399,7 @@ try_transmission_to_peer (struct NeighbourMapEntry *n)
1399 if (NULL != n->is_active) 1399 if (NULL != n->is_active)
1400 { 1400 {
1401 /* transmission already pending */ 1401 /* transmission already pending */
1402 return; 1402 return;
1403 } 1403 }
1404 1404
1405 /* timeout messages from the queue that are past their due date */ 1405 /* timeout messages from the queue that are past their due date */
@@ -1535,7 +1535,7 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour)
1535 n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 1535 n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
1536 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1536 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1537 "Latency for peer `%s' is %s\n", 1537 "Latency for peer `%s' is %s\n",
1538 GNUNET_i2s (&n->id), 1538 GNUNET_i2s (&n->id),
1539 GNUNET_STRINGS_relative_time_to_string (n->latency, 1539 GNUNET_STRINGS_relative_time_to_string (n->latency,
1540 GNUNET_YES)); 1540 GNUNET_YES));
1541 /* append latency */ 1541 /* append latency */
@@ -1570,7 +1570,7 @@ GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity
1570{ 1570{
1571 struct NeighbourMapEntry *n; 1571 struct NeighbourMapEntry *n;
1572 struct GNUNET_TIME_Relative ret; 1572 struct GNUNET_TIME_Relative ret;
1573 1573
1574 if (NULL == neighbours) 1574 if (NULL == neighbours)
1575 { 1575 {
1576 *do_forward = GNUNET_NO; 1576 *do_forward = GNUNET_NO;
@@ -1634,7 +1634,7 @@ GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity
1634 GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES)); 1634 GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES));
1635 GNUNET_STATISTICS_update (GST_stats, 1635 GNUNET_STATISTICS_update (GST_stats,
1636 gettext_noop ("# ms throttling suggested"), 1636 gettext_noop ("# ms throttling suggested"),
1637 (int64_t) ret.rel_value_us / 1000LL, 1637 (int64_t) ret.rel_value_us / 1000LL,
1638 GNUNET_NO); 1638 GNUNET_NO);
1639 } 1639 }
1640 return ret; 1640 return ret;
@@ -1708,13 +1708,13 @@ send_session_connect (struct NeighbourAddress *na)
1708 struct GNUNET_TRANSPORT_PluginFunctions *papi; 1708 struct GNUNET_TRANSPORT_PluginFunctions *papi;
1709 struct SessionConnectMessage connect_msg; 1709 struct SessionConnectMessage connect_msg;
1710 1710
1711 if (NULL == (papi = GST_plugins_find (na->address->transport_name))) 1711 if (NULL == (papi = GST_plugins_find (na->address->transport_name)))
1712 { 1712 {
1713 GNUNET_break (0); 1713 GNUNET_break (0);
1714 return; 1714 return;
1715 } 1715 }
1716 if (NULL == na->session) 1716 if (NULL == na->session)
1717 na->session = papi->get_session (papi->cls, na->address); 1717 na->session = papi->get_session (papi->cls, na->address);
1718 if (NULL == na->session) 1718 if (NULL == na->session)
1719 { 1719 {
1720 GNUNET_break (0); 1720 GNUNET_break (0);
@@ -1750,13 +1750,13 @@ send_session_connect_ack_message (const struct GNUNET_HELLO_Address *address,
1750 struct GNUNET_TRANSPORT_PluginFunctions *papi; 1750 struct GNUNET_TRANSPORT_PluginFunctions *papi;
1751 struct SessionConnectMessage connect_msg; 1751 struct SessionConnectMessage connect_msg;
1752 1752
1753 if (NULL == (papi = GST_plugins_find (address->transport_name))) 1753 if (NULL == (papi = GST_plugins_find (address->transport_name)))
1754 { 1754 {
1755 GNUNET_break (0); 1755 GNUNET_break (0);
1756 return; 1756 return;
1757 } 1757 }
1758 if (NULL == session) 1758 if (NULL == session)
1759 session = papi->get_session (papi->cls, address); 1759 session = papi->get_session (papi->cls, address);
1760 if (NULL == session) 1760 if (NULL == session)
1761 { 1761 {
1762 GNUNET_break (0); 1762 GNUNET_break (0);
@@ -1788,7 +1788,7 @@ setup_neighbour (const struct GNUNET_PeerIdentity *peer)
1788 struct NeighbourMapEntry *n; 1788 struct NeighbourMapEntry *n;
1789 1789
1790 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1790 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1791 "Creating new neighbour entry for `%s'\n", 1791 "Creating new neighbour entry for `%s'\n",
1792 GNUNET_i2s (peer)); 1792 GNUNET_i2s (peer));
1793 n = MEMDEBUG_malloc (sizeof (struct NeighbourMapEntry), __LINE__); 1793 n = MEMDEBUG_malloc (sizeof (struct NeighbourMapEntry), __LINE__);
1794 n->id = *peer; 1794 n->id = *peer;
@@ -1842,7 +1842,7 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target)
1842{ 1842{
1843 struct NeighbourMapEntry *n; 1843 struct NeighbourMapEntry *n;
1844 1844
1845 if (NULL == neighbours) 1845 if (NULL == neighbours)
1846 { 1846 {
1847 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1847 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1848 "Asked to connect to peer `%s' during shutdown\n", 1848 "Asked to connect to peer `%s' during shutdown\n",
@@ -1881,7 +1881,7 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target)
1881 "Ignoring request to try to connect to `%s', already trying!\n", 1881 "Ignoring request to try to connect to `%s', already trying!\n",
1882 GNUNET_i2s (target)); 1882 GNUNET_i2s (target));
1883 return; /* already trying */ 1883 return; /* already trying */
1884 case S_CONNECTED: 1884 case S_CONNECTED:
1885 case S_RECONNECT_ATS: 1885 case S_RECONNECT_ATS:
1886 case S_RECONNECT_BLACKLIST: 1886 case S_RECONNECT_BLACKLIST:
1887 case S_RECONNECT_SENT: 1887 case S_RECONNECT_SENT:
@@ -1896,8 +1896,8 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target)
1896 free_neighbour (n, GNUNET_NO); 1896 free_neighbour (n, GNUNET_NO);
1897 break; 1897 break;
1898 case S_DISCONNECT_FINISHED: 1898 case S_DISCONNECT_FINISHED:
1899 /* should not be possible */ 1899 /* should not be possible */
1900 GNUNET_assert (0); 1900 GNUNET_assert (0);
1901 default: 1901 default:
1902 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state)); 1902 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state));
1903 GNUNET_break (0); 1903 GNUNET_break (0);
@@ -1905,8 +1905,8 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target)
1905 break; 1905 break;
1906 } 1906 }
1907 } 1907 }
1908 n = setup_neighbour (target); 1908 n = setup_neighbour (target);
1909 n->state = S_INIT_ATS; 1909 n->state = S_INIT_ATS;
1910 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT); 1910 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT);
1911 1911
1912 GNUNET_ATS_reset_backoff (GST_ats, target); 1912 GNUNET_ATS_reset_backoff (GST_ats, target);
@@ -1988,7 +1988,7 @@ handle_test_blacklist_cont (void *cls,
1988 n->primary_address.session, 1988 n->primary_address.session,
1989 n->connect_ack_timestamp); 1989 n->connect_ack_timestamp);
1990 } 1990 }
1991 break; 1991 break;
1992 case S_CONNECT_RECV_BLACKLIST_INBOUND: 1992 case S_CONNECT_RECV_BLACKLIST_INBOUND:
1993 if (GNUNET_OK == result) 1993 if (GNUNET_OK == result)
1994 GST_ats_add_address (bcc->na.address, bcc->na.session); 1994 GST_ats_add_address (bcc->na.address, bcc->na.session);
@@ -2011,7 +2011,7 @@ handle_test_blacklist_cont (void *cls,
2011 send_session_connect_ack_message (bcc->na.address, 2011 send_session_connect_ack_message (bcc->na.address,
2012 bcc->na.session, 2012 bcc->na.session,
2013 n->connect_ack_timestamp); 2013 n->connect_ack_timestamp);
2014 if (1 == n->send_connect_ack) 2014 if (1 == n->send_connect_ack)
2015 n->send_connect_ack = 2; 2015 n->send_connect_ack = 2;
2016 } 2016 }
2017 else 2017 else
@@ -2038,13 +2038,13 @@ handle_test_blacklist_cont (void *cls,
2038 n->primary_address.session, 2038 n->primary_address.session,
2039 n->connect_ack_timestamp); 2039 n->connect_ack_timestamp);
2040 } 2040 }
2041 break; 2041 break;
2042 case S_CONNECTED: 2042 case S_CONNECTED:
2043 /* already connected, don't care about blacklist */ 2043 /* already connected, don't care about blacklist */
2044 break; 2044 break;
2045 case S_RECONNECT_ATS: 2045 case S_RECONNECT_ATS:
2046 /* still waiting on ATS suggestion, don't care about blacklist */ 2046 /* still waiting on ATS suggestion, don't care about blacklist */
2047 break; 2047 break;
2048 case S_RECONNECT_BLACKLIST: 2048 case S_RECONNECT_BLACKLIST:
2049 if ( (GNUNET_OK == result) && 2049 if ( (GNUNET_OK == result) &&
2050 (1 == n->send_connect_ack) ) 2050 (1 == n->send_connect_ack) )
@@ -2083,7 +2083,7 @@ handle_test_blacklist_cont (void *cls,
2083 n->primary_address.session, 2083 n->primary_address.session,
2084 n->connect_ack_timestamp); 2084 n->connect_ack_timestamp);
2085 } 2085 }
2086 break; 2086 break;
2087 case S_CONNECTED_SWITCHING_BLACKLIST: 2087 case S_CONNECTED_SWITCHING_BLACKLIST:
2088 if (GNUNET_YES != address_matches (&bcc->na, &n->alternative_address)) 2088 if (GNUNET_YES != address_matches (&bcc->na, &n->alternative_address))
2089 break; /* result for an address we currently don't care about */ 2089 break; /* result for an address we currently don't care about */
@@ -2111,7 +2111,7 @@ handle_test_blacklist_cont (void *cls,
2111 n->primary_address.session, 2111 n->primary_address.session,
2112 n->connect_ack_timestamp); 2112 n->connect_ack_timestamp);
2113 } 2113 }
2114 break; 2114 break;
2115 case S_DISCONNECT: 2115 case S_DISCONNECT:
2116 /* Nothing to do here, ATS will already do what can be done */ 2116 /* Nothing to do here, ATS will already do what can be done */
2117 break; 2117 break;
@@ -2163,10 +2163,10 @@ check_blacklist (const struct GNUNET_PeerIdentity *peer,
2163 GNUNET_CONTAINER_DLL_insert (bc_head, 2163 GNUNET_CONTAINER_DLL_insert (bc_head,
2164 bc_tail, 2164 bc_tail,
2165 bcc); 2165 bcc);
2166 if (NULL != (bc = GST_blacklist_test_allowed (peer, 2166 if (NULL != (bc = GST_blacklist_test_allowed (peer,
2167 address->transport_name, 2167 address->transport_name,
2168 &handle_test_blacklist_cont, bcc))) 2168 &handle_test_blacklist_cont, bcc)))
2169 bcc->bc = bc; 2169 bcc->bc = bc;
2170 /* if NULL == bc, 'cont' was already called and 'bcc' already free'd, so 2170 /* if NULL == bc, 'cont' was already called and 'bcc' already free'd, so
2171 we must only store 'bc' if 'bc' is non-NULL... */ 2171 we must only store 'bc' if 'bc' is non-NULL... */
2172} 2172}
@@ -2193,7 +2193,7 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message,
2193 struct GNUNET_TIME_Absolute ts; 2193 struct GNUNET_TIME_Absolute ts;
2194 2194
2195 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2195 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2196 "Received CONNECT message from peer `%s'\n", 2196 "Received CONNECT message from peer `%s'\n",
2197 GNUNET_i2s (peer)); 2197 GNUNET_i2s (peer));
2198 2198
2199 if (ntohs (message->size) != sizeof (struct SessionConnectMessage)) 2199 if (ntohs (message->size) != sizeof (struct SessionConnectMessage))
@@ -2213,7 +2213,7 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message,
2213 n->connect_ack_timestamp = ts; 2213 n->connect_ack_timestamp = ts;
2214 2214
2215 switch (n->state) 2215 switch (n->state)
2216 { 2216 {
2217 case S_NOT_CONNECTED: 2217 case S_NOT_CONNECTED:
2218 n->state = S_CONNECT_RECV_BLACKLIST_INBOUND; 2218 n->state = S_CONNECT_RECV_BLACKLIST_INBOUND;
2219 /* Do a blacklist check for the new address */ 2219 /* Do a blacklist check for the new address */
@@ -2229,7 +2229,7 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message,
2229 case S_CONNECT_RECV_ATS: 2229 case S_CONNECT_RECV_ATS:
2230 case S_CONNECT_RECV_BLACKLIST: 2230 case S_CONNECT_RECV_BLACKLIST:
2231 case S_CONNECT_RECV_ACK: 2231 case S_CONNECT_RECV_ACK:
2232 /* It can never hurt to have an alternative address in the above cases, 2232 /* It can never hurt to have an alternative address in the above cases,
2233 see if it is allowed */ 2233 see if it is allowed */
2234 check_blacklist (peer, ts, address, session); 2234 check_blacklist (peer, ts, address, session);
2235 break; 2235 break;
@@ -2247,7 +2247,7 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message,
2247 case S_RECONNECT_ATS: 2247 case S_RECONNECT_ATS:
2248 case S_RECONNECT_BLACKLIST: 2248 case S_RECONNECT_BLACKLIST:
2249 case S_RECONNECT_SENT: 2249 case S_RECONNECT_SENT:
2250 /* It can never hurt to have an alternative address in the above cases, 2250 /* It can never hurt to have an alternative address in the above cases,
2251 see if it is allowed */ 2251 see if it is allowed */
2252 check_blacklist (peer, ts, address, session); 2252 check_blacklist (peer, ts, address, session);
2253 break; 2253 break;
@@ -2286,7 +2286,7 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message,
2286 2286
2287/** 2287/**
2288 * For an existing neighbour record, set the active connection to 2288 * For an existing neighbour record, set the active connection to
2289 * use the given address. 2289 * use the given address.
2290 * 2290 *
2291 * @param peer identity of the peer to switch the address for 2291 * @param peer identity of the peer to switch the address for
2292 * @param address address of the other peer, NULL if other peer 2292 * @param address address of the other peer, NULL if other peer
@@ -2355,7 +2355,7 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
2355 { 2355 {
2356 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2356 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2357 "Failed to obtain new session for peer `%s' and address '%s'\n", 2357 "Failed to obtain new session for peer `%s' and address '%s'\n",
2358 GNUNET_i2s (&address->peer), GST_plugins_a2s (address)); 2358 GNUNET_i2s (&address->peer), GST_plugins_a2s (address));
2359 GNUNET_ATS_address_destroyed (GST_ats, address, NULL); 2359 GNUNET_ATS_address_destroyed (GST_ats, address, NULL);
2360 return; 2360 return;
2361 } 2361 }
@@ -2529,7 +2529,7 @@ master_task (void *cls,
2529 struct GNUNET_TIME_Relative delay; 2529 struct GNUNET_TIME_Relative delay;
2530 2530
2531 n->task = GNUNET_SCHEDULER_NO_TASK; 2531 n->task = GNUNET_SCHEDULER_NO_TASK;
2532 delay = GNUNET_TIME_absolute_get_remaining (n->timeout); 2532 delay = GNUNET_TIME_absolute_get_remaining (n->timeout);
2533 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2533 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2534 "Master task runs for neighbour `%s' in state %s with timeout in %s\n", 2534 "Master task runs for neighbour `%s' in state %s with timeout in %s\n",
2535 GNUNET_i2s (&n->id), 2535 GNUNET_i2s (&n->id),
@@ -2698,11 +2698,11 @@ master_task (void *cls,
2698 default: 2698 default:
2699 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state)); 2699 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state));
2700 GNUNET_break (0); 2700 GNUNET_break (0);
2701 break; 2701 break;
2702 } 2702 }
2703 if ( (S_CONNECTED_SWITCHING_CONNECT_SENT == n->state) || 2703 if ( (S_CONNECTED_SWITCHING_CONNECT_SENT == n->state) ||
2704 (S_CONNECTED_SWITCHING_BLACKLIST == n->state) || 2704 (S_CONNECTED_SWITCHING_BLACKLIST == n->state) ||
2705 (S_CONNECTED == n->state) ) 2705 (S_CONNECTED == n->state) )
2706 { 2706 {
2707 /* if we are *now* in one of these three states, we're sending 2707 /* if we are *now* in one of these three states, we're sending
2708 keep alive messages, so we need to consider the keepalive 2708 keep alive messages, so we need to consider the keepalive
@@ -2789,14 +2789,14 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
2789 gettext_noop 2789 gettext_noop
2790 ("# unexpected CONNECT_ACK messages (not ready)"), 2790 ("# unexpected CONNECT_ACK messages (not ready)"),
2791 1, GNUNET_NO); 2791 1, GNUNET_NO);
2792 break; 2792 break;
2793 case S_CONNECT_SENT: 2793 case S_CONNECT_SENT:
2794 if (ts.abs_value_us != n->primary_address.connect_timestamp.abs_value_us) 2794 if (ts.abs_value_us != n->primary_address.connect_timestamp.abs_value_us)
2795 break; /* ACK does not match our original CONNECT message */ 2795 break; /* ACK does not match our original CONNECT message */
2796 n->state = S_CONNECTED; 2796 n->state = S_CONNECTED;
2797 n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 2797 n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
2798 GNUNET_STATISTICS_set (GST_stats, 2798 GNUNET_STATISTICS_set (GST_stats,
2799 gettext_noop ("# peers connected"), 2799 gettext_noop ("# peers connected"),
2800 ++neighbours_connected, 2800 ++neighbours_connected,
2801 GNUNET_NO); 2801 GNUNET_NO);
2802 connect_notify_cb (callback_cls, &n->id, 2802 connect_notify_cb (callback_cls, &n->id,
@@ -2858,7 +2858,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
2858 GNUNET_YES); 2858 GNUNET_YES);
2859 free_address (&n->alternative_address); 2859 free_address (&n->alternative_address);
2860 send_session_ack_message (n); 2860 send_session_ack_message (n);
2861 break; 2861 break;
2862 case S_DISCONNECT: 2862 case S_DISCONNECT:
2863 GNUNET_STATISTICS_update (GST_stats, 2863 GNUNET_STATISTICS_update (GST_stats,
2864 gettext_noop 2864 gettext_noop
@@ -2871,7 +2871,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
2871 default: 2871 default:
2872 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state)); 2872 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state));
2873 GNUNET_break (0); 2873 GNUNET_break (0);
2874 break; 2874 break;
2875 } 2875 }
2876} 2876}
2877 2877
@@ -2945,7 +2945,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
2945 n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, &n->id); 2945 n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, &n->id);
2946 break; 2946 break;
2947 case S_CONNECT_RECV_BLACKLIST_INBOUND: 2947 case S_CONNECT_RECV_BLACKLIST_INBOUND:
2948 case S_CONNECT_RECV_ATS: 2948 case S_CONNECT_RECV_ATS:
2949 case S_CONNECT_RECV_BLACKLIST: 2949 case S_CONNECT_RECV_BLACKLIST:
2950 case S_CONNECT_RECV_ACK: 2950 case S_CONNECT_RECV_ACK:
2951 /* error on inbound session; free neighbour entirely */ 2951 /* error on inbound session; free neighbour entirely */
@@ -2972,7 +2972,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
2972 break; 2972 break;
2973 case S_CONNECTED_SWITCHING_BLACKLIST: 2973 case S_CONNECTED_SWITCHING_BLACKLIST:
2974 /* primary went down while we were checking secondary against 2974 /* primary went down while we were checking secondary against
2975 blacklist, adopt secondary as primary */ 2975 blacklist, adopt secondary as primary */
2976 free_address (&n->primary_address); 2976 free_address (&n->primary_address);
2977 n->primary_address = n->alternative_address; 2977 n->primary_address = n->alternative_address;
2978 memset (&n->alternative_address, 0, sizeof (struct NeighbourAddress)); 2978 memset (&n->alternative_address, 0, sizeof (struct NeighbourAddress));
@@ -2981,7 +2981,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
2981 break; 2981 break;
2982 case S_CONNECTED_SWITCHING_CONNECT_SENT: 2982 case S_CONNECTED_SWITCHING_CONNECT_SENT:
2983 /* primary went down while we were waiting for CONNECT_ACK on secondary; 2983 /* primary went down while we were waiting for CONNECT_ACK on secondary;
2984 secondary as primary */ 2984 secondary as primary */
2985 free_address (&n->primary_address); 2985 free_address (&n->primary_address);
2986 n->primary_address = n->alternative_address; 2986 n->primary_address = n->alternative_address;
2987 memset (&n->alternative_address, 0, sizeof (struct NeighbourAddress)); 2987 memset (&n->alternative_address, 0, sizeof (struct NeighbourAddress));
@@ -3026,7 +3026,7 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
3026{ 3026{
3027 struct NeighbourMapEntry *n; 3027 struct NeighbourMapEntry *n;
3028 3028
3029 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3029 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3030 "Received SESSION_ACK message from peer `%s'\n", 3030 "Received SESSION_ACK message from peer `%s'\n",
3031 GNUNET_i2s (peer)); 3031 GNUNET_i2s (peer));
3032 if (ntohs (message->size) != sizeof (struct GNUNET_MessageHeader)) 3032 if (ntohs (message->size) != sizeof (struct GNUNET_MessageHeader))
@@ -3049,8 +3049,8 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
3049 } 3049 }
3050 n->state = S_CONNECTED; 3050 n->state = S_CONNECTED;
3051 n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 3051 n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
3052 GNUNET_STATISTICS_set (GST_stats, 3052 GNUNET_STATISTICS_set (GST_stats,
3053 gettext_noop ("# peers connected"), 3053 gettext_noop ("# peers connected"),
3054 ++neighbours_connected, 3054 ++neighbours_connected,
3055 GNUNET_NO); 3055 GNUNET_NO);
3056 connect_notify_cb (callback_cls, &n->id, 3056 connect_notify_cb (callback_cls, &n->id,
@@ -3263,7 +3263,7 @@ GST_neighbours_iterate (GST_NeighbourIterator cb, void *cb_cls)
3263{ 3263{
3264 struct IteratorContext ic; 3264 struct IteratorContext ic;
3265 3265
3266 if (NULL == neighbours) 3266 if (NULL == neighbours)
3267 return; /* can happen during shutdown */ 3267 return; /* can happen during shutdown */
3268 ic.cb = cb; 3268 ic.cb = cb;
3269 ic.cb_cls = cb_cls; 3269 ic.cb_cls = cb_cls;
@@ -3296,7 +3296,7 @@ GST_neighbours_force_disconnect (const struct GNUNET_PeerIdentity *target)
3296 * Obtain current latency information for the given neighbour. 3296 * Obtain current latency information for the given neighbour.
3297 * 3297 *
3298 * @param peer to get the latency for 3298 * @param peer to get the latency for
3299 * @return observed latency of the address, FOREVER if the 3299 * @return observed latency of the address, FOREVER if the
3300 * the connection is not up 3300 * the connection is not up
3301 */ 3301 */
3302struct GNUNET_TIME_Relative 3302struct GNUNET_TIME_Relative
@@ -3305,7 +3305,7 @@ GST_neighbour_get_latency (const struct GNUNET_PeerIdentity *peer)
3305 struct NeighbourMapEntry *n; 3305 struct NeighbourMapEntry *n;
3306 3306
3307 n = lookup_neighbour (peer); 3307 n = lookup_neighbour (peer);
3308 if (NULL == n) 3308 if (NULL == n)
3309 return GNUNET_TIME_UNIT_FOREVER_REL; 3309 return GNUNET_TIME_UNIT_FOREVER_REL;
3310 switch (n->state) 3310 switch (n->state)
3311 { 3311 {
@@ -3332,7 +3332,7 @@ GST_neighbour_get_latency (const struct GNUNET_PeerIdentity *peer)
3332 GNUNET_break (0); 3332 GNUNET_break (0);
3333 break; 3333 break;
3334 } 3334 }
3335 return GNUNET_TIME_UNIT_FOREVER_REL; 3335 return GNUNET_TIME_UNIT_FOREVER_REL;
3336} 3336}
3337 3337
3338 3338
@@ -3388,13 +3388,13 @@ GST_neighbours_start (void *cls,
3388 * @return GNUNET_OK (continue to iterate) 3388 * @return GNUNET_OK (continue to iterate)
3389 */ 3389 */
3390static int 3390static int
3391disconnect_all_neighbours (void *cls, 3391disconnect_all_neighbours (void *cls,
3392 const struct GNUNET_PeerIdentity *key, 3392 const struct GNUNET_PeerIdentity *key,
3393 void *value) 3393 void *value)
3394{ 3394{
3395 struct NeighbourMapEntry *n = value; 3395 struct NeighbourMapEntry *n = value;
3396 3396
3397 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3397 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3398 "Disconnecting peer `%4s', %s\n", 3398 "Disconnecting peer `%4s', %s\n",
3399 GNUNET_i2s (&n->id), "SHUTDOWN_TASK"); 3399 GNUNET_i2s (&n->id), "SHUTDOWN_TASK");
3400 n->state = S_DISCONNECT_FINISHED; 3400 n->state = S_DISCONNECT_FINISHED;
@@ -3411,7 +3411,7 @@ GST_neighbours_stop ()
3411{ 3411{
3412 if (NULL == neighbours) 3412 if (NULL == neighbours)
3413 return; 3413 return;
3414 GNUNET_CONTAINER_multipeermap_iterate (neighbours, 3414 GNUNET_CONTAINER_multipeermap_iterate (neighbours,
3415 &disconnect_all_neighbours, 3415 &disconnect_all_neighbours,
3416 NULL); 3416 NULL);
3417 GNUNET_CONTAINER_multipeermap_destroy (neighbours); 3417 GNUNET_CONTAINER_multipeermap_destroy (neighbours);
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
index 54393d753..6018e2c7b 100644
--- a/src/transport/gnunet-service-transport_validation.c
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -811,7 +811,7 @@ GST_validation_start (unsigned int max_fds)
811 validations_fast_start_threshold = (max_fds / 2); 811 validations_fast_start_threshold = (max_fds / 2);
812 validations_running = 0; 812 validations_running = 0;
813 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Validation uses a fast start threshold of %u connections and a delay between of %s\n ", 813 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Validation uses a fast start threshold of %u connections and a delay between of %s\n ",
814 validations_fast_start_threshold, 814 validations_fast_start_threshold,
815 GNUNET_STRINGS_relative_time_to_string (validation_delay, 815 GNUNET_STRINGS_relative_time_to_string (validation_delay,
816 GNUNET_YES)); 816 GNUNET_YES));
817 validation_map = GNUNET_CONTAINER_multipeermap_create (VALIDATION_MAP_SIZE, 817 validation_map = GNUNET_CONTAINER_multipeermap_create (VALIDATION_MAP_SIZE,
@@ -855,7 +855,7 @@ GST_validation_stop ()
855 */ 855 */
856static void 856static void
857multicast_pong (void *cls, 857multicast_pong (void *cls,
858 const struct GNUNET_CRYPTO_EccPublicSignKey *public_key, 858 const struct GNUNET_CRYPTO_EccPublicSignKey *public_key,
859 struct GNUNET_TIME_Absolute valid_until, 859 struct GNUNET_TIME_Absolute valid_until,
860 struct GNUNET_TIME_Absolute validation_block, 860 struct GNUNET_TIME_Absolute validation_block,
861 const struct GNUNET_HELLO_Address *address) 861 const struct GNUNET_HELLO_Address *address)
@@ -1075,7 +1075,7 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
1075 pong->expiration = GNUNET_TIME_absolute_hton (*sig_cache_exp); 1075 pong->expiration = GNUNET_TIME_absolute_hton (*sig_cache_exp);
1076 } 1076 }
1077 pong->signature = *sig_cache; 1077 pong->signature = *sig_cache;
1078 1078
1079 GNUNET_assert (sender_address != NULL); 1079 GNUNET_assert (sender_address != NULL);
1080 1080
1081 /* first see if the session we got this PING from can be used to transmit 1081 /* first see if the session we got this PING from can be used to transmit
diff --git a/src/transport/gnunet-transport-certificate-creation.c b/src/transport/gnunet-transport-certificate-creation.c
index b26d2e06d..ff9a331f1 100644
--- a/src/transport/gnunet-transport-certificate-creation.c
+++ b/src/transport/gnunet-transport-certificate-creation.c
@@ -28,7 +28,7 @@
28 28
29 29
30static void 30static void
31removecerts (const char *file1, 31removecerts (const char *file1,
32 const char *file2) 32 const char *file2)
33{ 33{
34 if (GNUNET_YES == GNUNET_DISK_file_test (file1)) 34 if (GNUNET_YES == GNUNET_DISK_file_test (file1))
@@ -55,7 +55,7 @@ main (int argc, char **argv)
55 55
56 if (3 != argc) 56 if (3 != argc)
57 { 57 {
58 fprintf (stderr, 58 fprintf (stderr,
59 "Invalid arguments.\n"); 59 "Invalid arguments.\n");
60 return 1; 60 return 1;
61 } 61 }
@@ -68,7 +68,7 @@ main (int argc, char **argv)
68 "-out", argv[1], "1024", NULL); 68 "-out", argv[1], "1024", NULL);
69 if (NULL == openssl) 69 if (NULL == openssl)
70 { 70 {
71 fprintf (stderr, 71 fprintf (stderr,
72 "Failed to run openssl. Is openssl installed?\n"); 72 "Failed to run openssl. Is openssl installed?\n");
73 return 2; 73 return 2;
74 } 74 }
@@ -83,7 +83,7 @@ main (int argc, char **argv)
83 "-new", "-x509", "-key", argv[1], NULL); 83 "-new", "-x509", "-key", argv[1], NULL);
84 if (NULL == openssl) 84 if (NULL == openssl)
85 { 85 {
86 fprintf (stderr, 86 fprintf (stderr,
87 "Failed to create self-signed certificate with openssl.\n"); 87 "Failed to create self-signed certificate with openssl.\n");
88 return 3; 88 return 3;
89 } 89 }
diff --git a/src/transport/gnunet-transport-wlan-receiver.c b/src/transport/gnunet-transport-wlan-receiver.c
index ccc1d291f..b38285123 100644
--- a/src/transport/gnunet-transport-wlan-receiver.c
+++ b/src/transport/gnunet-transport-wlan-receiver.c
@@ -53,7 +53,7 @@ main (int argc, char *argv[])
53 /* Setup communication pipeline first */ 53 /* Setup communication pipeline first */
54 if (pipe (commpipe)) 54 if (pipe (commpipe))
55 { 55 {
56 fprintf (stderr, 56 fprintf (stderr,
57 "Failed to create pipe: %s\n", 57 "Failed to create pipe: %s\n",
58 STRERROR (errno)); 58 STRERROR (errno));
59 exit (1); 59 exit (1);
@@ -62,8 +62,8 @@ main (int argc, char *argv[])
62 /* Attempt to fork and check for errors */ 62 /* Attempt to fork and check for errors */
63 if ((pid = fork ()) == -1) 63 if ((pid = fork ()) == -1)
64 { 64 {
65 fprintf (stderr, "Failed to fork: %s\n", 65 fprintf (stderr, "Failed to fork: %s\n",
66 STRERROR (errno)); 66 STRERROR (errno));
67 exit (1); 67 exit (1);
68 } 68 }
69 69
@@ -90,7 +90,7 @@ main (int argc, char *argv[])
90 { 90 {
91 bytes_per_s = count / (akt - start); 91 bytes_per_s = count / (akt - start);
92 bytes_per_s /= 1024; 92 bytes_per_s /= 1024;
93 printf ("recv %f kb/s\n", bytes_per_s); 93 printf ("recv %f kb/s\n", bytes_per_s);
94 start = akt; 94 start = akt;
95 count = 0; 95 count = 0;
96 } 96 }
diff --git a/src/transport/gnunet-transport-wlan-sender.c b/src/transport/gnunet-transport-wlan-sender.c
index 0ab6c9fd1..12989dd55 100644
--- a/src/transport/gnunet-transport-wlan-sender.c
+++ b/src/transport/gnunet-transport-wlan-sender.c
@@ -74,7 +74,7 @@ getRadiotapHeader (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *header,
74 * @return GNUNET_YES if there was no error 74 * @return GNUNET_YES if there was no error
75 */ 75 */
76static int 76static int
77getWlanHeader (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *Header, 77getWlanHeader (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *Header,
78 const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr, 78 const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr,
79 const struct GNUNET_TRANSPORT_WLAN_MacAddress *mac, unsigned int size) 79 const struct GNUNET_TRANSPORT_WLAN_MacAddress *mac, unsigned int size)
80{ 80{
@@ -148,14 +148,14 @@ main (int argc, char *argv[])
148 /* Setup communication pipeline first */ 148 /* Setup communication pipeline first */
149 if (pipe (commpipe)) 149 if (pipe (commpipe))
150 { 150 {
151 fprintf (stderr, 151 fprintf (stderr,
152 "Failed to create pipe: %s\n", 152 "Failed to create pipe: %s\n",
153 STRERROR (errno)); 153 STRERROR (errno));
154 exit (1); 154 exit (1);
155 } 155 }
156 if (pipe (macpipe)) 156 if (pipe (macpipe))
157 { 157 {
158 fprintf (stderr, 158 fprintf (stderr,
159 "Failed to create pipe: %s\n", 159 "Failed to create pipe: %s\n",
160 STRERROR (errno)); 160 STRERROR (errno));
161 exit (1); 161 exit (1);
@@ -164,8 +164,8 @@ main (int argc, char *argv[])
164 /* Attempt to fork and check for errors */ 164 /* Attempt to fork and check for errors */
165 if ((pid = fork ()) == -1) 165 if ((pid = fork ()) == -1)
166 { 166 {
167 fprintf (stderr, "Failed to fork: %s\n", 167 fprintf (stderr, "Failed to fork: %s\n",
168 STRERROR (errno)); 168 STRERROR (errno));
169 exit (1); 169 exit (1);
170 } 170 }
171 memset (msg_buf, 0x42, sizeof (msg_buf)); 171 memset (msg_buf, 0x42, sizeof (msg_buf));
@@ -183,12 +183,12 @@ main (int argc, char *argv[])
183 "Failed to close fd: %s\n", 183 "Failed to close fd: %s\n",
184 strerror (errno)); 184 strerror (errno));
185 if (sizeof (hcm) != read (macpipe[0], &hcm, sizeof (hcm))) 185 if (sizeof (hcm) != read (macpipe[0], &hcm, sizeof (hcm)))
186 fprintf (stderr, 186 fprintf (stderr,
187 "Failed to read hcm...\n"); 187 "Failed to read hcm...\n");
188 fprintf (stderr, 188 fprintf (stderr,
189 "Got MAC %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\n", 189 "Got MAC %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\n",
190 hcm.mac.mac[0], hcm.mac.mac[1], 190 hcm.mac.mac[0], hcm.mac.mac[1],
191 hcm.mac.mac[2], hcm.mac.mac[3], hcm.mac.mac[4], hcm.mac.mac[5]); 191 hcm.mac.mac[2], hcm.mac.mac[3], hcm.mac.mac[4], hcm.mac.mac[5]);
192 radiotap = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) msg_buf; 192 radiotap = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) msg_buf;
193 getRadiotapHeader (radiotap, WLAN_MTU); 193 getRadiotapHeader (radiotap, WLAN_MTU);
194 getWlanHeader (&radiotap->frame, &outmac, &inmac, 194 getWlanHeader (&radiotap->frame, &outmac, &inmac,
@@ -212,7 +212,7 @@ main (int argc, char *argv[])
212 printf ("send %f kbytes/s\n", bytes_per_s); 212 printf ("send %f kbytes/s\n", bytes_per_s);
213 start = akt; 213 start = akt;
214 count = 0; 214 count = 0;
215 } 215 }
216 } 216 }
217 } 217 }
218 else 218 else
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index 4fc1622b3..cbda8ac6e 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -518,8 +518,8 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
518 if (try_connect) 518 if (try_connect)
519 { 519 {
520 /* all done, terminate instantly */ 520 /* all done, terminate instantly */
521 FPRINTF (stdout, 521 FPRINTF (stdout,
522 _("Successfully connected to `%s'\n"), 522 _("Successfully connected to `%s'\n"),
523 GNUNET_i2s_full (peer)); 523 GNUNET_i2s_full (peer));
524 ret = 0; 524 ret = 0;
525 525
@@ -803,12 +803,12 @@ testservice_task (void *cls,
803 803
804 if (GNUNET_YES != result) 804 if (GNUNET_YES != result)
805 { 805 {
806 FPRINTF (stderr, 806 FPRINTF (stderr,
807 _("Service `%s' is not running\n"), "transport"); 807 _("Service `%s' is not running\n"), "transport");
808 return; 808 return;
809 } 809 }
810 810
811 if ( (NULL != cpid) && 811 if ( (NULL != cpid) &&
812 (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (cpid, 812 (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (cpid,
813 strlen (cpid), 813 strlen (cpid),
814 &pid.public_key))) 814 &pid.public_key)))
diff --git a/src/transport/plugin_transport_bluetooth.c b/src/transport/plugin_transport_bluetooth.c
index a6b73c494..5ea439310 100644
--- a/src/transport/plugin_transport_bluetooth.c
+++ b/src/transport/plugin_transport_bluetooth.c
@@ -81,7 +81,7 @@ GNUNET_NETWORK_STRUCT_BEGIN
81/** 81/**
82 * Header for messages which need fragmentation. This is the format of 82 * Header for messages which need fragmentation. This is the format of
83 * a message we obtain AFTER defragmentation. We then need to check 83 * a message we obtain AFTER defragmentation. We then need to check
84 * the CRC and then tokenize the payload and pass it to the 84 * the CRC and then tokenize the payload and pass it to the
85 * 'receive' callback. 85 * 'receive' callback.
86 */ 86 */
87struct WlanHeader 87struct WlanHeader
@@ -397,7 +397,7 @@ struct Plugin
397 397
398 /** 398 /**
399 * Handle to helper process for priviledged operations. 399 * Handle to helper process for priviledged operations.
400 */ 400 */
401 struct GNUNET_HELPER_Handle *suid_helper; 401 struct GNUNET_HELPER_Handle *suid_helper;
402 402
403 /** 403 /**
@@ -559,7 +559,7 @@ get_radiotap_header (struct MacEndpoint *endpoint,
559static void 559static void
560get_wlan_header (struct Plugin *plugin, 560get_wlan_header (struct Plugin *plugin,
561 struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *header, 561 struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *header,
562 const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr, 562 const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr,
563 unsigned int size) 563 unsigned int size)
564{ 564{
565 const int rate = 11000000; 565 const int rate = 11000000;
@@ -599,12 +599,12 @@ send_ack (void *cls, uint32_t msg_id,
599 GNUNET_break (0); 599 GNUNET_break (0);
600 return; 600 return;
601 } 601 }
602 LOG (GNUNET_ERROR_TYPE_DEBUG, 602 LOG (GNUNET_ERROR_TYPE_DEBUG,
603 "Sending ACK to helper\n"); 603 "Sending ACK to helper\n");
604 radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf; 604 radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf;
605 get_radiotap_header (endpoint, radio_header, size); 605 get_radiotap_header (endpoint, radio_header, size);
606 get_wlan_header (endpoint->plugin, 606 get_wlan_header (endpoint->plugin,
607 &radio_header->frame, 607 &radio_header->frame,
608 &endpoint->addr.mac, 608 &endpoint->addr.mac,
609 size); 609 size);
610 memcpy (&radio_header[1], hdr, msize); 610 memcpy (&radio_header[1], hdr, msize);
@@ -612,7 +612,7 @@ send_ack (void *cls, uint32_t msg_id,
612 GNUNET_HELPER_send (endpoint->plugin->suid_helper, 612 GNUNET_HELPER_send (endpoint->plugin->suid_helper,
613 &radio_header->header, 613 &radio_header->header,
614 GNUNET_NO /* dropping ACKs is bad */, 614 GNUNET_NO /* dropping ACKs is bad */,
615 NULL, NULL)) 615 NULL, NULL))
616 GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# Bluetooth ACKs sent"), 616 GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# Bluetooth ACKs sent"),
617 1, GNUNET_NO); 617 1, GNUNET_NO);
618} 618}
@@ -636,7 +636,7 @@ bluetooth_data_message_handler (void *cls, const struct GNUNET_MessageHeader *hd
636 GNUNET_NO); 636 GNUNET_NO);
637 mas.session = NULL; 637 mas.session = NULL;
638 mas.endpoint = endpoint; 638 mas.endpoint = endpoint;
639 (void) GNUNET_SERVER_mst_receive (plugin->fragment_data_tokenizer, 639 (void) GNUNET_SERVER_mst_receive (plugin->fragment_data_tokenizer,
640 &mas, 640 &mas,
641 (const char *) hdr, 641 (const char *) hdr,
642 ntohs (hdr->size), 642 ntohs (hdr->size),
@@ -654,7 +654,7 @@ free_session (struct Session *session)
654{ 654{
655 struct MacEndpoint *endpoint = session->mac; 655 struct MacEndpoint *endpoint = session->mac;
656 struct PendingMessage *pm; 656 struct PendingMessage *pm;
657 657
658 endpoint->plugin->env->session_end (endpoint->plugin->env->cls, 658 endpoint->plugin->env->session_end (endpoint->plugin->env->cls,
659 &session->target, 659 &session->target,
660 session); 660 session);
@@ -670,7 +670,7 @@ free_session (struct Session *session)
670 GNUNET_free (pm->msg); 670 GNUNET_free (pm->msg);
671 GNUNET_free (pm); 671 GNUNET_free (pm);
672 } 672 }
673 GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head, 673 GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head,
674 endpoint->sessions_tail, 674 endpoint->sessions_tail,
675 session); 675 session);
676 if (session->timeout_task != GNUNET_SCHEDULER_NO_TASK) 676 if (session->timeout_task != GNUNET_SCHEDULER_NO_TASK)
@@ -698,7 +698,7 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
698 698
699 session->timeout_task = GNUNET_SCHEDULER_NO_TASK; 699 session->timeout_task = GNUNET_SCHEDULER_NO_TASK;
700 timeout = GNUNET_TIME_absolute_get_remaining (session->timeout); 700 timeout = GNUNET_TIME_absolute_get_remaining (session->timeout);
701 if (0 == timeout.rel_value_us) 701 if (0 == timeout.rel_value_us)
702 { 702 {
703 free_session (session); 703 free_session (session);
704 return; 704 return;
@@ -739,7 +739,7 @@ create_session (struct MacEndpoint *endpoint,
739 session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 739 session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
740 session->timeout_task = 740 session->timeout_task =
741 GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, &session_timeout, session); 741 GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, &session_timeout, session);
742 LOG (GNUNET_ERROR_TYPE_DEBUG, 742 LOG (GNUNET_ERROR_TYPE_DEBUG,
743 "Created new session for peer `%s' with endpoint %s\n", 743 "Created new session for peer `%s' with endpoint %s\n",
744 GNUNET_i2s (peer), 744 GNUNET_i2s (peer),
745 mac_to_string (&endpoint->addr.mac)); 745 mac_to_string (&endpoint->addr.mac));
@@ -752,7 +752,7 @@ create_session (struct MacEndpoint *endpoint,
752 * message to the SUID helper process and we are thus ready for 752 * message to the SUID helper process and we are thus ready for
753 * the next fragment. 753 * the next fragment.
754 * 754 *
755 * @param cls the 'struct FragmentMessage' 755 * @param cls the 'struct FragmentMessage'
756 * @param result result of the operation (GNUNET_OK on success, GNUNET_NO if the helper died, GNUNET_SYSERR 756 * @param result result of the operation (GNUNET_OK on success, GNUNET_NO if the helper died, GNUNET_SYSERR
757 * if the helper was stopped) 757 * if the helper was stopped)
758 */ 758 */
@@ -772,7 +772,7 @@ fragment_transmission_done (void *cls,
772 * Transmit a fragment of a message. 772 * Transmit a fragment of a message.
773 * 773 *
774 * @param cls 'struct FragmentMessage' this fragment message belongs to 774 * @param cls 'struct FragmentMessage' this fragment message belongs to
775 * @param hdr pointer to the start of the fragment message 775 * @param hdr pointer to the start of the fragment message
776 */ 776 */
777static void 777static void
778transmit_fragment (void *cls, 778transmit_fragment (void *cls,
@@ -792,7 +792,7 @@ transmit_fragment (void *cls,
792 radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf; 792 radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf;
793 get_radiotap_header (endpoint, radio_header, size); 793 get_radiotap_header (endpoint, radio_header, size);
794 get_wlan_header (endpoint->plugin, 794 get_wlan_header (endpoint->plugin,
795 &radio_header->frame, 795 &radio_header->frame,
796 &endpoint->addr.mac, 796 &endpoint->addr.mac,
797 size); 797 size);
798 memcpy (&radio_header[1], hdr, msize); 798 memcpy (&radio_header[1], hdr, msize);
@@ -827,7 +827,7 @@ free_fragment_message (struct FragmentMessage *fm)
827{ 827{
828 struct MacEndpoint *endpoint = fm->macendpoint; 828 struct MacEndpoint *endpoint = fm->macendpoint;
829 829
830 GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# Bluetooth messages pending (with fragmentation)"), 830 GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# Bluetooth messages pending (with fragmentation)"),
831 -1, GNUNET_NO); 831 -1, GNUNET_NO);
832 GNUNET_CONTAINER_DLL_remove (endpoint->sending_messages_head, 832 GNUNET_CONTAINER_DLL_remove (endpoint->sending_messages_head,
833 endpoint->sending_messages_tail, fm); 833 endpoint->sending_messages_tail, fm);
@@ -887,7 +887,7 @@ fragmentmessage_timeout (void *cls,
887static void 887static void
888send_with_fragmentation (struct MacEndpoint *endpoint, 888send_with_fragmentation (struct MacEndpoint *endpoint,
889 struct GNUNET_TIME_Relative timeout, 889 struct GNUNET_TIME_Relative timeout,
890 const struct GNUNET_PeerIdentity *target, 890 const struct GNUNET_PeerIdentity *target,
891 const struct GNUNET_MessageHeader *msg, 891 const struct GNUNET_MessageHeader *msg,
892 size_t payload_size, 892 size_t payload_size,
893 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) 893 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
@@ -914,7 +914,7 @@ send_with_fragmentation (struct MacEndpoint *endpoint,
914 msg, 914 msg,
915 &transmit_fragment, fm); 915 &transmit_fragment, fm);
916 fm->timeout_task = 916 fm->timeout_task =
917 GNUNET_SCHEDULER_add_delayed (timeout, 917 GNUNET_SCHEDULER_add_delayed (timeout,
918 &fragmentmessage_timeout, fm); 918 &fragmentmessage_timeout, fm);
919 GNUNET_CONTAINER_DLL_insert_tail (endpoint->sending_messages_head, 919 GNUNET_CONTAINER_DLL_insert_tail (endpoint->sending_messages_head,
920 endpoint->sending_messages_tail, 920 endpoint->sending_messages_tail,
@@ -924,7 +924,7 @@ send_with_fragmentation (struct MacEndpoint *endpoint,
924 924
925/** 925/**
926 * Free a MAC endpoint. 926 * Free a MAC endpoint.
927 * 927 *
928 * @param endpoint pointer to the MacEndpoint to free 928 * @param endpoint pointer to the MacEndpoint to free
929 */ 929 */
930static void 930static void
@@ -940,8 +940,8 @@ free_macendpoint (struct MacEndpoint *endpoint)
940 free_session (session); 940 free_session (session);
941 while (NULL != (fm = endpoint->sending_messages_head)) 941 while (NULL != (fm = endpoint->sending_messages_head))
942 free_fragment_message (fm); 942 free_fragment_message (fm);
943 GNUNET_CONTAINER_DLL_remove (plugin->mac_head, 943 GNUNET_CONTAINER_DLL_remove (plugin->mac_head,
944 plugin->mac_tail, 944 plugin->mac_tail,
945 endpoint); 945 endpoint);
946 946
947 if (NULL != endpoint->defrag) 947 if (NULL != endpoint->defrag)
@@ -974,7 +974,7 @@ macendpoint_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
974 974
975 endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK; 975 endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK;
976 timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout); 976 timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout);
977 if (0 == timeout.rel_value_us) 977 if (0 == timeout.rel_value_us)
978 { 978 {
979 free_macendpoint (endpoint); 979 free_macendpoint (endpoint);
980 return; 980 return;
@@ -1000,14 +1000,14 @@ create_macendpoint (struct Plugin *plugin,
1000 1000
1001 for (pos = plugin->mac_head; NULL != pos; pos = pos->next) 1001 for (pos = plugin->mac_head; NULL != pos; pos = pos->next)
1002 if (0 == memcmp (addr, &pos->addr, sizeof (struct WlanAddress))) 1002 if (0 == memcmp (addr, &pos->addr, sizeof (struct WlanAddress)))
1003 return pos; 1003 return pos;
1004 pos = GNUNET_malloc (sizeof (struct MacEndpoint)); 1004 pos = GNUNET_malloc (sizeof (struct MacEndpoint));
1005 pos->addr = *addr; 1005 pos->addr = *addr;
1006 pos->plugin = plugin; 1006 pos->plugin = plugin;
1007 pos->defrag = 1007 pos->defrag =
1008 GNUNET_DEFRAGMENT_context_create (plugin->env->stats, WLAN_MTU, 1008 GNUNET_DEFRAGMENT_context_create (plugin->env->stats, WLAN_MTU,
1009 MESSAGES_IN_DEFRAG_QUEUE_PER_MAC, 1009 MESSAGES_IN_DEFRAG_QUEUE_PER_MAC,
1010 pos, 1010 pos,
1011 &bluetooth_data_message_handler, 1011 &bluetooth_data_message_handler,
1012 &send_ack); 1012 &send_ack);
1013 1013
@@ -1022,7 +1022,7 @@ create_macendpoint (struct Plugin *plugin,
1022 plugin->mac_count++; 1022 plugin->mac_count++;
1023 GNUNET_STATISTICS_update (plugin->env->stats, _("# Bluetooth MAC endpoints allocated"), 1023 GNUNET_STATISTICS_update (plugin->env->stats, _("# Bluetooth MAC endpoints allocated"),
1024 1, GNUNET_NO); 1024 1, GNUNET_NO);
1025 LOG (GNUNET_ERROR_TYPE_DEBUG, 1025 LOG (GNUNET_ERROR_TYPE_DEBUG,
1026 "New MAC endpoint `%s'\n", 1026 "New MAC endpoint `%s'\n",
1027 bluetooth_plugin_address_to_string(NULL, addr, sizeof (struct WlanAddress))); 1027 bluetooth_plugin_address_to_string(NULL, addr, sizeof (struct WlanAddress)));
1028 return pos; 1028 return pos;
@@ -1142,7 +1142,7 @@ bluetooth_plugin_send (void *cls,
1142 size_t size = msgbuf_size + sizeof (struct WlanHeader); 1142 size_t size = msgbuf_size + sizeof (struct WlanHeader);
1143 char buf[size] GNUNET_ALIGN; 1143 char buf[size] GNUNET_ALIGN;
1144 1144
1145 LOG (GNUNET_ERROR_TYPE_DEBUG, 1145 LOG (GNUNET_ERROR_TYPE_DEBUG,
1146 "Transmitting %u bytes of payload to peer `%s' (starting with %u byte message of type %u)\n", 1146 "Transmitting %u bytes of payload to peer `%s' (starting with %u byte message of type %u)\n",
1147 msgbuf_size, 1147 msgbuf_size,
1148 GNUNET_i2s (&session->target), 1148 GNUNET_i2s (&session->target),
@@ -1202,7 +1202,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1202 switch (ntohs (hdr->type)) 1202 switch (ntohs (hdr->type))
1203 { 1203 {
1204 case GNUNET_MESSAGE_TYPE_HELLO: 1204 case GNUNET_MESSAGE_TYPE_HELLO:
1205 if (GNUNET_OK != 1205 if (GNUNET_OK !=
1206 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) hdr, &tmpsource)) 1206 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) hdr, &tmpsource))
1207 { 1207 {
1208 GNUNET_break_op (0); 1208 GNUNET_break_op (0);
@@ -1217,9 +1217,9 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1217 GNUNET_STATISTICS_update (plugin->env->stats, 1217 GNUNET_STATISTICS_update (plugin->env->stats,
1218 _("# HELLO messages received via Bluetooth"), 1, 1218 _("# HELLO messages received via Bluetooth"), 1,
1219 GNUNET_NO); 1219 GNUNET_NO);
1220 plugin->env->receive (plugin->env->cls, 1220 plugin->env->receive (plugin->env->cls,
1221 &tmpsource, 1221 &tmpsource,
1222 hdr, 1222 hdr,
1223 mas->session, 1223 mas->session,
1224 (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr, 1224 (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr,
1225 (mas->endpoint == NULL) ? 0 : sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); 1225 (mas->endpoint == NULL) ? 0 : sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
@@ -1236,7 +1236,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1236 GNUNET_break (0); 1236 GNUNET_break (0);
1237 break; 1237 break;
1238 } 1238 }
1239 LOG (GNUNET_ERROR_TYPE_DEBUG, 1239 LOG (GNUNET_ERROR_TYPE_DEBUG,
1240 "Processing %u bytes of FRAGMENT from MAC %s\n", 1240 "Processing %u bytes of FRAGMENT from MAC %s\n",
1241 (unsigned int) msize, 1241 (unsigned int) msize,
1242 bluetooth_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress))); 1242 bluetooth_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress)));
@@ -1258,7 +1258,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1258 ret = GNUNET_FRAGMENT_process_ack (fm->fragcontext, hdr); 1258 ret = GNUNET_FRAGMENT_process_ack (fm->fragcontext, hdr);
1259 if (GNUNET_OK == ret) 1259 if (GNUNET_OK == ret)
1260 { 1260 {
1261 LOG (GNUNET_ERROR_TYPE_DEBUG, 1261 LOG (GNUNET_ERROR_TYPE_DEBUG,
1262 "Got last ACK, finished message transmission to `%s' (%p)\n", 1262 "Got last ACK, finished message transmission to `%s' (%p)\n",
1263 bluetooth_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress)), 1263 bluetooth_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress)),
1264 fm); 1264 fm);
@@ -1273,13 +1273,13 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1273 } 1273 }
1274 if (GNUNET_NO == ret) 1274 if (GNUNET_NO == ret)
1275 { 1275 {
1276 LOG (GNUNET_ERROR_TYPE_DEBUG, 1276 LOG (GNUNET_ERROR_TYPE_DEBUG,
1277 "Got an ACK, message transmission to `%s' not yet finished\n", 1277 "Got an ACK, message transmission to `%s' not yet finished\n",
1278 bluetooth_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress))); 1278 bluetooth_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress)));
1279 break; 1279 break;
1280 } 1280 }
1281 } 1281 }
1282 LOG (GNUNET_ERROR_TYPE_DEBUG, 1282 LOG (GNUNET_ERROR_TYPE_DEBUG,
1283 "ACK not matched against any active fragmentation with MAC `%s'\n", 1283 "ACK not matched against any active fragmentation with MAC `%s'\n",
1284 bluetooth_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress))); 1284 bluetooth_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress)));
1285 break; 1285 break;
@@ -1293,13 +1293,13 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1293 { 1293 {
1294 GNUNET_break (0); 1294 GNUNET_break (0);
1295 break; 1295 break;
1296 } 1296 }
1297 wlanheader = (const struct WlanHeader *) hdr; 1297 wlanheader = (const struct WlanHeader *) hdr;
1298 if (0 != memcmp (&wlanheader->target, 1298 if (0 != memcmp (&wlanheader->target,
1299 plugin->env->my_identity, 1299 plugin->env->my_identity,
1300 sizeof (struct GNUNET_PeerIdentity))) 1300 sizeof (struct GNUNET_PeerIdentity)))
1301 { 1301 {
1302 LOG (GNUNET_ERROR_TYPE_DEBUG, 1302 LOG (GNUNET_ERROR_TYPE_DEBUG,
1303 "Bluetooth data for `%s', not for me, ignoring\n", 1303 "Bluetooth data for `%s', not for me, ignoring\n",
1304 GNUNET_i2s (&wlanheader->target)); 1304 GNUNET_i2s (&wlanheader->target));
1305 break; 1305 break;
@@ -1314,15 +1314,15 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1314 } 1314 }
1315 xmas.endpoint = mas->endpoint; 1315 xmas.endpoint = mas->endpoint;
1316 xmas.session = create_session (mas->endpoint, &wlanheader->sender); 1316 xmas.session = create_session (mas->endpoint, &wlanheader->sender);
1317 LOG (GNUNET_ERROR_TYPE_DEBUG, 1317 LOG (GNUNET_ERROR_TYPE_DEBUG,
1318 "Processing %u bytes of BLUETOOTH DATA from peer `%s'\n", 1318 "Processing %u bytes of BLUETOOTH DATA from peer `%s'\n",
1319 (unsigned int) msize, 1319 (unsigned int) msize,
1320 GNUNET_i2s (&wlanheader->sender)); 1320 GNUNET_i2s (&wlanheader->sender));
1321 (void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer, 1321 (void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer,
1322 &xmas, 1322 &xmas,
1323 (const char *) &wlanheader[1], 1323 (const char *) &wlanheader[1],
1324 msize - sizeof (struct WlanHeader), 1324 msize - sizeof (struct WlanHeader),
1325 GNUNET_YES, GNUNET_NO); 1325 GNUNET_YES, GNUNET_NO);
1326 break; 1326 break;
1327 default: 1327 default:
1328 if (NULL == mas->endpoint) 1328 if (NULL == mas->endpoint)
@@ -1340,9 +1340,9 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1340 (unsigned int) msize, 1340 (unsigned int) msize,
1341 (unsigned int) ntohs (hdr->type), 1341 (unsigned int) ntohs (hdr->type),
1342 GNUNET_i2s (&mas->session->target)); 1342 GNUNET_i2s (&mas->session->target));
1343 plugin->env->receive (plugin->env->cls, 1343 plugin->env->receive (plugin->env->cls,
1344 &mas->session->target, 1344 &mas->session->target,
1345 hdr, 1345 hdr,
1346 mas->session, 1346 mas->session,
1347 (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr, 1347 (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr,
1348 (mas->endpoint == NULL) ? 0 : sizeof (struct WlanAddress)); 1348 (mas->endpoint == NULL) ? 0 : sizeof (struct WlanAddress));
@@ -1416,7 +1416,7 @@ handle_helper_message (void *cls, void *client,
1416 "bluetooth"); 1416 "bluetooth");
1417 break; 1417 break;
1418 case GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER: 1418 case GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER:
1419 LOG (GNUNET_ERROR_TYPE_DEBUG, 1419 LOG (GNUNET_ERROR_TYPE_DEBUG,
1420 "Got data message from helper with %u bytes\n", 1420 "Got data message from helper with %u bytes\n",
1421 msize); 1421 msize);
1422 GNUNET_STATISTICS_update (plugin->env->stats, 1422 GNUNET_STATISTICS_update (plugin->env->stats,
@@ -1453,7 +1453,7 @@ handle_helper_message (void *cls, void *client,
1453 /* packet is FROM us, thus not FOR us */ 1453 /* packet is FROM us, thus not FOR us */
1454 break; 1454 break;
1455 } 1455 }
1456 1456
1457 GNUNET_STATISTICS_update (plugin->env->stats, 1457 GNUNET_STATISTICS_update (plugin->env->stats,
1458 _("# Bluetooth DATA messages processed"), 1458 _("# Bluetooth DATA messages processed"),
1459 1, GNUNET_NO); 1459 1, GNUNET_NO);
@@ -1465,7 +1465,7 @@ handle_helper_message (void *cls, void *client,
1465 wa.options = htonl (0); 1465 wa.options = htonl (0);
1466 mas.endpoint = create_macendpoint (plugin, &wa); 1466 mas.endpoint = create_macendpoint (plugin, &wa);
1467 mas.session = NULL; 1467 mas.session = NULL;
1468 (void) GNUNET_SERVER_mst_receive (plugin->helper_payload_tokenizer, 1468 (void) GNUNET_SERVER_mst_receive (plugin->helper_payload_tokenizer,
1469 &mas, 1469 &mas,
1470 (const char*) &rxinfo[1], 1470 (const char*) &rxinfo[1],
1471 msize - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage), 1471 msize - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage),
@@ -1473,7 +1473,7 @@ handle_helper_message (void *cls, void *client,
1473 break; 1473 break;
1474 default: 1474 default:
1475 GNUNET_break (0); 1475 GNUNET_break (0);
1476 LOG (GNUNET_ERROR_TYPE_DEBUG, 1476 LOG (GNUNET_ERROR_TYPE_DEBUG,
1477 "Unexpected message of type %u (%u bytes)", 1477 "Unexpected message of type %u (%u bytes)",
1478 ntohs (hdr->type), ntohs (hdr->size)); 1478 ntohs (hdr->type), ntohs (hdr->size));
1479 break; 1479 break;
@@ -1506,7 +1506,7 @@ send_hello_beacon (void *cls,
1506 { 1506 {
1507 char buf[size] GNUNET_ALIGN; 1507 char buf[size] GNUNET_ALIGN;
1508 1508
1509 LOG (GNUNET_ERROR_TYPE_DEBUG, 1509 LOG (GNUNET_ERROR_TYPE_DEBUG,
1510 "Sending %u byte HELLO beacon\n", 1510 "Sending %u byte HELLO beacon\n",
1511 (unsigned int) size); 1511 (unsigned int) size);
1512 radioHeader = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage*) buf; 1512 radioHeader = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage*) buf;
@@ -1550,13 +1550,13 @@ bluetooth_plugin_address_suggested (void *cls, const void *addr, size_t addrlen)
1550 struct WlanAddress *wa = (struct WlanAddress *) addr; 1550 struct WlanAddress *wa = (struct WlanAddress *) addr;
1551 1551
1552 if (addrlen != sizeof (struct WlanAddress)) 1552 if (addrlen != sizeof (struct WlanAddress))
1553 { 1553 {
1554 GNUNET_break_op (0); 1554 GNUNET_break_op (0);
1555 return GNUNET_SYSERR; 1555 return GNUNET_SYSERR;
1556 } 1556 }
1557 if (GNUNET_YES != plugin->have_mac) 1557 if (GNUNET_YES != plugin->have_mac)
1558 { 1558 {
1559 LOG (GNUNET_ERROR_TYPE_DEBUG, 1559 LOG (GNUNET_ERROR_TYPE_DEBUG,
1560 "Rejecting MAC `%s': I don't know my MAC!\n", 1560 "Rejecting MAC `%s': I don't know my MAC!\n",
1561 mac_to_string (addr)); 1561 mac_to_string (addr));
1562 return GNUNET_NO; /* don't know my MAC */ 1562 return GNUNET_NO; /* don't know my MAC */
@@ -1565,7 +1565,7 @@ bluetooth_plugin_address_suggested (void *cls, const void *addr, size_t addrlen)
1565 &plugin->mac_address, 1565 &plugin->mac_address,
1566 sizeof (wa->mac))) 1566 sizeof (wa->mac)))
1567 { 1567 {
1568 LOG (GNUNET_ERROR_TYPE_DEBUG, 1568 LOG (GNUNET_ERROR_TYPE_DEBUG,
1569 "Rejecting MAC `%s': not my MAC!\n", 1569 "Rejecting MAC `%s': not my MAC!\n",
1570 mac_to_string (addr)); 1570 mac_to_string (addr));
1571 return GNUNET_NO; /* not my MAC */ 1571 return GNUNET_NO; /* not my MAC */
@@ -1643,7 +1643,7 @@ bluetooth_plugin_address_pretty_printer (void *cls, const char *type,
1643 1643
1644 1644
1645/** 1645/**
1646 * Exit point from the plugin. 1646 * Exit point from the plugin.
1647 * 1647 *
1648 * @param cls pointer to the api struct 1648 * @param cls pointer to the api struct
1649 */ 1649 */
@@ -1799,7 +1799,7 @@ libgnunet_plugin_transport_bluetooth_init (void *cls)
1799 1799
1800 testmode = 0; 1800 testmode = 0;
1801 /* check configuration */ 1801 /* check configuration */
1802 if ( (GNUNET_YES == 1802 if ( (GNUNET_YES ==
1803 GNUNET_CONFIGURATION_have_value (env->cfg, "transport-bluetooth", "TESTMODE")) && 1803 GNUNET_CONFIGURATION_have_value (env->cfg, "transport-bluetooth", "TESTMODE")) &&
1804 ( (GNUNET_SYSERR == 1804 ( (GNUNET_SYSERR ==
1805 GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-bluetooth", 1805 GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-bluetooth",
@@ -1828,7 +1828,7 @@ libgnunet_plugin_transport_bluetooth_init (void *cls)
1828 { 1828 {
1829 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, 1829 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
1830 "transport-bluetooth", "INTERFACE"); 1830 "transport-bluetooth", "INTERFACE");
1831 return NULL; 1831 return NULL;
1832 } 1832 }
1833 1833
1834 plugin = GNUNET_malloc (sizeof (struct Plugin)); 1834 plugin = GNUNET_malloc (sizeof (struct Plugin));
@@ -1844,7 +1844,7 @@ libgnunet_plugin_transport_bluetooth_init (void *cls)
1844 plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); 1844 plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin);
1845 plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); 1845 plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin);
1846 plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); 1846 plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin);
1847 plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon, 1847 plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon,
1848 plugin); 1848 plugin);
1849 1849
1850 plugin->options = 0; 1850 plugin->options = 0;
@@ -1852,7 +1852,7 @@ libgnunet_plugin_transport_bluetooth_init (void *cls)
1852 /* some compilers do not like switch on 'long long'... */ 1852 /* some compilers do not like switch on 'long long'... */
1853 switch ((unsigned int) testmode) 1853 switch ((unsigned int) testmode)
1854 { 1854 {
1855 case 0: /* normal */ 1855 case 0: /* normal */
1856 plugin->helper_argv[0] = (char *) "gnunet-helper-transport-bluetooth"; 1856 plugin->helper_argv[0] = (char *) "gnunet-helper-transport-bluetooth";
1857 plugin->helper_argv[1] = interface; 1857 plugin->helper_argv[1] = interface;
1858 plugin->helper_argv[2] = NULL; 1858 plugin->helper_argv[2] = NULL;
@@ -1899,7 +1899,7 @@ libgnunet_plugin_transport_bluetooth_init (void *cls)
1899 api->address_to_string = &bluetooth_plugin_address_to_string;; 1899 api->address_to_string = &bluetooth_plugin_address_to_string;;
1900 api->string_to_address = &bluetooth_string_to_address; 1900 api->string_to_address = &bluetooth_string_to_address;
1901 api->get_network = &bluetooth_get_network; 1901 api->get_network = &bluetooth_get_network;
1902 1902
1903 return api; 1903 return api;
1904} 1904}
1905 1905
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c
index 637e74063..979978e73 100644
--- a/src/transport/plugin_transport_http.c
+++ b/src/transport/plugin_transport_http.c
@@ -216,7 +216,7 @@ http_plugin_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
216 * @param added length of created address 216 * @param added length of created address
217 * @return GNUNET_OK on success, GNUNET_SYSERR on failure 217 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
218 */ 218 */
219int 219int
220http_string_to_address (void *cls, 220http_string_to_address (void *cls,
221 const char *addr, 221 const char *addr,
222 uint16_t addrlen, 222 uint16_t addrlen,
@@ -363,7 +363,7 @@ lookup_session_old (struct Plugin *plugin, const struct GNUNET_PeerIdentity *tar
363 e_peer = GNUNET_YES; 363 e_peer = GNUNET_YES;
364 if ( (addrlen == t->addrlen) && 364 if ( (addrlen == t->addrlen) &&
365 (0 == memcmp (addr, t->addr, addrlen)) ) 365 (0 == memcmp (addr, t->addr, addrlen)) )
366 e_addr = GNUNET_YES; 366 e_addr = GNUNET_YES;
367 if ( (t == session) && 367 if ( (t == session) &&
368 (t->addrlen == session->addrlen) && 368 (t->addrlen == session->addrlen) &&
369 (0 == memcmp (session->addr, t->addr, t->addrlen)) ) 369 (0 == memcmp (session->addr, t->addr, t->addrlen)) )
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index d6db3d22d..79c34c641 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -107,17 +107,17 @@ struct Session;
107 107
108/** 108/**
109 * A connection handle 109 * A connection handle
110 * 110 *
111 */ 111 */
112struct ConnectionHandle 112struct ConnectionHandle
113{ 113{
114 /** 114 /**
115 * The curl easy handle 115 * The curl easy handle
116 */ 116 */
117 CURL *easyhandle; 117 CURL *easyhandle;
118 118
119 /** 119 /**
120 * The related session 120 * The related session
121 */ 121 */
122 struct Session *s; 122 struct Session *s;
123}; 123};
@@ -363,7 +363,7 @@ client_schedule (struct HTTP_Client_Plugin *plugin, int now);
363 363
364 364
365/** 365/**
366 * Connect a HTTP put connection 366 * Connect a HTTP put connection
367 * 367 *
368 * @param s the session to connect 368 * @param s the session to connect
369 * @return GNUNET_SYSERR for hard failure, GNUNET_OK for success 369 * @return GNUNET_SYSERR for hard failure, GNUNET_OK for success
@@ -407,7 +407,7 @@ client_exist_session (struct HTTP_Client_Plugin *plugin, struct Session *s)
407 * @return always 0 407 * @return always 0
408 */ 408 */
409static int 409static int
410client_log (CURL *curl, curl_infotype type, 410client_log (CURL *curl, curl_infotype type,
411 const char *data, size_t size, void *cls) 411 const char *data, size_t size, void *cls)
412{ 412{
413 struct ConnectionHandle *ch = cls; 413 struct ConnectionHandle *ch = cls;
@@ -755,7 +755,7 @@ http_client_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *targ
755 755
756/** 756/**
757 * Check if a sessions exists for an specific address 757 * Check if a sessions exists for an specific address
758 * 758 *
759 * @param plugin the plugin 759 * @param plugin the plugin
760 * @param address the address 760 * @param address the address
761 * @return the session or NULL 761 * @return the session or NULL
@@ -946,7 +946,7 @@ client_receive_mst_cb (void *cls, void *client,
946 "Client: peer `%s' address `%s' next read delayed for %s\n", 946 "Client: peer `%s' address `%s' next read delayed for %s\n",
947 GNUNET_i2s (&s->target), 947 GNUNET_i2s (&s->target),
948 http_common_plugin_address_to_string (NULL, 948 http_common_plugin_address_to_string (NULL,
949 s->plugin->protocol, 949 s->plugin->protocol,
950 s->addr, s->addrlen), 950 s->addr, s->addrlen),
951 GNUNET_STRINGS_relative_time_to_string (delay, 951 GNUNET_STRINGS_relative_time_to_string (delay,
952 GNUNET_YES)); 952 GNUNET_YES));
@@ -1002,7 +1002,7 @@ client_receive (void *stream, size_t size, size_t nmemb, void *cls)
1002 GNUNET_TIME_absolute_get_difference (now, s->next_receive); 1002 GNUNET_TIME_absolute_get_difference (now, s->next_receive);
1003 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name, 1003 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name,
1004 "Session %p / connection %p: No inbound bandwidth available! Next read was delayed for %s\n", 1004 "Session %p / connection %p: No inbound bandwidth available! Next read was delayed for %s\n",
1005 s, s->client_get, 1005 s, s->client_get,
1006 GNUNET_STRINGS_relative_time_to_string (delta, 1006 GNUNET_STRINGS_relative_time_to_string (delta,
1007 GNUNET_YES)); 1007 GNUNET_YES));
1008 if (s->recv_wakeup_task != GNUNET_SCHEDULER_NO_TASK) 1008 if (s->recv_wakeup_task != GNUNET_SCHEDULER_NO_TASK)
@@ -1231,7 +1231,7 @@ client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1231 1231
1232/** 1232/**
1233 * Connect GET connection for a session 1233 * Connect GET connection for a session
1234 * 1234 *
1235 * @param s the session to connect 1235 * @param s the session to connect
1236 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 1236 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
1237 */ 1237 */
@@ -1306,7 +1306,7 @@ client_connect_get (struct Session *s)
1306} 1306}
1307 1307
1308/** 1308/**
1309 * Connect a HTTP put connection 1309 * Connect a HTTP put connection
1310 * 1310 *
1311 * @param s the session to connect 1311 * @param s the session to connect
1312 * @return GNUNET_SYSERR for hard failure, GNUNET_OK for ok 1312 * @return GNUNET_SYSERR for hard failure, GNUNET_OK for ok
@@ -1383,7 +1383,7 @@ client_connect_put (struct Session *s)
1383 1383
1384/** 1384/**
1385 * Connect both PUT and GET connection for a session 1385 * Connect both PUT and GET connection for a session
1386 * 1386 *
1387 * @param s the session to connect 1387 * @param s the session to connect
1388 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 1388 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
1389 */ 1389 */
@@ -1627,7 +1627,7 @@ client_start_session_timeout (struct Session *s)
1627 s); 1627 s);
1628 GNUNET_log (TIMEOUT_LOG, 1628 GNUNET_log (TIMEOUT_LOG,
1629 "Timeout for session %p set to %s\n", 1629 "Timeout for session %p set to %s\n",
1630 s, 1630 s,
1631 GNUNET_STRINGS_relative_time_to_string (CLIENT_SESSION_TIMEOUT, 1631 GNUNET_STRINGS_relative_time_to_string (CLIENT_SESSION_TIMEOUT,
1632 GNUNET_YES)); 1632 GNUNET_YES));
1633} 1633}
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index 5695e1d7d..323379d3e 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -883,7 +883,7 @@ server_disconnect (struct Session *s)
883 * @param to timeout in seconds 883 * @param to timeout in seconds
884 */ 884 */
885static void 885static void
886server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin, 886server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin,
887 struct Session *s, 887 struct Session *s,
888 unsigned int to) 888 unsigned int to)
889{ 889{
@@ -925,7 +925,7 @@ server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin,
925static int 925static int
926server_parse_url (struct HTTP_Server_Plugin *plugin, 926server_parse_url (struct HTTP_Server_Plugin *plugin,
927 const char *url, 927 const char *url,
928 struct GNUNET_PeerIdentity *target, 928 struct GNUNET_PeerIdentity *target,
929 uint32_t *tag) 929 uint32_t *tag)
930{ 930{
931 char * tag_start = NULL; 931 char * tag_start = NULL;
@@ -1012,7 +1012,7 @@ server_parse_url (struct HTTP_Server_Plugin *plugin,
1012 if (DEBUG_URL_PARSE) GNUNET_break (0); 1012 if (DEBUG_URL_PARSE) GNUNET_break (0);
1013 return GNUNET_SYSERR; 1013 return GNUNET_SYSERR;
1014 } 1014 }
1015 if (GNUNET_OK != 1015 if (GNUNET_OK !=
1016 GNUNET_CRYPTO_ecc_public_sign_key_from_string (target_start, 1016 GNUNET_CRYPTO_ecc_public_sign_key_from_string (target_start,
1017 hash_length, 1017 hash_length,
1018 &target->public_key)) 1018 &target->public_key))
@@ -1021,9 +1021,9 @@ server_parse_url (struct HTTP_Server_Plugin *plugin,
1021 if (DEBUG_URL_PARSE) GNUNET_break (0); 1021 if (DEBUG_URL_PARSE) GNUNET_break (0);
1022 return GNUNET_SYSERR; 1022 return GNUNET_SYSERR;
1023 } 1023 }
1024 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 1024 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
1025 plugin->name, 1025 plugin->name,
1026 "Found target `%s' in URL\n", 1026 "Found target `%s' in URL\n",
1027 GNUNET_i2s_full (target)); 1027 GNUNET_i2s_full (target));
1028 return GNUNET_OK; 1028 return GNUNET_OK;
1029} 1029}
@@ -1181,7 +1181,7 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin,
1181 if ((NULL == s->server_recv) || (NULL == s->server_send)) 1181 if ((NULL == s->server_recv) || (NULL == s->server_send))
1182 { 1182 {
1183 to = (HTTP_SERVER_NOT_VALIDATED_TIMEOUT.rel_value_us / 1000LL / 1000LL); 1183 to = (HTTP_SERVER_NOT_VALIDATED_TIMEOUT.rel_value_us / 1000LL / 1000LL);
1184 MHD_set_connection_option (mhd_connection, 1184 MHD_set_connection_option (mhd_connection,
1185 MHD_CONNECTION_OPTION_TIMEOUT, to); 1185 MHD_CONNECTION_OPTION_TIMEOUT, to);
1186 server_reschedule (plugin, sc->mhd_daemon, GNUNET_NO); 1186 server_reschedule (plugin, sc->mhd_daemon, GNUNET_NO);
1187 } 1187 }
@@ -2902,7 +2902,7 @@ server_session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc
2902 s->timeout_task = GNUNET_SCHEDULER_NO_TASK; 2902 s->timeout_task = GNUNET_SCHEDULER_NO_TASK;
2903 GNUNET_log (TIMEOUT_LOG, 2903 GNUNET_log (TIMEOUT_LOG,
2904 "Session %p was idle for %s, disconnecting\n", 2904 "Session %p was idle for %s, disconnecting\n",
2905 s, 2905 s,
2906 GNUNET_STRINGS_relative_time_to_string (SERVER_SESSION_TIMEOUT, 2906 GNUNET_STRINGS_relative_time_to_string (SERVER_SESSION_TIMEOUT,
2907 GNUNET_YES)); 2907 GNUNET_YES));
2908 2908
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 0e49300b0..113cb70c5 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -454,7 +454,7 @@ tcp_address_to_string (void *cls, const void *addr, size_t addrlen);
454static unsigned int sessions; 454static unsigned int sessions;
455 455
456 456
457static void 457static void
458inc_sessions (struct Plugin *plugin, struct Session *session, int line) 458inc_sessions (struct Plugin *plugin, struct Session *session, int line)
459{ 459{
460 sessions++; 460 sessions++;
@@ -471,7 +471,7 @@ inc_sessions (struct Plugin *plugin, struct Session *session, int line)
471} 471}
472 472
473 473
474static void 474static void
475dec_sessions (struct Plugin *plugin, struct Session *session, int line) 475dec_sessions (struct Plugin *plugin, struct Session *session, int line)
476{ 476{
477 GNUNET_assert (sessions > 0); 477 GNUNET_assert (sessions > 0);
@@ -607,7 +607,7 @@ tcp_address_to_string (void *cls, const void *addr, size_t addrlen)
607 memcpy (&a6, &t6->ipv6_addr, sizeof (a6)); 607 memcpy (&a6, &t6->ipv6_addr, sizeof (a6));
608 sb = &a6; 608 sb = &a6;
609 break; 609 break;
610 case sizeof (struct IPv4TcpAddress): 610 case sizeof (struct IPv4TcpAddress):
611 t4 = addr; 611 t4 = addr;
612 af = AF_INET; 612 af = AF_INET;
613 port = ntohs (t4->t4_port); 613 port = ntohs (t4->t4_port);
@@ -724,7 +724,7 @@ tcp_string_to_address (void *cls, const char *addr, uint16_t addrlen,
724 *added = sizeof (struct IPv4TcpAddress); 724 *added = sizeof (struct IPv4TcpAddress);
725 return GNUNET_OK; 725 return GNUNET_OK;
726 } 726 }
727 case AF_INET6: 727 case AF_INET6:
728 { 728 {
729 struct IPv6TcpAddress *t6; 729 struct IPv6TcpAddress *t6;
730 struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) &socket_address; 730 struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) &socket_address;
@@ -749,7 +749,7 @@ struct SessionClientCtx
749}; 749};
750 750
751 751
752static int 752static int
753session_lookup_by_client_it (void *cls, 753session_lookup_by_client_it (void *cls,
754 const struct GNUNET_PeerIdentity *key, 754 const struct GNUNET_PeerIdentity *key,
755 void *value) 755 void *value)
@@ -810,7 +810,7 @@ create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target,
810 else 810 else
811 GNUNET_assert (NULL == client); 811 GNUNET_assert (NULL == client);
812 812
813 LOG (GNUNET_ERROR_TYPE_DEBUG, 813 LOG (GNUNET_ERROR_TYPE_DEBUG,
814 "Creating new session for peer `%4s'\n", 814 "Creating new session for peer `%4s'\n",
815 GNUNET_i2s (target)); 815 GNUNET_i2s (target));
816 session = GNUNET_malloc (sizeof (struct Session)); 816 session = GNUNET_malloc (sizeof (struct Session));
@@ -886,7 +886,7 @@ do_transmit (void *cls, size_t size, void *buf)
886 plugin = session->plugin; 886 plugin = session->plugin;
887 if (NULL == buf) 887 if (NULL == buf)
888 { 888 {
889 LOG (GNUNET_ERROR_TYPE_DEBUG, 889 LOG (GNUNET_ERROR_TYPE_DEBUG,
890 "Timeout trying to transmit to peer `%4s', discarding message queue.\n", 890 "Timeout trying to transmit to peer `%4s', discarding message queue.\n",
891 GNUNET_i2s (&session->target)); 891 GNUNET_i2s (&session->target));
892 /* timeout; cancel all messages that have already expired */ 892 /* timeout; cancel all messages that have already expired */
@@ -940,7 +940,7 @@ do_transmit (void *cls, size_t size, void *buf)
940 GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, 940 GNUNET_CONTAINER_DLL_remove (session->pending_messages_head,
941 session->pending_messages_tail, pos); 941 session->pending_messages_tail, pos);
942 GNUNET_assert (size >= pos->message_size); 942 GNUNET_assert (size >= pos->message_size);
943 LOG (GNUNET_ERROR_TYPE_DEBUG, 943 LOG (GNUNET_ERROR_TYPE_DEBUG,
944 "Transmitting message of type %u\n", 944 "Transmitting message of type %u\n",
945 ntohs (((struct GNUNET_MessageHeader *) pos->msg)->type)); 945 ntohs (((struct GNUNET_MessageHeader *) pos->msg)->type));
946 /* FIXME: this memcpy can be up to 7% of our total runtime */ 946 /* FIXME: this memcpy can be up to 7% of our total runtime */
@@ -1017,7 +1017,7 @@ disconnect_session (struct Session *session)
1017 struct PendingMessage *pm; 1017 struct PendingMessage *pm;
1018 struct Plugin * plugin = session->plugin; 1018 struct Plugin * plugin = session->plugin;
1019 1019
1020 LOG (GNUNET_ERROR_TYPE_DEBUG, 1020 LOG (GNUNET_ERROR_TYPE_DEBUG,
1021 "Disconnecting session of peer `%s' address `%s'\n", 1021 "Disconnecting session of peer `%s' address `%s'\n",
1022 GNUNET_i2s (&session->target), 1022 GNUNET_i2s (&session->target),
1023 tcp_address_to_string (NULL, session->addr, session->addrlen)); 1023 tcp_address_to_string (NULL, session->addr, session->addrlen));
@@ -1050,7 +1050,7 @@ disconnect_session (struct Session *session)
1050 1050
1051 while (NULL != (pm = session->pending_messages_head)) 1051 while (NULL != (pm = session->pending_messages_head))
1052 { 1052 {
1053 LOG (GNUNET_ERROR_TYPE_DEBUG, 1053 LOG (GNUNET_ERROR_TYPE_DEBUG,
1054 pm->transmit_cont != 1054 pm->transmit_cont !=
1055 NULL ? "Could not deliver message to `%4s'.\n" : 1055 NULL ? "Could not deliver message to `%4s'.\n" :
1056 "Could not deliver message to `%4s', notifying.\n", 1056 "Could not deliver message to `%4s', notifying.\n",
@@ -1094,7 +1094,7 @@ struct FindSessionContext
1094}; 1094};
1095 1095
1096 1096
1097static int 1097static int
1098session_it (void *cls, 1098session_it (void *cls,
1099 const struct GNUNET_PeerIdentity * key, 1099 const struct GNUNET_PeerIdentity * key,
1100 void *value) 1100 void *value)
@@ -1190,12 +1190,12 @@ tcp_plugin_send (void *cls,
1190 pm->transmit_cont = cont; 1190 pm->transmit_cont = cont;
1191 pm->transmit_cont_cls = cont_cls; 1191 pm->transmit_cont_cls = cont_cls;
1192 1192
1193 LOG (GNUNET_ERROR_TYPE_DEBUG, 1193 LOG (GNUNET_ERROR_TYPE_DEBUG,
1194 "Asked to transmit %u bytes to `%s', added message to list.\n", 1194 "Asked to transmit %u bytes to `%s', added message to list.\n",
1195 msgbuf_size, GNUNET_i2s (&session->target)); 1195 msgbuf_size, GNUNET_i2s (&session->target));
1196 1196
1197 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap, 1197 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap,
1198 &session->target, 1198 &session->target,
1199 session)) 1199 session))
1200 { 1200 {
1201 GNUNET_assert (session->client != NULL); 1201 GNUNET_assert (session->client != NULL);
@@ -1215,7 +1215,7 @@ tcp_plugin_send (void *cls,
1215 } 1215 }
1216 else if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains_value(plugin->nat_wait_conns, &session->target, session)) 1216 else if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains_value(plugin->nat_wait_conns, &session->target, session))
1217 { 1217 {
1218 LOG (GNUNET_ERROR_TYPE_DEBUG, 1218 LOG (GNUNET_ERROR_TYPE_DEBUG,
1219 "This NAT WAIT session for peer `%s' is not yet ready!\n", 1219 "This NAT WAIT session for peer `%s' is not yet ready!\n",
1220 GNUNET_i2s (&session->target)); 1220 GNUNET_i2s (&session->target));
1221 reschedule_session_timeout (session); 1221 reschedule_session_timeout (session);
@@ -1249,7 +1249,7 @@ struct SessionItCtx
1249}; 1249};
1250 1250
1251 1251
1252static int 1252static int
1253session_lookup_it (void *cls, 1253session_lookup_it (void *cls,
1254 const struct GNUNET_PeerIdentity *key, 1254 const struct GNUNET_PeerIdentity *key,
1255 void *value) 1255 void *value)
@@ -1340,14 +1340,14 @@ tcp_plugin_get_session (void *cls,
1340 GNUNET_assert (plugin != NULL); 1340 GNUNET_assert (plugin != NULL);
1341 GNUNET_assert (address != NULL); 1341 GNUNET_assert (address != NULL);
1342 addrlen = address->address_length; 1342 addrlen = address->address_length;
1343 LOG (GNUNET_ERROR_TYPE_DEBUG, 1343 LOG (GNUNET_ERROR_TYPE_DEBUG,
1344 "Trying to get session for `%s' address of peer `%s'\n", 1344 "Trying to get session for `%s' address of peer `%s'\n",
1345 tcp_address_to_string(NULL, address->address, address->address_length), 1345 tcp_address_to_string(NULL, address->address, address->address_length),
1346 GNUNET_i2s (&address->peer)); 1346 GNUNET_i2s (&address->peer));
1347 1347
1348 /* look for existing session */ 1348 /* look for existing session */
1349 if (GNUNET_YES == 1349 if (GNUNET_YES ==
1350 GNUNET_CONTAINER_multipeermap_contains (plugin->sessionmap, 1350 GNUNET_CONTAINER_multipeermap_contains (plugin->sessionmap,
1351 &address->peer)) 1351 &address->peer))
1352 { 1352 {
1353 struct SessionItCtx si_ctx; 1353 struct SessionItCtx si_ctx;
@@ -1357,8 +1357,8 @@ tcp_plugin_get_session (void *cls,
1357 1357
1358 si_ctx.result = NULL; 1358 si_ctx.result = NULL;
1359 1359
1360 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap, 1360 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap,
1361 &address->peer, 1361 &address->peer,
1362 &session_lookup_it, &si_ctx); 1362 &session_lookup_it, &si_ctx);
1363 if (si_ctx.result != NULL) 1363 if (si_ctx.result != NULL)
1364 { 1364 {
@@ -1447,7 +1447,7 @@ tcp_plugin_get_session (void *cls,
1447 GNUNET_CONTAINER_multipeermap_contains (plugin->nat_wait_conns, 1447 GNUNET_CONTAINER_multipeermap_contains (plugin->nat_wait_conns,
1448 &address->peer))) 1448 &address->peer)))
1449 { 1449 {
1450 LOG (GNUNET_ERROR_TYPE_DEBUG, 1450 LOG (GNUNET_ERROR_TYPE_DEBUG,
1451 "Found valid IPv4 NAT address (creating session)!\n") ; 1451 "Found valid IPv4 NAT address (creating session)!\n") ;
1452 session = create_session (plugin, &address->peer, NULL, GNUNET_YES); 1452 session = create_session (plugin, &address->peer, NULL, GNUNET_YES);
1453 session->addrlen = 0; 1453 session->addrlen = 0;
@@ -1458,12 +1458,12 @@ tcp_plugin_get_session (void *cls,
1458 session); 1458 session);
1459 GNUNET_assert (session != NULL); 1459 GNUNET_assert (session != NULL);
1460 GNUNET_assert (GNUNET_OK == 1460 GNUNET_assert (GNUNET_OK ==
1461 GNUNET_CONTAINER_multipeermap_put (plugin->nat_wait_conns, 1461 GNUNET_CONTAINER_multipeermap_put (plugin->nat_wait_conns,
1462 &session->target, 1462 &session->target,
1463 session, 1463 session,
1464 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 1464 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
1465 1465
1466 LOG (GNUNET_ERROR_TYPE_DEBUG, 1466 LOG (GNUNET_ERROR_TYPE_DEBUG,
1467 "Created NAT WAIT connection to `%4s' at `%s'\n", 1467 "Created NAT WAIT connection to `%4s' at `%s'\n",
1468 GNUNET_i2s (&session->target), GNUNET_a2s (sb, sbs)); 1468 GNUNET_i2s (&session->target), GNUNET_a2s (sb, sbs));
1469 1469
@@ -1471,7 +1471,7 @@ tcp_plugin_get_session (void *cls,
1471 return session; 1471 return session;
1472 else 1472 else
1473 { 1473 {
1474 LOG (GNUNET_ERROR_TYPE_DEBUG, 1474 LOG (GNUNET_ERROR_TYPE_DEBUG,
1475 "Running NAT client for `%4s' at `%s' failed\n", 1475 "Running NAT client for `%4s' at `%s' failed\n",
1476 GNUNET_i2s (&session->target), GNUNET_a2s (sb, sbs)); 1476 GNUNET_i2s (&session->target), GNUNET_a2s (sb, sbs));
1477 disconnect_session (session); 1477 disconnect_session (session);
@@ -1484,7 +1484,7 @@ tcp_plugin_get_session (void *cls,
1484 sa = GNUNET_CONNECTION_create_from_sockaddr (af, sb, sbs); 1484 sa = GNUNET_CONNECTION_create_from_sockaddr (af, sb, sbs);
1485 if (sa == NULL) 1485 if (sa == NULL)
1486 { 1486 {
1487 LOG (GNUNET_ERROR_TYPE_DEBUG, 1487 LOG (GNUNET_ERROR_TYPE_DEBUG,
1488 "Failed to create connection to `%4s' at `%s'\n", 1488 "Failed to create connection to `%4s' at `%s'\n",
1489 GNUNET_i2s (&address->peer), GNUNET_a2s (sb, sbs)); 1489 GNUNET_i2s (&address->peer), GNUNET_a2s (sb, sbs));
1490 return NULL; 1490 return NULL;
@@ -1506,8 +1506,8 @@ tcp_plugin_get_session (void *cls,
1506 session->addrlen = addrlen; 1506 session->addrlen = addrlen;
1507 session->ats_address_network_type = ats.value; 1507 session->ats_address_network_type = ats.value;
1508 1508
1509 GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, 1509 GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap,
1510 &session->target, 1510 &session->target,
1511 session, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 1511 session, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
1512 inc_sessions (plugin, session, __LINE__); 1512 inc_sessions (plugin, session, __LINE__);
1513 LOG (GNUNET_ERROR_TYPE_DEBUG, 1513 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1522,7 +1522,7 @@ tcp_plugin_get_session (void *cls,
1522} 1522}
1523 1523
1524 1524
1525static int 1525static int
1526session_disconnect_it (void *cls, 1526session_disconnect_it (void *cls,
1527 const struct GNUNET_PeerIdentity *key, 1527 const struct GNUNET_PeerIdentity *key,
1528 void *value) 1528 void *value)
@@ -1559,9 +1559,9 @@ tcp_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
1559{ 1559{
1560 struct Plugin *plugin = cls; 1560 struct Plugin *plugin = cls;
1561 1561
1562 LOG (GNUNET_ERROR_TYPE_DEBUG, 1562 LOG (GNUNET_ERROR_TYPE_DEBUG,
1563 "Disconnecting peer `%4s'\n", GNUNET_i2s (target)); 1563 "Disconnecting peer `%4s'\n", GNUNET_i2s (target));
1564 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap, target, 1564 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap, target,
1565 &session_disconnect_it, plugin); 1565 &session_disconnect_it, plugin);
1566 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->nat_wait_conns, target, 1566 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->nat_wait_conns, target,
1567 &session_disconnect_it, plugin); 1567 &session_disconnect_it, plugin);
@@ -1944,12 +1944,12 @@ handle_tcp_nat_probe (void *cls, struct GNUNET_SERVER_Client *client,
1944 clientIdentity); 1944 clientIdentity);
1945 if (session == NULL) 1945 if (session == NULL)
1946 { 1946 {
1947 LOG (GNUNET_ERROR_TYPE_DEBUG, 1947 LOG (GNUNET_ERROR_TYPE_DEBUG,
1948 "Did NOT find session for NAT probe!\n"); 1948 "Did NOT find session for NAT probe!\n");
1949 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1949 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1950 return; 1950 return;
1951 } 1951 }
1952 LOG (GNUNET_ERROR_TYPE_DEBUG, 1952 LOG (GNUNET_ERROR_TYPE_DEBUG,
1953 "Found session for NAT probe!\n"); 1953 "Found session for NAT probe!\n");
1954 1954
1955 if (session->nat_connection_timeout != GNUNET_SCHEDULER_NO_TASK) 1955 if (session->nat_connection_timeout != GNUNET_SCHEDULER_NO_TASK)
@@ -1970,11 +1970,11 @@ handle_tcp_nat_probe (void *cls, struct GNUNET_SERVER_Client *client,
1970 &tcp_nat_probe->clientIdentity, 1970 &tcp_nat_probe->clientIdentity,
1971 session) == GNUNET_YES); 1971 session) == GNUNET_YES);
1972 GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, 1972 GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap,
1973 &session->target, session, 1973 &session->target, session,
1974 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 1974 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
1975 session->last_activity = GNUNET_TIME_absolute_get (); 1975 session->last_activity = GNUNET_TIME_absolute_get ();
1976 session->inbound = GNUNET_NO; 1976 session->inbound = GNUNET_NO;
1977 LOG (GNUNET_ERROR_TYPE_DEBUG, 1977 LOG (GNUNET_ERROR_TYPE_DEBUG,
1978 "Found address `%s' for incoming connection\n", 1978 "Found address `%s' for incoming connection\n",
1979 GNUNET_a2s (vaddr, alen)); 1979 GNUNET_a2s (vaddr, alen));
1980 switch (((const struct sockaddr *) vaddr)->sa_family) 1980 switch (((const struct sockaddr *) vaddr)->sa_family)
@@ -1999,7 +1999,7 @@ handle_tcp_nat_probe (void *cls, struct GNUNET_SERVER_Client *client,
1999 break; 1999 break;
2000 default: 2000 default:
2001 GNUNET_break_op (0); 2001 GNUNET_break_op (0);
2002 LOG (GNUNET_ERROR_TYPE_DEBUG, 2002 LOG (GNUNET_ERROR_TYPE_DEBUG,
2003 "Bad address for incoming connection!\n"); 2003 "Bad address for incoming connection!\n");
2004 GNUNET_free (vaddr); 2004 GNUNET_free (vaddr);
2005 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 2005 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -2124,7 +2124,7 @@ handle_tcp_welcome (void *cls, struct GNUNET_SERVER_Client *client,
2124 } 2124 }
2125 else 2125 else
2126 { 2126 {
2127 LOG (GNUNET_ERROR_TYPE_DEBUG, 2127 LOG (GNUNET_ERROR_TYPE_DEBUG,
2128 "Did not obtain TCP socket address for incoming connection\n"); 2128 "Did not obtain TCP socket address for incoming connection\n");
2129 GNUNET_break (0); 2129 GNUNET_break (0);
2130 } 2130 }
@@ -2207,9 +2207,9 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client,
2207 /* No inbound session found */ 2207 /* No inbound session found */
2208 void *vaddr; 2208 void *vaddr;
2209 size_t alen; 2209 size_t alen;
2210 2210
2211 GNUNET_SERVER_client_get_address (client, &vaddr, &alen); 2211 GNUNET_SERVER_client_get_address (client, &vaddr, &alen);
2212 LOG (GNUNET_ERROR_TYPE_ERROR, 2212 LOG (GNUNET_ERROR_TYPE_ERROR,
2213 "Received unexpected %u bytes of type %u from `%s'\n", 2213 "Received unexpected %u bytes of type %u from `%s'\n",
2214 (unsigned int) ntohs (message->size), 2214 (unsigned int) ntohs (message->size),
2215 (unsigned int) ntohs (message->type), 2215 (unsigned int) ntohs (message->type),
@@ -2226,7 +2226,7 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client,
2226 size_t alen; 2226 size_t alen;
2227 2227
2228 GNUNET_SERVER_client_get_address (client, &vaddr, &alen); 2228 GNUNET_SERVER_client_get_address (client, &vaddr, &alen);
2229 LOG (GNUNET_ERROR_TYPE_ERROR, 2229 LOG (GNUNET_ERROR_TYPE_ERROR,
2230 "Received unexpected %u bytes of type %u from `%s'\n", 2230 "Received unexpected %u bytes of type %u from `%s'\n",
2231 (unsigned int) ntohs (message->size), 2231 (unsigned int) ntohs (message->size),
2232 (unsigned int) ntohs (message->type), 2232 (unsigned int) ntohs (message->type),
@@ -2238,7 +2238,7 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client,
2238 } 2238 }
2239 2239
2240 session->last_activity = GNUNET_TIME_absolute_get (); 2240 session->last_activity = GNUNET_TIME_absolute_get ();
2241 LOG (GNUNET_ERROR_TYPE_DEBUG, 2241 LOG (GNUNET_ERROR_TYPE_DEBUG,
2242 "Passing %u bytes of type %u from `%4s' to transport service.\n", 2242 "Passing %u bytes of type %u from `%4s' to transport service.\n",
2243 (unsigned int) ntohs (message->size), 2243 (unsigned int) ntohs (message->size),
2244 (unsigned int) ntohs (message->type), 2244 (unsigned int) ntohs (message->type),
@@ -2277,7 +2277,7 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client,
2277 } 2277 }
2278 else 2278 else
2279 { 2279 {
2280 LOG (GNUNET_ERROR_TYPE_DEBUG, 2280 LOG (GNUNET_ERROR_TYPE_DEBUG,
2281 "Throttling receiving from `%s' for %s\n", 2281 "Throttling receiving from `%s' for %s\n",
2282 GNUNET_i2s (&session->target), 2282 GNUNET_i2s (&session->target),
2283 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); 2283 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
@@ -2450,7 +2450,7 @@ start_session_timeout (struct Session *s)
2450 s); 2450 s);
2451 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2451 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2452 "Timeout for session %p set to %s\n", 2452 "Timeout for session %p set to %s\n",
2453 s, 2453 s,
2454 GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 2454 GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
2455 GNUNET_YES)); 2455 GNUNET_YES));
2456} 2456}
@@ -2471,7 +2471,7 @@ reschedule_session_timeout (struct Session *s)
2471 s); 2471 s);
2472 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2472 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2473 "Timeout rescheduled for session %p set to %s\n", 2473 "Timeout rescheduled for session %p set to %s\n",
2474 s, 2474 s,
2475 GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 2475 GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
2476 GNUNET_YES)); 2476 GNUNET_YES));
2477} 2477}
@@ -2571,7 +2571,7 @@ libgnunet_plugin_transport_tcp_init (void *cls)
2571 "ADVERTISED-PORT", &aport)) && 2571 "ADVERTISED-PORT", &aport)) &&
2572 (aport > 65535))) 2572 (aport > 65535)))
2573 { 2573 {
2574 LOG (GNUNET_ERROR_TYPE_ERROR, 2574 LOG (GNUNET_ERROR_TYPE_ERROR,
2575 _ 2575 _
2576 ("Require valid port number for service `%s' in configuration!\n"), 2576 ("Require valid port number for service `%s' in configuration!\n"),
2577 "transport-tcp"); 2577 "transport-tcp");
@@ -2613,7 +2613,7 @@ libgnunet_plugin_transport_tcp_init (void *cls)
2613 { 2613 {
2614 for (ret = ret_s-1; ret >= 0; ret--) 2614 for (ret = ret_s-1; ret >= 0; ret--)
2615 LOG (GNUNET_ERROR_TYPE_INFO, 2615 LOG (GNUNET_ERROR_TYPE_INFO,
2616 "Binding to address `%s'\n", 2616 "Binding to address `%s'\n",
2617 GNUNET_a2s (addrs[ret], addrlens[ret])); 2617 GNUNET_a2s (addrs[ret], addrlens[ret]));
2618 plugin->nat = 2618 plugin->nat =
2619 GNUNET_NAT_register (env->cfg, GNUNET_YES, aport, (unsigned int) ret_s, 2619 GNUNET_NAT_register (env->cfg, GNUNET_YES, aport, (unsigned int) ret_s,
@@ -2679,14 +2679,14 @@ libgnunet_plugin_transport_tcp_init (void *cls)
2679 GNUNET_SERVER_disconnect_notify (plugin->server, &disconnect_notify, plugin); 2679 GNUNET_SERVER_disconnect_notify (plugin->server, &disconnect_notify, plugin);
2680 plugin->nat_wait_conns = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES); 2680 plugin->nat_wait_conns = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES);
2681 if (bport != 0) 2681 if (bport != 0)
2682 LOG (GNUNET_ERROR_TYPE_INFO, 2682 LOG (GNUNET_ERROR_TYPE_INFO,
2683 _("TCP transport listening on port %llu\n"), bport); 2683 _("TCP transport listening on port %llu\n"), bport);
2684 else 2684 else
2685 LOG (GNUNET_ERROR_TYPE_INFO, 2685 LOG (GNUNET_ERROR_TYPE_INFO,
2686 _ 2686 _
2687 ("TCP transport not listening on any port (client only)\n")); 2687 ("TCP transport not listening on any port (client only)\n"));
2688 if (aport != bport) 2688 if (aport != bport)
2689 LOG (GNUNET_ERROR_TYPE_INFO, 2689 LOG (GNUNET_ERROR_TYPE_INFO,
2690 _ 2690 _
2691 ("TCP transport advertises itself as being on port %llu\n"), 2691 ("TCP transport advertises itself as being on port %llu\n"),
2692 aport); 2692 aport);
diff --git a/src/transport/plugin_transport_template.c b/src/transport/plugin_transport_template.c
index faee0c38d..dedc8e857 100644
--- a/src/transport/plugin_transport_template.c
+++ b/src/transport/plugin_transport_template.c
@@ -212,7 +212,7 @@ template_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
212 * @return the network type in HBO or GNUNET_SYSERR 212 * @return the network type in HBO or GNUNET_SYSERR
213 */ 213 */
214static enum GNUNET_ATS_Network_Type 214static enum GNUNET_ATS_Network_Type
215template_plugin_get_network (void *cls, 215template_plugin_get_network (void *cls,
216 struct Session *session) 216 struct Session *session)
217{ 217{
218 GNUNET_assert (NULL != session); 218 GNUNET_assert (NULL != session);
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 4fe4d94cf..6327d744f 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -82,7 +82,7 @@ struct PrettyPrinterContext
82 * DLL 82 * DLL
83 */ 83 */
84 struct PrettyPrinterContext *next; 84 struct PrettyPrinterContext *next;
85 85
86 /** 86 /**
87 * DLL 87 * DLL
88 */ 88 */
@@ -502,7 +502,7 @@ schedule_select (struct Plugin *plugin)
502 for (udpw = plugin->ipv4_queue_head; NULL != udpw; udpw = udpw->next) 502 for (udpw = plugin->ipv4_queue_head; NULL != udpw; udpw = udpw->next)
503 min_delay = GNUNET_TIME_relative_min (min_delay, 503 min_delay = GNUNET_TIME_relative_min (min_delay,
504 GNUNET_TIME_absolute_get_remaining (udpw->session->flow_delay_from_other_peer)); 504 GNUNET_TIME_absolute_get_remaining (udpw->session->flow_delay_from_other_peer));
505 505
506 if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK) 506 if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK)
507 GNUNET_SCHEDULER_cancel(plugin->select_task); 507 GNUNET_SCHEDULER_cancel(plugin->select_task);
508 508
@@ -514,7 +514,7 @@ schedule_select (struct Plugin *plugin)
514 (0 == min_delay.rel_value_us) ? GNUNET_TIME_UNIT_FOREVER_REL : min_delay, 514 (0 == min_delay.rel_value_us) ? GNUNET_TIME_UNIT_FOREVER_REL : min_delay,
515 plugin->rs_v4, 515 plugin->rs_v4,
516 (0 == min_delay.rel_value_us) ? plugin->ws_v4 : NULL, 516 (0 == min_delay.rel_value_us) ? plugin->ws_v4 : NULL,
517 &udp_plugin_select, plugin); 517 &udp_plugin_select, plugin);
518 } 518 }
519 if ((GNUNET_YES == plugin->enable_ipv6) && (NULL != plugin->sockv6)) 519 if ((GNUNET_YES == plugin->enable_ipv6) && (NULL != plugin->sockv6))
520 { 520 {
@@ -522,7 +522,7 @@ schedule_select (struct Plugin *plugin)
522 for (udpw = plugin->ipv6_queue_head; NULL != udpw; udpw = udpw->next) 522 for (udpw = plugin->ipv6_queue_head; NULL != udpw; udpw = udpw->next)
523 min_delay = GNUNET_TIME_relative_min (min_delay, 523 min_delay = GNUNET_TIME_relative_min (min_delay,
524 GNUNET_TIME_absolute_get_remaining (udpw->session->flow_delay_from_other_peer)); 524 GNUNET_TIME_absolute_get_remaining (udpw->session->flow_delay_from_other_peer));
525 525
526 if (GNUNET_SCHEDULER_NO_TASK != plugin->select_task_v6) 526 if (GNUNET_SCHEDULER_NO_TASK != plugin->select_task_v6)
527 GNUNET_SCHEDULER_cancel(plugin->select_task_v6); 527 GNUNET_SCHEDULER_cancel(plugin->select_task_v6);
528 plugin->select_task_v6 = 528 plugin->select_task_v6 =
@@ -589,7 +589,7 @@ udp_address_to_string (void *cls, const void *addr, size_t addrlen)
589 } 589 }
590 inet_ntop (af, sb, buf, INET6_ADDRSTRLEN); 590 inet_ntop (af, sb, buf, INET6_ADDRSTRLEN);
591 591
592 GNUNET_snprintf (rbuf, sizeof (rbuf), 592 GNUNET_snprintf (rbuf, sizeof (rbuf),
593 (af == AF_INET6) ? "%s.%u.[%s]:%u" : "%s.%u.%s:%u", 593 (af == AF_INET6) ? "%s.%u.[%s]:%u" : "%s.%u.%s:%u",
594 PLUGIN_NAME, options, buf, port); 594 PLUGIN_NAME, options, buf, port);
595 return rbuf; 595 return rbuf;
@@ -1150,11 +1150,11 @@ fragmented_message_done (struct UDP_FragmentationContext *fc, int result)
1150 struct UDP_MessageWrapper dummy; 1150 struct UDP_MessageWrapper dummy;
1151 struct Session *s = fc->session; 1151 struct Session *s = fc->session;
1152 1152
1153 LOG (GNUNET_ERROR_TYPE_DEBUG, 1153 LOG (GNUNET_ERROR_TYPE_DEBUG,
1154 "%p : Fragmented message removed with result %s\n", 1154 "%p : Fragmented message removed with result %s\n",
1155 fc, 1155 fc,
1156 (result == GNUNET_SYSERR) ? "FAIL" : "SUCCESS"); 1156 (result == GNUNET_SYSERR) ? "FAIL" : "SUCCESS");
1157 1157
1158 /* Call continuation for fragmented message */ 1158 /* Call continuation for fragmented message */
1159 memset (&dummy, 0, sizeof (dummy)); 1159 memset (&dummy, 0, sizeof (dummy));
1160 dummy.msg_type = MSG_FRAGMENTED_COMPLETE; 1160 dummy.msg_type = MSG_FRAGMENTED_COMPLETE;
@@ -1376,7 +1376,7 @@ reschedule_session_timeout (struct Session *s)
1376 s); 1376 s);
1377 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1377 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1378 "Timeout rescheduled for session %p set to %s\n", 1378 "Timeout rescheduled for session %p set to %s\n",
1379 s, 1379 s,
1380 GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 1380 GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
1381 GNUNET_YES)); 1381 GNUNET_YES));
1382} 1382}
@@ -1478,7 +1478,7 @@ session_cmp_it (void *cls,
1478 1478
1479 LOG (GNUNET_ERROR_TYPE_DEBUG, 1479 LOG (GNUNET_ERROR_TYPE_DEBUG,
1480 "Comparing address %s <-> %s\n", 1480 "Comparing address %s <-> %s\n",
1481 udp_address_to_string (NULL, (void *) address->address, 1481 udp_address_to_string (NULL, (void *) address->address,
1482 address->address_length), 1482 address->address_length),
1483 GNUNET_a2s (s->sock_addr, s->addrlen)); 1483 GNUNET_a2s (s->sock_addr, s->addrlen));
1484 if (s->inbound != cctx->inbound) 1484 if (s->inbound != cctx->inbound)
@@ -1524,7 +1524,7 @@ session_cmp_it (void *cls,
1524 * @return the network type in HBO or GNUNET_SYSERR 1524 * @return the network type in HBO or GNUNET_SYSERR
1525 */ 1525 */
1526static enum GNUNET_ATS_Network_Type 1526static enum GNUNET_ATS_Network_Type
1527udp_get_network (void *cls, 1527udp_get_network (void *cls,
1528 struct Session *session) 1528 struct Session *session)
1529{ 1529{
1530 return ntohl (session->ats.value); 1530 return ntohl (session->ats.value);
@@ -1589,8 +1589,8 @@ udp_plugin_lookup_session (void *cls,
1589 cctx.res = NULL; 1589 cctx.res = NULL;
1590 cctx.inbound = inbound; 1590 cctx.inbound = inbound;
1591 LOG (GNUNET_ERROR_TYPE_DEBUG, 1591 LOG (GNUNET_ERROR_TYPE_DEBUG,
1592 "Looking for existing session for peer `%s' `%s' \n", 1592 "Looking for existing session for peer `%s' `%s' \n",
1593 GNUNET_i2s (&address->peer), 1593 GNUNET_i2s (&address->peer),
1594 udp_address_to_string(NULL, address->address, address->address_length)); 1594 udp_address_to_string(NULL, address->address, address->address_length));
1595 GNUNET_CONTAINER_multipeermap_get_multiple(plugin->sessions, &address->peer, session_cmp_it, &cctx); 1595 GNUNET_CONTAINER_multipeermap_get_multiple(plugin->sessions, &address->peer, session_cmp_it, &cctx);
1596 if (cctx.res != NULL) 1596 if (cctx.res != NULL)
@@ -1666,7 +1666,7 @@ udp_plugin_get_session (void *cls,
1666} 1666}
1667 1667
1668 1668
1669static void 1669static void
1670enqueue (struct Plugin *plugin, struct UDP_MessageWrapper * udpw) 1670enqueue (struct Plugin *plugin, struct UDP_MessageWrapper * udpw)
1671{ 1671{
1672 if (plugin->bytes_in_buffer + udpw->msg_size > INT64_MAX) 1672 if (plugin->bytes_in_buffer + udpw->msg_size > INT64_MAX)
@@ -1708,7 +1708,7 @@ send_next_fragment (void *cls,
1708{ 1708{
1709 struct UDP_MessageWrapper *udpw = cls; 1709 struct UDP_MessageWrapper *udpw = cls;
1710 1710
1711 GNUNET_FRAGMENT_context_transmission_done (udpw->frag_ctx->frag); 1711 GNUNET_FRAGMENT_context_transmission_done (udpw->frag_ctx->frag);
1712} 1712}
1713 1713
1714 1714
@@ -1728,8 +1728,8 @@ enqueue_fragment (void *cls, const struct GNUNET_MessageHeader *msg)
1728 struct Plugin *plugin = frag_ctx->plugin; 1728 struct Plugin *plugin = frag_ctx->plugin;
1729 struct UDP_MessageWrapper * udpw; 1729 struct UDP_MessageWrapper * udpw;
1730 size_t msg_len = ntohs (msg->size); 1730 size_t msg_len = ntohs (msg->size);
1731 1731
1732 LOG (GNUNET_ERROR_TYPE_DEBUG, 1732 LOG (GNUNET_ERROR_TYPE_DEBUG,
1733 "Enqueuing fragment with %u bytes\n", msg_len); 1733 "Enqueuing fragment with %u bytes\n", msg_len);
1734 frag_ctx->fragments_used ++; 1734 frag_ctx->fragments_used ++;
1735 udpw = GNUNET_malloc (sizeof (struct UDP_MessageWrapper) + msg_len); 1735 udpw = GNUNET_malloc (sizeof (struct UDP_MessageWrapper) + msg_len);
@@ -1862,11 +1862,11 @@ udp_plugin_send (void *cls,
1862 frag_ctx->frag = GNUNET_FRAGMENT_context_create (plugin->env->stats, 1862 frag_ctx->frag = GNUNET_FRAGMENT_context_create (plugin->env->stats,
1863 UDP_MTU, 1863 UDP_MTU,
1864 &plugin->tracker, 1864 &plugin->tracker,
1865 s->last_expected_msg_delay, 1865 s->last_expected_msg_delay,
1866 s->last_expected_ack_delay, 1866 s->last_expected_ack_delay,
1867 &udp->header, 1867 &udp->header,
1868 &enqueue_fragment, 1868 &enqueue_fragment,
1869 frag_ctx); 1869 frag_ctx);
1870 s->frag_ctx = frag_ctx; 1870 s->frag_ctx = frag_ctx;
1871 GNUNET_STATISTICS_update (plugin->env->stats, 1871 GNUNET_STATISTICS_update (plugin->env->stats,
1872 "# UDP, fragmented msgs, messages, pending", 1872 "# UDP, fragmented msgs, messages, pending",
@@ -2138,8 +2138,8 @@ struct LookupContext
2138 2138
2139 2139
2140static int 2140static int
2141lookup_session_by_addr_it (void *cls, 2141lookup_session_by_addr_it (void *cls,
2142 const struct GNUNET_PeerIdentity *key, 2142 const struct GNUNET_PeerIdentity *key,
2143 void *value) 2143 void *value)
2144{ 2144{
2145 struct LookupContext *l_ctx = cls; 2145 struct LookupContext *l_ctx = cls;
@@ -2223,7 +2223,7 @@ ack_proc (void *cls, uint32_t id, const struct GNUNET_MessageHeader *msg)
2223} 2223}
2224 2224
2225 2225
2226static void 2226static void
2227read_process_msg (struct Plugin *plugin, 2227read_process_msg (struct Plugin *plugin,
2228 const struct GNUNET_MessageHeader *msg, 2228 const struct GNUNET_MessageHeader *msg,
2229 const char *addr, 2229 const char *addr,
@@ -2239,7 +2239,7 @@ read_process_msg (struct Plugin *plugin,
2239} 2239}
2240 2240
2241 2241
2242static void 2242static void
2243read_process_ack (struct Plugin *plugin, 2243read_process_ack (struct Plugin *plugin,
2244 const struct GNUNET_MessageHeader *msg, 2244 const struct GNUNET_MessageHeader *msg,
2245 char *addr, 2245 char *addr,
@@ -2273,7 +2273,7 @@ read_process_ack (struct Plugin *plugin,
2273 2273
2274 2274
2275 flow_delay.rel_value_us = (uint64_t) ntohl (udp_ack->delay); 2275 flow_delay.rel_value_us = (uint64_t) ntohl (udp_ack->delay);
2276 LOG (GNUNET_ERROR_TYPE_DEBUG, 2276 LOG (GNUNET_ERROR_TYPE_DEBUG,
2277 "We received a sending delay of %s\n", 2277 "We received a sending delay of %s\n",
2278 GNUNET_STRINGS_relative_time_to_string (flow_delay, 2278 GNUNET_STRINGS_relative_time_to_string (flow_delay,
2279 GNUNET_YES)); 2279 GNUNET_YES));
@@ -2310,7 +2310,7 @@ read_process_ack (struct Plugin *plugin,
2310} 2310}
2311 2311
2312 2312
2313static void 2313static void
2314read_process_fragment (struct Plugin *plugin, 2314read_process_fragment (struct Plugin *plugin,
2315 const struct GNUNET_MessageHeader *msg, 2315 const struct GNUNET_MessageHeader *msg,
2316 char *addr, 2316 char *addr,
@@ -2350,7 +2350,7 @@ read_process_fragment (struct Plugin *plugin,
2350 GNUNET_CONTAINER_heap_insert (plugin->defrag_ctxs, d_ctx, 2350 GNUNET_CONTAINER_heap_insert (plugin->defrag_ctxs, d_ctx,
2351 (GNUNET_CONTAINER_HeapCostType) 2351 (GNUNET_CONTAINER_HeapCostType)
2352 now.abs_value_us); 2352 now.abs_value_us);
2353 LOG (GNUNET_ERROR_TYPE_DEBUG, 2353 LOG (GNUNET_ERROR_TYPE_DEBUG,
2354 "Created new defragmentation context for %u-byte fragment from `%s'\n", 2354 "Created new defragmentation context for %u-byte fragment from `%s'\n",
2355 (unsigned int) ntohs (msg->size), 2355 (unsigned int) ntohs (msg->size),
2356 GNUNET_a2s ((const struct sockaddr *) addr, fromlen)); 2356 GNUNET_a2s ((const struct sockaddr *) addr, fromlen));
@@ -2571,7 +2571,7 @@ remove_timeout_messages_and_select (struct UDP_MessageWrapper *head,
2571 if (GNUNET_TIME_UNIT_ZERO.rel_value_us == remaining.rel_value_us) 2571 if (GNUNET_TIME_UNIT_ZERO.rel_value_us == remaining.rel_value_us)
2572 { 2572 {
2573 /* this message is not delayed */ 2573 /* this message is not delayed */
2574 LOG (GNUNET_ERROR_TYPE_DEBUG, 2574 LOG (GNUNET_ERROR_TYPE_DEBUG,
2575 "Message for peer `%s' (%u bytes) is not delayed \n", 2575 "Message for peer `%s' (%u bytes) is not delayed \n",
2576 GNUNET_i2s(&udpw->session->target), udpw->payload_size); 2576 GNUNET_i2s(&udpw->session->target), udpw->payload_size);
2577 break; /* Found message to send, break */ 2577 break; /* Found message to send, break */
@@ -2581,7 +2581,7 @@ remove_timeout_messages_and_select (struct UDP_MessageWrapper *head,
2581 /* Message is delayed, try next */ 2581 /* Message is delayed, try next */
2582 LOG (GNUNET_ERROR_TYPE_DEBUG, 2582 LOG (GNUNET_ERROR_TYPE_DEBUG,
2583 "Message for peer `%s' (%u bytes) is delayed for %s\n", 2583 "Message for peer `%s' (%u bytes) is delayed for %s\n",
2584 GNUNET_i2s(&udpw->session->target), udpw->payload_size, 2584 GNUNET_i2s(&udpw->session->target), udpw->payload_size,
2585 GNUNET_STRINGS_relative_time_to_string (remaining, 2585 GNUNET_STRINGS_relative_time_to_string (remaining,
2586 GNUNET_YES)); 2586 GNUNET_YES));
2587 udpw = udpw->next; 2587 udpw = udpw->next;
@@ -2719,10 +2719,10 @@ udp_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2719 (GNUNET_NETWORK_fdset_isset (tc->read_ready, plugin->sockv4)) ) 2719 (GNUNET_NETWORK_fdset_isset (tc->read_ready, plugin->sockv4)) )
2720 udp_select_read (plugin, plugin->sockv4); 2720 udp_select_read (plugin, plugin->sockv4);
2721 if ( (0 != (tc->reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) && 2721 if ( (0 != (tc->reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) &&
2722 (NULL != plugin->sockv4) && 2722 (NULL != plugin->sockv4) &&
2723 (NULL != plugin->ipv4_queue_head) && 2723 (NULL != plugin->ipv4_queue_head) &&
2724 (GNUNET_NETWORK_fdset_isset (tc->write_ready, plugin->sockv4)) ) 2724 (GNUNET_NETWORK_fdset_isset (tc->write_ready, plugin->sockv4)) )
2725 udp_select_send (plugin, plugin->sockv4); 2725 udp_select_send (plugin, plugin->sockv4);
2726 schedule_select (plugin); 2726 schedule_select (plugin);
2727} 2727}
2728 2728
@@ -2749,7 +2749,7 @@ udp_plugin_select_v6 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2749 udp_select_read (plugin, plugin->sockv6); 2749 udp_select_read (plugin, plugin->sockv6);
2750 if ( (0 != (tc->reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) && 2750 if ( (0 != (tc->reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) &&
2751 (NULL != plugin->sockv6) && (plugin->ipv6_queue_head != NULL) && 2751 (NULL != plugin->sockv6) && (plugin->ipv6_queue_head != NULL) &&
2752 (GNUNET_NETWORK_fdset_isset (tc->write_ready, plugin->sockv6)) ) 2752 (GNUNET_NETWORK_fdset_isset (tc->write_ready, plugin->sockv6)) )
2753 udp_select_send (plugin, plugin->sockv6); 2753 udp_select_send (plugin, plugin->sockv6);
2754 schedule_select (plugin); 2754 schedule_select (plugin);
2755} 2755}
@@ -2760,7 +2760,7 @@ udp_plugin_select_v6 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2760 * @return number of sockets that were successfully bound 2760 * @return number of sockets that were successfully bound
2761 */ 2761 */
2762static int 2762static int
2763setup_sockets (struct Plugin *plugin, 2763setup_sockets (struct Plugin *plugin,
2764 const struct sockaddr_in6 *bind_v6, 2764 const struct sockaddr_in6 *bind_v6,
2765 const struct sockaddr_in *bind_v4) 2765 const struct sockaddr_in *bind_v4)
2766{ 2766{
@@ -2869,23 +2869,23 @@ setup_sockets (struct Plugin *plugin,
2869 serverAddrv4.sin_addr = bind_v4->sin_addr; 2869 serverAddrv4.sin_addr = bind_v4->sin_addr;
2870 else 2870 else
2871 serverAddrv4.sin_addr.s_addr = INADDR_ANY; 2871 serverAddrv4.sin_addr.s_addr = INADDR_ANY;
2872 2872
2873 if (0 == plugin->port) 2873 if (0 == plugin->port)
2874 /* autodetect */ 2874 /* autodetect */
2875 serverAddrv4.sin_port = htons (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, 33537) + 32000); 2875 serverAddrv4.sin_port = htons (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, 33537) + 32000);
2876 else 2876 else
2877 serverAddrv4.sin_port = htons (plugin->port); 2877 serverAddrv4.sin_port = htons (plugin->port);
2878 2878
2879 2879
2880 addrlen = sizeof (struct sockaddr_in); 2880 addrlen = sizeof (struct sockaddr_in);
2881 serverAddr = (struct sockaddr *) &serverAddrv4; 2881 serverAddr = (struct sockaddr *) &serverAddrv4;
2882 2882
2883 tries = 0; 2883 tries = 0;
2884 while (tries < 10) 2884 while (tries < 10)
2885 { 2885 {
2886 LOG (GNUNET_ERROR_TYPE_DEBUG, "Binding to IPv4 `%s'\n", 2886 LOG (GNUNET_ERROR_TYPE_DEBUG, "Binding to IPv4 `%s'\n",
2887 GNUNET_a2s (serverAddr, addrlen)); 2887 GNUNET_a2s (serverAddr, addrlen));
2888 2888
2889 /* binding */ 2889 /* binding */
2890 if (GNUNET_OK == GNUNET_NETWORK_socket_bind (plugin->sockv4, 2890 if (GNUNET_OK == GNUNET_NETWORK_socket_bind (plugin->sockv4,
2891 serverAddr, addrlen, 0)) 2891 serverAddr, addrlen, 0))
@@ -2896,19 +2896,19 @@ setup_sockets (struct Plugin *plugin,
2896 tries = 10; /* fail */ 2896 tries = 10; /* fail */
2897 break; /* bind failed on specific port */ 2897 break; /* bind failed on specific port */
2898 } 2898 }
2899 2899
2900 /* autodetect */ 2900 /* autodetect */
2901 serverAddrv4.sin_port = htons (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, 33537) + 32000); 2901 serverAddrv4.sin_port = htons (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, 33537) + 32000);
2902 tries ++; 2902 tries ++;
2903 } 2903 }
2904 2904
2905 if (tries >= 10) 2905 if (tries >= 10)
2906 { 2906 {
2907 GNUNET_NETWORK_socket_close (plugin->sockv4); 2907 GNUNET_NETWORK_socket_close (plugin->sockv4);
2908 plugin->enable_ipv4 = GNUNET_NO; 2908 plugin->enable_ipv4 = GNUNET_NO;
2909 plugin->sockv4 = NULL; 2909 plugin->sockv4 = NULL;
2910 } 2910 }
2911 2911
2912 if (plugin->sockv4 != NULL) 2912 if (plugin->sockv4 != NULL)
2913 { 2913 {
2914 LOG (GNUNET_ERROR_TYPE_DEBUG, 2914 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -2918,13 +2918,13 @@ setup_sockets (struct Plugin *plugin,
2918 sockets_created++; 2918 sockets_created++;
2919 } 2919 }
2920 else 2920 else
2921 { 2921 {
2922 LOG (GNUNET_ERROR_TYPE_ERROR, 2922 LOG (GNUNET_ERROR_TYPE_ERROR,
2923 "Failed to bind UDP socket to %s: %s\n", 2923 "Failed to bind UDP socket to %s: %s\n",
2924 GNUNET_a2s (serverAddr, addrlen), STRERROR (eno)); 2924 GNUNET_a2s (serverAddr, addrlen), STRERROR (eno));
2925 } 2925 }
2926 } 2926 }
2927 2927
2928 if (0 == sockets_created) 2928 if (0 == sockets_created)
2929 { 2929 {
2930 LOG (GNUNET_ERROR_TYPE_WARNING, _("Failed to open UDP sockets\n")); 2930 LOG (GNUNET_ERROR_TYPE_WARNING, _("Failed to open UDP sockets\n"));
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c
index 4e153aab4..f5ab3a694 100644
--- a/src/transport/plugin_transport_unix.c
+++ b/src/transport/plugin_transport_unix.c
@@ -452,7 +452,7 @@ struct LookupCtx
452 * @param value a session 452 * @param value a session
453 * @return GNUNET_YES if not found (continue looking), GNUNET_NO on success 453 * @return GNUNET_YES if not found (continue looking), GNUNET_NO on success
454 */ 454 */
455static int 455static int
456lookup_session_it (void *cls, 456lookup_session_it (void *cls,
457 const struct GNUNET_PeerIdentity * key, 457 const struct GNUNET_PeerIdentity * key,
458 void *value) 458 void *value)
@@ -486,8 +486,8 @@ lookup_session_it (void *cls,
486 * @return NULL if session was not found 486 * @return NULL if session was not found
487 */ 487 */
488static struct Session * 488static struct Session *
489lookup_session (struct Plugin *plugin, 489lookup_session (struct Plugin *plugin,
490 const struct GNUNET_PeerIdentity *sender, 490 const struct GNUNET_PeerIdentity *sender,
491 const struct UnixAddress *ua, size_t ua_len) 491 const struct UnixAddress *ua, size_t ua_len)
492{ 492{
493 struct LookupCtx lctx; 493 struct LookupCtx lctx;
@@ -498,7 +498,7 @@ lookup_session (struct Plugin *plugin,
498 lctx.s = NULL; 498 lctx.s = NULL;
499 lctx.ua = ua; 499 lctx.ua = ua;
500 lctx.ua_len = ua_len; 500 lctx.ua_len = ua_len;
501 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map, 501 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map,
502 sender, 502 sender,
503 &lookup_session_it, &lctx); 503 &lookup_session_it, &lctx);
504 return lctx.s; 504 return lctx.s;
@@ -520,9 +520,9 @@ disconnect_session (struct Session *s)
520 struct UNIXMessageWrapper *next; 520 struct UNIXMessageWrapper *next;
521 int removed; 521 int removed;
522 522
523 LOG (GNUNET_ERROR_TYPE_DEBUG, 523 LOG (GNUNET_ERROR_TYPE_DEBUG,
524 "Disconnecting session for peer `%s' `%s'\n", 524 "Disconnecting session for peer `%s' `%s'\n",
525 GNUNET_i2s (&s->target), 525 GNUNET_i2s (&s->target),
526 s->addr); 526 s->addr);
527 plugin->env->session_end (plugin->env->cls, &s->target, s); 527 plugin->env->session_end (plugin->env->cls, &s->target, s);
528 removed = GNUNET_NO; 528 removed = GNUNET_NO;
@@ -539,11 +539,11 @@ disconnect_session (struct Session *s)
539 msgw->payload, 0); 539 msgw->payload, 0);
540 GNUNET_free (msgw->msg); 540 GNUNET_free (msgw->msg);
541 GNUNET_free (msgw); 541 GNUNET_free (msgw);
542 removed = GNUNET_YES; 542 removed = GNUNET_YES;
543 } 543 }
544 GNUNET_assert (GNUNET_YES == 544 GNUNET_assert (GNUNET_YES ==
545 GNUNET_CONTAINER_multipeermap_remove (plugin->session_map, 545 GNUNET_CONTAINER_multipeermap_remove (plugin->session_map,
546 &s->target, 546 &s->target,
547 s)); 547 s));
548 GNUNET_STATISTICS_set (plugin->env->stats, 548 GNUNET_STATISTICS_set (plugin->env->stats,
549 "# UNIX sessions active", 549 "# UNIX sessions active",
@@ -671,7 +671,7 @@ resend:
671 671
672 LOG (GNUNET_ERROR_TYPE_DEBUG, 672 LOG (GNUNET_ERROR_TYPE_DEBUG,
673 "UNIX transmit %u-byte message to %s (%d: %s)\n", 673 "UNIX transmit %u-byte message to %s (%d: %s)\n",
674 (unsigned int) msgbuf_size, 674 (unsigned int) msgbuf_size,
675 GNUNET_a2s ((const struct sockaddr *)un, un_len), 675 GNUNET_a2s ((const struct sockaddr *)un, un_len),
676 (int) sent, 676 (int) sent,
677 (sent < 0) ? STRERROR (errno) : "ok"); 677 (sent < 0) ? STRERROR (errno) : "ok");
@@ -684,7 +684,7 @@ resend:
684 * Closure for 'get_session_it'. 684 * Closure for 'get_session_it'.
685 */ 685 */
686struct GetSessionIteratorContext 686struct GetSessionIteratorContext
687{ 687{
688 /** 688 /**
689 * Location to store the session, if found. 689 * Location to store the session, if found.
690 */ 690 */
@@ -711,8 +711,8 @@ struct GetSessionIteratorContext
711 * @return GNUNET_YES if not found (continue looking), GNUNET_NO on success 711 * @return GNUNET_YES if not found (continue looking), GNUNET_NO on success
712 */ 712 */
713static int 713static int
714get_session_it (void *cls, 714get_session_it (void *cls,
715 const struct GNUNET_PeerIdentity *key, 715 const struct GNUNET_PeerIdentity *key,
716 void *value) 716 void *value)
717{ 717{
718 struct GetSessionIteratorContext *gsi = cls; 718 struct GetSessionIteratorContext *gsi = cls;
@@ -735,11 +735,11 @@ get_session_it (void *cls,
735 * @param tc scheduler context 735 * @param tc scheduler context
736 */ 736 */
737static void 737static void
738session_timeout (void *cls, 738session_timeout (void *cls,
739 const struct GNUNET_SCHEDULER_TaskContext *tc) 739 const struct GNUNET_SCHEDULER_TaskContext *tc)
740{ 740{
741 struct Session *s = cls; 741 struct Session *s = cls;
742 742
743 s->timeout_task = GNUNET_SCHEDULER_NO_TASK; 743 s->timeout_task = GNUNET_SCHEDULER_NO_TASK;
744 LOG (GNUNET_ERROR_TYPE_DEBUG, 744 LOG (GNUNET_ERROR_TYPE_DEBUG,
745 "Session %p was idle for %s, disconnecting\n", 745 "Session %p was idle for %s, disconnecting\n",
@@ -758,7 +758,7 @@ session_timeout (void *cls,
758 * @return the network type in HBO or GNUNET_SYSERR 758 * @return the network type in HBO or GNUNET_SYSERR
759 */ 759 */
760static enum GNUNET_ATS_Network_Type 760static enum GNUNET_ATS_Network_Type
761unix_get_network (void *cls, 761unix_get_network (void *cls,
762 struct Session *session) 762 struct Session *session)
763{ 763{
764 GNUNET_assert (NULL != session); 764 GNUNET_assert (NULL != session);
@@ -818,12 +818,12 @@ unix_plugin_get_session (void *cls,
818 gsi.address = (const char *) address->address; 818 gsi.address = (const char *) address->address;
819 gsi.addrlen = address->address_length; 819 gsi.addrlen = address->address_length;
820 gsi.res = NULL; 820 gsi.res = NULL;
821 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map, 821 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map,
822 &address->peer, 822 &address->peer,
823 &get_session_it, &gsi); 823 &get_session_it, &gsi);
824 if (NULL != gsi.res) 824 if (NULL != gsi.res)
825 { 825 {
826 LOG (GNUNET_ERROR_TYPE_DEBUG, 826 LOG (GNUNET_ERROR_TYPE_DEBUG,
827 "Found existing session\n"); 827 "Found existing session\n");
828 return gsi.res; 828 return gsi.res;
829 } 829 }
@@ -893,23 +893,23 @@ unix_plugin_send (void *cls,
893 struct UNIXMessageWrapper *wrapper; 893 struct UNIXMessageWrapper *wrapper;
894 struct UNIXMessage *message; 894 struct UNIXMessage *message;
895 int ssize; 895 int ssize;
896 896
897 GNUNET_assert (NULL != plugin); 897 GNUNET_assert (NULL != plugin);
898 GNUNET_assert (NULL != session); 898 GNUNET_assert (NULL != session);
899 899
900 if (GNUNET_OK != 900 if (GNUNET_OK !=
901 GNUNET_CONTAINER_multipeermap_contains_value (plugin->session_map, 901 GNUNET_CONTAINER_multipeermap_contains_value (plugin->session_map,
902 &session->target, 902 &session->target,
903 session)) 903 session))
904 { 904 {
905 LOG (GNUNET_ERROR_TYPE_ERROR, 905 LOG (GNUNET_ERROR_TYPE_ERROR,
906 "Invalid session for peer `%s' `%s'\n", 906 "Invalid session for peer `%s' `%s'\n",
907 GNUNET_i2s (&session->target), 907 GNUNET_i2s (&session->target),
908 (const char *) session->addr); 908 (const char *) session->addr);
909 GNUNET_break (0); 909 GNUNET_break (0);
910 return GNUNET_SYSERR; 910 return GNUNET_SYSERR;
911 } 911 }
912 LOG (GNUNET_ERROR_TYPE_DEBUG, 912 LOG (GNUNET_ERROR_TYPE_DEBUG,
913 "Sending %u bytes with session for peer `%s' `%s'\n", 913 "Sending %u bytes with session for peer `%s' `%s'\n",
914 msgbuf_size, 914 msgbuf_size,
915 GNUNET_i2s (&session->target), 915 GNUNET_i2s (&session->target),
@@ -931,13 +931,13 @@ unix_plugin_send (void *cls,
931 wrapper->cont = cont; 931 wrapper->cont = cont;
932 wrapper->cont_cls = cont_cls; 932 wrapper->cont_cls = cont_cls;
933 wrapper->session = session; 933 wrapper->session = session;
934 GNUNET_CONTAINER_DLL_insert (plugin->msg_head, 934 GNUNET_CONTAINER_DLL_insert (plugin->msg_head,
935 plugin->msg_tail, 935 plugin->msg_tail,
936 wrapper); 936 wrapper);
937 plugin->bytes_in_queue += ssize; 937 plugin->bytes_in_queue += ssize;
938 GNUNET_STATISTICS_set (plugin->env->stats, 938 GNUNET_STATISTICS_set (plugin->env->stats,
939 "# bytes currently in UNIX buffers", 939 "# bytes currently in UNIX buffers",
940 plugin->bytes_in_queue, 940 plugin->bytes_in_queue,
941 GNUNET_NO); 941 GNUNET_NO);
942 if (GNUNET_NO == plugin->with_ws) 942 if (GNUNET_NO == plugin->with_ws)
943 reschedule_select (plugin); 943 reschedule_select (plugin);
@@ -1101,25 +1101,25 @@ unix_plugin_select_write (struct Plugin *plugin)
1101 break; /* Message is ready for sending */ 1101 break; /* Message is ready for sending */
1102 /* Message has a timeout */ 1102 /* Message has a timeout */
1103 LOG (GNUNET_ERROR_TYPE_DEBUG, 1103 LOG (GNUNET_ERROR_TYPE_DEBUG,
1104 "Timeout for message with %u bytes \n", 1104 "Timeout for message with %u bytes \n",
1105 (unsigned int) msgw->msgsize); 1105 (unsigned int) msgw->msgsize);
1106 GNUNET_CONTAINER_DLL_remove (plugin->msg_head, plugin->msg_tail, msgw); 1106 GNUNET_CONTAINER_DLL_remove (plugin->msg_head, plugin->msg_tail, msgw);
1107 plugin->bytes_in_queue -= msgw->msgsize; 1107 plugin->bytes_in_queue -= msgw->msgsize;
1108 GNUNET_STATISTICS_set (plugin->env->stats, 1108 GNUNET_STATISTICS_set (plugin->env->stats,
1109 "# bytes currently in UNIX buffers", 1109 "# bytes currently in UNIX buffers",
1110 plugin->bytes_in_queue, GNUNET_NO); 1110 plugin->bytes_in_queue, GNUNET_NO);
1111 GNUNET_STATISTICS_update (plugin->env->stats, 1111 GNUNET_STATISTICS_update (plugin->env->stats,
1112 "# UNIX bytes discarded", 1112 "# UNIX bytes discarded",
1113 msgw->msgsize, 1113 msgw->msgsize,
1114 GNUNET_NO); 1114 GNUNET_NO);
1115 if (NULL != msgw->cont) 1115 if (NULL != msgw->cont)
1116 msgw->cont (msgw->cont_cls, 1116 msgw->cont (msgw->cont_cls,
1117 &msgw->session->target, 1117 &msgw->session->target,
1118 GNUNET_SYSERR, 1118 GNUNET_SYSERR,
1119 msgw->payload, 1119 msgw->payload,
1120 0); 1120 0);
1121 GNUNET_free (msgw->msg); 1121 GNUNET_free (msgw->msg);
1122 GNUNET_free (msgw); 1122 GNUNET_free (msgw);
1123 } 1123 }
1124 if (NULL == msgw) 1124 if (NULL == msgw)
1125 return; /* Nothing to send at the moment */ 1125 return; /* Nothing to send at the moment */
@@ -1153,7 +1153,7 @@ unix_plugin_select_write (struct Plugin *plugin)
1153 1153
1154 GNUNET_assert (plugin->bytes_in_queue >= msgw->msgsize); 1154 GNUNET_assert (plugin->bytes_in_queue >= msgw->msgsize);
1155 plugin->bytes_in_queue -= msgw->msgsize; 1155 plugin->bytes_in_queue -= msgw->msgsize;
1156 GNUNET_STATISTICS_set (plugin->env->stats, 1156 GNUNET_STATISTICS_set (plugin->env->stats,
1157 "# bytes currently in UNIX buffers", 1157 "# bytes currently in UNIX buffers",
1158 plugin->bytes_in_queue, GNUNET_NO); 1158 plugin->bytes_in_queue, GNUNET_NO);
1159 GNUNET_STATISTICS_update (plugin->env->stats, 1159 GNUNET_STATISTICS_update (plugin->env->stats,
@@ -1167,9 +1167,9 @@ unix_plugin_select_write (struct Plugin *plugin)
1167 } 1167 }
1168 /* successfully sent bytes */ 1168 /* successfully sent bytes */
1169 GNUNET_break (sent > 0); 1169 GNUNET_break (sent > 0);
1170 GNUNET_CONTAINER_DLL_remove (plugin->msg_head, 1170 GNUNET_CONTAINER_DLL_remove (plugin->msg_head,
1171 plugin->msg_tail, 1171 plugin->msg_tail,
1172 msgw); 1172 msgw);
1173 GNUNET_assert (plugin->bytes_in_queue >= msgw->msgsize); 1173 GNUNET_assert (plugin->bytes_in_queue >= msgw->msgsize);
1174 plugin->bytes_in_queue -= msgw->msgsize; 1174 plugin->bytes_in_queue -= msgw->msgsize;
1175 GNUNET_STATISTICS_set (plugin->env->stats, 1175 GNUNET_STATISTICS_set (plugin->env->stats,
@@ -1179,12 +1179,12 @@ unix_plugin_select_write (struct Plugin *plugin)
1179 GNUNET_STATISTICS_update (plugin->env->stats, 1179 GNUNET_STATISTICS_update (plugin->env->stats,
1180 "# bytes transmitted via UNIX", 1180 "# bytes transmitted via UNIX",
1181 msgw->msgsize, 1181 msgw->msgsize,
1182 GNUNET_NO); 1182 GNUNET_NO);
1183 if (NULL != msgw->cont) 1183 if (NULL != msgw->cont)
1184 msgw->cont (msgw->cont_cls, &msgw->session->target, 1184 msgw->cont (msgw->cont_cls, &msgw->session->target,
1185 GNUNET_OK, 1185 GNUNET_OK,
1186 msgw->payload, 1186 msgw->payload,
1187 msgw->msgsize); 1187 msgw->msgsize);
1188 GNUNET_free (msgw->msg); 1188 GNUNET_free (msgw->msg);
1189 GNUNET_free (msgw); 1189 GNUNET_free (msgw);
1190} 1190}
@@ -1553,8 +1553,8 @@ reschedule_session_timeout (struct Session *s)
1553 * @return GNUNET_YES (always, continue to iterate) 1553 * @return GNUNET_YES (always, continue to iterate)
1554 */ 1554 */
1555static int 1555static int
1556get_session_delete_it (void *cls, 1556get_session_delete_it (void *cls,
1557 const struct GNUNET_PeerIdentity *key, 1557 const struct GNUNET_PeerIdentity *key,
1558 void *value) 1558 void *value)
1559{ 1559{
1560 struct Session *s = value; 1560 struct Session *s = value;
@@ -1572,14 +1572,14 @@ get_session_delete_it (void *cls,
1572 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the operation failed 1572 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the operation failed
1573 */ 1573 */
1574static void 1574static void
1575unix_disconnect (void *cls, 1575unix_disconnect (void *cls,
1576 const struct GNUNET_PeerIdentity *target) 1576 const struct GNUNET_PeerIdentity *target)
1577{ 1577{
1578 struct Plugin *plugin = cls; 1578 struct Plugin *plugin = cls;
1579 1579
1580 GNUNET_assert (plugin != NULL); 1580 GNUNET_assert (plugin != NULL);
1581 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map, 1581 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map,
1582 target, 1582 target,
1583 &get_session_delete_it, plugin); 1583 &get_session_delete_it, plugin);
1584} 1584}
1585 1585
@@ -1618,7 +1618,7 @@ libgnunet_plugin_transport_unix_init (void *cls)
1618 plugin = GNUNET_malloc (sizeof (struct Plugin)); 1618 plugin = GNUNET_malloc (sizeof (struct Plugin));
1619 plugin->port = port; 1619 plugin->port = port;
1620 plugin->env = env; 1620 plugin->env = env;
1621 GNUNET_asprintf (&plugin->unix_socket_path, 1621 GNUNET_asprintf (&plugin->unix_socket_path,
1622 "/tmp/unix-plugin-sock.%d", 1622 "/tmp/unix-plugin-sock.%d",
1623 plugin->port); 1623 plugin->port);
1624 1624
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index ec0947648..932d3b762 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -75,7 +75,7 @@ GNUNET_NETWORK_STRUCT_BEGIN
75/** 75/**
76 * Header for messages which need fragmentation. This is the format of 76 * Header for messages which need fragmentation. This is the format of
77 * a message we obtain AFTER defragmentation. We then need to check 77 * a message we obtain AFTER defragmentation. We then need to check
78 * the CRC and then tokenize the payload and pass it to the 78 * the CRC and then tokenize the payload and pass it to the
79 * 'receive' callback. 79 * 'receive' callback.
80 */ 80 */
81struct WlanHeader 81struct WlanHeader
@@ -398,7 +398,7 @@ struct Plugin
398 398
399 /** 399 /**
400 * Handle to helper process for priviledged operations. 400 * Handle to helper process for priviledged operations.
401 */ 401 */
402 struct GNUNET_HELPER_Handle *suid_helper; 402 struct GNUNET_HELPER_Handle *suid_helper;
403 403
404 /** 404 /**
@@ -560,7 +560,7 @@ get_radiotap_header (struct MacEndpoint *endpoint,
560static void 560static void
561get_wlan_header (struct Plugin *plugin, 561get_wlan_header (struct Plugin *plugin,
562 struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *header, 562 struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *header,
563 const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr, 563 const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr,
564 unsigned int size) 564 unsigned int size)
565{ 565{
566 const int rate = 11000000; 566 const int rate = 11000000;
@@ -606,12 +606,12 @@ send_ack (void *cls, uint32_t msg_id,
606 GNUNET_break (0); 606 GNUNET_break (0);
607 return; 607 return;
608 } 608 }
609 LOG (GNUNET_ERROR_TYPE_DEBUG, 609 LOG (GNUNET_ERROR_TYPE_DEBUG,
610 "Sending ACK to helper\n"); 610 "Sending ACK to helper\n");
611 radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf; 611 radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf;
612 get_radiotap_header (endpoint, radio_header, size); 612 get_radiotap_header (endpoint, radio_header, size);
613 get_wlan_header (endpoint->plugin, 613 get_wlan_header (endpoint->plugin,
614 &radio_header->frame, 614 &radio_header->frame,
615 &endpoint->addr.mac, 615 &endpoint->addr.mac,
616 size); 616 size);
617 memcpy (&radio_header[1], hdr, msize); 617 memcpy (&radio_header[1], hdr, msize);
@@ -619,7 +619,7 @@ send_ack (void *cls, uint32_t msg_id,
619 GNUNET_HELPER_send (endpoint->plugin->suid_helper, 619 GNUNET_HELPER_send (endpoint->plugin->suid_helper,
620 &radio_header->header, 620 &radio_header->header,
621 GNUNET_NO /* dropping ACKs is bad */, 621 GNUNET_NO /* dropping ACKs is bad */,
622 NULL, NULL)) 622 NULL, NULL))
623 GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# WLAN ACKs sent"), 623 GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# WLAN ACKs sent"),
624 1, GNUNET_NO); 624 1, GNUNET_NO);
625} 625}
@@ -643,7 +643,7 @@ wlan_data_message_handler (void *cls, const struct GNUNET_MessageHeader *hdr)
643 GNUNET_NO); 643 GNUNET_NO);
644 mas.session = NULL; 644 mas.session = NULL;
645 mas.endpoint = endpoint; 645 mas.endpoint = endpoint;
646 (void) GNUNET_SERVER_mst_receive (plugin->fragment_data_tokenizer, 646 (void) GNUNET_SERVER_mst_receive (plugin->fragment_data_tokenizer,
647 &mas, 647 &mas,
648 (const char *) hdr, 648 (const char *) hdr,
649 ntohs (hdr->size), 649 ntohs (hdr->size),
@@ -661,7 +661,7 @@ free_session (struct Session *session)
661{ 661{
662 struct MacEndpoint *endpoint = session->mac; 662 struct MacEndpoint *endpoint = session->mac;
663 struct PendingMessage *pm; 663 struct PendingMessage *pm;
664 664
665 endpoint->plugin->env->session_end (endpoint->plugin->env->cls, 665 endpoint->plugin->env->session_end (endpoint->plugin->env->cls,
666 &session->target, 666 &session->target,
667 session); 667 session);
@@ -677,7 +677,7 @@ free_session (struct Session *session)
677 GNUNET_free (pm->msg); 677 GNUNET_free (pm->msg);
678 GNUNET_free (pm); 678 GNUNET_free (pm);
679 } 679 }
680 GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head, 680 GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head,
681 endpoint->sessions_tail, 681 endpoint->sessions_tail,
682 session); 682 session);
683 if (session->timeout_task != GNUNET_SCHEDULER_NO_TASK) 683 if (session->timeout_task != GNUNET_SCHEDULER_NO_TASK)
@@ -705,7 +705,7 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
705 705
706 session->timeout_task = GNUNET_SCHEDULER_NO_TASK; 706 session->timeout_task = GNUNET_SCHEDULER_NO_TASK;
707 timeout = GNUNET_TIME_absolute_get_remaining (session->timeout); 707 timeout = GNUNET_TIME_absolute_get_remaining (session->timeout);
708 if (0 == timeout.rel_value_us) 708 if (0 == timeout.rel_value_us)
709 { 709 {
710 free_session (session); 710 free_session (session);
711 return; 711 return;
@@ -800,7 +800,7 @@ get_session (struct MacEndpoint *endpoint,
800 * message to the SUID helper process and we are thus ready for 800 * message to the SUID helper process and we are thus ready for
801 * the next fragment. 801 * the next fragment.
802 * 802 *
803 * @param cls the 'struct FragmentMessage' 803 * @param cls the 'struct FragmentMessage'
804 * @param result result of the operation (GNUNET_OK on success, GNUNET_NO if the helper died, GNUNET_SYSERR 804 * @param result result of the operation (GNUNET_OK on success, GNUNET_NO if the helper died, GNUNET_SYSERR
805 * if the helper was stopped) 805 * if the helper was stopped)
806 */ 806 */
@@ -820,7 +820,7 @@ fragment_transmission_done (void *cls,
820 * Transmit a fragment of a message. 820 * Transmit a fragment of a message.
821 * 821 *
822 * @param cls 'struct FragmentMessage' this fragment message belongs to 822 * @param cls 'struct FragmentMessage' this fragment message belongs to
823 * @param hdr pointer to the start of the fragment message 823 * @param hdr pointer to the start of the fragment message
824 */ 824 */
825static void 825static void
826transmit_fragment (void *cls, 826transmit_fragment (void *cls,
@@ -846,7 +846,7 @@ transmit_fragment (void *cls,
846 radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf; 846 radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf;
847 get_radiotap_header (endpoint, radio_header, size); 847 get_radiotap_header (endpoint, radio_header, size);
848 get_wlan_header (endpoint->plugin, 848 get_wlan_header (endpoint->plugin,
849 &radio_header->frame, 849 &radio_header->frame,
850 &endpoint->addr.mac, 850 &endpoint->addr.mac,
851 size); 851 size);
852 memcpy (&radio_header[1], hdr, msize); 852 memcpy (&radio_header[1], hdr, msize);
@@ -881,7 +881,7 @@ free_fragment_message (struct FragmentMessage *fm)
881{ 881{
882 struct MacEndpoint *endpoint = fm->macendpoint; 882 struct MacEndpoint *endpoint = fm->macendpoint;
883 883
884 GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# WLAN messages pending (with fragmentation)"), 884 GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# WLAN messages pending (with fragmentation)"),
885 -1, GNUNET_NO); 885 -1, GNUNET_NO);
886 GNUNET_CONTAINER_DLL_remove (endpoint->sending_messages_head, 886 GNUNET_CONTAINER_DLL_remove (endpoint->sending_messages_head,
887 endpoint->sending_messages_tail, fm); 887 endpoint->sending_messages_tail, fm);
@@ -941,7 +941,7 @@ fragmentmessage_timeout (void *cls,
941static void 941static void
942send_with_fragmentation (struct MacEndpoint *endpoint, 942send_with_fragmentation (struct MacEndpoint *endpoint,
943 struct GNUNET_TIME_Relative timeout, 943 struct GNUNET_TIME_Relative timeout,
944 const struct GNUNET_PeerIdentity *target, 944 const struct GNUNET_PeerIdentity *target,
945 const struct GNUNET_MessageHeader *msg, 945 const struct GNUNET_MessageHeader *msg,
946 size_t payload_size, 946 size_t payload_size,
947 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) 947 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
@@ -968,7 +968,7 @@ send_with_fragmentation (struct MacEndpoint *endpoint,
968 msg, 968 msg,
969 &transmit_fragment, fm); 969 &transmit_fragment, fm);
970 fm->timeout_task = 970 fm->timeout_task =
971 GNUNET_SCHEDULER_add_delayed (timeout, 971 GNUNET_SCHEDULER_add_delayed (timeout,
972 &fragmentmessage_timeout, fm); 972 &fragmentmessage_timeout, fm);
973 GNUNET_CONTAINER_DLL_insert_tail (endpoint->sending_messages_head, 973 GNUNET_CONTAINER_DLL_insert_tail (endpoint->sending_messages_head,
974 endpoint->sending_messages_tail, 974 endpoint->sending_messages_tail,
@@ -978,7 +978,7 @@ send_with_fragmentation (struct MacEndpoint *endpoint,
978 978
979/** 979/**
980 * Free a MAC endpoint. 980 * Free a MAC endpoint.
981 * 981 *
982 * @param endpoint pointer to the MacEndpoint to free 982 * @param endpoint pointer to the MacEndpoint to free
983 */ 983 */
984static void 984static void
@@ -994,8 +994,8 @@ free_macendpoint (struct MacEndpoint *endpoint)
994 free_session (session); 994 free_session (session);
995 while (NULL != (fm = endpoint->sending_messages_head)) 995 while (NULL != (fm = endpoint->sending_messages_head))
996 free_fragment_message (fm); 996 free_fragment_message (fm);
997 GNUNET_CONTAINER_DLL_remove (plugin->mac_head, 997 GNUNET_CONTAINER_DLL_remove (plugin->mac_head,
998 plugin->mac_tail, 998 plugin->mac_tail,
999 endpoint); 999 endpoint);
1000 1000
1001 if (NULL != endpoint->defrag) 1001 if (NULL != endpoint->defrag)
@@ -1028,7 +1028,7 @@ macendpoint_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1028 1028
1029 endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK; 1029 endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK;
1030 timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout); 1030 timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout);
1031 if (0 == timeout.rel_value_us) 1031 if (0 == timeout.rel_value_us)
1032 { 1032 {
1033 free_macendpoint (endpoint); 1033 free_macendpoint (endpoint);
1034 return; 1034 return;
@@ -1054,14 +1054,14 @@ create_macendpoint (struct Plugin *plugin,
1054 1054
1055 for (pos = plugin->mac_head; NULL != pos; pos = pos->next) 1055 for (pos = plugin->mac_head; NULL != pos; pos = pos->next)
1056 if (0 == memcmp (addr, &pos->addr, sizeof (struct WlanAddress))) 1056 if (0 == memcmp (addr, &pos->addr, sizeof (struct WlanAddress)))
1057 return pos; 1057 return pos;
1058 pos = GNUNET_malloc (sizeof (struct MacEndpoint)); 1058 pos = GNUNET_malloc (sizeof (struct MacEndpoint));
1059 pos->addr = *addr; 1059 pos->addr = *addr;
1060 pos->plugin = plugin; 1060 pos->plugin = plugin;
1061 pos->defrag = 1061 pos->defrag =
1062 GNUNET_DEFRAGMENT_context_create (plugin->env->stats, WLAN_MTU, 1062 GNUNET_DEFRAGMENT_context_create (plugin->env->stats, WLAN_MTU,
1063 MESSAGES_IN_DEFRAG_QUEUE_PER_MAC, 1063 MESSAGES_IN_DEFRAG_QUEUE_PER_MAC,
1064 pos, 1064 pos,
1065 &wlan_data_message_handler, 1065 &wlan_data_message_handler,
1066 &send_ack); 1066 &send_ack);
1067 1067
@@ -1076,7 +1076,7 @@ create_macendpoint (struct Plugin *plugin,
1076 plugin->mac_count++; 1076 plugin->mac_count++;
1077 GNUNET_STATISTICS_update (plugin->env->stats, _("# WLAN MAC endpoints allocated"), 1077 GNUNET_STATISTICS_update (plugin->env->stats, _("# WLAN MAC endpoints allocated"),
1078 1, GNUNET_NO); 1078 1, GNUNET_NO);
1079 LOG (GNUNET_ERROR_TYPE_DEBUG, 1079 LOG (GNUNET_ERROR_TYPE_DEBUG,
1080 "New MAC endpoint `%s'\n", 1080 "New MAC endpoint `%s'\n",
1081 wlan_plugin_address_to_string(NULL, addr, sizeof (struct WlanAddress))); 1081 wlan_plugin_address_to_string(NULL, addr, sizeof (struct WlanAddress)));
1082 return pos; 1082 return pos;
@@ -1091,7 +1091,7 @@ create_macendpoint (struct Plugin *plugin,
1091 * @return the network type in HBO or GNUNET_SYSERR 1091 * @return the network type in HBO or GNUNET_SYSERR
1092 */ 1092 */
1093static enum GNUNET_ATS_Network_Type 1093static enum GNUNET_ATS_Network_Type
1094wlan_get_network (void *cls, 1094wlan_get_network (void *cls,
1095 struct Session *session) 1095 struct Session *session)
1096{ 1096{
1097 GNUNET_assert (NULL != session); 1097 GNUNET_assert (NULL != session);
@@ -1196,7 +1196,7 @@ wlan_plugin_send (void *cls,
1196 size_t size = msgbuf_size + sizeof (struct WlanHeader); 1196 size_t size = msgbuf_size + sizeof (struct WlanHeader);
1197 char buf[size] GNUNET_ALIGN; 1197 char buf[size] GNUNET_ALIGN;
1198 1198
1199 LOG (GNUNET_ERROR_TYPE_DEBUG, 1199 LOG (GNUNET_ERROR_TYPE_DEBUG,
1200 "Transmitting %u bytes of payload to peer `%s' (starting with %u byte message of type %u)\n", 1200 "Transmitting %u bytes of payload to peer `%s' (starting with %u byte message of type %u)\n",
1201 msgbuf_size, 1201 msgbuf_size,
1202 GNUNET_i2s (&session->target), 1202 GNUNET_i2s (&session->target),
@@ -1256,7 +1256,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1256 switch (ntohs (hdr->type)) 1256 switch (ntohs (hdr->type))
1257 { 1257 {
1258 case GNUNET_MESSAGE_TYPE_HELLO: 1258 case GNUNET_MESSAGE_TYPE_HELLO:
1259 if (GNUNET_OK != 1259 if (GNUNET_OK !=
1260 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) hdr, &tmpsource)) 1260 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) hdr, &tmpsource))
1261 { 1261 {
1262 GNUNET_break_op (0); 1262 GNUNET_break_op (0);
@@ -1271,9 +1271,9 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1271 GNUNET_STATISTICS_update (plugin->env->stats, 1271 GNUNET_STATISTICS_update (plugin->env->stats,
1272 _("# HELLO messages received via WLAN"), 1, 1272 _("# HELLO messages received via WLAN"), 1,
1273 GNUNET_NO); 1273 GNUNET_NO);
1274 plugin->env->receive (plugin->env->cls, 1274 plugin->env->receive (plugin->env->cls,
1275 &tmpsource, 1275 &tmpsource,
1276 hdr, 1276 hdr,
1277 mas->session, 1277 mas->session,
1278 (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr, 1278 (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr,
1279 (mas->endpoint == NULL) ? 0 : sizeof (struct WlanAddress)); 1279 (mas->endpoint == NULL) ? 0 : sizeof (struct WlanAddress));
@@ -1290,7 +1290,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1290 GNUNET_break (0); 1290 GNUNET_break (0);
1291 break; 1291 break;
1292 } 1292 }
1293 LOG (GNUNET_ERROR_TYPE_DEBUG, 1293 LOG (GNUNET_ERROR_TYPE_DEBUG,
1294 "Processing %u bytes of FRAGMENT from MAC %s\n", 1294 "Processing %u bytes of FRAGMENT from MAC %s\n",
1295 (unsigned int) msize, 1295 (unsigned int) msize,
1296 wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress))); 1296 wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress)));
@@ -1312,7 +1312,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1312 ret = GNUNET_FRAGMENT_process_ack (fm->fragcontext, hdr); 1312 ret = GNUNET_FRAGMENT_process_ack (fm->fragcontext, hdr);
1313 if (GNUNET_OK == ret) 1313 if (GNUNET_OK == ret)
1314 { 1314 {
1315 LOG (GNUNET_ERROR_TYPE_DEBUG, 1315 LOG (GNUNET_ERROR_TYPE_DEBUG,
1316 "Got last ACK, finished message transmission to `%s' (%p)\n", 1316 "Got last ACK, finished message transmission to `%s' (%p)\n",
1317 wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress)), 1317 wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress)),
1318 fm); 1318 fm);
@@ -1327,13 +1327,13 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1327 } 1327 }
1328 if (GNUNET_NO == ret) 1328 if (GNUNET_NO == ret)
1329 { 1329 {
1330 LOG (GNUNET_ERROR_TYPE_DEBUG, 1330 LOG (GNUNET_ERROR_TYPE_DEBUG,
1331 "Got an ACK, message transmission to `%s' not yet finished\n", 1331 "Got an ACK, message transmission to `%s' not yet finished\n",
1332 wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress))); 1332 wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress)));
1333 break; 1333 break;
1334 } 1334 }
1335 } 1335 }
1336 LOG (GNUNET_ERROR_TYPE_DEBUG, 1336 LOG (GNUNET_ERROR_TYPE_DEBUG,
1337 "ACK not matched against any active fragmentation with MAC `%s'\n", 1337 "ACK not matched against any active fragmentation with MAC `%s'\n",
1338 wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress))); 1338 wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress)));
1339 break; 1339 break;
@@ -1347,13 +1347,13 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1347 { 1347 {
1348 GNUNET_break (0); 1348 GNUNET_break (0);
1349 break; 1349 break;
1350 } 1350 }
1351 wlanheader = (const struct WlanHeader *) hdr; 1351 wlanheader = (const struct WlanHeader *) hdr;
1352 if (0 != memcmp (&wlanheader->target, 1352 if (0 != memcmp (&wlanheader->target,
1353 plugin->env->my_identity, 1353 plugin->env->my_identity,
1354 sizeof (struct GNUNET_PeerIdentity))) 1354 sizeof (struct GNUNET_PeerIdentity)))
1355 { 1355 {
1356 LOG (GNUNET_ERROR_TYPE_DEBUG, 1356 LOG (GNUNET_ERROR_TYPE_DEBUG,
1357 "WLAN data for `%s', not for me, ignoring\n", 1357 "WLAN data for `%s', not for me, ignoring\n",
1358 GNUNET_i2s (&wlanheader->target)); 1358 GNUNET_i2s (&wlanheader->target));
1359 break; 1359 break;
@@ -1380,11 +1380,11 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1380 "Processing %u bytes of WLAN DATA from peer `%s'\n", 1380 "Processing %u bytes of WLAN DATA from peer `%s'\n",
1381 (unsigned int) msize, 1381 (unsigned int) msize,
1382 GNUNET_i2s (&wlanheader->sender)); 1382 GNUNET_i2s (&wlanheader->sender));
1383 (void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer, 1383 (void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer,
1384 &xmas, 1384 &xmas,
1385 (const char *) &wlanheader[1], 1385 (const char *) &wlanheader[1],
1386 msize - sizeof (struct WlanHeader), 1386 msize - sizeof (struct WlanHeader),
1387 GNUNET_YES, GNUNET_NO); 1387 GNUNET_YES, GNUNET_NO);
1388 break; 1388 break;
1389 default: 1389 default:
1390 if (NULL == mas->endpoint) 1390 if (NULL == mas->endpoint)
@@ -1402,9 +1402,9 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1402 (unsigned int) msize, 1402 (unsigned int) msize,
1403 (unsigned int) ntohs (hdr->type), 1403 (unsigned int) ntohs (hdr->type),
1404 GNUNET_i2s (&mas->session->target)); 1404 GNUNET_i2s (&mas->session->target));
1405 plugin->env->receive (plugin->env->cls, 1405 plugin->env->receive (plugin->env->cls,
1406 &mas->session->target, 1406 &mas->session->target,
1407 hdr, 1407 hdr,
1408 mas->session, 1408 mas->session,
1409 (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr, 1409 (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr,
1410 (mas->endpoint == NULL) ? 0 : sizeof (struct WlanAddress)); 1410 (mas->endpoint == NULL) ? 0 : sizeof (struct WlanAddress));
@@ -1478,7 +1478,7 @@ handle_helper_message (void *cls, void *client,
1478 "wlan"); 1478 "wlan");
1479 break; 1479 break;
1480 case GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER: 1480 case GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER:
1481 LOG (GNUNET_ERROR_TYPE_DEBUG, 1481 LOG (GNUNET_ERROR_TYPE_DEBUG,
1482 "Got data message from helper with %u bytes\n", 1482 "Got data message from helper with %u bytes\n",
1483 msize); 1483 msize);
1484 GNUNET_STATISTICS_update (plugin->env->stats, 1484 GNUNET_STATISTICS_update (plugin->env->stats,
@@ -1515,7 +1515,7 @@ handle_helper_message (void *cls, void *client,
1515 /* packet is FROM us, thus not FOR us */ 1515 /* packet is FROM us, thus not FOR us */
1516 break; 1516 break;
1517 } 1517 }
1518 1518
1519 GNUNET_STATISTICS_update (plugin->env->stats, 1519 GNUNET_STATISTICS_update (plugin->env->stats,
1520 _("# WLAN DATA messages processed"), 1520 _("# WLAN DATA messages processed"),
1521 1, GNUNET_NO); 1521 1, GNUNET_NO);
@@ -1527,7 +1527,7 @@ handle_helper_message (void *cls, void *client,
1527 wa.options = htonl (0); 1527 wa.options = htonl (0);
1528 mas.endpoint = create_macendpoint (plugin, &wa); 1528 mas.endpoint = create_macendpoint (plugin, &wa);
1529 mas.session = NULL; 1529 mas.session = NULL;
1530 (void) GNUNET_SERVER_mst_receive (plugin->helper_payload_tokenizer, 1530 (void) GNUNET_SERVER_mst_receive (plugin->helper_payload_tokenizer,
1531 &mas, 1531 &mas,
1532 (const char*) &rxinfo[1], 1532 (const char*) &rxinfo[1],
1533 msize - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage), 1533 msize - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage),
@@ -1535,7 +1535,7 @@ handle_helper_message (void *cls, void *client,
1535 break; 1535 break;
1536 default: 1536 default:
1537 GNUNET_break (0); 1537 GNUNET_break (0);
1538 LOG (GNUNET_ERROR_TYPE_DEBUG, 1538 LOG (GNUNET_ERROR_TYPE_DEBUG,
1539 "Unexpected message of type %u (%u bytes)", 1539 "Unexpected message of type %u (%u bytes)",
1540 ntohs (hdr->type), ntohs (hdr->size)); 1540 ntohs (hdr->type), ntohs (hdr->size));
1541 break; 1541 break;
@@ -1568,7 +1568,7 @@ send_hello_beacon (void *cls,
1568 { 1568 {
1569 char buf[size] GNUNET_ALIGN; 1569 char buf[size] GNUNET_ALIGN;
1570 1570
1571 LOG (GNUNET_ERROR_TYPE_DEBUG, 1571 LOG (GNUNET_ERROR_TYPE_DEBUG,
1572 "Sending %u byte HELLO beacon\n", 1572 "Sending %u byte HELLO beacon\n",
1573 (unsigned int) size); 1573 (unsigned int) size);
1574 radioHeader = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage*) buf; 1574 radioHeader = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage*) buf;
@@ -1612,13 +1612,13 @@ wlan_plugin_address_suggested (void *cls, const void *addr, size_t addrlen)
1612 struct WlanAddress *wa = (struct WlanAddress *) addr; 1612 struct WlanAddress *wa = (struct WlanAddress *) addr;
1613 1613
1614 if (addrlen != sizeof (struct WlanAddress)) 1614 if (addrlen != sizeof (struct WlanAddress))
1615 { 1615 {
1616 GNUNET_break_op (0); 1616 GNUNET_break_op (0);
1617 return GNUNET_SYSERR; 1617 return GNUNET_SYSERR;
1618 } 1618 }
1619 if (GNUNET_YES != plugin->have_mac) 1619 if (GNUNET_YES != plugin->have_mac)
1620 { 1620 {
1621 LOG (GNUNET_ERROR_TYPE_DEBUG, 1621 LOG (GNUNET_ERROR_TYPE_DEBUG,
1622 "Rejecting MAC `%s': I don't know my MAC!\n", 1622 "Rejecting MAC `%s': I don't know my MAC!\n",
1623 mac_to_string (addr)); 1623 mac_to_string (addr));
1624 return GNUNET_NO; /* don't know my MAC */ 1624 return GNUNET_NO; /* don't know my MAC */
@@ -1627,7 +1627,7 @@ wlan_plugin_address_suggested (void *cls, const void *addr, size_t addrlen)
1627 &plugin->mac_address, 1627 &plugin->mac_address,
1628 sizeof (wa->mac))) 1628 sizeof (wa->mac)))
1629 { 1629 {
1630 LOG (GNUNET_ERROR_TYPE_DEBUG, 1630 LOG (GNUNET_ERROR_TYPE_DEBUG,
1631 "Rejecting MAC `%s': not my MAC!\n", 1631 "Rejecting MAC `%s': not my MAC!\n",
1632 mac_to_string (addr)); 1632 mac_to_string (addr));
1633 return GNUNET_NO; /* not my MAC */ 1633 return GNUNET_NO; /* not my MAC */
@@ -1705,7 +1705,7 @@ wlan_plugin_address_pretty_printer (void *cls, const char *type,
1705 1705
1706 1706
1707/** 1707/**
1708 * Exit point from the plugin. 1708 * Exit point from the plugin.
1709 * 1709 *
1710 * @param cls pointer to the api struct 1710 * @param cls pointer to the api struct
1711 */ 1711 */
@@ -1861,7 +1861,7 @@ libgnunet_plugin_transport_wlan_init (void *cls)
1861 1861
1862 testmode = 0; 1862 testmode = 0;
1863 /* check configuration */ 1863 /* check configuration */
1864 if ( (GNUNET_YES == 1864 if ( (GNUNET_YES ==
1865 GNUNET_CONFIGURATION_have_value (env->cfg, "transport-wlan", "TESTMODE")) && 1865 GNUNET_CONFIGURATION_have_value (env->cfg, "transport-wlan", "TESTMODE")) &&
1866 ( (GNUNET_SYSERR == 1866 ( (GNUNET_SYSERR ==
1867 GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-wlan", 1867 GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-wlan",
@@ -1890,7 +1890,7 @@ libgnunet_plugin_transport_wlan_init (void *cls)
1890 { 1890 {
1891 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, 1891 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
1892 "transport-wlan", "INTERFACE"); 1892 "transport-wlan", "INTERFACE");
1893 return NULL; 1893 return NULL;
1894 } 1894 }
1895 1895
1896 plugin = GNUNET_malloc (sizeof (struct Plugin)); 1896 plugin = GNUNET_malloc (sizeof (struct Plugin));
@@ -1906,7 +1906,7 @@ libgnunet_plugin_transport_wlan_init (void *cls)
1906 plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); 1906 plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin);
1907 plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); 1907 plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin);
1908 plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); 1908 plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin);
1909 plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon, 1909 plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon,
1910 plugin); 1910 plugin);
1911 1911
1912 plugin->options = 0; 1912 plugin->options = 0;
@@ -1914,7 +1914,7 @@ libgnunet_plugin_transport_wlan_init (void *cls)
1914 /* some compilers do not like switch on 'long long'... */ 1914 /* some compilers do not like switch on 'long long'... */
1915 switch ((unsigned int) testmode) 1915 switch ((unsigned int) testmode)
1916 { 1916 {
1917 case 0: /* normal */ 1917 case 0: /* normal */
1918 plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan"; 1918 plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan";
1919 plugin->helper_argv[1] = interface; 1919 plugin->helper_argv[1] = interface;
1920 plugin->helper_argv[2] = NULL; 1920 plugin->helper_argv[2] = NULL;
diff --git a/src/transport/plugin_transport_wlan.h b/src/transport/plugin_transport_wlan.h
index 044c6818a..c265edcab 100644
--- a/src/transport/plugin_transport_wlan.h
+++ b/src/transport/plugin_transport_wlan.h
@@ -41,7 +41,7 @@
41 41
42/** 42/**
43 * Value for "Management" in the 'frame_control' field of the 43 * Value for "Management" in the 'frame_control' field of the
44 * struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame. 44 * struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame.
45 */ 45 */
46#define IEEE80211_FC0_TYPE_MGT 0x00 46#define IEEE80211_FC0_TYPE_MGT 0x00
47 47
diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c
index 816b40a2e..06cd27f9c 100644
--- a/src/transport/test_plugin_transport.c
+++ b/src/transport/test_plugin_transport.c
@@ -498,7 +498,7 @@ env_get_our_hello ()
498} 498}
499 499
500 500
501static void 501static void
502env_session_end (void *cls, 502env_session_end (void *cls,
503 const struct GNUNET_PeerIdentity *peer, 503 const struct GNUNET_PeerIdentity *peer,
504 struct Session * session) 504 struct Session * session)
diff --git a/src/transport/test_transport_api_limited_sockets.c b/src/transport/test_transport_api_limited_sockets.c
index b7a230283..511422aa6 100644
--- a/src/transport/test_transport_api_limited_sockets.c
+++ b/src/transport/test_transport_api_limited_sockets.c
@@ -339,7 +339,7 @@ main (int argc, char *argv[])
339 return ret; 339 return ret;
340} 340}
341 341
342#else 342#else
343/* cannot setrlimit */ 343/* cannot setrlimit */
344 344
345 345
diff --git a/src/transport/test_transport_api_timeout.c b/src/transport/test_transport_api_timeout.c
index 908374cb7..01af9f81b 100644
--- a/src/transport/test_transport_api_timeout.c
+++ b/src/transport/test_transport_api_timeout.c
@@ -112,7 +112,7 @@ end ()
112 ok = disconnects; 112 ok = disconnects;
113 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 113 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
114 "Fail! Had %u disconnects while waiting %s\n", 114 "Fail! Had %u disconnects while waiting %s\n",
115 disconnects, 115 disconnects,
116 GNUNET_STRINGS_relative_time_to_string (WAIT, 116 GNUNET_STRINGS_relative_time_to_string (WAIT,
117 GNUNET_YES)); 117 GNUNET_YES));
118 } 118 }
@@ -223,7 +223,7 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
223 223
224 shutdown_flag = GNUNET_NO; 224 shutdown_flag = GNUNET_NO;
225 225
226 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 226 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
227 "Waiting for %s\n", 227 "Waiting for %s\n",
228 GNUNET_STRINGS_relative_time_to_string (WAIT, 228 GNUNET_STRINGS_relative_time_to_string (WAIT,
229 GNUNET_YES)); 229 GNUNET_YES));
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c
index cb6cefdb1..86ce454e5 100644
--- a/src/transport/transport_api.c
+++ b/src/transport/transport_api.c
@@ -437,7 +437,7 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h,
437 * GNUNET_NO if not. 437 * GNUNET_NO if not.
438 */ 438 */
439static int 439static int
440neighbour_delete (void *cls, 440neighbour_delete (void *cls,
441 const struct GNUNET_PeerIdentity *key, void *value) 441 const struct GNUNET_PeerIdentity *key, void *value)
442{ 442{
443 struct GNUNET_TRANSPORT_Handle *handle = cls; 443 struct GNUNET_TRANSPORT_Handle *handle = cls;
@@ -1341,7 +1341,7 @@ GNUNET_TRANSPORT_check_neighbour_connected (struct GNUNET_TRANSPORT_Handle *hand
1341{ 1341{
1342 GNUNET_assert (NULL != handle); 1342 GNUNET_assert (NULL != handle);
1343 GNUNET_assert (NULL != peer); 1343 GNUNET_assert (NULL != peer);
1344 1344
1345 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (handle->neighbours, peer)) 1345 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (handle->neighbours, peer))
1346 return GNUNET_YES; 1346 return GNUNET_YES;
1347 else 1347 else
@@ -1364,7 +1364,7 @@ call_hello_update_cb_async (void *cls,
1364 GNUNET_assert (NULL != ghh->handle->my_hello); 1364 GNUNET_assert (NULL != ghh->handle->my_hello);
1365 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != ghh->notify_task); 1365 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != ghh->notify_task);
1366 ghh->notify_task = GNUNET_SCHEDULER_NO_TASK; 1366 ghh->notify_task = GNUNET_SCHEDULER_NO_TASK;
1367 ghh->rec (ghh->rec_cls, 1367 ghh->rec (ghh->rec_cls,
1368 (const struct GNUNET_MessageHeader *) ghh->handle->my_hello); 1368 (const struct GNUNET_MessageHeader *) ghh->handle->my_hello);
1369} 1369}
1370 1370
@@ -1564,7 +1564,7 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle,
1564 delay.rel_value_us = 0; /* notify immediately (with failure) */ 1564 delay.rel_value_us = 0; /* notify immediately (with failure) */
1565 LOG (GNUNET_ERROR_TYPE_DEBUG, 1565 LOG (GNUNET_ERROR_TYPE_DEBUG,
1566 "Bandwidth tracker allows next transmission to peer %s in %s\n", 1566 "Bandwidth tracker allows next transmission to peer %s in %s\n",
1567 GNUNET_i2s (target), 1567 GNUNET_i2s (target),
1568 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); 1568 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
1569 n->hn = GNUNET_CONTAINER_heap_insert (handle->ready_heap, n, delay.rel_value_us); 1569 n->hn = GNUNET_CONTAINER_heap_insert (handle->ready_heap, n, delay.rel_value_us);
1570 schedule_transmission (handle); 1570 schedule_transmission (handle);
diff --git a/src/transport/transport_api_address_lookup.c b/src/transport/transport_api_address_lookup.c
index 9c1301ed2..515be9bf8 100644
--- a/src/transport/transport_api_address_lookup.c
+++ b/src/transport/transport_api_address_lookup.c
@@ -70,7 +70,7 @@ struct GNUNET_TRANSPORT_PeerIterateContext
70 * Backoff for reconnect. 70 * Backoff for reconnect.
71 */ 71 */
72 struct GNUNET_TIME_Relative backoff; 72 struct GNUNET_TIME_Relative backoff;
73 73
74 /** 74 /**
75 * Task ID for reconnect. 75 * Task ID for reconnect.
76 */ 76 */
@@ -116,7 +116,7 @@ send_request (struct GNUNET_TRANSPORT_PeerIterateContext *pal_ctx)
116 msg.timeout = GNUNET_TIME_absolute_hton (pal_ctx->timeout); 116 msg.timeout = GNUNET_TIME_absolute_hton (pal_ctx->timeout);
117 msg.peer = pal_ctx->peer; 117 msg.peer = pal_ctx->peer;
118 GNUNET_assert (GNUNET_OK == 118 GNUNET_assert (GNUNET_OK ==
119 GNUNET_CLIENT_transmit_and_get_response (pal_ctx->client, 119 GNUNET_CLIENT_transmit_and_get_response (pal_ctx->client,
120 &msg.header, 120 &msg.header,
121 GNUNET_TIME_absolute_get_remaining (pal_ctx->timeout), 121 GNUNET_TIME_absolute_get_remaining (pal_ctx->timeout),
122 GNUNET_YES, 122 GNUNET_YES,
@@ -126,7 +126,7 @@ send_request (struct GNUNET_TRANSPORT_PeerIterateContext *pal_ctx)
126 126
127/** 127/**
128 * Task run to re-establish the connection. 128 * Task run to re-establish the connection.
129 * 129 *
130 * @param cls our 'struct GNUNET_TRANSPORT_PeerAddressLookupContext*' 130 * @param cls our 'struct GNUNET_TRANSPORT_PeerAddressLookupContext*'
131 * @param tc scheduler context, unused 131 * @param tc scheduler context, unused
132 */ 132 */
@@ -329,7 +329,7 @@ GNUNET_TRANSPORT_peer_get_active_addresses (const struct
329 pal_ctx->timeout = GNUNET_TIME_relative_to_absolute (timeout); 329 pal_ctx->timeout = GNUNET_TIME_relative_to_absolute (timeout);
330 if (NULL != peer) 330 if (NULL != peer)
331 pal_ctx->peer = *peer; 331 pal_ctx->peer = *peer;
332 pal_ctx->one_shot = one_shot; 332 pal_ctx->one_shot = one_shot;
333 pal_ctx->client = client; 333 pal_ctx->client = client;
334 send_request (pal_ctx); 334 send_request (pal_ctx);
335 335
diff --git a/src/tun/regex.c b/src/tun/regex.c
index 61d0b3e18..87e75b511 100644
--- a/src/tun/regex.c
+++ b/src/tun/regex.c
@@ -40,13 +40,13 @@ static void
40iptobinstr (const int af, const void *addr, char *str) 40iptobinstr (const int af, const void *addr, char *str)
41{ 41{
42 int i; 42 int i;
43 43
44 switch (af) 44 switch (af)
45 { 45 {
46 case AF_INET: 46 case AF_INET:
47 { 47 {
48 uint32_t b = htonl (((struct in_addr *) addr)->s_addr); 48 uint32_t b = htonl (((struct in_addr *) addr)->s_addr);
49 49
50 str[32] = '\0'; 50 str[32] = '\0';
51 str += 31; 51 str += 31;
52 for (i = 31; i >= 0; i--) 52 for (i = 31; i >= 0; i--)
@@ -60,7 +60,7 @@ iptobinstr (const int af, const void *addr, char *str)
60 case AF_INET6: 60 case AF_INET6:
61 { 61 {
62 struct in6_addr b = *(const struct in6_addr *) addr; 62 struct in6_addr b = *(const struct in6_addr *) addr;
63 63
64 str[128] = '\0'; 64 str[128] = '\0';
65 str += 127; 65 str += 127;
66 for (i = 127; i >= 0; i--) 66 for (i = 127; i >= 0; i--)
@@ -88,7 +88,7 @@ ipv4netmasktoprefixlen (const char *netmask)
88 struct in_addr a; 88 struct in_addr a;
89 unsigned int len; 89 unsigned int len;
90 uint32_t t; 90 uint32_t t;
91 91
92 if (1 != inet_pton (AF_INET, netmask, &a)) 92 if (1 != inet_pton (AF_INET, netmask, &a))
93 return 0; 93 return 0;
94 len = 32; 94 len = 32;
@@ -111,7 +111,7 @@ GNUNET_TUN_ipv4toregexsearch (const struct in_addr *ip, const char *netmask,
111 char *rxstr) 111 char *rxstr)
112{ 112{
113 unsigned int pfxlen; 113 unsigned int pfxlen;
114 114
115 pfxlen = ipv4netmasktoprefixlen (netmask); 115 pfxlen = ipv4netmasktoprefixlen (netmask);
116 iptobinstr (AF_INET, ip, rxstr); 116 iptobinstr (AF_INET, ip, rxstr);
117 rxstr[pfxlen] = '\0'; 117 rxstr[pfxlen] = '\0';
diff --git a/src/tun/test_tun.c b/src/tun/test_tun.c
index 3539fd177..71737d8f0 100644
--- a/src/tun/test_tun.c
+++ b/src/tun/test_tun.c
@@ -56,7 +56,7 @@ test_udp (size_t pll,
56 pll); 56 pll);
57 if (crc != ntohs (udp.crc)) 57 if (crc != ntohs (udp.crc))
58 { 58 {
59 fprintf (stderr, "Got CRC: %u, wanted: %u\n", 59 fprintf (stderr, "Got CRC: %u, wanted: %u\n",
60 ntohs (udp.crc), 60 ntohs (udp.crc),
61 crc); 61 crc);
62 ret = 1; 62 ret = 1;
diff --git a/src/tun/tun.c b/src/tun/tun.c
index 3b0e9b94a..ed3aef1c1 100644
--- a/src/tun/tun.c
+++ b/src/tun/tun.c
@@ -55,7 +55,7 @@ GNUNET_TUN_initialize_ipv4_header (struct GNUNET_TUN_IPv4Header *ip,
55 ip->header_length = sizeof (struct GNUNET_TUN_IPv4Header) / 4; 55 ip->header_length = sizeof (struct GNUNET_TUN_IPv4Header) / 4;
56 ip->version = 4; 56 ip->version = 4;
57 ip->total_length = htons (sizeof (struct GNUNET_TUN_IPv4Header) + payload_length); 57 ip->total_length = htons (sizeof (struct GNUNET_TUN_IPv4Header) + payload_length);
58 ip->identification = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 58 ip->identification = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
59 65536); 59 65536);
60 ip->ttl = FRESH_TTL; 60 ip->ttl = FRESH_TTL;
61 ip->protocol = protocol; 61 ip->protocol = protocol;
@@ -89,7 +89,7 @@ GNUNET_TUN_initialize_ipv6_header (struct GNUNET_TUN_IPv6Header *ip,
89 ip->payload_length = htons ((uint16_t) payload_length); 89 ip->payload_length = htons ((uint16_t) payload_length);
90 ip->hop_limit = FRESH_TTL; 90 ip->hop_limit = FRESH_TTL;
91 ip->destination_address = *dst; 91 ip->destination_address = *dst;
92 ip->source_address = *src; 92 ip->source_address = *src;
93} 93}
94 94
95 95
@@ -116,7 +116,7 @@ GNUNET_TUN_calculate_tcp4_checksum (const struct GNUNET_TUN_IPv4Header *ip,
116 GNUNET_assert (IPPROTO_TCP == ip->protocol); 116 GNUNET_assert (IPPROTO_TCP == ip->protocol);
117 117
118 tcp->crc = 0; 118 tcp->crc = 0;
119 sum = GNUNET_CRYPTO_crc16_step (0, 119 sum = GNUNET_CRYPTO_crc16_step (0,
120 &ip->source_address, 120 &ip->source_address,
121 sizeof (struct in_addr) * 2); 121 sizeof (struct in_addr) * 2);
122 tmp = htons (IPPROTO_TCP); 122 tmp = htons (IPPROTO_TCP);
@@ -186,21 +186,21 @@ GNUNET_TUN_calculate_udp4_checksum (const struct GNUNET_TUN_IPv4Header *ip,
186 GNUNET_assert (IPPROTO_UDP == ip->protocol); 186 GNUNET_assert (IPPROTO_UDP == ip->protocol);
187 187
188 udp->crc = 0; /* technically optional, but we calculate it anyway, just to be sure */ 188 udp->crc = 0; /* technically optional, but we calculate it anyway, just to be sure */
189 sum = GNUNET_CRYPTO_crc16_step (0, 189 sum = GNUNET_CRYPTO_crc16_step (0,
190 &ip->source_address, 190 &ip->source_address,
191 sizeof (struct in_addr) * 2); 191 sizeof (struct in_addr) * 2);
192 tmp = htons (IPPROTO_UDP); 192 tmp = htons (IPPROTO_UDP);
193 sum = GNUNET_CRYPTO_crc16_step (sum, 193 sum = GNUNET_CRYPTO_crc16_step (sum,
194 &tmp, 194 &tmp,
195 sizeof (uint16_t)); 195 sizeof (uint16_t));
196 tmp = htons (sizeof (struct GNUNET_TUN_UdpHeader) + payload_length); 196 tmp = htons (sizeof (struct GNUNET_TUN_UdpHeader) + payload_length);
197 sum = GNUNET_CRYPTO_crc16_step (sum, 197 sum = GNUNET_CRYPTO_crc16_step (sum,
198 &tmp, 198 &tmp,
199 sizeof (uint16_t)); 199 sizeof (uint16_t));
200 sum = GNUNET_CRYPTO_crc16_step (sum, 200 sum = GNUNET_CRYPTO_crc16_step (sum,
201 udp, 201 udp,
202 sizeof (struct GNUNET_TUN_UdpHeader)); 202 sizeof (struct GNUNET_TUN_UdpHeader));
203 sum = GNUNET_CRYPTO_crc16_step (sum, 203 sum = GNUNET_CRYPTO_crc16_step (sum,
204 payload, 204 payload,
205 payload_length); 205 payload_length);
206 udp->crc = GNUNET_CRYPTO_crc16_finish (sum); 206 udp->crc = GNUNET_CRYPTO_crc16_finish (sum);
diff --git a/src/util/bandwidth.c b/src/util/bandwidth.c
index 5caaec03c..79497ad51 100644
--- a/src/util/bandwidth.c
+++ b/src/util/bandwidth.c
@@ -254,7 +254,7 @@ GNUNET_BANDWIDTH_tracker_get_delay (struct GNUNET_BANDWIDTH_Tracker *av,
254 254
255 if (av->available_bytes_per_s__ == 0) 255 if (av->available_bytes_per_s__ == 0)
256 { 256 {
257 LOG (GNUNET_ERROR_TYPE_DEBUG, 257 LOG (GNUNET_ERROR_TYPE_DEBUG,
258 "Tracker %p delay is infinity\n", av); 258 "Tracker %p delay is infinity\n", av);
259 return GNUNET_TIME_UNIT_FOREVER_REL; 259 return GNUNET_TIME_UNIT_FOREVER_REL;
260 } 260 }
@@ -270,9 +270,9 @@ GNUNET_BANDWIDTH_tracker_get_delay (struct GNUNET_BANDWIDTH_Tracker *av,
270 ret.rel_value_us = 270 ret.rel_value_us =
271 (1000LL * 1000LL * bytes_needed) / 271 (1000LL * 1000LL * bytes_needed) /
272 (unsigned long long) av->available_bytes_per_s__; 272 (unsigned long long) av->available_bytes_per_s__;
273 LOG (GNUNET_ERROR_TYPE_DEBUG, 273 LOG (GNUNET_ERROR_TYPE_DEBUG,
274 "Tracker %p delay for %u bytes is %s\n", 274 "Tracker %p delay for %u bytes is %s\n",
275 av, (unsigned int) size, 275 av, (unsigned int) size,
276 GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES)); 276 GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES));
277 return ret; 277 return ret;
278} 278}
@@ -321,7 +321,7 @@ GNUNET_BANDWIDTH_tracker_update_quota (struct GNUNET_BANDWIDTH_Tracker *av,
321 uint32_t new_limit; 321 uint32_t new_limit;
322 322
323 new_limit = ntohl (bytes_per_second_limit.value__); 323 new_limit = ntohl (bytes_per_second_limit.value__);
324 LOG (GNUNET_ERROR_TYPE_DEBUG, 324 LOG (GNUNET_ERROR_TYPE_DEBUG,
325 "Tracker %p bandwidth changed to %u Bps\n", av, 325 "Tracker %p bandwidth changed to %u Bps\n", av,
326 (unsigned int) new_limit); 326 (unsigned int) new_limit);
327 update_tracker (av); 327 update_tracker (av);
diff --git a/src/util/bio.c b/src/util/bio.c
index 0a1c213f3..2514a266f 100644
--- a/src/util/bio.c
+++ b/src/util/bio.c
@@ -30,7 +30,7 @@
30 30
31/** 31/**
32 * Size for I/O buffers. 32 * Size for I/O buffers.
33 */ 33 */
34#define BIO_BUFFER_SIZE 65536 34#define BIO_BUFFER_SIZE 65536
35 35
36/** 36/**
@@ -135,7 +135,7 @@ GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h,
135 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure 135 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
136 */ 136 */
137int 137int
138GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, 138GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h,
139 const char *what, 139 const char *what,
140 void *result, size_t len) 140 void *result, size_t len)
141{ 141{
@@ -175,7 +175,7 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h,
175 if (0 == ret) 175 if (0 == ret)
176 { 176 {
177 GNUNET_asprintf (&h->emsg, 177 GNUNET_asprintf (&h->emsg,
178 _("Error reading `%s': %s"), 178 _("Error reading `%s': %s"),
179 what, 179 what,
180 _("End of file")); 180 _("End of file"));
181 return GNUNET_SYSERR; 181 return GNUNET_SYSERR;
@@ -199,10 +199,10 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h,
199 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure 199 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
200 */ 200 */
201int 201int
202GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, 202GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h,
203 const char *file, 203 const char *file,
204 int line, 204 int line,
205 void *result, 205 void *result,
206 size_t len) 206 size_t len)
207{ 207{
208 char what[1024]; 208 char what[1024];
@@ -225,7 +225,7 @@ GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h,
225int 225int
226GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, 226GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h,
227 const char *what, 227 const char *what,
228 char **result, 228 char **result,
229 size_t max_length) 229 size_t max_length)
230{ 230{
231 char *buf; 231 char *buf;
@@ -272,7 +272,7 @@ GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h,
272 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure 272 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
273 */ 273 */
274int 274int
275GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, 275GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h,
276 const char *what, 276 const char *what,
277 struct GNUNET_CONTAINER_MetaData **result) 277 struct GNUNET_CONTAINER_MetaData **result)
278{ 278{
@@ -345,9 +345,9 @@ GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, const char *file,
345 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 345 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
346 */ 346 */
347int 347int
348GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, 348GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h,
349 const char *file, 349 const char *file,
350 int line, 350 int line,
351 int64_t *i) 351 int64_t *i)
352{ 352{
353 int64_t big; 353 int64_t big;
@@ -368,7 +368,7 @@ struct GNUNET_BIO_WriteHandle
368 * Underlying file handle. 368 * Underlying file handle.
369 */ 369 */
370 struct GNUNET_DISK_FileHandle *fd; 370 struct GNUNET_DISK_FileHandle *fd;
371 371
372 /** 372 /**
373 * I/O buffer. Do not free, allocated at the end of the struct. 373 * I/O buffer. Do not free, allocated at the end of the struct.
374 */ 374 */
@@ -504,7 +504,7 @@ GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer,
504 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 504 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
505 */ 505 */
506int 506int
507GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, 507GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h,
508 const char *s) 508 const char *s)
509{ 509{
510 uint32_t slen; 510 uint32_t slen;
@@ -562,7 +562,7 @@ GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h,
562 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 562 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
563 */ 563 */
564int 564int
565GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, 565GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h,
566 int32_t i) 566 int32_t i)
567{ 567{
568 int32_t big; 568 int32_t big;
@@ -580,7 +580,7 @@ GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h,
580 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 580 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
581 */ 581 */
582int 582int
583GNUNET_BIO_write_int64 (struct GNUNET_BIO_WriteHandle *h, 583GNUNET_BIO_write_int64 (struct GNUNET_BIO_WriteHandle *h,
584 int64_t i) 584 int64_t i)
585{ 585{
586 int64_t big; 586 int64_t big;
diff --git a/src/util/client.c b/src/util/client.c
index 30c80bf03..5b753ec74 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -251,8 +251,8 @@ try_unixpath (const char *service_name,
251 struct sockaddr_un s_un; 251 struct sockaddr_un s_un;
252 252
253 unixpath = NULL; 253 unixpath = NULL;
254 if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) && 254 if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) &&
255 (0 < strlen (unixpath))) 255 (0 < strlen (unixpath)))
256 { 256 {
257 /* We have a non-NULL unixpath, need to validate it */ 257 /* We have a non-NULL unixpath, need to validate it */
258 if (strlen (unixpath) >= sizeof (s_un.sun_path)) 258 if (strlen (unixpath) >= sizeof (s_un.sun_path))
@@ -299,8 +299,8 @@ test_service_configuration (const char *service_name,
299#if AF_UNIX 299#if AF_UNIX
300 char *unixpath = NULL; 300 char *unixpath = NULL;
301 301
302 if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) && 302 if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) &&
303 (0 < strlen (unixpath))) 303 (0 < strlen (unixpath)))
304 ret = GNUNET_OK; 304 ret = GNUNET_OK;
305 GNUNET_free_non_null (unixpath); 305 GNUNET_free_non_null (unixpath);
306#endif 306#endif
@@ -308,7 +308,7 @@ test_service_configuration (const char *service_name,
308 if ( (GNUNET_YES == 308 if ( (GNUNET_YES ==
309 GNUNET_CONFIGURATION_have_value (cfg, service_name, "PORT")) && 309 GNUNET_CONFIGURATION_have_value (cfg, service_name, "PORT")) &&
310 (GNUNET_OK == 310 (GNUNET_OK ==
311 GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "PORT", &port)) && 311 GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "PORT", &port)) &&
312 (port <= 65535) && (0 != port) && 312 (port <= 65535) && (0 != port) &&
313 (GNUNET_OK == 313 (GNUNET_OK ==
314 GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "HOSTNAME", 314 GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "HOSTNAME",
@@ -406,7 +406,7 @@ GNUNET_CLIENT_connect (const char *service_name,
406 struct GNUNET_CLIENT_Connection *client; 406 struct GNUNET_CLIENT_Connection *client;
407 struct GNUNET_CONNECTION_Handle *connection; 407 struct GNUNET_CONNECTION_Handle *connection;
408 408
409 if (GNUNET_OK != 409 if (GNUNET_OK !=
410 test_service_configuration (service_name, 410 test_service_configuration (service_name,
411 cfg)) 411 cfg))
412 return NULL; 412 return NULL;
@@ -629,7 +629,7 @@ GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *client,
629/** 629/**
630 * Handle for a test to check if a service is running. 630 * Handle for a test to check if a service is running.
631 */ 631 */
632struct GNUNET_CLIENT_TestHandle 632struct GNUNET_CLIENT_TestHandle
633{ 633{
634 /** 634 /**
635 * Function to call with the result of the test. 635 * Function to call with the result of the test.
@@ -643,7 +643,7 @@ struct GNUNET_CLIENT_TestHandle
643 643
644 /** 644 /**
645 * Client connection we are using for the test, if any. 645 * Client connection we are using for the test, if any.
646 */ 646 */
647 struct GNUNET_CLIENT_Connection *client; 647 struct GNUNET_CLIENT_Connection *client;
648 648
649 /** 649 /**
@@ -707,7 +707,7 @@ report_result (void *cls,
707 const struct GNUNET_SCHEDULER_TaskContext *tc) 707 const struct GNUNET_SCHEDULER_TaskContext *tc)
708{ 708{
709 struct GNUNET_CLIENT_TestHandle *th = cls; 709 struct GNUNET_CLIENT_TestHandle *th = cls;
710 710
711 th->task = GNUNET_SCHEDULER_NO_TASK; 711 th->task = GNUNET_SCHEDULER_NO_TASK;
712 th->cb (th->cb_cls, th->result); 712 th->cb (th->cb_cls, th->result);
713 GNUNET_CLIENT_service_test_cancel (th); 713 GNUNET_CLIENT_service_test_cancel (th);
@@ -726,7 +726,7 @@ service_test_report (struct GNUNET_CLIENT_TestHandle *th,
726{ 726{
727 th->result = result; 727 th->result = result;
728 th->task = GNUNET_SCHEDULER_add_now (&report_result, 728 th->task = GNUNET_SCHEDULER_add_now (&report_result,
729 th); 729 th);
730} 730}
731 731
732 732
@@ -775,18 +775,18 @@ write_test (void *cls, size_t size, void *buf)
775 th->th = NULL; 775 th->th = NULL;
776 if (size < sizeof (struct GNUNET_MessageHeader)) 776 if (size < sizeof (struct GNUNET_MessageHeader))
777 { 777 {
778 LOG (GNUNET_ERROR_TYPE_DEBUG, 778 LOG (GNUNET_ERROR_TYPE_DEBUG,
779 "Failed to transmit TEST request.\n"); 779 "Failed to transmit TEST request.\n");
780 service_test_report (th, GNUNET_NO); 780 service_test_report (th, GNUNET_NO);
781 return 0; /* client disconnected */ 781 return 0; /* client disconnected */
782 } 782 }
783 LOG (GNUNET_ERROR_TYPE_DEBUG, 783 LOG (GNUNET_ERROR_TYPE_DEBUG,
784 "Transmitting `%s' request.\n", 784 "Transmitting `%s' request.\n",
785 "TEST"); 785 "TEST");
786 msg = (struct GNUNET_MessageHeader *) buf; 786 msg = (struct GNUNET_MessageHeader *) buf;
787 msg->type = htons (GNUNET_MESSAGE_TYPE_TEST); 787 msg->type = htons (GNUNET_MESSAGE_TYPE_TEST);
788 msg->size = htons (sizeof (struct GNUNET_MessageHeader)); 788 msg->size = htons (sizeof (struct GNUNET_MessageHeader));
789 GNUNET_CLIENT_receive (th->client, 789 GNUNET_CLIENT_receive (th->client,
790 &confirm_handler, th, 790 &confirm_handler, th,
791 GNUNET_TIME_absolute_get_remaining 791 GNUNET_TIME_absolute_get_remaining
792 (th->test_deadline)); 792 (th->test_deadline));
@@ -822,7 +822,7 @@ GNUNET_CLIENT_service_test (const char *service,
822 th->cb = cb; 822 th->cb = cb;
823 th->cb_cls = cb_cls; 823 th->cb_cls = cb_cls;
824 th->test_deadline = GNUNET_TIME_relative_to_absolute (timeout); 824 th->test_deadline = GNUNET_TIME_relative_to_absolute (timeout);
825 LOG (GNUNET_ERROR_TYPE_DEBUG, 825 LOG (GNUNET_ERROR_TYPE_DEBUG,
826 "Testing if service `%s' is running.\n", 826 "Testing if service `%s' is running.\n",
827 service); 827 service);
828#ifdef AF_UNIX 828#ifdef AF_UNIX
@@ -874,7 +874,7 @@ GNUNET_CLIENT_service_test (const char *service,
874 service_test_report (th, GNUNET_YES); 874 service_test_report (th, GNUNET_YES);
875 return th; 875 return th;
876 } 876 }
877 (void) GNUNET_NETWORK_socket_close (sock); 877 (void) GNUNET_NETWORK_socket_close (sock);
878 /* let's try IP */ 878 /* let's try IP */
879 } 879 }
880 } 880 }
@@ -1026,7 +1026,7 @@ client_delayed_retry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1026{ 1026{
1027 struct GNUNET_CLIENT_TransmitHandle *th = cls; 1027 struct GNUNET_CLIENT_TransmitHandle *th = cls;
1028 struct GNUNET_TIME_Relative delay; 1028 struct GNUNET_TIME_Relative delay;
1029 1029
1030 th->reconnect_task = GNUNET_SCHEDULER_NO_TASK; 1030 th->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
1031 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1031 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1032 { 1032 {
@@ -1116,7 +1116,7 @@ client_notify (void *cls, size_t size, void *buf)
1116 { 1116 {
1117 GNUNET_CONNECTION_receive_cancel (client->connection); 1117 GNUNET_CONNECTION_receive_cancel (client->connection);
1118 client->in_receive = GNUNET_NO; 1118 client->in_receive = GNUNET_NO;
1119 } 1119 }
1120 GNUNET_CONNECTION_destroy (client->connection); 1120 GNUNET_CONNECTION_destroy (client->connection);
1121 client->connection = NULL; 1121 client->connection = NULL;
1122 delay = GNUNET_TIME_relative_min (delay, client->back_off); 1122 delay = GNUNET_TIME_relative_min (delay, client->back_off);
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c
index 27dda5e59..5ff92edc3 100644
--- a/src/util/common_allocation.c
+++ b/src/util/common_allocation.c
@@ -224,9 +224,9 @@ GNUNET_xfree_ (void *ptr, const char *filename, int linenumber)
224 { 224 {
225 const uint64_t baadfood = GNUNET_ntohll (0xBAADF00DBAADF00DLL); 225 const uint64_t baadfood = GNUNET_ntohll (0xBAADF00DBAADF00DLL);
226 uint64_t *base = ptr; 226 uint64_t *base = ptr;
227 size_t s = M_SIZE (ptr); 227 size_t s = M_SIZE (ptr);
228 size_t i; 228 size_t i;
229 229
230 for (i=0;i<s/8;i++) 230 for (i=0;i<s/8;i++)
231 base[i] = baadfood; 231 base[i] = baadfood;
232 memcpy (&base[s/8], &baadfood, s % 8); 232 memcpy (&base[s/8], &baadfood, s % 8);
@@ -258,7 +258,7 @@ GNUNET_xstrdup_ (const char *str, const char *filename, int linenumber)
258 258
259#if ! HAVE_STRNLEN 259#if ! HAVE_STRNLEN
260static size_t 260static size_t
261strnlen (const char *s, 261strnlen (const char *s,
262 size_t n) 262 size_t n)
263{ 263{
264 const char *e; 264 const char *e;
diff --git a/src/util/common_endian.c b/src/util/common_endian.c
index 247e9e876..1fb74600e 100644
--- a/src/util/common_endian.c
+++ b/src/util/common_endian.c
@@ -59,8 +59,8 @@ GNUNET_htonll (uint64_t n)
59 * @param d the value in network byte order 59 * @param d the value in network byte order
60 * @return the same value in host byte order 60 * @return the same value in host byte order
61 */ 61 */
62double 62double
63GNUNET_hton_double (double d) 63GNUNET_hton_double (double d)
64{ 64{
65 double res; 65 double res;
66 uint64_t *in = (uint64_t *) &d; 66 uint64_t *in = (uint64_t *) &d;
@@ -77,15 +77,15 @@ GNUNET_hton_double (double d)
77 * @param d the value in network byte order 77 * @param d the value in network byte order
78 * @return the same value in host byte order 78 * @return the same value in host byte order
79 */ 79 */
80double 80double
81GNUNET_ntoh_double (double d) 81GNUNET_ntoh_double (double d)
82{ 82{
83 double res; 83 double res;
84 uint64_t *in = (uint64_t *) &d; 84 uint64_t *in = (uint64_t *) &d;
85 uint64_t *out = (uint64_t *) &res; 85 uint64_t *out = (uint64_t *) &res;
86 86
87 out[0] = GNUNET_ntohll(in[0]); 87 out[0] = GNUNET_ntohll(in[0]);
88 88
89 return res; 89 return res;
90} 90}
91 91
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 59a2eeb29..93a104c8d 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -294,7 +294,7 @@ GNUNET_abort ()
294 * Rotate logs, deleting the oldest log. 294 * Rotate logs, deleting the oldest log.
295 * 295 *
296 * @param new_name new name to add to the rotation 296 * @param new_name new name to add to the rotation
297 */ 297 */
298static void 298static void
299log_rotate (const char *new_name) 299log_rotate (const char *new_name)
300{ 300{
@@ -313,7 +313,7 @@ log_rotate (const char *new_name)
313 GNUNET_free (discard); 313 GNUNET_free (discard);
314 } 314 }
315 rotation[rotation_off % ROTATION_KEEP] = GNUNET_strdup (new_name); 315 rotation[rotation_off % ROTATION_KEEP] = GNUNET_strdup (new_name);
316 rotation_off++; 316 rotation_off++;
317} 317}
318 318
319 319
@@ -326,14 +326,14 @@ log_rotate (const char *new_name)
326static int 326static int
327setup_log_file (const struct tm *tm) 327setup_log_file (const struct tm *tm)
328{ 328{
329 static char last_fn[PATH_MAX + 1]; 329 static char last_fn[PATH_MAX + 1];
330 char fn[PATH_MAX + 1]; 330 char fn[PATH_MAX + 1];
331 int dirwarn; 331 int dirwarn;
332 int altlog_fd; 332 int altlog_fd;
333 int dup_return; 333 int dup_return;
334 FILE *altlog; 334 FILE *altlog;
335 char *leftsquare; 335 char *leftsquare;
336 336
337 if (NULL == log_file_name) 337 if (NULL == log_file_name)
338 return GNUNET_SYSERR; 338 return GNUNET_SYSERR;
339 if (0 == strftime (fn, sizeof (fn), log_file_name, tm)) 339 if (0 == strftime (fn, sizeof (fn), log_file_name, tm))
@@ -392,7 +392,7 @@ setup_log_file (const struct tm *tm)
392 fn); 392 fn);
393 return GNUNET_SYSERR; 393 return GNUNET_SYSERR;
394 } 394 }
395 GNUNET_stderr = altlog; 395 GNUNET_stderr = altlog;
396 return GNUNET_OK; 396 return GNUNET_OK;
397} 397}
398 398
@@ -665,7 +665,7 @@ parse_all_definitions ()
665 */ 665 */
666int 666int
667GNUNET_log_setup (const char *comp, 667GNUNET_log_setup (const char *comp,
668 const char *loglevel, 668 const char *loglevel,
669 const char *logfile) 669 const char *logfile)
670{ 670{
671 const char *env_logfile; 671 const char *env_logfile;
@@ -831,7 +831,7 @@ flush_bulk (const char *datestr)
831 * @param check_reset #GNUNET_YES to assert that the log skip counter is currently zero 831 * @param check_reset #GNUNET_YES to assert that the log skip counter is currently zero
832 */ 832 */
833void 833void
834GNUNET_log_skip (int n, 834GNUNET_log_skip (int n,
835 int check_reset) 835 int check_reset)
836{ 836{
837 int ok; 837 int ok;
@@ -872,7 +872,7 @@ GNUNET_get_log_skip ()
872 */ 872 */
873static void 873static void
874mylog (enum GNUNET_ErrorType kind, 874mylog (enum GNUNET_ErrorType kind,
875 const char *comp, 875 const char *comp,
876 const char *message, 876 const char *message,
877 va_list va) 877 va_list va)
878{ 878{
@@ -949,7 +949,7 @@ mylog (enum GNUNET_ErrorType kind,
949 strftime (date2, DATE_STR_SIZE, "%b %d %H:%M:%S-%%06u", tmptr); 949 strftime (date2, DATE_STR_SIZE, "%b %d %H:%M:%S-%%06u", tmptr);
950 snprintf (date, sizeof (date), date2, timeofday.tv_usec); 950 snprintf (date, sizeof (date), date2, timeofday.tv_usec);
951 } 951 }
952#endif 952#endif
953 VSNPRINTF (buf, size, message, va); 953 VSNPRINTF (buf, size, message, va);
954 if (NULL != tmptr) 954 if (NULL != tmptr)
955 (void) setup_log_file (tmptr); 955 (void) setup_log_file (tmptr);
@@ -959,7 +959,7 @@ mylog (enum GNUNET_ErrorType kind,
959 { 959 {
960 last_bulk_repeat++; 960 last_bulk_repeat++;
961 if ( (GNUNET_TIME_absolute_get_duration (last_bulk_time).rel_value_us > 961 if ( (GNUNET_TIME_absolute_get_duration (last_bulk_time).rel_value_us >
962 BULK_DELAY_THRESHOLD) || 962 BULK_DELAY_THRESHOLD) ||
963 (last_bulk_repeat > BULK_REPEAT_THRESHOLD) ) 963 (last_bulk_repeat > BULK_REPEAT_THRESHOLD) )
964 flush_bulk (date); 964 flush_bulk (date);
965 return; 965 return;
@@ -983,7 +983,7 @@ mylog (enum GNUNET_ErrorType kind,
983 * @param ... arguments for format string 983 * @param ... arguments for format string
984 */ 984 */
985void 985void
986GNUNET_log_nocheck (enum GNUNET_ErrorType kind, 986GNUNET_log_nocheck (enum GNUNET_ErrorType kind,
987 const char *message, ...) 987 const char *message, ...)
988{ 988{
989 va_list va; 989 va_list va;
@@ -1199,7 +1199,7 @@ GNUNET_a2s (const struct sockaddr *addr, socklen_t addrlen)
1199 * @param option name of missing option 1199 * @param option name of missing option
1200 */ 1200 */
1201void 1201void
1202GNUNET_log_config_missing (enum GNUNET_ErrorType kind, 1202GNUNET_log_config_missing (enum GNUNET_ErrorType kind,
1203 const char *section, 1203 const char *section,
1204 const char *option) 1204 const char *option)
1205{ 1205{
@@ -1219,7 +1219,7 @@ GNUNET_log_config_missing (enum GNUNET_ErrorType kind,
1219 * @param required what is required that is invalid about the option 1219 * @param required what is required that is invalid about the option
1220 */ 1220 */
1221void 1221void
1222GNUNET_log_config_invalid (enum GNUNET_ErrorType kind, 1222GNUNET_log_config_invalid (enum GNUNET_ErrorType kind,
1223 const char *section, 1223 const char *section,
1224 const char *option, 1224 const char *option,
1225 const char *required) 1225 const char *required)
@@ -1240,7 +1240,7 @@ void __attribute__ ((constructor)) GNUNET_util_cl_init ()
1240 GNInitWinEnv (NULL); 1240 GNInitWinEnv (NULL);
1241#endif 1241#endif
1242#if WINDOWS 1242#if WINDOWS
1243 if (!InitializeCriticalSectionAndSpinCount (&output_message_cs, 0x00000400)) 1243 if (!InitializeCriticalSectionAndSpinCount (&output_message_cs, 0x00000400))
1244 GNUNET_abort (); 1244 GNUNET_abort ();
1245#endif 1245#endif
1246} 1246}
diff --git a/src/util/configuration.c b/src/util/configuration.c
index a1150aa9b..1b600b4c8 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -183,7 +183,7 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
183 if (NULL == pos) 183 if (NULL == pos)
184 { 184 {
185 line_orig = GNUNET_strndup (&mem[r_bytes], line_size = to_read); 185 line_orig = GNUNET_strndup (&mem[r_bytes], line_size = to_read);
186 r_bytes += line_size; 186 r_bytes += line_size;
187 } 187 }
188 else 188 else
189 { 189 {
@@ -220,10 +220,10 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
220 continue; 220 continue;
221 221
222 /* handle special "@INLINE@" directive */ 222 /* handle special "@INLINE@" directive */
223 if (0 == strncasecmp (line, 223 if (0 == strncasecmp (line,
224 "@INLINE@ ", 224 "@INLINE@ ",
225 strlen ("@INLINE@ "))) 225 strlen ("@INLINE@ ")))
226 { 226 {
227 /* @INLINE@ value */ 227 /* @INLINE@ value */
228 value = &line[strlen ("@INLINE@ ")]; 228 value = &line[strlen ("@INLINE@ ")];
229 if (GNUNET_YES == allow_inline) 229 if (GNUNET_YES == allow_inline)
@@ -250,19 +250,19 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
250 value = &line[1]; 250 value = &line[1];
251 GNUNET_free (section); 251 GNUNET_free (section);
252 section = GNUNET_strdup (value); 252 section = GNUNET_strdup (value);
253 LOG (GNUNET_ERROR_TYPE_DEBUG, 253 LOG (GNUNET_ERROR_TYPE_DEBUG,
254 "Config section `%s'\n", 254 "Config section `%s'\n",
255 section); 255 section);
256 continue; 256 continue;
257 } 257 }
258 if (NULL != (eq = strchr (line, '='))) 258 if (NULL != (eq = strchr (line, '=')))
259 { 259 {
260 /* tag = value */ 260 /* tag = value */
261 tag = GNUNET_strndup (line, eq - line); 261 tag = GNUNET_strndup (line, eq - line);
262 /* remove tailing whitespace */ 262 /* remove tailing whitespace */
263 for (i = strlen (tag) - 1; (i >= 1) && (isspace ((unsigned char) tag[i]));i--) 263 for (i = strlen (tag) - 1; (i >= 1) && (isspace ((unsigned char) tag[i]));i--)
264 tag[i] = '\0'; 264 tag[i] = '\0';
265 265
266 /* Strip whitespace */ 266 /* Strip whitespace */
267 value = eq + 1; 267 value = eq + 1;
268 while (isspace ((unsigned char) value[0])) 268 while (isspace ((unsigned char) value[0]))
@@ -285,14 +285,14 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
285 } 285 }
286 /* parse error */ 286 /* parse error */
287 LOG (GNUNET_ERROR_TYPE_WARNING, 287 LOG (GNUNET_ERROR_TYPE_WARNING,
288 _("Syntax error while deserializing in line %u\n"), 288 _("Syntax error while deserializing in line %u\n"),
289 nr); 289 nr);
290 ret = GNUNET_SYSERR; 290 ret = GNUNET_SYSERR;
291 break; 291 break;
292 } 292 }
293 LOG (GNUNET_ERROR_TYPE_DEBUG, "Finished deserializing config\n"); 293 LOG (GNUNET_ERROR_TYPE_DEBUG, "Finished deserializing config\n");
294 GNUNET_free_non_null (line_orig); 294 GNUNET_free_non_null (line_orig);
295 GNUNET_free (section); 295 GNUNET_free (section);
296 GNUNET_assert ( (GNUNET_OK != ret) || (r_bytes == size) ); 296 GNUNET_assert ( (GNUNET_OK != ret) || (r_bytes == size) );
297 return ret; 297 return ret;
298} 298}
@@ -323,7 +323,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
323 if (fn == NULL) 323 if (fn == NULL)
324 return GNUNET_SYSERR; 324 return GNUNET_SYSERR;
325 dirty = cfg->dirty; /* back up value! */ 325 dirty = cfg->dirty; /* back up value! */
326 if (GNUNET_SYSERR == 326 if (GNUNET_SYSERR ==
327 GNUNET_DISK_file_size (fn, &fs64, GNUNET_YES, GNUNET_YES)) 327 GNUNET_DISK_file_size (fn, &fs64, GNUNET_YES, GNUNET_YES))
328 { 328 {
329 LOG (GNUNET_ERROR_TYPE_WARNING, 329 LOG (GNUNET_ERROR_TYPE_WARNING,
@@ -349,7 +349,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
349 } 349 }
350 LOG (GNUNET_ERROR_TYPE_DEBUG, "Deserializing contents of file `%s'\n", fn); 350 LOG (GNUNET_ERROR_TYPE_DEBUG, "Deserializing contents of file `%s'\n", fn);
351 GNUNET_free (fn); 351 GNUNET_free (fn);
352 ret = GNUNET_CONFIGURATION_deserialize (cfg, mem, fs, GNUNET_YES); 352 ret = GNUNET_CONFIGURATION_deserialize (cfg, mem, fs, GNUNET_YES);
353 GNUNET_free (mem); 353 GNUNET_free (mem);
354 /* restore dirty flag - anything we set in the meantime 354 /* restore dirty flag - anything we set in the meantime
355 * came from disk */ 355 * came from disk */
@@ -425,7 +425,7 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
425 mem = GNUNET_malloc (m_size); 425 mem = GNUNET_malloc (m_size);
426 sec = cfg->sections; 426 sec = cfg->sections;
427 c_size = 0; 427 c_size = 0;
428 *size = c_size; 428 *size = c_size;
429 while (NULL != sec) 429 while (NULL != sec)
430 { 430 {
431 len = GNUNET_asprintf (&cbuf, "[%s]\n", sec->name); 431 len = GNUNET_asprintf (&cbuf, "[%s]\n", sec->name);
@@ -487,9 +487,9 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
487 } 487 }
488 cfg_buf = GNUNET_CONFIGURATION_serialize (cfg, &size); 488 cfg_buf = GNUNET_CONFIGURATION_serialize (cfg, &size);
489 if (size != GNUNET_DISK_fn_write (fn, cfg_buf, size, 489 if (size != GNUNET_DISK_fn_write (fn, cfg_buf, size,
490 GNUNET_DISK_PERM_USER_READ 490 GNUNET_DISK_PERM_USER_READ
491 | GNUNET_DISK_PERM_USER_WRITE 491 | GNUNET_DISK_PERM_USER_WRITE
492 | GNUNET_DISK_PERM_GROUP_READ 492 | GNUNET_DISK_PERM_GROUP_READ
493 | GNUNET_DISK_PERM_GROUP_WRITE)) 493 | GNUNET_DISK_PERM_GROUP_WRITE))
494 { 494 {
495 GNUNET_free (fn); 495 GNUNET_free (fn);
@@ -1090,7 +1090,7 @@ GNUNET_CONFIGURATION_get_value_filename (const struct
1090 const char *option, char **value) 1090 const char *option, char **value)
1091{ 1091{
1092 char *tmp; 1092 char *tmp;
1093 1093
1094 LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to retrieve filename `%s' in section `%s'\n", option, section); 1094 LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to retrieve filename `%s' in section `%s'\n", option, section);
1095 if (GNUNET_OK != 1095 if (GNUNET_OK !=
1096 GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &tmp)) 1096 GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &tmp))
diff --git a/src/util/connection.c b/src/util/connection.c
index e90fa9f51..a429f2f7e 100644
--- a/src/util/connection.c
+++ b/src/util/connection.c
@@ -433,7 +433,7 @@ GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access,
433 connection->addr = uaddr; 433 connection->addr = uaddr;
434 connection->addrlen = addrlen; 434 connection->addrlen = addrlen;
435 connection->sock = sock; 435 connection->sock = sock;
436 LOG (GNUNET_ERROR_TYPE_INFO, 436 LOG (GNUNET_ERROR_TYPE_INFO,
437 _("Accepting connection from `%s': %p\n"), 437 _("Accepting connection from `%s': %p\n"),
438 GNUNET_a2s (uaddr, addrlen), connection); 438 GNUNET_a2s (uaddr, addrlen), connection);
439 return connection; 439 return connection;
@@ -473,7 +473,7 @@ signal_receive_error (struct GNUNET_CONNECTION_Handle *connection, int errcode)
473 GNUNET_CONNECTION_Receiver receiver; 473 GNUNET_CONNECTION_Receiver receiver;
474 474
475 LOG (GNUNET_ERROR_TYPE_DEBUG, 475 LOG (GNUNET_ERROR_TYPE_DEBUG,
476 "Receive encounters error (%s), connection closed (%p)\n", 476 "Receive encounters error (%s), connection closed (%p)\n",
477 STRERROR (errcode), 477 STRERROR (errcode),
478 connection); 478 connection);
479 GNUNET_assert (NULL != (receiver = connection->receiver)); 479 GNUNET_assert (NULL != (receiver = connection->receiver));
@@ -608,14 +608,14 @@ receive_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
608static void 608static void
609connect_success_continuation (struct GNUNET_CONNECTION_Handle *connection) 609connect_success_continuation (struct GNUNET_CONNECTION_Handle *connection)
610{ 610{
611 LOG (GNUNET_ERROR_TYPE_DEBUG, 611 LOG (GNUNET_ERROR_TYPE_DEBUG,
612 "Connection to `%s' succeeded! (%p)\n", 612 "Connection to `%s' succeeded! (%p)\n",
613 GNUNET_a2s (connection->addr, connection->addrlen), connection); 613 GNUNET_a2s (connection->addr, connection->addrlen), connection);
614 /* trigger jobs that waited for the connection */ 614 /* trigger jobs that waited for the connection */
615 if (NULL != connection->receiver) 615 if (NULL != connection->receiver)
616 { 616 {
617 LOG (GNUNET_ERROR_TYPE_DEBUG, 617 LOG (GNUNET_ERROR_TYPE_DEBUG,
618 "Connection succeeded, starting with receiving data (%p)\n", 618 "Connection succeeded, starting with receiving data (%p)\n",
619 connection); 619 connection);
620 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->read_task); 620 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->read_task);
621 connection->read_task = 621 connection->read_task =
@@ -989,10 +989,10 @@ GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *connection)
989 if ( (NULL != connection->sock) && 989 if ( (NULL != connection->sock) &&
990 (GNUNET_YES != connection->persist) ) 990 (GNUNET_YES != connection->persist) )
991 { 991 {
992 if ((GNUNET_YES != GNUNET_NETWORK_socket_shutdown (connection->sock, SHUT_RDWR)) && 992 if ((GNUNET_YES != GNUNET_NETWORK_socket_shutdown (connection->sock, SHUT_RDWR)) &&
993 (ENOTCONN != errno) && 993 (ENOTCONN != errno) &&
994 (ECONNRESET != errno) ) 994 (ECONNRESET != errno) )
995 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "shutdown"); 995 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "shutdown");
996 } 996 }
997 if (NULL != connection->sock) 997 if (NULL != connection->sock)
998 { 998 {
@@ -1286,7 +1286,7 @@ transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1286 return; 1286 return;
1287 } 1287 }
1288 GNUNET_assert (NULL != connection->sock); 1288 GNUNET_assert (NULL != connection->sock);
1289 if (NULL == tc->write_ready) 1289 if (NULL == tc->write_ready)
1290 { 1290 {
1291 /* special circumstances (in particular, PREREQ_DONE after 1291 /* special circumstances (in particular, PREREQ_DONE after
1292 * connect): not yet ready to write, but no "fatal" error either. 1292 * connect): not yet ready to write, but no "fatal" error either.
@@ -1400,7 +1400,7 @@ GNUNET_CONNECTION_notify_transmit_ready (struct GNUNET_CONNECTION_Handle *connec
1400 connection->nth.notify_size = size; 1400 connection->nth.notify_size = size;
1401 connection->nth.transmit_timeout = GNUNET_TIME_relative_to_absolute (timeout); 1401 connection->nth.transmit_timeout = GNUNET_TIME_relative_to_absolute (timeout);
1402 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->nth.timeout_task); 1402 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->nth.timeout_task);
1403 if ((NULL == connection->sock) && 1403 if ((NULL == connection->sock) &&
1404 (NULL == connection->ap_head) && 1404 (NULL == connection->ap_head) &&
1405 (NULL == connection->dns_active)) 1405 (NULL == connection->dns_active))
1406 { 1406 {
diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c
index f9487f98f..08a083df4 100644
--- a/src/util/container_bloomfilter.c
+++ b/src/util/container_bloomfilter.c
@@ -558,8 +558,8 @@ GNUNET_CONTAINER_bloomfilter_load (const char *filename, size_t size,
558 } 558 }
559 bf->bitArraySize = size; 559 bf->bitArraySize = size;
560 bf->addressesPerElement = k; 560 bf->addressesPerElement = k;
561 if (GNUNET_YES != must_read) 561 if (GNUNET_YES != must_read)
562 return bf; /* already done! */ 562 return bf; /* already done! */
563 /* Read from the file what bits we can */ 563 /* Read from the file what bits we can */
564 rbuff = GNUNET_malloc (BUFFSIZE); 564 rbuff = GNUNET_malloc (BUFFSIZE);
565 pos = 0; 565 pos = 0;
diff --git a/src/util/container_meta_data.c b/src/util/container_meta_data.c
index 6e77c40a2..ea1172d56 100644
--- a/src/util/container_meta_data.c
+++ b/src/util/container_meta_data.c
@@ -996,7 +996,7 @@ decompress (const char *input, size_t inputSize, size_t outputSize)
996 uncompress ((Bytef *) output, &olen, (const Bytef *) input, inputSize)) 996 uncompress ((Bytef *) output, &olen, (const Bytef *) input, inputSize))
997 return output; 997 return output;
998 GNUNET_free (output); 998 GNUNET_free (output);
999 return NULL; 999 return NULL;
1000} 1000}
1001 1001
1002 1002
diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c
index 24eae9f0d..d62f5f366 100644
--- a/src/util/container_multihashmap.c
+++ b/src/util/container_multihashmap.c
@@ -67,7 +67,7 @@ struct SmallMapEntry
67 * If there is a hash collision, we create a linked list. 67 * If there is a hash collision, we create a linked list.
68 */ 68 */
69 struct SmallMapEntry *next; 69 struct SmallMapEntry *next;
70 70
71 /** 71 /**
72 * Key for the entry. 72 * Key for the entry.
73 */ 73 */
@@ -162,10 +162,10 @@ struct GNUNET_CONTAINER_MultiHashMapIterator
162 * @param len initial size (map will grow as needed) 162 * @param len initial size (map will grow as needed)
163 * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default; 163 * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default;
164 * GNUNET_YES means that on 'put', the 'key' does not have 164 * GNUNET_YES means that on 'put', the 'key' does not have
165 * to be copied as the destination of the pointer is 165 * to be copied as the destination of the pointer is
166 * guaranteed to be life as long as the value is stored in 166 * guaranteed to be life as long as the value is stored in
167 * the hashmap. This can significantly reduce memory 167 * the hashmap. This can significantly reduce memory
168 * consumption, but of course is also a recipie for 168 * consumption, but of course is also a recipie for
169 * heap corruption if the assumption is not true. Only 169 * heap corruption if the assumption is not true. Only
170 * use this if (1) memory use is important in this case and 170 * use this if (1) memory use is important in this case and
171 * (2) you have triple-checked that the invariant holds 171 * (2) you have triple-checked that the invariant holds
@@ -331,7 +331,7 @@ GNUNET_CONTAINER_multihashmap_iterate (const struct
331 struct SmallMapEntry *sme; 331 struct SmallMapEntry *sme;
332 struct SmallMapEntry *nxt; 332 struct SmallMapEntry *nxt;
333 333
334 nxt = me.sme; 334 nxt = me.sme;
335 while (NULL != (sme = nxt)) 335 while (NULL != (sme = nxt))
336 { 336 {
337 nxt = sme->next; 337 nxt = sme->next;
@@ -348,7 +348,7 @@ GNUNET_CONTAINER_multihashmap_iterate (const struct
348 struct BigMapEntry *bme; 348 struct BigMapEntry *bme;
349 struct BigMapEntry *nxt; 349 struct BigMapEntry *nxt;
350 350
351 nxt = me.bme; 351 nxt = me.bme;
352 while (NULL != (bme = nxt)) 352 while (NULL != (bme = nxt))
353 { 353 {
354 nxt = bme->next; 354 nxt = bme->next;
@@ -379,7 +379,7 @@ GNUNET_CONTAINER_multihashmap_iterate (const struct
379 */ 379 */
380int 380int
381GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map, 381GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
382 const struct GNUNET_HashCode *key, 382 const struct GNUNET_HashCode *key,
383 const void *value) 383 const void *value)
384{ 384{
385 union MapEntry me; 385 union MapEntry me;
@@ -390,7 +390,7 @@ GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
390 i = idx_of (map, key); 390 i = idx_of (map, key);
391 me = map->map[i]; 391 me = map->map[i];
392 if (map->use_small_entries) 392 if (map->use_small_entries)
393 { 393 {
394 struct SmallMapEntry *sme; 394 struct SmallMapEntry *sme;
395 struct SmallMapEntry *p; 395 struct SmallMapEntry *p;
396 396
@@ -459,7 +459,7 @@ GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap
459 i = idx_of (map, key); 459 i = idx_of (map, key);
460 me = map->map[i]; 460 me = map->map[i];
461 if (map->use_small_entries) 461 if (map->use_small_entries)
462 { 462 {
463 struct SmallMapEntry *sme; 463 struct SmallMapEntry *sme;
464 struct SmallMapEntry *p; 464 struct SmallMapEntry *p;
465 465
@@ -668,7 +668,7 @@ grow (struct GNUNET_CONTAINER_MultiHashMap *map)
668 */ 668 */
669int 669int
670GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, 670GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
671 const struct GNUNET_HashCode *key, 671 const struct GNUNET_HashCode *key,
672 void *value, 672 void *value,
673 enum GNUNET_CONTAINER_MultiHashMapOption opt) 673 enum GNUNET_CONTAINER_MultiHashMapOption opt)
674{ 674{
@@ -684,7 +684,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
684 { 684 {
685 struct SmallMapEntry *sme; 685 struct SmallMapEntry *sme;
686 686
687 for (sme = me.sme; NULL != sme; sme = sme->next) 687 for (sme = me.sme; NULL != sme; sme = sme->next)
688 if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_HashCode))) 688 if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_HashCode)))
689 { 689 {
690 if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) 690 if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)
@@ -697,7 +697,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
697 { 697 {
698 struct BigMapEntry *bme; 698 struct BigMapEntry *bme;
699 699
700 for (bme = me.bme; NULL != bme; bme = bme->next) 700 for (bme = me.bme; NULL != bme; bme = bme->next)
701 if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_HashCode))) 701 if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_HashCode)))
702 { 702 {
703 if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) 703 if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)
@@ -715,7 +715,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
715 if (map->use_small_entries) 715 if (map->use_small_entries)
716 { 716 {
717 struct SmallMapEntry *sme; 717 struct SmallMapEntry *sme;
718 718
719 sme = GNUNET_new (struct SmallMapEntry); 719 sme = GNUNET_new (struct SmallMapEntry);
720 sme->key = key; 720 sme->key = key;
721 sme->value = value; 721 sme->value = value;
@@ -725,7 +725,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
725 else 725 else
726 { 726 {
727 struct BigMapEntry *bme; 727 struct BigMapEntry *bme;
728 728
729 bme = GNUNET_new (struct BigMapEntry); 729 bme = GNUNET_new (struct BigMapEntry);
730 bme->key = *key; 730 bme->key = *key;
731 bme->value = value; 731 bme->value = value;
@@ -761,9 +761,9 @@ GNUNET_CONTAINER_multihashmap_get_multiple (const struct
761 me = map->map[idx_of (map, key)]; 761 me = map->map[idx_of (map, key)];
762 if (map->use_small_entries) 762 if (map->use_small_entries)
763 { 763 {
764 struct SmallMapEntry *sme; 764 struct SmallMapEntry *sme;
765 struct SmallMapEntry *nxt; 765 struct SmallMapEntry *nxt;
766 766
767 nxt = me.sme; 767 nxt = me.sme;
768 while (NULL != (sme = nxt)) 768 while (NULL != (sme = nxt))
769 { 769 {
@@ -777,9 +777,9 @@ GNUNET_CONTAINER_multihashmap_get_multiple (const struct
777 } 777 }
778 else 778 else
779 { 779 {
780 struct BigMapEntry *bme; 780 struct BigMapEntry *bme;
781 struct BigMapEntry *nxt; 781 struct BigMapEntry *nxt;
782 782
783 nxt = me.bme; 783 nxt = me.bme;
784 while (NULL != (bme = nxt)) 784 while (NULL != (bme = nxt))
785 { 785 {
diff --git a/src/util/container_multihashmap32.c b/src/util/container_multihashmap32.c
index 5448a3cde..afb0e3653 100644
--- a/src/util/container_multihashmap32.c
+++ b/src/util/container_multihashmap32.c
@@ -350,7 +350,7 @@ GNUNET_CONTAINER_multihashmap32_contains (const struct
350int 350int
351GNUNET_CONTAINER_multihashmap32_contains_value (const struct 351GNUNET_CONTAINER_multihashmap32_contains_value (const struct
352 GNUNET_CONTAINER_MultiHashMap32 352 GNUNET_CONTAINER_MultiHashMap32
353 *map, 353 *map,
354 uint32_t key, 354 uint32_t key,
355 const void *value) 355 const void *value)
356{ 356{
@@ -470,7 +470,7 @@ int
470GNUNET_CONTAINER_multihashmap32_get_multiple (const struct 470GNUNET_CONTAINER_multihashmap32_get_multiple (const struct
471 GNUNET_CONTAINER_MultiHashMap32 471 GNUNET_CONTAINER_MultiHashMap32
472 *map, uint32_t key, 472 *map, uint32_t key,
473 GNUNET_CONTAINER_HashMapIterator32 473 GNUNET_CONTAINER_HashMapIterator32
474 it, void *it_cls) 474 it, void *it_cls)
475{ 475{
476 int count; 476 int count;
diff --git a/src/util/container_multipeermap.c b/src/util/container_multipeermap.c
index 54a1d1635..8ec3a2077 100644
--- a/src/util/container_multipeermap.c
+++ b/src/util/container_multipeermap.c
@@ -67,7 +67,7 @@ struct SmallMapEntry
67 * If there is a hash collision, we create a linked list. 67 * If there is a hash collision, we create a linked list.
68 */ 68 */
69 struct SmallMapEntry *next; 69 struct SmallMapEntry *next;
70 70
71 /** 71 /**
72 * Key for the entry. 72 * Key for the entry.
73 */ 73 */
@@ -162,10 +162,10 @@ struct GNUNET_CONTAINER_MultiPeerMapIterator
162 * @param len initial size (map will grow as needed) 162 * @param len initial size (map will grow as needed)
163 * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default; 163 * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default;
164 * GNUNET_YES means that on 'put', the 'key' does not have 164 * GNUNET_YES means that on 'put', the 'key' does not have
165 * to be copied as the destination of the pointer is 165 * to be copied as the destination of the pointer is
166 * guaranteed to be life as long as the value is stored in 166 * guaranteed to be life as long as the value is stored in
167 * the hashmap. This can significantly reduce memory 167 * the hashmap. This can significantly reduce memory
168 * consumption, but of course is also a recipie for 168 * consumption, but of course is also a recipie for
169 * heap corruption if the assumption is not true. Only 169 * heap corruption if the assumption is not true. Only
170 * use this if (1) memory use is important in this case and 170 * use this if (1) memory use is important in this case and
171 * (2) you have triple-checked that the invariant holds 171 * (2) you have triple-checked that the invariant holds
@@ -331,7 +331,7 @@ GNUNET_CONTAINER_multipeermap_iterate (const struct
331 struct SmallMapEntry *sme; 331 struct SmallMapEntry *sme;
332 struct SmallMapEntry *nxt; 332 struct SmallMapEntry *nxt;
333 333
334 nxt = me.sme; 334 nxt = me.sme;
335 while (NULL != (sme = nxt)) 335 while (NULL != (sme = nxt))
336 { 336 {
337 nxt = sme->next; 337 nxt = sme->next;
@@ -348,7 +348,7 @@ GNUNET_CONTAINER_multipeermap_iterate (const struct
348 struct BigMapEntry *bme; 348 struct BigMapEntry *bme;
349 struct BigMapEntry *nxt; 349 struct BigMapEntry *nxt;
350 350
351 nxt = me.bme; 351 nxt = me.bme;
352 while (NULL != (bme = nxt)) 352 while (NULL != (bme = nxt))
353 { 353 {
354 nxt = bme->next; 354 nxt = bme->next;
@@ -379,7 +379,7 @@ GNUNET_CONTAINER_multipeermap_iterate (const struct
379 */ 379 */
380int 380int
381GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map, 381GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map,
382 const struct GNUNET_PeerIdentity *key, 382 const struct GNUNET_PeerIdentity *key,
383 const void *value) 383 const void *value)
384{ 384{
385 union MapEntry me; 385 union MapEntry me;
@@ -390,7 +390,7 @@ GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map,
390 i = idx_of (map, key); 390 i = idx_of (map, key);
391 me = map->map[i]; 391 me = map->map[i];
392 if (map->use_small_entries) 392 if (map->use_small_entries)
393 { 393 {
394 struct SmallMapEntry *sme; 394 struct SmallMapEntry *sme;
395 struct SmallMapEntry *p; 395 struct SmallMapEntry *p;
396 396
@@ -459,7 +459,7 @@ GNUNET_CONTAINER_multipeermap_remove_all (struct GNUNET_CONTAINER_MultiPeerMap
459 i = idx_of (map, key); 459 i = idx_of (map, key);
460 me = map->map[i]; 460 me = map->map[i];
461 if (map->use_small_entries) 461 if (map->use_small_entries)
462 { 462 {
463 struct SmallMapEntry *sme; 463 struct SmallMapEntry *sme;
464 struct SmallMapEntry *p; 464 struct SmallMapEntry *p;
465 465
@@ -668,7 +668,7 @@ grow (struct GNUNET_CONTAINER_MultiPeerMap *map)
668 */ 668 */
669int 669int
670GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map, 670GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map,
671 const struct GNUNET_PeerIdentity *key, 671 const struct GNUNET_PeerIdentity *key,
672 void *value, 672 void *value,
673 enum GNUNET_CONTAINER_MultiHashMapOption opt) 673 enum GNUNET_CONTAINER_MultiHashMapOption opt)
674{ 674{
@@ -684,7 +684,7 @@ GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map,
684 { 684 {
685 struct SmallMapEntry *sme; 685 struct SmallMapEntry *sme;
686 686
687 for (sme = me.sme; NULL != sme; sme = sme->next) 687 for (sme = me.sme; NULL != sme; sme = sme->next)
688 if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_PeerIdentity))) 688 if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_PeerIdentity)))
689 { 689 {
690 if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) 690 if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)
@@ -697,7 +697,7 @@ GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map,
697 { 697 {
698 struct BigMapEntry *bme; 698 struct BigMapEntry *bme;
699 699
700 for (bme = me.bme; NULL != bme; bme = bme->next) 700 for (bme = me.bme; NULL != bme; bme = bme->next)
701 if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_PeerIdentity))) 701 if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_PeerIdentity)))
702 { 702 {
703 if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) 703 if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)
@@ -715,7 +715,7 @@ GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map,
715 if (map->use_small_entries) 715 if (map->use_small_entries)
716 { 716 {
717 struct SmallMapEntry *sme; 717 struct SmallMapEntry *sme;
718 718
719 sme = GNUNET_new (struct SmallMapEntry); 719 sme = GNUNET_new (struct SmallMapEntry);
720 sme->key = key; 720 sme->key = key;
721 sme->value = value; 721 sme->value = value;
@@ -725,7 +725,7 @@ GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map,
725 else 725 else
726 { 726 {
727 struct BigMapEntry *bme; 727 struct BigMapEntry *bme;
728 728
729 bme = GNUNET_new (struct BigMapEntry); 729 bme = GNUNET_new (struct BigMapEntry);
730 bme->key = *key; 730 bme->key = *key;
731 bme->value = value; 731 bme->value = value;
@@ -760,9 +760,9 @@ GNUNET_CONTAINER_multipeermap_get_multiple (const struct GNUNET_CONTAINER_MultiP
760 me = map->map[idx_of (map, key)]; 760 me = map->map[idx_of (map, key)];
761 if (map->use_small_entries) 761 if (map->use_small_entries)
762 { 762 {
763 struct SmallMapEntry *sme; 763 struct SmallMapEntry *sme;
764 struct SmallMapEntry *nxt; 764 struct SmallMapEntry *nxt;
765 765
766 nxt = me.sme; 766 nxt = me.sme;
767 while (NULL != (sme = nxt)) 767 while (NULL != (sme = nxt))
768 { 768 {
@@ -776,9 +776,9 @@ GNUNET_CONTAINER_multipeermap_get_multiple (const struct GNUNET_CONTAINER_MultiP
776 } 776 }
777 else 777 else
778 { 778 {
779 struct BigMapEntry *bme; 779 struct BigMapEntry *bme;
780 struct BigMapEntry *nxt; 780 struct BigMapEntry *nxt;
781 781
782 nxt = me.bme; 782 nxt = me.bme;
783 while (NULL != (bme = nxt)) 783 while (NULL != (bme = nxt))
784 { 784 {
diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c
index 144cfbd45..34edec3de 100644
--- a/src/util/crypto_ecc.c
+++ b/src/util/crypto_ecc.c
@@ -27,14 +27,14 @@
27#include <gcrypt.h> 27#include <gcrypt.h>
28#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
29 29
30#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS 30#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS
31 31
32/** 32/**
33 * Name of the curve we are using. Note that we have hard-coded 33 * Name of the curve we are using. Note that we have hard-coded
34 * structs that use 256 bits, so using a bigger curve will require 34 * structs that use 256 bits, so using a bigger curve will require
35 * changes that break stuff badly. The name of the curve given here 35 * changes that break stuff badly. The name of the curve given here
36 * must be agreed by all peers and be supported by libgcrypt. 36 * must be agreed by all peers and be supported by libgcrypt.
37 * 37 *
38 * NOTE: this will change to Curve25519 before GNUnet 0.10.0. 38 * NOTE: this will change to Curve25519 before GNUnet 0.10.0.
39 */ 39 */
40#define CURVE "NIST P-256" 40#define CURVE "NIST P-256"
@@ -73,13 +73,13 @@ key_from_sexp (gcry_mpi_t * array, gcry_sexp_t sexp, const char *topname,
73 unsigned int idx; 73 unsigned int idx;
74 74
75 list = gcry_sexp_find_token (sexp, topname, 0); 75 list = gcry_sexp_find_token (sexp, topname, 0);
76 if (! list) 76 if (! list)
77 return 1; 77 return 1;
78 l2 = gcry_sexp_cadr (list); 78 l2 = gcry_sexp_cadr (list);
79 gcry_sexp_release (list); 79 gcry_sexp_release (list);
80 list = l2; 80 list = l2;
81 if (! list) 81 if (! list)
82 return 2; 82 return 2;
83 83
84 idx = 0; 84 idx = 0;
85 for (s = elems; *s; s++, idx++) 85 for (s = elems; *s; s++, idx++)
@@ -136,7 +136,7 @@ adjust (unsigned char *buf,
136 136
137/** 137/**
138 * Output the given MPI value to the given buffer. 138 * Output the given MPI value to the given buffer.
139 * 139 *
140 * @param buf where to output to 140 * @param buf where to output to
141 * @param size number of bytes in @a buf 141 * @param size number of bytes in @a buf
142 * @param val value to write to @a buf 142 * @param val value to write to @a buf
@@ -171,7 +171,7 @@ mpi_scan (gcry_mpi_t *result,
171 int rc; 171 int rc;
172 172
173 if (0 != (rc = gcry_mpi_scan (result, 173 if (0 != (rc = gcry_mpi_scan (result,
174 GCRYMPI_FMT_USG, 174 GCRYMPI_FMT_USG,
175 data, size, &size))) 175 data, size, &size)))
176 { 176 {
177 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_scan", rc); 177 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_scan", rc);
@@ -203,7 +203,7 @@ decode_private_key (const struct GNUNET_CRYPTO_EccPrivateKey *priv)
203 gcry_mpi_release (d); 203 gcry_mpi_release (d);
204 if (0 != rc) 204 if (0 != rc)
205 { 205 {
206 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc); 206 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc);
207 GNUNET_assert (0); 207 GNUNET_assert (0);
208 } 208 }
209#if EXTRA_CHECKS 209#if EXTRA_CHECKS
@@ -224,7 +224,7 @@ decode_private_key (const struct GNUNET_CRYPTO_EccPrivateKey *priv)
224 * @param q point on curve 224 * @param q point on curve
225 * @param pub public key struct to initialize 225 * @param pub public key struct to initialize
226 * @param ctx context to use for ECC operations 226 * @param ctx context to use for ECC operations
227 */ 227 */
228static void 228static void
229point_to_public_sign_key (gcry_mpi_point_t q, 229point_to_public_sign_key (gcry_mpi_point_t q,
230 gcry_ctx_t ctx, 230 gcry_ctx_t ctx,
@@ -232,7 +232,7 @@ point_to_public_sign_key (gcry_mpi_point_t q,
232{ 232{
233 gcry_mpi_t q_x; 233 gcry_mpi_t q_x;
234 gcry_mpi_t q_y; 234 gcry_mpi_t q_y;
235 235
236 q_x = gcry_mpi_new (256); 236 q_x = gcry_mpi_new (256);
237 q_y = gcry_mpi_new (256); 237 q_y = gcry_mpi_new (256);
238 if (gcry_mpi_ec_get_affine (q_x, q_y, q, ctx)) 238 if (gcry_mpi_ec_get_affine (q_x, q_y, q, ctx))
@@ -255,7 +255,7 @@ point_to_public_sign_key (gcry_mpi_point_t q,
255 * @param q point on curve 255 * @param q point on curve
256 * @param pub public key struct to initialize 256 * @param pub public key struct to initialize
257 * @param ctx context to use for ECC operations 257 * @param ctx context to use for ECC operations
258 */ 258 */
259static void 259static void
260point_to_public_encrypt_key (gcry_mpi_point_t q, 260point_to_public_encrypt_key (gcry_mpi_point_t q,
261 gcry_ctx_t ctx, 261 gcry_ctx_t ctx,
@@ -263,7 +263,7 @@ point_to_public_encrypt_key (gcry_mpi_point_t q,
263{ 263{
264 gcry_mpi_t q_x; 264 gcry_mpi_t q_x;
265 gcry_mpi_t q_y; 265 gcry_mpi_t q_y;
266 266
267 q_x = gcry_mpi_new (256); 267 q_x = gcry_mpi_new (256);
268 q_y = gcry_mpi_new (256); 268 q_y = gcry_mpi_new (256);
269 if (gcry_mpi_ec_get_affine (q_x, q_y, q, ctx)) 269 if (gcry_mpi_ec_get_affine (q_x, q_y, q, ctx))
@@ -346,9 +346,9 @@ GNUNET_CRYPTO_ecc_public_sign_key_to_string (const struct GNUNET_CRYPTO_EccPubli
346 keylen += 5 - keylen % 5; 346 keylen += 5 - keylen % 5;
347 keylen /= 5; 347 keylen /= 5;
348 pubkeybuf = GNUNET_malloc (keylen + 1); 348 pubkeybuf = GNUNET_malloc (keylen + 1);
349 end = GNUNET_STRINGS_data_to_string ((unsigned char *) pub, 349 end = GNUNET_STRINGS_data_to_string ((unsigned char *) pub,
350 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), 350 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
351 pubkeybuf, 351 pubkeybuf,
352 keylen); 352 keylen);
353 if (NULL == end) 353 if (NULL == end)
354 { 354 {
@@ -369,7 +369,7 @@ GNUNET_CRYPTO_ecc_public_sign_key_to_string (const struct GNUNET_CRYPTO_EccPubli
369 * @return #GNUNET_OK on success 369 * @return #GNUNET_OK on success
370 */ 370 */
371int 371int
372GNUNET_CRYPTO_ecc_public_sign_key_from_string (const char *enc, 372GNUNET_CRYPTO_ecc_public_sign_key_from_string (const char *enc,
373 size_t enclen, 373 size_t enclen,
374 struct GNUNET_CRYPTO_EccPublicSignKey *pub) 374 struct GNUNET_CRYPTO_EccPublicSignKey *pub)
375{ 375{
@@ -408,7 +408,7 @@ decode_public_sign_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub)
408 mpi_scan (&q_x, pub->q_x, sizeof (pub->q_x)); 408 mpi_scan (&q_x, pub->q_x, sizeof (pub->q_x));
409 mpi_scan (&q_y, pub->q_y, sizeof (pub->q_y)); 409 mpi_scan (&q_y, pub->q_y, sizeof (pub->q_y));
410 q = gcry_mpi_point_new (256); 410 q = gcry_mpi_point_new (256);
411 gcry_mpi_point_set (q, q_x, q_y, GCRYMPI_CONST_ONE); 411 gcry_mpi_point_set (q, q_x, q_y, GCRYMPI_CONST_ONE);
412 gcry_mpi_release (q_x); 412 gcry_mpi_release (q_x);
413 gcry_mpi_release (q_y); 413 gcry_mpi_release (q_y);
414 414
@@ -426,7 +426,7 @@ decode_public_sign_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub)
426 426
427/** 427/**
428 * @ingroup crypto 428 * @ingroup crypto
429 * Clear memory that was used to store a private key. 429 * Clear memory that was used to store a private key.
430 * 430 *
431 * @param pk location of the key 431 * @param pk location of the key
432 */ 432 */
@@ -503,8 +503,8 @@ GNUNET_CRYPTO_ecc_key_get_anonymous ()
503 503
504 if (once) 504 if (once)
505 return &anonymous; 505 return &anonymous;
506 mpi_print (anonymous.d, 506 mpi_print (anonymous.d,
507 sizeof (anonymous.d), 507 sizeof (anonymous.d),
508 GCRYMPI_CONST_ONE); 508 GCRYMPI_CONST_ONE);
509 once = 1; 509 once = 1;
510 return &anonymous; 510 return &anonymous;
@@ -700,7 +700,7 @@ GNUNET_CRYPTO_ecc_key_create_from_configuration (const struct GNUNET_CONFIGURATI
700 struct GNUNET_CRYPTO_EccPrivateKey *priv; 700 struct GNUNET_CRYPTO_EccPrivateKey *priv;
701 char *fn; 701 char *fn;
702 702
703 if (GNUNET_OK != 703 if (GNUNET_OK !=
704 GNUNET_CONFIGURATION_get_value_filename (cfg, "PEER", "PRIVATE_KEY", &fn)) 704 GNUNET_CONFIGURATION_get_value_filename (cfg, "PEER", "PRIVATE_KEY", &fn))
705 return NULL; 705 return NULL;
706 priv = GNUNET_CRYPTO_ecc_key_create_from_file (fn); 706 priv = GNUNET_CRYPTO_ecc_key_create_from_file (fn);
@@ -865,7 +865,7 @@ GNUNET_CRYPTO_ecc_verify (uint32_t purpose,
865 /* build s-expression for signature */ 865 /* build s-expression for signature */
866 mpi_scan (&r, sig->r, sizeof (sig->r)); 866 mpi_scan (&r, sig->r, sizeof (sig->r));
867 mpi_scan (&s, sig->s, sizeof (sig->s)); 867 mpi_scan (&s, sig->s, sizeof (sig->s));
868 if (0 != (rc = gcry_sexp_build (&sig_sexpr, NULL, 868 if (0 != (rc = gcry_sexp_build (&sig_sexpr, NULL,
869 "(sig-val(ecdsa(r %m)(s %m)))", 869 "(sig-val(ecdsa(r %m)(s %m)))",
870 r, s))) 870 r, s)))
871 { 871 {
@@ -917,7 +917,7 @@ decode_public_encrypt_key (const struct GNUNET_CRYPTO_EccPublicEncryptKey *pub)
917 mpi_scan (&q_x, pub->q_x, sizeof (pub->q_x)); 917 mpi_scan (&q_x, pub->q_x, sizeof (pub->q_x));
918 mpi_scan (&q_y, pub->q_y, sizeof (pub->q_y)); 918 mpi_scan (&q_y, pub->q_y, sizeof (pub->q_y));
919 q = gcry_mpi_point_new (256); 919 q = gcry_mpi_point_new (256);
920 gcry_mpi_point_set (q, q_x, q_y, GCRYMPI_CONST_ONE); 920 gcry_mpi_point_set (q, q_x, q_y, GCRYMPI_CONST_ONE);
921 gcry_mpi_release (q_x); 921 gcry_mpi_release (q_x);
922 gcry_mpi_release (q_y); 922 gcry_mpi_release (q_y);
923 923
@@ -945,7 +945,7 @@ int
945GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv, 945GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv,
946 const struct GNUNET_CRYPTO_EccPublicEncryptKey *pub, 946 const struct GNUNET_CRYPTO_EccPublicEncryptKey *pub,
947 struct GNUNET_HashCode *key_material) 947 struct GNUNET_HashCode *key_material)
948{ 948{
949 gcry_mpi_point_t result; 949 gcry_mpi_point_t result;
950 gcry_mpi_point_t q; 950 gcry_mpi_point_t q;
951 gcry_mpi_t d; 951 gcry_mpi_t d;
@@ -993,7 +993,7 @@ GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv,
993 993
994 994
995/** 995/**
996 * Derive the 'h' value for key derivation, where 996 * Derive the 'h' value for key derivation, where
997 * 'h = H(l,P)'. 997 * 'h = H(l,P)'.
998 * 998 *
999 * @param pub public key for deriviation 999 * @param pub public key for deriviation
@@ -1001,8 +1001,8 @@ GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv,
1001 * @param context additional context to use for HKDF of 'h'; 1001 * @param context additional context to use for HKDF of 'h';
1002 * typically the name of the subsystem/application 1002 * typically the name of the subsystem/application
1003 * @return h value 1003 * @return h value
1004 */ 1004 */
1005static gcry_mpi_t 1005static gcry_mpi_t
1006derive_h (const struct GNUNET_CRYPTO_EccPublicSignKey *pub, 1006derive_h (const struct GNUNET_CRYPTO_EccPublicSignKey *pub,
1007 const char *label, 1007 const char *label,
1008 const char *context) 1008 const char *context)
@@ -1090,7 +1090,7 @@ GNUNET_CRYPTO_ecc_public_key_derive (const struct GNUNET_CRYPTO_EccPublicSignKey
1090 gcry_mpi_point_t v; 1090 gcry_mpi_point_t v;
1091 1091
1092 GNUNET_assert (0 == gcry_mpi_ec_new (&ctx, NULL, CURVE)); 1092 GNUNET_assert (0 == gcry_mpi_ec_new (&ctx, NULL, CURVE));
1093 1093
1094 /* obtain point 'q' from original public key */ 1094 /* obtain point 'q' from original public key */
1095 mpi_scan (&q_x, pub->q_x, sizeof (pub->q_x)); 1095 mpi_scan (&q_x, pub->q_x, sizeof (pub->q_x));
1096 mpi_scan (&q_y, pub->q_y, sizeof (pub->q_y)); 1096 mpi_scan (&q_y, pub->q_y, sizeof (pub->q_y));
diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c
index 67cf92d17..cd2ea75bf 100644
--- a/src/util/crypto_hash.c
+++ b/src/util/crypto_hash.c
@@ -289,7 +289,7 @@ GNUNET_CRYPTO_hash_from_string2 (const char *enc,
289 289
290/** 290/**
291 * @ingroup hash 291 * @ingroup hash
292 * 292 *
293 * Compute the distance between 2 hashcodes. The computation must be 293 * Compute the distance between 2 hashcodes. The computation must be
294 * fast, not involve bits[0] or bits[4] (they're used elsewhere), and be 294 * fast, not involve bits[0] or bits[4] (they're used elsewhere), and be
295 * somewhat consistent. And of course, the result should be a positive 295 * somewhat consistent. And of course, the result should be a positive
@@ -457,7 +457,7 @@ GNUNET_CRYPTO_hash_matching_bits (const struct GNUNET_HashCode * first,
457 * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2. 457 * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2.
458 */ 458 */
459int 459int
460GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode *h1, 460GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode *h1,
461 const struct GNUNET_HashCode *h2) 461 const struct GNUNET_HashCode *h2)
462{ 462{
463 unsigned int *i1; 463 unsigned int *i1;
@@ -543,8 +543,8 @@ GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key,
543 const void *salt, size_t salt_len, 543 const void *salt, size_t salt_len,
544 va_list argp) 544 va_list argp)
545{ 545{
546 GNUNET_CRYPTO_kdf_v (key->key, sizeof (key->key), 546 GNUNET_CRYPTO_kdf_v (key->key, sizeof (key->key),
547 salt, salt_len, 547 salt, salt_len,
548 rkey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), 548 rkey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey),
549 argp); 549 argp);
550} 550}
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c
index e3388faad..e66c3c71b 100644
--- a/src/util/crypto_random.c
+++ b/src/util/crypto_random.c
@@ -279,7 +279,7 @@ entropy_generator (void *cls, const char *what, int printchar, int current,
279 LOG (GNUNET_ERROR_TYPE_INFO, _("Starting `%s' process to generate entropy\n"), 279 LOG (GNUNET_ERROR_TYPE_INFO, _("Starting `%s' process to generate entropy\n"),
280 "find"); 280 "find");
281 genproc = 281 genproc =
282 GNUNET_OS_start_process (GNUNET_NO, 0, 282 GNUNET_OS_start_process (GNUNET_NO, 0,
283 NULL, NULL, "sh", "sh", "-c", 283 NULL, NULL, "sh", "sh", "-c",
284 "exec find / -mount -type f -exec cp {} /dev/null \\; 2>/dev/null", 284 "exec find / -mount -type f -exec cp {} /dev/null \\; 2>/dev/null",
285 NULL); 285 NULL);
@@ -298,7 +298,7 @@ killfind ()
298} 298}
299 299
300 300
301void __attribute__ ((constructor)) 301void __attribute__ ((constructor))
302GNUNET_CRYPTO_random_init () 302GNUNET_CRYPTO_random_init ()
303{ 303{
304 gcry_error_t rc; 304 gcry_error_t rc;
@@ -319,7 +319,7 @@ GNUNET_CRYPTO_random_init ()
319 if ((rc = gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0))) 319 if ((rc = gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0)))
320 FPRINTF (stderr, "Failed to set libgcrypt option %s: %s\n", "ENABLE_QUICK_RANDOM", 320 FPRINTF (stderr, "Failed to set libgcrypt option %s: %s\n", "ENABLE_QUICK_RANDOM",
321 gcry_strerror (rc)); 321 gcry_strerror (rc));
322 322
323#ifdef GCRYCTL_INITIALIZATION_FINISHED 323#ifdef GCRYCTL_INITIALIZATION_FINISHED
324 gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); 324 gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
325#endif 325#endif
@@ -334,7 +334,7 @@ GNUNET_CRYPTO_random_init ()
334} 334}
335 335
336 336
337void __attribute__ ((destructor)) 337void __attribute__ ((destructor))
338GNUNET_CRYPTO_random_fini () 338GNUNET_CRYPTO_random_fini ()
339{ 339{
340 gcry_set_progress_handler (NULL, NULL); 340 gcry_set_progress_handler (NULL, NULL);
diff --git a/src/util/crypto_symmetric.c b/src/util/crypto_symmetric.c
index 97e2a4cfb..f6810ec5a 100644
--- a/src/util/crypto_symmetric.c
+++ b/src/util/crypto_symmetric.c
@@ -39,10 +39,10 @@
39void 39void
40GNUNET_CRYPTO_symmetric_create_session_key (struct GNUNET_CRYPTO_SymmetricSessionKey *key) 40GNUNET_CRYPTO_symmetric_create_session_key (struct GNUNET_CRYPTO_SymmetricSessionKey *key)
41{ 41{
42 gcry_randomize (key->aes_key, 42 gcry_randomize (key->aes_key,
43 GNUNET_CRYPTO_AES_KEY_LENGTH, 43 GNUNET_CRYPTO_AES_KEY_LENGTH,
44 GCRY_STRONG_RANDOM); 44 GCRY_STRONG_RANDOM);
45 gcry_randomize (key->twofish_key, 45 gcry_randomize (key->twofish_key,
46 GNUNET_CRYPTO_AES_KEY_LENGTH, 46 GNUNET_CRYPTO_AES_KEY_LENGTH,
47 GCRY_STRONG_RANDOM); 47 GCRY_STRONG_RANDOM);
48} 48}
@@ -66,12 +66,12 @@ setup_cipher_aes (gcry_cipher_hd_t *handle,
66 GNUNET_assert (0 == 66 GNUNET_assert (0 ==
67 gcry_cipher_open (handle, GCRY_CIPHER_AES256, 67 gcry_cipher_open (handle, GCRY_CIPHER_AES256,
68 GCRY_CIPHER_MODE_CFB, 0)); 68 GCRY_CIPHER_MODE_CFB, 0));
69 rc = gcry_cipher_setkey (*handle, 69 rc = gcry_cipher_setkey (*handle,
70 sessionkey->aes_key, 70 sessionkey->aes_key,
71 sizeof (sessionkey->aes_key)); 71 sizeof (sessionkey->aes_key));
72 GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); 72 GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY));
73 rc = gcry_cipher_setiv (*handle, 73 rc = gcry_cipher_setiv (*handle,
74 iv->aes_iv, 74 iv->aes_iv,
75 sizeof (iv->aes_iv)); 75 sizeof (iv->aes_iv));
76 GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); 76 GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY));
77 return GNUNET_OK; 77 return GNUNET_OK;
@@ -94,13 +94,13 @@ setup_cipher_twofish (gcry_cipher_hd_t *handle,
94 int rc; 94 int rc;
95 95
96 GNUNET_assert (0 == 96 GNUNET_assert (0 ==
97 gcry_cipher_open (handle, GCRY_CIPHER_TWOFISH, 97 gcry_cipher_open (handle, GCRY_CIPHER_TWOFISH,
98 GCRY_CIPHER_MODE_CFB, 0)); 98 GCRY_CIPHER_MODE_CFB, 0));
99 rc = gcry_cipher_setkey (*handle, 99 rc = gcry_cipher_setkey (*handle,
100 sessionkey->twofish_key, 100 sessionkey->twofish_key,
101 sizeof (sessionkey->twofish_key)); 101 sizeof (sessionkey->twofish_key));
102 GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); 102 GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY));
103 rc = gcry_cipher_setiv (*handle, 103 rc = gcry_cipher_setiv (*handle,
104 iv->twofish_iv, 104 iv->twofish_iv,
105 sizeof (iv->twofish_iv)); 105 sizeof (iv->twofish_iv));
106 GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); 106 GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY));
@@ -121,7 +121,7 @@ setup_cipher_twofish (gcry_cipher_hd_t *handle,
121 * @returns the size of the encrypted block, -1 for errors 121 * @returns the size of the encrypted block, -1 for errors
122 */ 122 */
123ssize_t 123ssize_t
124GNUNET_CRYPTO_symmetric_encrypt (const void *block, 124GNUNET_CRYPTO_symmetric_encrypt (const void *block,
125 size_t len, 125 size_t len,
126 const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, 126 const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey,
127 const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, 127 const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
@@ -157,7 +157,7 @@ GNUNET_CRYPTO_symmetric_encrypt (const void *block,
157ssize_t 157ssize_t
158GNUNET_CRYPTO_symmetric_decrypt (const void *block, size_t size, 158GNUNET_CRYPTO_symmetric_decrypt (const void *block, size_t size,
159 const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, 159 const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey,
160 const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, 160 const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
161 void *result) 161 void *result)
162{ 162{
163 gcry_cipher_hd_t handle; 163 gcry_cipher_hd_t handle;
@@ -219,13 +219,13 @@ GNUNET_CRYPTO_symmetric_derive_iv_v (struct GNUNET_CRYPTO_SymmetricInitializatio
219 memcpy (&aes_salt[salt_len], "AES!", 4); 219 memcpy (&aes_salt[salt_len], "AES!", 4);
220 memcpy (twofish_salt, salt, salt_len); 220 memcpy (twofish_salt, salt, salt_len);
221 memcpy (&twofish_salt[salt_len], "FISH", 4); 221 memcpy (&twofish_salt[salt_len], "FISH", 4);
222 GNUNET_CRYPTO_kdf_v (iv->aes_iv, sizeof (iv->aes_iv), 222 GNUNET_CRYPTO_kdf_v (iv->aes_iv, sizeof (iv->aes_iv),
223 aes_salt, salt_len + 4, 223 aes_salt, salt_len + 4,
224 skey->aes_key, sizeof (skey->aes_key), 224 skey->aes_key, sizeof (skey->aes_key),
225 argp); 225 argp);
226 GNUNET_CRYPTO_kdf_v (iv->twofish_iv, sizeof (iv->twofish_iv), 226 GNUNET_CRYPTO_kdf_v (iv->twofish_iv, sizeof (iv->twofish_iv),
227 twofish_salt, salt_len + 4, 227 twofish_salt, salt_len + 4,
228 skey->twofish_key, sizeof (skey->twofish_key), 228 skey->twofish_key, sizeof (skey->twofish_key),
229 argp); 229 argp);
230} 230}
231 231
diff --git a/src/util/disk.c b/src/util/disk.c
index d349aeb8e..69473a13d 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -410,7 +410,7 @@ mktemp_name (const char *t)
410 if (NULL == tmpdir) 410 if (NULL == tmpdir)
411 tmpdir = getenv ("TMP"); 411 tmpdir = getenv ("TMP");
412 if (NULL == tmpdir) 412 if (NULL == tmpdir)
413 tmpdir = getenv ("TEMP"); 413 tmpdir = getenv ("TEMP");
414 if (NULL == tmpdir) 414 if (NULL == tmpdir)
415 tmpdir = "/tmp"; 415 tmpdir = "/tmp";
416 GNUNET_asprintf (&tmpl, "%s/%s%s", tmpdir, t, "XXXXXX"); 416 GNUNET_asprintf (&tmpl, "%s/%s%s", tmpdir, t, "XXXXXX");
@@ -522,7 +522,7 @@ GNUNET_DISK_file_backup (const char *fil)
522 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, 522 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
523 "rename", 523 "rename",
524 fil); 524 fil);
525 GNUNET_free (target); 525 GNUNET_free (target);
526} 526}
527 527
528 528
@@ -795,7 +795,7 @@ GNUNET_DISK_directory_create_for_file (const char *filename)
795 * @return the number of bytes read on success, #GNUNET_SYSERR on failure 795 * @return the number of bytes read on success, #GNUNET_SYSERR on failure
796 */ 796 */
797ssize_t 797ssize_t
798GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, 798GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h,
799 void *result, 799 void *result,
800 size_t len) 800 size_t len)
801{ 801{
@@ -850,7 +850,7 @@ GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h,
850 */ 850 */
851ssize_t 851ssize_t
852GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle *h, 852GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle *h,
853 void *result, 853 void *result,
854 size_t len) 854 size_t len)
855{ 855{
856 if (NULL == h) 856 if (NULL == h)
@@ -921,8 +921,8 @@ GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle *h,
921 * @return number of bytes read, #GNUNET_SYSERR on failure 921 * @return number of bytes read, #GNUNET_SYSERR on failure
922 */ 922 */
923ssize_t 923ssize_t
924GNUNET_DISK_fn_read (const char *fn, 924GNUNET_DISK_fn_read (const char *fn,
925 void *result, 925 void *result,
926 size_t len) 926 size_t len)
927{ 927{
928 struct GNUNET_DISK_FileHandle *fh; 928 struct GNUNET_DISK_FileHandle *fh;
@@ -1033,7 +1033,7 @@ GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle * h,
1033 */ 1033 */
1034ssize_t 1034ssize_t
1035GNUNET_DISK_file_write_blocking (const struct GNUNET_DISK_FileHandle * h, 1035GNUNET_DISK_file_write_blocking (const struct GNUNET_DISK_FileHandle * h,
1036 const void *buffer, 1036 const void *buffer,
1037 size_t n) 1037 size_t n)
1038{ 1038{
1039 if (NULL == h) 1039 if (NULL == h)
@@ -1152,7 +1152,7 @@ GNUNET_DISK_directory_scan (const char *dir_name,
1152 } 1152 }
1153 if (!S_ISDIR (istat.st_mode)) 1153 if (!S_ISDIR (istat.st_mode))
1154 { 1154 {
1155 LOG (GNUNET_ERROR_TYPE_WARNING, 1155 LOG (GNUNET_ERROR_TYPE_WARNING,
1156 _("Expected `%s' to be a directory!\n"), 1156 _("Expected `%s' to be a directory!\n"),
1157 dir_name); 1157 dir_name);
1158 GNUNET_free (dname); 1158 GNUNET_free (dname);
@@ -1413,7 +1413,7 @@ GNUNET_DISK_directory_remove (const char *filename)
1413 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 1413 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
1414 */ 1414 */
1415int 1415int
1416GNUNET_DISK_file_copy (const char *src, 1416GNUNET_DISK_file_copy (const char *src,
1417 const char *dst) 1417 const char *dst)
1418{ 1418{
1419 char *buf; 1419 char *buf;
@@ -1684,7 +1684,7 @@ GNUNET_DISK_file_open (const char *fn,
1684 mode = translate_unix_perms (perm); 1684 mode = translate_unix_perms (perm);
1685 } 1685 }
1686 1686
1687 fd = open (expfn, oflags 1687 fd = open (expfn, oflags
1688#if O_CLOEXEC 1688#if O_CLOEXEC
1689 | O_CLOEXEC 1689 | O_CLOEXEC
1690#endif 1690#endif
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c
index e1aa94a5c..1d204dd07 100644
--- a/src/util/gnunet-config.c
+++ b/src/util/gnunet-config.c
@@ -61,12 +61,12 @@ static int ret;
61 * @param option name of the option 61 * @param option name of the option
62 * @param value value of the option 62 * @param value value of the option
63 */ 63 */
64static void 64static void
65print_option (void *cls, const char *section, 65print_option (void *cls, const char *section,
66 const char *option, 66 const char *option,
67 const char *value) 67 const char *value)
68{ 68{
69 fprintf (stdout, 69 fprintf (stdout,
70 "%s = %s\n", option, value); 70 "%s = %s\n", option, value);
71} 71}
72 72
@@ -136,11 +136,11 @@ run (void *cls, char *const *args, const char *cfgfile,
136 } 136 }
137 out = GNUNET_CONFIGURATION_dup (cfg); 137 out = GNUNET_CONFIGURATION_dup (cfg);
138 GNUNET_CONFIGURATION_set_value_string (out, section, option, value); 138 GNUNET_CONFIGURATION_set_value_string (out, section, option, value);
139 if (GNUNET_OK != 139 if (GNUNET_OK !=
140 GNUNET_CONFIGURATION_write (out, cfgfile)) 140 GNUNET_CONFIGURATION_write (out, cfgfile))
141 ret = 2; 141 ret = 2;
142 GNUNET_CONFIGURATION_destroy (out); 142 GNUNET_CONFIGURATION_destroy (out);
143 return; 143 return;
144 } 144 }
145} 145}
146 146
diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c
index 59c0f5fe2..23e562cbe 100644
--- a/src/util/gnunet-ecc.c
+++ b/src/util/gnunet-ecc.c
@@ -66,7 +66,7 @@ create_keys (const char *fn)
66 _("Generating %u keys, please wait"), 66 _("Generating %u keys, please wait"),
67 make_keys); 67 make_keys);
68 while (0 < make_keys--) 68 while (0 < make_keys--)
69 { 69 {
70 fprintf (stderr, 70 fprintf (stderr,
71 "."); 71 ".");
72 if (NULL == (pk = GNUNET_CRYPTO_ecc_key_create ())) 72 if (NULL == (pk = GNUNET_CRYPTO_ecc_key_create ()))
@@ -74,7 +74,7 @@ create_keys (const char *fn)
74 GNUNET_break (0); 74 GNUNET_break (0);
75 break; 75 break;
76 } 76 }
77 if (GNUNET_TESTING_HOSTKEYFILESIZE != 77 if (GNUNET_TESTING_HOSTKEYFILESIZE !=
78 fwrite (pk, 1, 78 fwrite (pk, 1,
79 GNUNET_TESTING_HOSTKEYFILESIZE, f)) 79 GNUNET_TESTING_HOSTKEYFILESIZE, f))
80 { 80 {
@@ -140,7 +140,7 @@ run (void *cls, char *const *args, const char *cfgfile,
140 140
141 GNUNET_CRYPTO_ecc_key_get_public_for_signature (pk, &pub); 141 GNUNET_CRYPTO_ecc_key_get_public_for_signature (pk, &pub);
142 str = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pub); 142 str = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pub);
143 fprintf (stdout, 143 fprintf (stdout,
144 "%s\n", 144 "%s\n",
145 str); 145 str);
146 GNUNET_free (str); 146 GNUNET_free (str);
diff --git a/src/util/gnunet-resolver.c b/src/util/gnunet-resolver.c
index 72ece9710..e71893873 100644
--- a/src/util/gnunet-resolver.c
+++ b/src/util/gnunet-resolver.c
@@ -84,7 +84,7 @@ run (void *cls, char *const *args, const char *cfgfile,
84 socklen_t salen; 84 socklen_t salen;
85 struct sockaddr_in v4; 85 struct sockaddr_in v4;
86 struct sockaddr_in6 v6; 86 struct sockaddr_in6 v6;
87 87
88 if (args[0] == NULL) 88 if (args[0] == NULL)
89 return; 89 return;
90 if (! reverse) 90 if (! reverse)
@@ -92,7 +92,7 @@ run (void *cls, char *const *args, const char *cfgfile,
92 GNUNET_RESOLVER_ip_get (args[0], AF_UNSPEC, GET_TIMEOUT, &print_sockaddr, NULL); 92 GNUNET_RESOLVER_ip_get (args[0], AF_UNSPEC, GET_TIMEOUT, &print_sockaddr, NULL);
93 return; 93 return;
94 } 94 }
95 95
96 sa = NULL; 96 sa = NULL;
97 memset (&v4, 0, sizeof (v4)); 97 memset (&v4, 0, sizeof (v4));
98 v4.sin_family = AF_INET; 98 v4.sin_family = AF_INET;
@@ -120,7 +120,7 @@ run (void *cls, char *const *args, const char *cfgfile,
120 } 120 }
121 if (NULL == sa) 121 if (NULL == sa)
122 { 122 {
123 fprintf (stderr, 123 fprintf (stderr,
124 "`%s' is not a valid IP: %s\n", 124 "`%s' is not a valid IP: %s\n",
125 args[0], 125 args[0],
126 strerror (errno)); 126 strerror (errno));
diff --git a/src/util/gnunet-service-resolver.c b/src/util/gnunet-service-resolver.c
index cab13ae57..c8d510770 100644
--- a/src/util/gnunet-service-resolver.c
+++ b/src/util/gnunet-service-resolver.c
@@ -213,7 +213,7 @@ get_ip_as_string (struct GNUNET_SERVER_Client *client,
213 next = cache_head; 213 next = cache_head;
214 while ( (NULL != (pos = next)) && 214 while ( (NULL != (pos = next)) &&
215 ( (pos->af != af) || 215 ( (pos->af != af) ||
216 (pos->ip_len != ip_len) || 216 (pos->ip_len != ip_len) ||
217 (0 != memcmp (pos->ip, ip, ip_len))) ) 217 (0 != memcmp (pos->ip, ip, ip_len))) )
218 { 218 {
219 next = pos->next; 219 next = pos->next;
@@ -323,7 +323,7 @@ getaddrinfo_resolve (struct GNUNET_SERVER_TransmitContext *tc,
323 default: 323 default:
324 /* unsupported, skip */ 324 /* unsupported, skip */
325 break; 325 break;
326 } 326 }
327 pos = pos->ai_next; 327 pos = pos->ai_next;
328 } 328 }
329 freeaddrinfo (result); 329 freeaddrinfo (result);
@@ -364,15 +364,15 @@ gethostbyname2_resolve (struct GNUNET_SERVER_TransmitContext *tc,
364 { 364 {
365 case AF_INET: 365 case AF_INET:
366 GNUNET_assert (hp->h_length == sizeof (struct in_addr)); 366 GNUNET_assert (hp->h_length == sizeof (struct in_addr));
367 GNUNET_SERVER_transmit_context_append_data (tc, 367 GNUNET_SERVER_transmit_context_append_data (tc,
368 hp->h_addr_list[0], 368 hp->h_addr_list[0],
369 hp->h_length, 369 hp->h_length,
370 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); 370 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE);
371 break; 371 break;
372 case AF_INET6: 372 case AF_INET6:
373 GNUNET_assert (hp->h_length == sizeof (struct in6_addr)); 373 GNUNET_assert (hp->h_length == sizeof (struct in6_addr));
374 GNUNET_SERVER_transmit_context_append_data (tc, 374 GNUNET_SERVER_transmit_context_append_data (tc,
375 hp->h_addr_list[0], 375 hp->h_addr_list[0],
376 hp->h_length, 376 hp->h_length,
377 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); 377 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE);
378 break; 378 break;
@@ -406,7 +406,7 @@ gethostbyname_resolve (struct GNUNET_SERVER_TransmitContext *tc,
406 return GNUNET_SYSERR; 406 return GNUNET_SYSERR;
407 } 407 }
408 GNUNET_assert (hp->h_length == sizeof (struct in_addr)); 408 GNUNET_assert (hp->h_length == sizeof (struct in_addr));
409 GNUNET_SERVER_transmit_context_append_data (tc, 409 GNUNET_SERVER_transmit_context_append_data (tc,
410 hp->h_addr_list[0], 410 hp->h_addr_list[0],
411 hp->h_length, 411 hp->h_length,
412 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); 412 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE);
@@ -482,7 +482,7 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client,
482 { 482 {
483 /* IP from hostname */ 483 /* IP from hostname */
484 const char *hostname; 484 const char *hostname;
485 485
486 hostname = (const char *) &msg[1]; 486 hostname = (const char *) &msg[1];
487 if (hostname[size - 1] != '\0') 487 if (hostname[size - 1] != '\0')
488 { 488 {
@@ -521,12 +521,12 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client,
521 } 521 }
522 { 522 {
523 char buf[INET6_ADDRSTRLEN]; 523 char buf[INET6_ADDRSTRLEN];
524 524
525 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 525 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
526 "Resolver asked to look up IP address `%s'.\n", 526 "Resolver asked to look up IP address `%s'.\n",
527 inet_ntop (af, ip, buf, sizeof (buf))); 527 inet_ntop (af, ip, buf, sizeof (buf)));
528 } 528 }
529 get_ip_as_string (client, af, ip); 529 get_ip_as_string (client, af, ip);
530} 530}
531 531
532 532
diff --git a/src/util/gnunet-uri.c b/src/util/gnunet-uri.c
index 5ca1f4efc..1964aade4 100644
--- a/src/util/gnunet-uri.c
+++ b/src/util/gnunet-uri.c
@@ -117,12 +117,12 @@ run (void *cls, char *const *args, const char *cfgfile,
117 rt = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, 117 rt = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
118 GNUNET_DISK_pipe_handle (sigpipe, 118 GNUNET_DISK_pipe_handle (sigpipe,
119 GNUNET_DISK_PIPE_END_READ), 119 GNUNET_DISK_PIPE_END_READ),
120 &maint_child_death, NULL); 120 &maint_child_death, NULL);
121 p = GNUNET_OS_start_process (GNUNET_NO, 0, 121 p = GNUNET_OS_start_process (GNUNET_NO, 0,
122 NULL, NULL, 122 NULL, NULL,
123 program, 123 program,
124 program, 124 program,
125 args[0], 125 args[0],
126 NULL); 126 NULL);
127 GNUNET_free (program); 127 GNUNET_free (program);
128 if (NULL == p) 128 if (NULL == p)
@@ -176,7 +176,7 @@ main (int argc, char *const *argv)
176 GNUNET_SIGNAL_handler_uninstall (shc_chld); 176 GNUNET_SIGNAL_handler_uninstall (shc_chld);
177 shc_chld = NULL; 177 shc_chld = NULL;
178 GNUNET_DISK_pipe_close (sigpipe); 178 GNUNET_DISK_pipe_close (sigpipe);
179 sigpipe = NULL; 179 sigpipe = NULL;
180 GNUNET_free ((void *) argv); 180 GNUNET_free ((void *) argv);
181 return (GNUNET_OK == ret) ? 0 : 1; 181 return (GNUNET_OK == ret) ? 0 : 1;
182} 182}
diff --git a/src/util/helper.c b/src/util/helper.c
index a70d86f18..21f196ebc 100644
--- a/src/util/helper.c
+++ b/src/util/helper.c
@@ -49,12 +49,12 @@ struct GNUNET_HELPER_SendHandle
49 * Message to transmit (allocated at the end of this struct) 49 * Message to transmit (allocated at the end of this struct)
50 */ 50 */
51 const struct GNUNET_MessageHeader *msg; 51 const struct GNUNET_MessageHeader *msg;
52 52
53 /** 53 /**
54 * The handle to a helper process. 54 * The handle to a helper process.
55 */ 55 */
56 struct GNUNET_HELPER_Handle *h; 56 struct GNUNET_HELPER_Handle *h;
57 57
58 /** 58 /**
59 * Function to call upon completion. 59 * Function to call upon completion.
60 */ 60 */
@@ -83,22 +83,22 @@ struct GNUNET_HELPER_Handle
83 * PipeHandle to receive data from the helper 83 * PipeHandle to receive data from the helper
84 */ 84 */
85 struct GNUNET_DISK_PipeHandle *helper_in; 85 struct GNUNET_DISK_PipeHandle *helper_in;
86 86
87 /** 87 /**
88 * PipeHandle to send data to the helper 88 * PipeHandle to send data to the helper
89 */ 89 */
90 struct GNUNET_DISK_PipeHandle *helper_out; 90 struct GNUNET_DISK_PipeHandle *helper_out;
91 91
92 /** 92 /**
93 * FileHandle to receive data from the helper 93 * FileHandle to receive data from the helper
94 */ 94 */
95 const struct GNUNET_DISK_FileHandle *fh_from_helper; 95 const struct GNUNET_DISK_FileHandle *fh_from_helper;
96 96
97 /** 97 /**
98 * FileHandle to send data to the helper 98 * FileHandle to send data to the helper
99 */ 99 */
100 const struct GNUNET_DISK_FileHandle *fh_to_helper; 100 const struct GNUNET_DISK_FileHandle *fh_to_helper;
101 101
102 /** 102 /**
103 * The process id of the helper 103 * The process id of the helper
104 */ 104 */
@@ -138,7 +138,7 @@ struct GNUNET_HELPER_Handle
138 * NULL-terminated list of command-line arguments. 138 * NULL-terminated list of command-line arguments.
139 */ 139 */
140 char **binary_argv; 140 char **binary_argv;
141 141
142 /** 142 /**
143 * Task to read from the helper. 143 * Task to read from the helper.
144 */ 144 */
@@ -172,7 +172,7 @@ struct GNUNET_HELPER_Handle
172 * @return #GNUNET_OK on success; #GNUNET_SYSERR on error 172 * @return #GNUNET_OK on success; #GNUNET_SYSERR on error
173 */ 173 */
174int 174int
175GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h, 175GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h,
176 int soft_kill) 176 int soft_kill)
177{ 177{
178 struct GNUNET_HELPER_SendHandle *sh; 178 struct GNUNET_HELPER_SendHandle *sh;
@@ -200,7 +200,7 @@ GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h,
200 if (NULL == h->helper_proc) 200 if (NULL == h->helper_proc)
201 return GNUNET_SYSERR; 201 return GNUNET_SYSERR;
202 if (GNUNET_YES == soft_kill) 202 if (GNUNET_YES == soft_kill)
203 { 203 {
204 /* soft-kill only possible with pipes */ 204 /* soft-kill only possible with pipes */
205 GNUNET_assert (NULL != h->helper_in); 205 GNUNET_assert (NULL != h->helper_in);
206 ret = GNUNET_DISK_pipe_close (h->helper_in); 206 ret = GNUNET_DISK_pipe_close (h->helper_in);
@@ -281,7 +281,7 @@ GNUNET_HELPER_wait (struct GNUNET_HELPER_Handle *h)
281 * stdin; #GNUNET_NO to signal termination by sending SIGTERM to helper 281 * stdin; #GNUNET_NO to signal termination by sending SIGTERM to helper
282 */ 282 */
283static void 283static void
284stop_helper (struct GNUNET_HELPER_Handle *h, 284stop_helper (struct GNUNET_HELPER_Handle *h,
285 int soft_kill) 285 int soft_kill)
286{ 286{
287 if (GNUNET_SCHEDULER_NO_TASK != h->restart_task) 287 if (GNUNET_SCHEDULER_NO_TASK != h->restart_task)
@@ -352,9 +352,9 @@ helper_read (void *cls,
352 } 352 }
353 if (0 == t) 353 if (0 == t)
354 { 354 {
355 /* this happens if the helper is shut down via a 355 /* this happens if the helper is shut down via a
356 signal, so it is not a "hard" error */ 356 signal, so it is not a "hard" error */
357 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 357 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
358 "Got 0 bytes from helper `%s' (EOF)\n", 358 "Got 0 bytes from helper `%s' (EOF)\n",
359 h->binary_name); 359 h->binary_name);
360 if (NULL != h->exp_cb) 360 if (NULL != h->exp_cb)
@@ -370,7 +370,7 @@ helper_read (void *cls,
370 &restart_task, h); 370 &restart_task, h);
371 return; 371 return;
372 } 372 }
373 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 373 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
374 "Got %u bytes from helper `%s'\n", 374 "Got %u bytes from helper `%s'\n",
375 (unsigned int) t, 375 (unsigned int) t,
376 h->binary_name); 376 h->binary_name);
@@ -379,7 +379,7 @@ helper_read (void *cls,
379 if (GNUNET_SYSERR == 379 if (GNUNET_SYSERR ==
380 GNUNET_SERVER_mst_receive (h->mst, NULL, buf, t, GNUNET_NO, GNUNET_NO)) 380 GNUNET_SERVER_mst_receive (h->mst, NULL, buf, t, GNUNET_NO, GNUNET_NO))
381 { 381 {
382 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 382 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
383 _("Failed to parse inbound message from helper `%s'\n"), 383 _("Failed to parse inbound message from helper `%s'\n"),
384 h->binary_name); 384 h->binary_name);
385 if (NULL != h->exp_cb) 385 if (NULL != h->exp_cb)
@@ -387,7 +387,7 @@ helper_read (void *cls,
387 h->exp_cb (h->cb_cls); 387 h->exp_cb (h->cb_cls);
388 GNUNET_HELPER_stop (h, GNUNET_NO); 388 GNUNET_HELPER_stop (h, GNUNET_NO);
389 return; 389 return;
390 } 390 }
391 stop_helper (h, GNUNET_NO); 391 stop_helper (h, GNUNET_NO);
392 /* Restart the helper */ 392 /* Restart the helper */
393 h->restart_task = 393 h->restart_task =
@@ -414,7 +414,7 @@ start_helper (struct GNUNET_HELPER_Handle *h)
414 stop_helper (h, GNUNET_NO); 414 stop_helper (h, GNUNET_NO);
415 h->restart_task = 415 h->restart_task =
416 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 416 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
417 &restart_task, h); 417 &restart_task, h);
418 return; 418 return;
419 } 419 }
420 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 420 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -425,7 +425,7 @@ start_helper (struct GNUNET_HELPER_Handle *h)
425 h->fh_to_helper = 425 h->fh_to_helper =
426 GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE); 426 GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE);
427 h->helper_proc = 427 h->helper_proc =
428 GNUNET_OS_start_process_vap (h->with_control_pipe, GNUNET_OS_INHERIT_STD_ERR, 428 GNUNET_OS_start_process_vap (h->with_control_pipe, GNUNET_OS_INHERIT_STD_ERR,
429 h->helper_in, h->helper_out, 429 h->helper_in, h->helper_out,
430 h->binary_name, 430 h->binary_name,
431 h->binary_argv); 431 h->binary_argv);
@@ -435,15 +435,15 @@ start_helper (struct GNUNET_HELPER_Handle *h)
435 stop_helper (h, GNUNET_NO); 435 stop_helper (h, GNUNET_NO);
436 h->restart_task = 436 h->restart_task =
437 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 437 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
438 &restart_task, h); 438 &restart_task, h);
439 return; 439 return;
440 } 440 }
441 GNUNET_DISK_pipe_close_end (h->helper_out, GNUNET_DISK_PIPE_END_WRITE); 441 GNUNET_DISK_pipe_close_end (h->helper_out, GNUNET_DISK_PIPE_END_WRITE);
442 GNUNET_DISK_pipe_close_end (h->helper_in, GNUNET_DISK_PIPE_END_READ); 442 GNUNET_DISK_pipe_close_end (h->helper_in, GNUNET_DISK_PIPE_END_READ);
443 if (NULL != h->mst) 443 if (NULL != h->mst)
444 h->read_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, 444 h->read_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
445 h->fh_from_helper, 445 h->fh_from_helper,
446 &helper_read, 446 &helper_read,
447 h); 447 h);
448} 448}
449 449
@@ -558,7 +558,7 @@ GNUNET_HELPER_destroy (struct GNUNET_HELPER_Handle *h)
558 * stdin; #GNUNET_NO to signal termination by sending SIGTERM to helper 558 * stdin; #GNUNET_NO to signal termination by sending SIGTERM to helper
559 */ 559 */
560void 560void
561GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h, 561GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h,
562 int soft_kill) 562 int soft_kill)
563{ 563{
564 h->exp_cb = NULL; 564 h->exp_cb = NULL;
@@ -591,7 +591,7 @@ helper_write (void *cls,
591 h->write_task = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, 591 h->write_task = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL,
592 h->fh_to_helper, &helper_write, h); 592 h->fh_to_helper, &helper_write, h);
593 return; 593 return;
594 } 594 }
595 if (NULL == (sh = h->sh_head)) 595 if (NULL == (sh = h->sh_head))
596 { 596 {
597 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 597 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -600,7 +600,7 @@ helper_write (void *cls,
600 } 600 }
601 buf = (const char*) sh->msg; 601 buf = (const char*) sh->msg;
602 t = GNUNET_DISK_file_write (h->fh_to_helper, 602 t = GNUNET_DISK_file_write (h->fh_to_helper,
603 &buf[sh->wpos], 603 &buf[sh->wpos],
604 ntohs (sh->msg->size) - sh->wpos); 604 ntohs (sh->msg->size) - sh->wpos);
605 if (-1 == t) 605 if (-1 == t)
606 { 606 {
@@ -640,8 +640,8 @@ helper_write (void *cls,
640 } 640 }
641 if (NULL != h->sh_head) 641 if (NULL != h->sh_head)
642 h->write_task = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, 642 h->write_task = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL,
643 h->fh_to_helper, 643 h->fh_to_helper,
644 &helper_write, 644 &helper_write,
645 h); 645 h);
646} 646}
647 647
@@ -655,12 +655,12 @@ helper_write (void *cls,
655 * @param cont continuation to run once the message is out (#GNUNET_OK on succees, #GNUNET_NO 655 * @param cont continuation to run once the message is out (#GNUNET_OK on succees, #GNUNET_NO
656 * if the helper process died, #GNUNET_SYSERR during #GNUNET_HELPER_destroy). 656 * if the helper process died, #GNUNET_SYSERR during #GNUNET_HELPER_destroy).
657 * @param cont_cls closure for @a cont 657 * @param cont_cls closure for @a cont
658 * @return NULL if the message was dropped, 658 * @return NULL if the message was dropped,
659 * otherwise handle to cancel *cont* (actual transmission may 659 * otherwise handle to cancel *cont* (actual transmission may
660 * not be abortable) 660 * not be abortable)
661 */ 661 */
662struct GNUNET_HELPER_SendHandle * 662struct GNUNET_HELPER_SendHandle *
663GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h, 663GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h,
664 const struct GNUNET_MessageHeader *msg, 664 const struct GNUNET_MessageHeader *msg,
665 int can_drop, 665 int can_drop,
666 GNUNET_HELPER_Continuation cont, 666 GNUNET_HELPER_Continuation cont,
@@ -686,10 +686,10 @@ GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h,
686 sh); 686 sh);
687 if (GNUNET_SCHEDULER_NO_TASK == h->write_task) 687 if (GNUNET_SCHEDULER_NO_TASK == h->write_task)
688 h->write_task = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, 688 h->write_task = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL,
689 h->fh_to_helper, 689 h->fh_to_helper,
690 &helper_write, 690 &helper_write,
691 h); 691 h);
692 692
693 return sh; 693 return sh;
694} 694}
695 695
diff --git a/src/util/mq.c b/src/util/mq.c
index 733329a2c..c4f9e0d0b 100644
--- a/src/util/mq.c
+++ b/src/util/mq.c
@@ -192,7 +192,7 @@ GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq, const struct GNUNET_Messa
192 handled = GNUNET_YES; 192 handled = GNUNET_YES;
193 } 193 }
194 } 194 }
195 195
196 if (GNUNET_NO == handled) 196 if (GNUNET_NO == handled)
197 LOG (GNUNET_ERROR_TYPE_WARNING, "no handler for message of type %d\n", ntohs (mh->type)); 197 LOG (GNUNET_ERROR_TYPE_WARNING, "no handler for message of type %d\n", ntohs (mh->type));
198} 198}
@@ -233,7 +233,7 @@ GNUNET_MQ_discard (struct GNUNET_MQ_Envelope *mqm)
233/** 233/**
234 * Send a message with the give message queue. 234 * Send a message with the give message queue.
235 * May only be called once per message. 235 * May only be called once per message.
236 * 236 *
237 * @param mq message queue 237 * @param mq message queue
238 * @param ev the envelope with the message to send. 238 * @param ev the envelope with the message to send.
239 */ 239 */
@@ -242,7 +242,7 @@ GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
242{ 242{
243 GNUNET_assert (NULL != mq); 243 GNUNET_assert (NULL != mq);
244 GNUNET_assert (NULL == ev->parent_queue); 244 GNUNET_assert (NULL == ev->parent_queue);
245 245
246 /* is the implementation busy? queue it! */ 246 /* is the implementation busy? queue it! */
247 if (NULL != mq->current_envelope) 247 if (NULL != mq->current_envelope)
248 { 248 {
@@ -465,7 +465,7 @@ server_client_destroy_impl (struct GNUNET_MQ_Handle *mq,
465 void *impl_state) 465 void *impl_state)
466{ 466{
467 struct ServerClientSocketState *state = impl_state; 467 struct ServerClientSocketState *state = impl_state;
468 468
469 GNUNET_assert (NULL != mq); 469 GNUNET_assert (NULL != mq);
470 GNUNET_assert (NULL != state); 470 GNUNET_assert (NULL != state);
471 GNUNET_SERVER_client_drop (state->client); 471 GNUNET_SERVER_client_drop (state->client);
@@ -483,7 +483,7 @@ server_client_send_impl (struct GNUNET_MQ_Handle *mq,
483 483
484 GNUNET_MQ_impl_send_commit (mq); 484 GNUNET_MQ_impl_send_commit (mq);
485 485
486 state->th = 486 state->th =
487 GNUNET_SERVER_notify_transmit_ready (state->client, ntohs (msg->size), 487 GNUNET_SERVER_notify_transmit_ready (state->client, ntohs (msg->size),
488 GNUNET_TIME_UNIT_FOREVER_REL, 488 GNUNET_TIME_UNIT_FOREVER_REL,
489 &transmit_queued, mq); 489 &transmit_queued, mq);
@@ -522,7 +522,7 @@ handle_client_message (void *cls,
522 struct ClientConnectionState *state; 522 struct ClientConnectionState *state;
523 523
524 state = mq->impl_state; 524 state = mq->impl_state;
525 525
526 if (NULL == msg) 526 if (NULL == msg)
527 { 527 {
528 GNUNET_MQ_inject_error (mq, GNUNET_MQ_ERROR_READ); 528 GNUNET_MQ_inject_error (mq, GNUNET_MQ_ERROR_READ);
@@ -600,8 +600,8 @@ connection_client_send_impl (struct GNUNET_MQ_Handle *mq,
600 600
601 GNUNET_MQ_impl_send_commit (mq); 601 GNUNET_MQ_impl_send_commit (mq);
602 602
603 state->th = 603 state->th =
604 GNUNET_CLIENT_notify_transmit_ready (state->connection, ntohs (msg->size), 604 GNUNET_CLIENT_notify_transmit_ready (state->connection, ntohs (msg->size),
605 GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_NO, 605 GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_NO,
606 &connection_client_transmit_queued, mq); 606 &connection_client_transmit_queued, mq);
607} 607}
diff --git a/src/util/network.c b/src/util/network.c
index 309c3a26d..a921998e9 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -118,7 +118,7 @@ GNUNET_NETWORK_shorten_unixpath (char *unixpath)
118 struct GNUNET_CRYPTO_HashAsciiEncoded ae; 118 struct GNUNET_CRYPTO_HashAsciiEncoded ae;
119 size_t upm; 119 size_t upm;
120 120
121 upm = sizeof (dummy.sun_path); 121 upm = sizeof (dummy.sun_path);
122 slen = strlen (unixpath); 122 slen = strlen (unixpath);
123 if (slen < upm) 123 if (slen < upm)
124 return unixpath; /* no shortening required */ 124 return unixpath; /* no shortening required */
@@ -243,7 +243,7 @@ socket_set_nosigpipe (const struct GNUNET_NETWORK_Handle *h)
243 int abs_value = 1; 243 int abs_value = 1;
244 244
245 if (0 != 245 if (0 !=
246 setsockopt (h->fd, SOL_SOCKET, SO_NOSIGPIPE, 246 setsockopt (h->fd, SOL_SOCKET, SO_NOSIGPIPE,
247 (const void *) &abs_value, 247 (const void *) &abs_value,
248 sizeof (abs_value))) 248 sizeof (abs_value)))
249 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt"); 249 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
@@ -270,7 +270,7 @@ socket_set_nodelay (const struct GNUNET_NETWORK_Handle *h)
270 const char *abs_value = "1"; 270 const char *abs_value = "1";
271 271
272 if (0 != 272 if (0 !=
273 setsockopt (h->fd, IPPROTO_TCP, TCP_NODELAY, 273 setsockopt (h->fd, IPPROTO_TCP, TCP_NODELAY,
274 (const void *) abs_value, 274 (const void *) abs_value,
275 sizeof (abs_value))) 275 sizeof (abs_value)))
276 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt"); 276 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
@@ -325,7 +325,7 @@ initialize_network_handle (struct GNUNET_NETWORK_Handle *h,
325#ifdef DARWIN 325#ifdef DARWIN
326 socket_set_nosigpipe (h); 326 socket_set_nosigpipe (h);
327#endif 327#endif
328 if ( (type == SOCK_STREAM) 328 if ( (type == SOCK_STREAM)
329#ifdef AF_UNIX 329#ifdef AF_UNIX
330 && (af != AF_UNIX) 330 && (af != AF_UNIX)
331#endif 331#endif
@@ -345,7 +345,7 @@ initialize_network_handle (struct GNUNET_NETWORK_Handle *h,
345 */ 345 */
346struct GNUNET_NETWORK_Handle * 346struct GNUNET_NETWORK_Handle *
347GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc, 347GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc,
348 struct sockaddr *address, 348 struct sockaddr *address,
349 socklen_t *address_len) 349 socklen_t *address_len)
350{ 350{
351 struct GNUNET_NETWORK_Handle *ret; 351 struct GNUNET_NETWORK_Handle *ret;
@@ -358,7 +358,7 @@ GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc,
358 int gsn = getsockname (desc->fd, &name, &namelen); 358 int gsn = getsockname (desc->fd, &name, &namelen);
359 359
360 if (gsn == 0) 360 if (gsn == 0)
361 LOG (GNUNET_ERROR_TYPE_DEBUG, 361 LOG (GNUNET_ERROR_TYPE_DEBUG,
362 "Accepting connection on `%s'\n", 362 "Accepting connection on `%s'\n",
363 GNUNET_a2s (&name, namelen)); 363 GNUNET_a2s (&name, namelen));
364 } 364 }
@@ -414,8 +414,8 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
414 const int on = 1; 414 const int on = 1;
415 415
416 if (desc->af == AF_INET6) 416 if (desc->af == AF_INET6)
417 if (setsockopt (desc->fd, IPPROTO_IPV6, IPV6_V6ONLY, 417 if (setsockopt (desc->fd, IPPROTO_IPV6, IPV6_V6ONLY,
418 (const void *) &on, 418 (const void *) &on,
419 sizeof (on))) 419 sizeof (on)))
420 LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt"); 420 LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt");
421 } 421 }
@@ -424,9 +424,9 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
424#ifndef WINDOWS 424#ifndef WINDOWS
425 { 425 {
426 const int on = 1; 426 const int on = 1;
427 427
428 /* This is required here for TCP sockets, but only on UNIX */ 428 /* This is required here for TCP sockets, but only on UNIX */
429 if ((SOCK_STREAM == desc->type) 429 if ((SOCK_STREAM == desc->type)
430 && (0 != setsockopt (desc->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)))) 430 && (0 != setsockopt (desc->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on))))
431 LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt"); 431 LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt");
432 } 432 }
@@ -1437,7 +1437,7 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds,
1437 tv.tv_usec = 1437 tv.tv_usec =
1438 (timeout.rel_value_us - 1438 (timeout.rel_value_us -
1439 (tv.tv_sec * GNUNET_TIME_UNIT_SECONDS.rel_value_us)); 1439 (tv.tv_sec * GNUNET_TIME_UNIT_SECONDS.rel_value_us));
1440 return select (nfds, 1440 return select (nfds,
1441 (NULL != rfds) ? &rfds->sds : NULL, 1441 (NULL != rfds) ? &rfds->sds : NULL,
1442 (NULL != wfds) ? &wfds->sds : NULL, 1442 (NULL != wfds) ? &wfds->sds : NULL,
1443 (NULL != efds) ? &efds->sds : NULL, 1443 (NULL != efds) ? &efds->sds : NULL,
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index 06eb4ed60..98ac7b989 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -741,16 +741,16 @@ GNUNET_OS_check_helper_binary (const char *binary, int check_suid, const char *p
741 char parameters[512]; 741 char parameters[512];
742 PROCESS_INFORMATION proc; 742 PROCESS_INFORMATION proc;
743 DWORD exit_value; 743 DWORD exit_value;
744 744
745 GNUNET_snprintf (parameters, 745 GNUNET_snprintf (parameters,
746 sizeof (parameters), 746 sizeof (parameters),
747 "-d %s", params); 747 "-d %s", params);
748 memset (&start, 0, sizeof (start)); 748 memset (&start, 0, sizeof (start));
749 start.cb = sizeof (start); 749 start.cb = sizeof (start);
750 memset (&proc, 0, sizeof (proc)); 750 memset (&proc, 0, sizeof (proc));
751 751
752 752
753 // Start the child process. 753 // Start the child process.
754 if ( ! (CreateProcess( p, // current windows (2k3 and up can handle / instead of \ in paths)) 754 if ( ! (CreateProcess( p, // current windows (2k3 and up can handle / instead of \ in paths))
755 parameters, // execute dryrun/priviliege checking mode 755 parameters, // execute dryrun/priviliege checking mode
756 NULL, // Process handle not inheritable 756 NULL, // Process handle not inheritable
@@ -758,12 +758,12 @@ GNUNET_OS_check_helper_binary (const char *binary, int check_suid, const char *p
758 FALSE, // Set handle inheritance to FALSE 758 FALSE, // Set handle inheritance to FALSE
759 CREATE_DEFAULT_ERROR_MODE, // No creation flags 759 CREATE_DEFAULT_ERROR_MODE, // No creation flags
760 NULL, // Use parent's environment block 760 NULL, // Use parent's environment block
761 NULL, // Use parent's starting directory 761 NULL, // Use parent's starting directory
762 &start, // Pointer to STARTUPINFO structure 762 &start, // Pointer to STARTUPINFO structure
763 &proc ) // Pointer to PROCESS_INFORMATION structure 763 &proc ) // Pointer to PROCESS_INFORMATION structure
764 )) 764 ))
765 { 765 {
766 LOG (GNUNET_ERROR_TYPE_ERROR, 766 LOG (GNUNET_ERROR_TYPE_ERROR,
767 _("CreateProcess failed for binary %s (%d).\n"), 767 _("CreateProcess failed for binary %s (%d).\n"),
768 p, GetLastError()); 768 p, GetLastError());
769 return GNUNET_SYSERR; 769 return GNUNET_SYSERR;
@@ -771,17 +771,17 @@ GNUNET_OS_check_helper_binary (const char *binary, int check_suid, const char *p
771 771
772 // Wait until child process exits. 772 // Wait until child process exits.
773 WaitForSingleObject( proc.hProcess, INFINITE ); 773 WaitForSingleObject( proc.hProcess, INFINITE );
774 774
775 if ( ! GetExitCodeProcess (proc.hProcess, &exit_value)){ 775 if ( ! GetExitCodeProcess (proc.hProcess, &exit_value)){
776 LOG (GNUNET_ERROR_TYPE_ERROR, 776 LOG (GNUNET_ERROR_TYPE_ERROR,
777 _("GetExitCodeProcess failed for binary %s (%d).\n"), 777 _("GetExitCodeProcess failed for binary %s (%d).\n"),
778 p, GetLastError() ); 778 p, GetLastError() );
779 return GNUNET_SYSERR; 779 return GNUNET_SYSERR;
780 } 780 }
781 // Close process and thread handles. 781 // Close process and thread handles.
782 CloseHandle( proc.hProcess ); 782 CloseHandle( proc.hProcess );
783 CloseHandle( proc.hThread ); 783 CloseHandle( proc.hThread );
784 784
785 if (!exit_value) 785 if (!exit_value)
786 return GNUNET_YES; 786 return GNUNET_YES;
787#endif 787#endif
diff --git a/src/util/os_network.c b/src/util/os_network.c
index 4d9155ae2..f0f66918e 100644
--- a/src/util/os_network.c
+++ b/src/util/os_network.c
@@ -250,7 +250,7 @@ GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor proc,
250 250
251 pass_netmask = (struct sockaddr *) &netmask6; 251 pass_netmask = (struct sockaddr *) &netmask6;
252 } 252 }
253 253
254 if (GNUNET_OK != 254 if (GNUNET_OK !=
255 proc (proc_cls, ifc, 0 == strcmp (ifc, GNUNET_DEFAULT_INTERFACE), 255 proc (proc_cls, ifc, 0 == strcmp (ifc, GNUNET_DEFAULT_INTERFACE),
256 (const struct sockaddr *) &a6, 256 (const struct sockaddr *) &a6,
diff --git a/src/util/os_priority.c b/src/util/os_priority.c
index 7a6d93858..d499ed985 100644
--- a/src/util/os_priority.c
+++ b/src/util/os_priority.c
@@ -80,7 +80,7 @@ parent_control_handler (void *cls,
80 char sig; 80 char sig;
81 char *pipe_fd; 81 char *pipe_fd;
82 ssize_t ret; 82 ssize_t ret;
83 83
84 LOG (GNUNET_ERROR_TYPE_DEBUG, "`%s' invoked because of %d\n", __FUNCTION__, 84 LOG (GNUNET_ERROR_TYPE_DEBUG, "`%s' invoked because of %d\n", __FUNCTION__,
85 tc->reason); 85 tc->reason);
86 if (0 != (tc->reason & 86 if (0 != (tc->reason &
@@ -275,7 +275,7 @@ GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig)
275#else 275#else
276 LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending signal %d to pid: %u via system call\n", sig, proc->pid); 276 LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending signal %d to pid: %u via system call\n", sig, proc->pid);
277 return PLIBC_KILL (proc->pid, sig); 277 return PLIBC_KILL (proc->pid, sig);
278#endif 278#endif
279 } 279 }
280} 280}
281 281
@@ -753,7 +753,7 @@ start_process (int pipe_control,
753 753
754 if (GNUNET_SYSERR == GNUNET_OS_check_helper_binary (filename, GNUNET_NO, NULL)) 754 if (GNUNET_SYSERR == GNUNET_OS_check_helper_binary (filename, GNUNET_NO, NULL))
755 return NULL; /* not executable */ 755 return NULL; /* not executable */
756 756
757 /* Search in prefix dir (hopefully - the directory from which 757 /* Search in prefix dir (hopefully - the directory from which
758 * the current module was loaded), bindir and libdir, then in PATH 758 * the current module was loaded), bindir and libdir, then in PATH
759 */ 759 */
@@ -902,7 +902,7 @@ start_process (int pipe_control,
902 else 902 else
903 SetHandleInformation (stdih, HANDLE_FLAG_INHERIT, 0); 903 SetHandleInformation (stdih, HANDLE_FLAG_INHERIT, 0);
904 } 904 }
905 905
906 906
907 stdoh = GetStdHandle (STD_OUTPUT_HANDLE); 907 stdoh = GetStdHandle (STD_OUTPUT_HANDLE);
908 GetHandleInformation (stdoh, &stdof); 908 GetHandleInformation (stdoh, &stdof);
@@ -1054,7 +1054,7 @@ start_process (int pipe_control,
1054 1054
1055 if ((NULL == pipe_stdin) && (stdih)) 1055 if ((NULL == pipe_stdin) && (stdih))
1056 SetHandleInformation (stdih, HANDLE_FLAG_INHERIT, stdif); 1056 SetHandleInformation (stdih, HANDLE_FLAG_INHERIT, stdif);
1057 1057
1058 1058
1059 if ((NULL == pipe_stdout) && (stdoh)) 1059 if ((NULL == pipe_stdout) && (stdoh))
1060 SetHandleInformation (stdoh, HANDLE_FLAG_INHERIT, stdof); 1060 SetHandleInformation (stdoh, HANDLE_FLAG_INHERIT, stdof);
@@ -1116,7 +1116,7 @@ start_process (int pipe_control,
1116 wrote = GNUNET_DISK_file_write (lsocks_write_fd, &count, sizeof (count)); 1116 wrote = GNUNET_DISK_file_write (lsocks_write_fd, &count, sizeof (count));
1117 if (sizeof (count) != wrote) 1117 if (sizeof (count) != wrote)
1118 { 1118 {
1119 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1119 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1120 "Failed to write %u count bytes to the child: %u\n", 1120 "Failed to write %u count bytes to the child: %u\n",
1121 sizeof (count), GetLastError ()); 1121 sizeof (count), GetLastError ());
1122 break; 1122 break;
@@ -1127,8 +1127,8 @@ start_process (int pipe_control,
1127 /* Get a socket duplication info */ 1127 /* Get a socket duplication info */
1128 if (SOCKET_ERROR == WSADuplicateSocketA (lsocks[i], gnunet_proc->pid, &pi)) 1128 if (SOCKET_ERROR == WSADuplicateSocketA (lsocks[i], gnunet_proc->pid, &pi))
1129 { 1129 {
1130 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1130 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1131 "Failed to duplicate an socket[%llu]: %u\n", i, 1131 "Failed to duplicate an socket[%llu]: %u\n", i,
1132 GetLastError ()); 1132 GetLastError ());
1133 break; 1133 break;
1134 } 1134 }
@@ -1144,8 +1144,8 @@ start_process (int pipe_control,
1144 wrote = GNUNET_DISK_file_write (lsocks_write_fd, &size, sizeof (size)); 1144 wrote = GNUNET_DISK_file_write (lsocks_write_fd, &size, sizeof (size));
1145 if (sizeof (size) != wrote) 1145 if (sizeof (size) != wrote)
1146 { 1146 {
1147 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1147 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1148 "Failed to write %u size[%llu] bytes to the child: %u\n", 1148 "Failed to write %u size[%llu] bytes to the child: %u\n",
1149 sizeof (size), i, GetLastError ()); 1149 sizeof (size), i, GetLastError ());
1150 break; 1150 break;
1151 } 1151 }
@@ -1153,8 +1153,8 @@ start_process (int pipe_control,
1153 wrote = GNUNET_DISK_file_write (lsocks_write_fd, &pi, sizeof (pi)); 1153 wrote = GNUNET_DISK_file_write (lsocks_write_fd, &pi, sizeof (pi));
1154 if (sizeof (pi) != wrote) 1154 if (sizeof (pi) != wrote)
1155 { 1155 {
1156 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1156 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1157 "Failed to write %u socket[%llu] bytes to the child: %u\n", 1157 "Failed to write %u socket[%llu] bytes to the child: %u\n",
1158 sizeof (pi), i, GetLastError ()); 1158 sizeof (pi), i, GetLastError ());
1159 break; 1159 break;
1160 } 1160 }
@@ -1207,7 +1207,7 @@ GNUNET_OS_start_process_vap (int pipe_control,
1207 enum GNUNET_OS_InheritStdioFlags std_inheritance, 1207 enum GNUNET_OS_InheritStdioFlags std_inheritance,
1208 struct GNUNET_DISK_PipeHandle *pipe_stdin, 1208 struct GNUNET_DISK_PipeHandle *pipe_stdin,
1209 struct GNUNET_DISK_PipeHandle *pipe_stdout, 1209 struct GNUNET_DISK_PipeHandle *pipe_stdout,
1210 const char *filename, 1210 const char *filename,
1211 char *const argv[]) 1211 char *const argv[])
1212{ 1212{
1213 return start_process (pipe_control, 1213 return start_process (pipe_control,
@@ -1328,7 +1328,7 @@ GNUNET_OS_start_process_v (int pipe_control,
1328/** 1328/**
1329 * Retrieve the status of a process, waiting on him if dead. 1329 * Retrieve the status of a process, waiting on him if dead.
1330 * Nonblocking version. 1330 * Nonblocking version.
1331 * 1331 *
1332 * @param proc process ID 1332 * @param proc process ID
1333 * @param type status type 1333 * @param type status type
1334 * @param code return code/signal number 1334 * @param code return code/signal number
@@ -1441,7 +1441,7 @@ GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc)
1441 1441
1442 while ( (pid != (ret = waitpid (pid, NULL, 0))) && 1442 while ( (pid != (ret = waitpid (pid, NULL, 0))) &&
1443 (EINTR == errno) ) ; 1443 (EINTR == errno) ) ;
1444 if (pid != ret) 1444 if (pid != ret)
1445 { 1445 {
1446 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "waitpid"); 1446 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "waitpid");
1447 return GNUNET_SYSERR; 1447 return GNUNET_SYSERR;
diff --git a/src/util/peer.c b/src/util/peer.c
index 08062e364..fa376d333 100644
--- a/src/util/peer.c
+++ b/src/util/peer.c
@@ -144,7 +144,7 @@ GNUNET_PEER_intern (const struct GNUNET_PeerIdentity *pid)
144 table[ret]->rc = 1; 144 table[ret]->rc = 1;
145 table[ret]->pid = ret; 145 table[ret]->pid = ret;
146 GNUNET_break (GNUNET_OK == 146 GNUNET_break (GNUNET_OK ==
147 GNUNET_CONTAINER_multipeermap_put (map, 147 GNUNET_CONTAINER_multipeermap_put (map,
148 &table[ret]->id, 148 &table[ret]->id,
149 table[ret], 149 table[ret],
150 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 150 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
diff --git a/src/util/perf_malloc.c b/src/util/perf_malloc.c
index 1a6ae4a7c..d3510ab82 100644
--- a/src/util/perf_malloc.c
+++ b/src/util/perf_malloc.c
@@ -27,7 +27,7 @@
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include <gauger.h> 28#include <gauger.h>
29 29
30static uint64_t 30static uint64_t
31perfMalloc () 31perfMalloc ()
32{ 32{
33 size_t i; 33 size_t i;
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c
index b35398619..46ac52586 100644
--- a/src/util/resolver_api.c
+++ b/src/util/resolver_api.c
@@ -332,7 +332,7 @@ handle_response (void *cls, const struct GNUNET_MessageHeader *msg)
332 struct GNUNET_RESOLVER_RequestHandle *rh = cls; 332 struct GNUNET_RESOLVER_RequestHandle *rh = cls;
333 uint16_t size; 333 uint16_t size;
334 334
335 LOG (GNUNET_ERROR_TYPE_DEBUG, 335 LOG (GNUNET_ERROR_TYPE_DEBUG,
336 "Receiving response from DNS service\n"); 336 "Receiving response from DNS service\n");
337 if (NULL == msg) 337 if (NULL == msg)
338 { 338 {
@@ -920,7 +920,7 @@ GNUNET_RESOLVER_hostname_resolve (int af,
920 return NULL; 920 return NULL;
921 } 921 }
922 LOG (GNUNET_ERROR_TYPE_DEBUG, 922 LOG (GNUNET_ERROR_TYPE_DEBUG,
923 "Resolving our hostname `%s'\n", 923 "Resolving our hostname `%s'\n",
924 hostname); 924 hostname);
925 return GNUNET_RESOLVER_ip_get (hostname, af, timeout, callback, cls); 925 return GNUNET_RESOLVER_ip_get (hostname, af, timeout, callback, cls);
926} 926}
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index a38bebf84..8652ee297 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -383,7 +383,7 @@ is_ready (struct Task *task, struct GNUNET_TIME_Absolute now,
383 reason |= GNUNET_SCHEDULER_REASON_WRITE_READY; 383 reason |= GNUNET_SCHEDULER_REASON_WRITE_READY;
384 if (reason == 0) 384 if (reason == 0)
385 return GNUNET_NO; /* not ready */ 385 return GNUNET_NO; /* not ready */
386 reason |= GNUNET_SCHEDULER_REASON_PREREQ_DONE; 386 reason |= GNUNET_SCHEDULER_REASON_PREREQ_DONE;
387 task->reason = reason; 387 task->reason = reason;
388 return GNUNET_YES; 388 return GNUNET_YES;
389} 389}
@@ -442,7 +442,7 @@ check_ready (const struct GNUNET_NETWORK_FDSet *rs,
442 pos = pending; 442 pos = pending;
443 while (pos != NULL) 443 while (pos != NULL)
444 { 444 {
445 LOG (GNUNET_ERROR_TYPE_DEBUG, 445 LOG (GNUNET_ERROR_TYPE_DEBUG,
446 "Checking readiness of task: %llu / %p\n", 446 "Checking readiness of task: %llu / %p\n",
447 pos->id, pos->callback_cls); 447 pos->id, pos->callback_cls);
448 next = pos->next; 448 next = pos->next;
@@ -568,7 +568,7 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws)
568 if (GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value_us > 568 if (GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value_us >
569 DELAY_THRESHOLD.rel_value_us) 569 DELAY_THRESHOLD.rel_value_us)
570 { 570 {
571 LOG (GNUNET_ERROR_TYPE_DEBUG, 571 LOG (GNUNET_ERROR_TYPE_DEBUG,
572 "Task %llu took %s to be scheduled\n", 572 "Task %llu took %s to be scheduled\n",
573 (unsigned long long) pos->id, 573 (unsigned long long) pos->id,
574 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (pos->start_time), GNUNET_YES)); 574 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (pos->start_time), GNUNET_YES));
@@ -587,7 +587,7 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws)
587 (pos->write_fd != -1) && 587 (pos->write_fd != -1) &&
588 (!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd))) 588 (!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd)))
589 GNUNET_abort (); // added to ready in previous select loop! 589 GNUNET_abort (); // added to ready in previous select loop!
590 LOG (GNUNET_ERROR_TYPE_DEBUG, 590 LOG (GNUNET_ERROR_TYPE_DEBUG,
591 "Running task: %llu / %p\n", pos->id, 591 "Running task: %llu / %p\n", pos->id,
592 pos->callback_cls); 592 pos->callback_cls);
593 pos->callback (pos->callback_cls, &tc); 593 pos->callback (pos->callback_cls, &tc);
@@ -1052,7 +1052,7 @@ GNUNET_SCHEDULER_TaskIdentifier
1052GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, 1052GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio,
1053 GNUNET_SCHEDULER_Task task, void *task_cls) 1053 GNUNET_SCHEDULER_Task task, void *task_cls)
1054{ 1054{
1055 return GNUNET_SCHEDULER_add_select (prio, 1055 return GNUNET_SCHEDULER_add_select (prio,
1056 GNUNET_TIME_UNIT_ZERO, NULL, NULL, task, 1056 GNUNET_TIME_UNIT_ZERO, NULL, NULL, task,
1057 task_cls); 1057 task_cls);
1058} 1058}
@@ -1175,7 +1175,7 @@ GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay,
1175 * to run) might get to run first. Just as with delays, clients must 1175 * to run) might get to run first. Just as with delays, clients must
1176 * not rely on any particular order of execution between tasks 1176 * not rely on any particular order of execution between tasks
1177 * scheduled concurrently. 1177 * scheduled concurrently.
1178 * 1178 *
1179 * The task will be run with the DEFAULT priority. 1179 * The task will be run with the DEFAULT priority.
1180 * 1180 *
1181 * @param task main function of the task 1181 * @param task main function of the task
@@ -1250,7 +1250,7 @@ GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness,
1250 */ 1250 */
1251#ifndef MINGW 1251#ifndef MINGW
1252static GNUNET_SCHEDULER_TaskIdentifier 1252static GNUNET_SCHEDULER_TaskIdentifier
1253add_without_sets (struct GNUNET_TIME_Relative delay, 1253add_without_sets (struct GNUNET_TIME_Relative delay,
1254 enum GNUNET_SCHEDULER_Priority priority, 1254 enum GNUNET_SCHEDULER_Priority priority,
1255 int rfd, int wfd, 1255 int rfd, int wfd,
1256 GNUNET_SCHEDULER_Task task, void *task_cls) 1256 GNUNET_SCHEDULER_Task task, void *task_cls)
@@ -1396,7 +1396,7 @@ GNUNET_SCHEDULER_add_read_net_with_priority (struct GNUNET_TIME_Relative delay,
1396 GNUNET_NETWORK_fdset_destroy (rs); 1396 GNUNET_NETWORK_fdset_destroy (rs);
1397 return ret; 1397 return ret;
1398#else 1398#else
1399 return add_without_sets (delay, 1399 return add_without_sets (delay,
1400 priority, 1400 priority,
1401 GNUNET_NETWORK_get_fd (rfd), -1, task, 1401 GNUNET_NETWORK_get_fd (rfd), -1, task,
1402 task_cls); 1402 task_cls);
@@ -1441,7 +1441,7 @@ GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay,
1441 return ret; 1441 return ret;
1442#else 1442#else
1443 GNUNET_assert (GNUNET_NETWORK_get_fd (wfd) >= 0); 1443 GNUNET_assert (GNUNET_NETWORK_get_fd (wfd) >= 0);
1444 return add_without_sets (delay, 1444 return add_without_sets (delay,
1445 GNUNET_SCHEDULER_PRIORITY_DEFAULT, 1445 GNUNET_SCHEDULER_PRIORITY_DEFAULT,
1446 -1, GNUNET_NETWORK_get_fd (wfd), task, 1446 -1, GNUNET_NETWORK_get_fd (wfd), task,
1447 task_cls); 1447 task_cls);
@@ -1486,7 +1486,7 @@ GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay,
1486 int fd; 1486 int fd;
1487 1487
1488 GNUNET_DISK_internal_file_handle_ (rfd, &fd, sizeof (int)); 1488 GNUNET_DISK_internal_file_handle_ (rfd, &fd, sizeof (int));
1489 return add_without_sets (delay, 1489 return add_without_sets (delay,
1490 GNUNET_SCHEDULER_PRIORITY_DEFAULT, 1490 GNUNET_SCHEDULER_PRIORITY_DEFAULT,
1491 fd, -1, task, task_cls); 1491 fd, -1, task, task_cls);
1492 1492
@@ -1532,7 +1532,7 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay,
1532 1532
1533 GNUNET_DISK_internal_file_handle_ (wfd, &fd, sizeof (int)); 1533 GNUNET_DISK_internal_file_handle_ (wfd, &fd, sizeof (int));
1534 GNUNET_assert (fd >= 0); 1534 GNUNET_assert (fd >= 0);
1535 return add_without_sets (delay, 1535 return add_without_sets (delay,
1536 GNUNET_SCHEDULER_PRIORITY_DEFAULT, 1536 GNUNET_SCHEDULER_PRIORITY_DEFAULT,
1537 -1, fd, task, task_cls); 1537 -1, fd, task, task_cls);
1538 1538
diff --git a/src/util/server.c b/src/util/server.c
index dce03bdcf..e00b2ffb8 100644
--- a/src/util/server.c
+++ b/src/util/server.c
@@ -368,7 +368,7 @@ GNUNET_SERVER_client_get_user_context_ (struct GNUNET_SERVER_Client *client,
368 * @param ptr pointer to user context 368 * @param ptr pointer to user context
369 * @param size number of bytes in user context struct (for verification only) 369 * @param size number of bytes in user context struct (for verification only)
370 */ 370 */
371void 371void
372GNUNET_SERVER_client_set_user_context_ (struct GNUNET_SERVER_Client *client, 372GNUNET_SERVER_client_set_user_context_ (struct GNUNET_SERVER_Client *client,
373 void *ptr, 373 void *ptr,
374 size_t size) 374 size_t size)
@@ -977,7 +977,7 @@ GNUNET_SERVER_inject (struct GNUNET_SERVER_Handle *server,
977 (GNUNET_SCHEDULER_NO_TASK == sender->warn_task) ) 977 (GNUNET_SCHEDULER_NO_TASK == sender->warn_task) )
978 { 978 {
979 GNUNET_break (0 != type); /* type should never be 0 here, as we don't use 0 */ 979 GNUNET_break (0 != type); /* type should never be 0 here, as we don't use 0 */
980 sender->warn_start = GNUNET_TIME_absolute_get (); 980 sender->warn_start = GNUNET_TIME_absolute_get ();
981 sender->warn_task = 981 sender->warn_task =
982 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, 982 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
983 &warn_no_receive_done, sender); 983 &warn_no_receive_done, sender);
@@ -1061,7 +1061,7 @@ process_mst (struct GNUNET_SERVER_Client *client, int ret)
1061 } 1061 }
1062 LOG (GNUNET_ERROR_TYPE_DEBUG, 1062 LOG (GNUNET_ERROR_TYPE_DEBUG,
1063 "Server leaves instant processing loop: ret = %d, server = %p, shutdown = %d, suspended = %u\n", 1063 "Server leaves instant processing loop: ret = %d, server = %p, shutdown = %d, suspended = %u\n",
1064 ret, client->server, 1064 ret, client->server,
1065 client->shutdown_now, 1065 client->shutdown_now,
1066 client->suspended); 1066 client->suspended);
1067 if (GNUNET_NO == ret) 1067 if (GNUNET_NO == ret)
@@ -1367,7 +1367,7 @@ GNUNET_SERVER_disconnect_notify (struct GNUNET_SERVER_Handle *server,
1367 */ 1367 */
1368void 1368void
1369GNUNET_SERVER_connect_notify (struct GNUNET_SERVER_Handle *server, 1369GNUNET_SERVER_connect_notify (struct GNUNET_SERVER_Handle *server,
1370 GNUNET_SERVER_ConnectCallback callback, 1370 GNUNET_SERVER_ConnectCallback callback,
1371 void *callback_cls) 1371 void *callback_cls)
1372{ 1372{
1373 struct NotifyList *n; 1373 struct NotifyList *n;
@@ -1419,7 +1419,7 @@ GNUNET_SERVER_disconnect_notify_cancel (struct GNUNET_SERVER_Handle *server,
1419 */ 1419 */
1420void 1420void
1421GNUNET_SERVER_connect_notify_cancel (struct GNUNET_SERVER_Handle *server, 1421GNUNET_SERVER_connect_notify_cancel (struct GNUNET_SERVER_Handle *server,
1422 GNUNET_SERVER_ConnectCallback callback, 1422 GNUNET_SERVER_ConnectCallback callback,
1423 void *callback_cls) 1423 void *callback_cls)
1424{ 1424{
1425 struct NotifyList *pos; 1425 struct NotifyList *pos;
@@ -1453,7 +1453,7 @@ destroy_connection (void *cls,
1453 const struct GNUNET_SCHEDULER_TaskContext *tc) 1453 const struct GNUNET_SCHEDULER_TaskContext *tc)
1454{ 1454{
1455 struct GNUNET_CONNECTION_Handle *connection = cls; 1455 struct GNUNET_CONNECTION_Handle *connection = cls;
1456 1456
1457 GNUNET_CONNECTION_destroy (connection); 1457 GNUNET_CONNECTION_destroy (connection);
1458} 1458}
1459 1459
@@ -1489,7 +1489,7 @@ GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client)
1489 GNUNET_CONNECTION_receive_cancel (client->connection); 1489 GNUNET_CONNECTION_receive_cancel (client->connection);
1490 client->receive_pending = GNUNET_NO; 1490 client->receive_pending = GNUNET_NO;
1491 } 1491 }
1492 client->shutdown_now = GNUNET_YES; 1492 client->shutdown_now = GNUNET_YES;
1493 client->reference_count++; /* make sure nobody else clean up client... */ 1493 client->reference_count++; /* make sure nobody else clean up client... */
1494 if ( (NULL != client->mst) && 1494 if ( (NULL != client->mst) &&
1495 (NULL != server) ) 1495 (NULL != server) )
@@ -1656,7 +1656,7 @@ GNUNET_SERVER_client_persist_ (struct GNUNET_SERVER_Client *client)
1656 * serious error) 1656 * serious error)
1657 */ 1657 */
1658void 1658void
1659GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, 1659GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client,
1660 int success) 1660 int success)
1661{ 1661{
1662 if (NULL == client) 1662 if (NULL == client)
diff --git a/src/util/server_nc.c b/src/util/server_nc.c
index d11025680..d6625eefb 100644
--- a/src/util/server_nc.c
+++ b/src/util/server_nc.c
@@ -268,7 +268,7 @@ GNUNET_SERVER_notification_context_add (struct GNUNET_SERVER_NotificationContext
268 268
269 for (cl = nc->clients_head; NULL != cl; cl = cl->next) 269 for (cl = nc->clients_head; NULL != cl; cl = cl->next)
270 if (cl->client == client) 270 if (cl->client == client)
271 return; /* already present */ 271 return; /* already present */
272 cl = GNUNET_malloc (sizeof (struct ClientList)); 272 cl = GNUNET_malloc (sizeof (struct ClientList));
273 GNUNET_CONTAINER_DLL_insert (nc->clients_head, 273 GNUNET_CONTAINER_DLL_insert (nc->clients_head,
274 nc->clients_tail, 274 nc->clients_tail,
diff --git a/src/util/service.c b/src/util/service.c
index cab8a8aef..d8ca5eba6 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -101,7 +101,7 @@ GNUNET_SPEEDUP_stop_ (void);
101 * with a semicolon). The network must be given in dotted-decimal 101 * with a semicolon). The network must be given in dotted-decimal
102 * notation. The netmask can be given in CIDR notation (/16) or 102 * notation. The netmask can be given in CIDR notation (/16) or
103 * in dotted-decimal (/255.255.0.0). 103 * in dotted-decimal (/255.255.0.0).
104 * 104 *
105 * @param routeList a string specifying the forbidden networks 105 * @param routeList a string specifying the forbidden networks
106 * @return the converted list, NULL if the synatx is flawed 106 * @return the converted list, NULL if the synatx is flawed
107 */ 107 */
@@ -254,7 +254,7 @@ parse_ipv4_specification (const char *routeList)
254 * with a semicolon). The network must be given in colon-hex 254 * with a semicolon). The network must be given in colon-hex
255 * notation. The netmask must be given in CIDR notation (/16) or 255 * notation. The netmask must be given in CIDR notation (/16) or
256 * can be omitted to specify a single host. 256 * can be omitted to specify a single host.
257 * 257 *
258 * @param routeListX a string specifying the forbidden networks 258 * @param routeListX a string specifying the forbidden networks
259 * @return the converted list, NULL if the synatx is flawed 259 * @return the converted list, NULL if the synatx is flawed
260 */ 260 */
@@ -659,18 +659,18 @@ check_access (void *cls, const struct GNUNET_CONNECTION_Credentials *uc,
659#ifndef WINDOWS 659#ifndef WINDOWS
660 case AF_UNIX: 660 case AF_UNIX:
661 ret = GNUNET_OK; /* always OK for now */ 661 ret = GNUNET_OK; /* always OK for now */
662 if (GNUNET_YES == sctx->match_uid) 662 if (GNUNET_YES == sctx->match_uid)
663 { 663 {
664 /* UID match required */ 664 /* UID match required */
665 ret = (NULL != uc) && ( (0 == uc->uid) || (uc->uid == geteuid ()) ); 665 ret = (NULL != uc) && ( (0 == uc->uid) || (uc->uid == geteuid ()) );
666 } 666 }
667 else if ( (GNUNET_YES == sctx->match_gid) && 667 else if ( (GNUNET_YES == sctx->match_gid) &&
668 ( (NULL == uc) || 668 ( (NULL == uc) ||
669 ( (0 != uc->uid) && 669 ( (0 != uc->uid) &&
670 (uc->uid != geteuid ()) ) ) ) 670 (uc->uid != geteuid ()) ) ) )
671 { 671 {
672 /* group match required and UID does not match */ 672 /* group match required and UID does not match */
673 if (NULL == uc) 673 if (NULL == uc)
674 { 674 {
675 /* no credentials, group match not possible */ 675 /* no credentials, group match not possible */
676 ret = GNUNET_NO; 676 ret = GNUNET_NO;
@@ -718,7 +718,7 @@ check_access (void *cls, const struct GNUNET_CONNECTION_Credentials *uc,
718 if (GNUNET_OK != ret) 718 if (GNUNET_OK != ret)
719 { 719 {
720 LOG (GNUNET_ERROR_TYPE_WARNING, 720 LOG (GNUNET_ERROR_TYPE_WARNING,
721 _("Access from `%s' denied to service `%s'\n"), 721 _("Access from `%s' denied to service `%s'\n"),
722 GNUNET_a2s (addr, addrlen), 722 GNUNET_a2s (addr, addrlen),
723 sctx->service_name); 723 sctx->service_name);
724 } 724 }
@@ -750,9 +750,9 @@ get_pid_file_name (struct GNUNET_SERVICE_Context *sctx)
750 * Parse an IPv4 access control list. 750 * Parse an IPv4 access control list.
751 * 751 *
752 * @param ret location where to write the ACL (set) 752 * @param ret location where to write the ACL (set)
753 * @param sctx service context to use to get the configuration 753 * @param sctx service context to use to get the configuration
754 * @param option name of the ACL option to parse 754 * @param option name of the ACL option to parse
755 * @return GNUNET_SYSERR on parse error, GNUNET_OK on success (including 755 * @return GNUNET_SYSERR on parse error, GNUNET_OK on success (including
756 * no ACL configured) 756 * no ACL configured)
757 */ 757 */
758static int 758static int
@@ -763,7 +763,7 @@ process_acl4 (struct IPv4NetworkSet **ret, struct GNUNET_SERVICE_Context *sctx,
763 763
764 if (!GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->service_name, option)) 764 if (!GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->service_name, option))
765 { 765 {
766 *ret = NULL; 766 *ret = NULL;
767 return GNUNET_OK; 767 return GNUNET_OK;
768 } 768 }
769 GNUNET_break (GNUNET_OK == 769 GNUNET_break (GNUNET_OK ==
@@ -787,9 +787,9 @@ process_acl4 (struct IPv4NetworkSet **ret, struct GNUNET_SERVICE_Context *sctx,
787 * Parse an IPv6 access control list. 787 * Parse an IPv6 access control list.
788 * 788 *
789 * @param ret location where to write the ACL (set) 789 * @param ret location where to write the ACL (set)
790 * @param sctx service context to use to get the configuration 790 * @param sctx service context to use to get the configuration
791 * @param option name of the ACL option to parse 791 * @param option name of the ACL option to parse
792 * @return GNUNET_SYSERR on parse error, GNUNET_OK on success (including 792 * @return GNUNET_SYSERR on parse error, GNUNET_OK on success (including
793 * no ACL configured) 793 * no ACL configured)
794 */ 794 */
795static int 795static int
@@ -1825,7 +1825,7 @@ shutdown:
1825#if HAVE_MALLINFO 1825#if HAVE_MALLINFO
1826 { 1826 {
1827 char *counter; 1827 char *counter;
1828 1828
1829 if ( (GNUNET_YES == 1829 if ( (GNUNET_YES ==
1830 GNUNET_CONFIGURATION_have_value (sctx.cfg, service_name, 1830 GNUNET_CONFIGURATION_have_value (sctx.cfg, service_name,
1831 "GAUGER_HEAP")) && 1831 "GAUGER_HEAP")) &&
@@ -1835,11 +1835,11 @@ shutdown:
1835 &counter)) ) 1835 &counter)) )
1836 { 1836 {
1837 struct mallinfo mi; 1837 struct mallinfo mi;
1838 1838
1839 mi = mallinfo (); 1839 mi = mallinfo ();
1840 GAUGER (service_name, counter, mi.usmblks, "blocks"); 1840 GAUGER (service_name, counter, mi.usmblks, "blocks");
1841 GNUNET_free (counter); 1841 GNUNET_free (counter);
1842 } 1842 }
1843 } 1843 }
1844#endif 1844#endif
1845 GNUNET_SPEEDUP_stop_ (); 1845 GNUNET_SPEEDUP_stop_ ();
@@ -1944,7 +1944,7 @@ GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Context *sctx)
1944#if HAVE_MALLINFO 1944#if HAVE_MALLINFO
1945 { 1945 {
1946 char *counter; 1946 char *counter;
1947 1947
1948 if ( (GNUNET_YES == 1948 if ( (GNUNET_YES ==
1949 GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->service_name, 1949 GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->service_name,
1950 "GAUGER_HEAP")) && 1950 "GAUGER_HEAP")) &&
@@ -1954,11 +1954,11 @@ GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Context *sctx)
1954 &counter)) ) 1954 &counter)) )
1955 { 1955 {
1956 struct mallinfo mi; 1956 struct mallinfo mi;
1957 1957
1958 mi = mallinfo (); 1958 mi = mallinfo ();
1959 GAUGER (sctx->service_name, counter, mi.usmblks, "blocks"); 1959 GAUGER (sctx->service_name, counter, mi.usmblks, "blocks");
1960 GNUNET_free (counter); 1960 GNUNET_free (counter);
1961 } 1961 }
1962 } 1962 }
1963#endif 1963#endif
1964 if (GNUNET_SCHEDULER_NO_TASK != sctx->shutdown_task) 1964 if (GNUNET_SCHEDULER_NO_TASK != sctx->shutdown_task)
diff --git a/src/util/speedup.c b/src/util/speedup.c
index 2482decea..52ac3287c 100644
--- a/src/util/speedup.c
+++ b/src/util/speedup.c
@@ -40,14 +40,14 @@ static void
40do_speedup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 40do_speedup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
41{ 41{
42 static long long current_offset; 42 static long long current_offset;
43 43
44 speedup_task = GNUNET_SCHEDULER_NO_TASK; 44 speedup_task = GNUNET_SCHEDULER_NO_TASK;
45 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 45 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
46 return; 46 return;
47 current_offset += delta.rel_value_us; 47 current_offset += delta.rel_value_us;
48 GNUNET_TIME_set_offset (current_offset); 48 GNUNET_TIME_set_offset (current_offset);
49 LOG (GNUNET_ERROR_TYPE_DEBUG, 49 LOG (GNUNET_ERROR_TYPE_DEBUG,
50 "Speeding up execution time by %s\n", 50 "Speeding up execution time by %s\n",
51 GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_NO)); 51 GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_NO));
52 speedup_task = GNUNET_SCHEDULER_add_delayed (interval, &do_speedup, NULL); 52 speedup_task = GNUNET_SCHEDULER_add_delayed (interval, &do_speedup, NULL);
53} 53}
@@ -95,7 +95,7 @@ GNUNET_SPEEDUP_stop_ ( )
95 GNUNET_SCHEDULER_cancel (speedup_task); 95 GNUNET_SCHEDULER_cancel (speedup_task);
96 speedup_task = GNUNET_SCHEDULER_NO_TASK; 96 speedup_task = GNUNET_SCHEDULER_NO_TASK;
97 } 97 }
98 if ( (0 != interval.rel_value_us) && 98 if ( (0 != interval.rel_value_us) &&
99 (0 != delta.rel_value_us) ) 99 (0 != delta.rel_value_us) )
100 LOG (GNUNET_ERROR_TYPE_DEBUG, 100 LOG (GNUNET_ERROR_TYPE_DEBUG,
101 "Stopped execution speed up\n"); 101 "Stopped execution speed up\n");
diff --git a/src/util/strings.c b/src/util/strings.c
index 3d061fb57..d0e8fddc7 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -381,8 +381,8 @@ GNUNET_STRINGS_fancy_time_to_absolute (const char *fancy_time,
381 */ 381 */
382char * 382char *
383GNUNET_STRINGS_conv (const char *input, 383GNUNET_STRINGS_conv (const char *input,
384 size_t len, 384 size_t len,
385 const char *input_charset, 385 const char *input_charset,
386 const char *output_charset) 386 const char *output_charset)
387{ 387{
388 char *ret; 388 char *ret;
@@ -391,10 +391,10 @@ GNUNET_STRINGS_conv (const char *input,
391 size_t u8_string_length; 391 size_t u8_string_length;
392 size_t encoded_string_length; 392 size_t encoded_string_length;
393 393
394 u8_string = u8_conv_from_encoding (input_charset, 394 u8_string = u8_conv_from_encoding (input_charset,
395 iconveh_error, 395 iconveh_error,
396 input, len, 396 input, len,
397 NULL, NULL, 397 NULL, NULL,
398 &u8_string_length); 398 &u8_string_length);
399 if (NULL == u8_string) 399 if (NULL == u8_string)
400 { 400 {
@@ -409,9 +409,9 @@ GNUNET_STRINGS_conv (const char *input,
409 free (u8_string); 409 free (u8_string);
410 return ret; 410 return ret;
411 } 411 }
412 encoded_string = u8_conv_to_encoding (output_charset, iconveh_error, 412 encoded_string = u8_conv_to_encoding (output_charset, iconveh_error,
413 u8_string, u8_string_length, 413 u8_string, u8_string_length,
414 NULL, NULL, 414 NULL, NULL,
415 &encoded_string_length); 415 &encoded_string_length);
416 free (u8_string); 416 free (u8_string);
417 if (NULL == encoded_string) 417 if (NULL == encoded_string)
@@ -644,14 +644,14 @@ GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta,
644 return _("forever"); 644 return _("forever");
645 if (0 == delta.rel_value_us) 645 if (0 == delta.rel_value_us)
646 return _("0 ms"); 646 return _("0 ms");
647 if ( ( (GNUNET_YES == do_round) && 647 if ( ( (GNUNET_YES == do_round) &&
648 (dval > 5 * 1000) ) || 648 (dval > 5 * 1000) ) ||
649 (0 == (dval % 1000) )) 649 (0 == (dval % 1000) ))
650 { 650 {
651 dval = dval / 1000; 651 dval = dval / 1000;
652 unit = _( /* time unit */ "ms"); 652 unit = _( /* time unit */ "ms");
653 if ( ( (GNUNET_YES == do_round) && 653 if ( ( (GNUNET_YES == do_round) &&
654 (dval > 5 * 1000) ) || 654 (dval > 5 * 1000) ) ||
655 (0 == (dval % 1000) )) 655 (0 == (dval % 1000) ))
656 { 656 {
657 dval = dval / 1000; 657 dval = dval / 1000;
@@ -663,7 +663,7 @@ GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta,
663 dval = dval / 60; 663 dval = dval / 60;
664 unit = _( /* time unit */ "m"); 664 unit = _( /* time unit */ "m");
665 if ( ( (GNUNET_YES == do_round) && 665 if ( ( (GNUNET_YES == do_round) &&
666 (dval > 5 * 60) ) || 666 (dval > 5 * 60) ) ||
667 (0 == (dval % 60) )) 667 (0 == (dval % 60) ))
668 { 668 {
669 dval = dval / 60; 669 dval = dval / 60;
@@ -756,7 +756,7 @@ getValue__ (unsigned char a)
756 * Convert binary data to ASCII encoding. The ASCII encoding is rather 756 * Convert binary data to ASCII encoding. The ASCII encoding is rather
757 * GNUnet specific. It was chosen such that it only uses characters 757 * GNUnet specific. It was chosen such that it only uses characters
758 * in [0-9A-V], can be produced without complex arithmetics and uses a 758 * in [0-9A-V], can be produced without complex arithmetics and uses a
759 * small number of characters. 759 * small number of characters.
760 * Does not append 0-terminator, but returns a pointer to the place where 760 * Does not append 0-terminator, but returns a pointer to the place where
761 * it should be placed, if needed. 761 * it should be placed, if needed.
762 * 762 *
@@ -771,7 +771,7 @@ char *
771GNUNET_STRINGS_data_to_string (const void *data, size_t size, char *out, size_t out_size) 771GNUNET_STRINGS_data_to_string (const void *data, size_t size, char *out, size_t out_size)
772{ 772{
773 /** 773 /**
774 * 32 characters for encoding 774 * 32 characters for encoding
775 */ 775 */
776 static char *encTable__ = "0123456789ABCDEFGHIJKLMNOPQRSTUV"; 776 static char *encTable__ = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
777 unsigned int wpos; 777 unsigned int wpos;
@@ -1040,7 +1040,7 @@ GNUNET_STRINGS_path_is_absolute (const char *filename, int can_be_uri,
1040 1040
1041/** 1041/**
1042 * Perform 'checks' on 'filename' 1042 * Perform 'checks' on 'filename'
1043 * 1043 *
1044 * @param filename file to check 1044 * @param filename file to check
1045 * @param checks checks to perform 1045 * @param checks checks to perform
1046 * @return GNUNET_YES if all checks pass, GNUNET_NO if at least one of them 1046 * @return GNUNET_YES if all checks pass, GNUNET_NO if at least one of them
@@ -1081,7 +1081,7 @@ GNUNET_STRINGS_check_filename (const char *filename,
1081/** 1081/**
1082 * Tries to convert 'zt_addr' string to an IPv6 address. 1082 * Tries to convert 'zt_addr' string to an IPv6 address.
1083 * The string is expected to have the format "[ABCD::01]:80". 1083 * The string is expected to have the format "[ABCD::01]:80".
1084 * 1084 *
1085 * @param zt_addr 0-terminated string. May be mangled by the function. 1085 * @param zt_addr 0-terminated string. May be mangled by the function.
1086 * @param addrlen length of zt_addr (not counting 0-terminator). 1086 * @param addrlen length of zt_addr (not counting 0-terminator).
1087 * @param r_buf a buffer to fill. Initially gets filled with zeroes, 1087 * @param r_buf a buffer to fill. Initially gets filled with zeroes,
@@ -1090,7 +1090,7 @@ GNUNET_STRINGS_check_filename (const char *filename,
1090 * case the contents of r_buf are undefined. 1090 * case the contents of r_buf are undefined.
1091 */ 1091 */
1092int 1092int
1093GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, 1093GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr,
1094 uint16_t addrlen, 1094 uint16_t addrlen,
1095 struct sockaddr_in6 *r_buf) 1095 struct sockaddr_in6 *r_buf)
1096{ 1096{
@@ -1100,7 +1100,7 @@ GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr,
1100 unsigned int port; 1100 unsigned int port;
1101 1101
1102 if (addrlen < 6) 1102 if (addrlen < 6)
1103 return GNUNET_SYSERR; 1103 return GNUNET_SYSERR;
1104 memcpy (zbuf, zt_addr, addrlen); 1104 memcpy (zbuf, zt_addr, addrlen);
1105 if ('[' != zbuf[0]) 1105 if ('[' != zbuf[0])
1106 { 1106 {
@@ -1152,7 +1152,7 @@ GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr,
1152/** 1152/**
1153 * Tries to convert 'zt_addr' string to an IPv4 address. 1153 * Tries to convert 'zt_addr' string to an IPv4 address.
1154 * The string is expected to have the format "1.2.3.4:80". 1154 * The string is expected to have the format "1.2.3.4:80".
1155 * 1155 *
1156 * @param zt_addr 0-terminated string. May be mangled by the function. 1156 * @param zt_addr 0-terminated string. May be mangled by the function.
1157 * @param addrlen length of zt_addr (not counting 0-terminator). 1157 * @param addrlen length of zt_addr (not counting 0-terminator).
1158 * @param r_buf a buffer to fill. 1158 * @param r_buf a buffer to fill.
@@ -1191,7 +1191,7 @@ GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr, uint16_t addrlen,
1191/** 1191/**
1192 * Tries to convert 'addr' string to an IP (v4 or v6) address. 1192 * Tries to convert 'addr' string to an IP (v4 or v6) address.
1193 * Will automatically decide whether to treat 'addr' as v4 or v6 address. 1193 * Will automatically decide whether to treat 'addr' as v4 or v6 address.
1194 * 1194 *
1195 * @param addr a string, may not be 0-terminated. 1195 * @param addr a string, may not be 0-terminated.
1196 * @param addrlen number of bytes in addr (if addr is 0-terminated, 1196 * @param addrlen number of bytes in addr (if addr is 0-terminated,
1197 * 0-terminator should not be counted towards addrlen). 1197 * 0-terminator should not be counted towards addrlen).
@@ -1200,7 +1200,7 @@ GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr, uint16_t addrlen,
1200 * case the contents of r_buf are undefined. 1200 * case the contents of r_buf are undefined.
1201 */ 1201 */
1202int 1202int
1203GNUNET_STRINGS_to_address_ip (const char *addr, 1203GNUNET_STRINGS_to_address_ip (const char *addr,
1204 uint16_t addrlen, 1204 uint16_t addrlen,
1205 struct sockaddr_storage *r_buf) 1205 struct sockaddr_storage *r_buf)
1206{ 1206{
diff --git a/src/util/test_common_logging_runtime_loglevels.c b/src/util/test_common_logging_runtime_loglevels.c
index c608d59c5..7d8834082 100644
--- a/src/util/test_common_logging_runtime_loglevels.c
+++ b/src/util/test_common_logging_runtime_loglevels.c
@@ -96,7 +96,7 @@ end_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
96static char * 96static char *
97read_output_line (int phase_from1, int phase_to1, int phase_from2, 97read_output_line (int phase_from1, int phase_to1, int phase_from2,
98 int phase_to2, char c, const char *expect_level, 98 int phase_to2, char c, const char *expect_level,
99 long delay_morethan, long delay_lessthan, int phase, 99 long delay_morethan, long delay_lessthan, int phase,
100 char *p, 100 char *p,
101 int *len, long *delay, char level[8]) 101 int *len, long *delay, char level[8])
102{ 102{
diff --git a/src/util/test_configuration.c b/src/util/test_configuration.c
index 2d2806956..e68740e7f 100644
--- a/src/util/test_configuration.c
+++ b/src/util/test_configuration.c
@@ -37,7 +37,7 @@ enum
37 ADD_NEW_ENTRY, 37 ADD_NEW_ENTRY,
38 REMOVE_SECTION, 38 REMOVE_SECTION,
39 REMOVE_ENTRY, 39 REMOVE_ENTRY,
40 COMPARE, 40 COMPARE,
41 PRINT 41 PRINT
42}; 42};
43 43
@@ -236,14 +236,14 @@ checkDiffs (struct GNUNET_CONFIGURATION_Handle *cfgDefault, int option)
236 GNUNET_CONFIGURATION_iterate (cfg, diffsCallBack, &cbData); 236 GNUNET_CONFIGURATION_iterate (cfg, diffsCallBack, &cbData);
237 if (1 == (ret = cbData.status)) 237 if (1 == (ret = cbData.status))
238 { 238 {
239 FPRINTF (stderr, "%s", 239 FPRINTF (stderr, "%s",
240 "Incorrect Configuration Diffs: Diffs may contain data not actually edited\n"); 240 "Incorrect Configuration Diffs: Diffs may contain data not actually edited\n");
241 goto housekeeping; 241 goto housekeeping;
242 } 242 }
243 cbData.cfgDiffs = cfg; 243 cbData.cfgDiffs = cfg;
244 GNUNET_CONFIGURATION_iterate (cfgDiffs, diffsCallBack, &cbData); 244 GNUNET_CONFIGURATION_iterate (cfgDiffs, diffsCallBack, &cbData);
245 if ((ret = cbData.status) == 1) 245 if ((ret = cbData.status) == 1)
246 FPRINTF (stderr, "%s", 246 FPRINTF (stderr, "%s",
247 "Incorrect Configuration Diffs: Data may be missing in diffs\n"); 247 "Incorrect Configuration Diffs: Data may be missing in diffs\n");
248 248
249housekeeping: 249housekeeping:
diff --git a/src/util/test_crypto_ecc.c b/src/util/test_crypto_ecc.c
index ff944ce0e..c89568bb9 100644
--- a/src/util/test_crypto_ecc.c
+++ b/src/util/test_crypto_ecc.c
@@ -108,7 +108,7 @@ testDeriveSignVerify ()
108 return GNUNET_SYSERR; 108 return GNUNET_SYSERR;
109 } 109 }
110 if (GNUNET_SYSERR == 110 if (GNUNET_SYSERR ==
111 GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_TEST, 111 GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_TEST,
112 &purp, &sig, 112 &purp, &sig,
113 &dpub)) 113 &dpub))
114 { 114 {
@@ -117,7 +117,7 @@ testDeriveSignVerify ()
117 return GNUNET_SYSERR; 117 return GNUNET_SYSERR;
118 } 118 }
119 if (GNUNET_SYSERR != 119 if (GNUNET_SYSERR !=
120 GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_TEST, 120 GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_TEST,
121 &purp, &sig, 121 &purp, &sig,
122 &pkey)) 122 &pkey))
123 { 123 {
@@ -280,7 +280,7 @@ main (int argc, char *argv[])
280 if (0 != failure_count) 280 if (0 != failure_count)
281 { 281 {
282 fprintf (stderr, 282 fprintf (stderr,
283 "\n\n%d TESTS FAILED!\n\n", 283 "\n\n%d TESTS FAILED!\n\n",
284 failure_count); 284 failure_count);
285 return -1; 285 return -1;
286 } 286 }
diff --git a/src/util/test_crypto_symmetric.c b/src/util/test_crypto_symmetric.c
index 1754a835a..42bf10ffd 100644
--- a/src/util/test_crypto_symmetric.c
+++ b/src/util/test_crypto_symmetric.c
@@ -95,8 +95,8 @@ verifyCrypto ()
95 }; 95 };
96 unsigned char encrresult[] = 96 unsigned char encrresult[] =
97 { 97 {
98 155, 88, 106, 174, 124, 172, 47, 149, 85, 15, 208, 176, 65, 124, 155, 98 155, 88, 106, 174, 124, 172, 47, 149, 85, 15, 208, 176, 65, 124, 155,
99 74, 215, 25, 177, 231, 162, 109, 165, 4, 133, 165, 93, 44, 213, 77, 99 74, 215, 25, 177, 231, 162, 109, 165, 4, 133, 165, 93, 44, 213, 77,
100 206, 204, 1 100 206, 204, 1
101 }; 101 };
102 102
@@ -109,7 +109,7 @@ verifyCrypto ()
109 GNUNET_CRYPTO_symmetric_encrypt (plain, GNUNET_CRYPTO_AES_KEY_LENGTH, &key, 109 GNUNET_CRYPTO_symmetric_encrypt (plain, GNUNET_CRYPTO_AES_KEY_LENGTH, &key,
110 (const struct 110 (const struct
111 GNUNET_CRYPTO_SymmetricInitializationVector *) 111 GNUNET_CRYPTO_SymmetricInitializationVector *)
112 "testtesttesttesttesttesttesttest", 112 "testtesttesttesttesttesttesttest",
113 result)) 113 result))
114 { 114 {
115 printf ("Wrong return value from encrypt block.\n"); 115 printf ("Wrong return value from encrypt block.\n");
diff --git a/src/util/test_mq.c b/src/util/test_mq.c
index f98fcd235..6fcef89c5 100644
--- a/src/util/test_mq.c
+++ b/src/util/test_mq.c
@@ -42,7 +42,7 @@ test1 ()
42{ 42{
43 struct GNUNET_MQ_Envelope *mqm; 43 struct GNUNET_MQ_Envelope *mqm;
44 struct MyMessage *mm; 44 struct MyMessage *mm;
45 45
46 mm = NULL; 46 mm = NULL;
47 mqm = NULL; 47 mqm = NULL;
48 48
diff --git a/src/util/test_os_start_process.c b/src/util/test_os_start_process.c
index 2b1d9070c..8e701750b 100644
--- a/src/util/test_os_start_process.c
+++ b/src/util/test_os_start_process.c
@@ -37,12 +37,12 @@ static int ok;
37static struct GNUNET_OS_Process *proc; 37static struct GNUNET_OS_Process *proc;
38 38
39/** 39/**
40 * Pipe to write to started processes stdin (on write end) 40 * Pipe to write to started processes stdin (on write end)
41 */ 41 */
42static struct GNUNET_DISK_PipeHandle *hello_pipe_stdin; 42static struct GNUNET_DISK_PipeHandle *hello_pipe_stdin;
43 43
44/** 44/**
45 * Pipe to read from started processes stdout (on read end) 45 * Pipe to read from started processes stdout (on read end)
46 */ 46 */
47static struct GNUNET_DISK_PipeHandle *hello_pipe_stdout; 47static struct GNUNET_DISK_PipeHandle *hello_pipe_stdout;
48 48
@@ -204,7 +204,7 @@ check_kill ()
204 fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); 204 fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver");
205 proc = 205 proc =
206 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn, 206 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn,
207 "gnunet-service-resolver", "-", NULL); 207 "gnunet-service-resolver", "-", NULL);
208 sleep (1); /* give process time to start, so we actually use the pipe-kill mechanism! */ 208 sleep (1); /* give process time to start, so we actually use the pipe-kill mechanism! */
209 GNUNET_free (fn); 209 GNUNET_free (fn);
210 if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) 210 if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
@@ -235,7 +235,7 @@ check_instant_kill ()
235 fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); 235 fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver");
236 proc = 236 proc =
237 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn, 237 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn,
238 "gnunet-service-resolver", "-", NULL); 238 "gnunet-service-resolver", "-", NULL);
239 if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) 239 if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
240 { 240 {
241 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); 241 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
diff --git a/src/util/test_peer.c b/src/util/test_peer.c
index 51f759867..c2cd49315 100644
--- a/src/util/test_peer.c
+++ b/src/util/test_peer.c
@@ -43,7 +43,7 @@ generatePeerIdList ()
43 for (i = 0; i < NUMBER_OF_PEERS; i++) 43 for (i = 0; i < NUMBER_OF_PEERS; i++)
44 { 44 {
45 gcry_randomize (&pidArr[i], 45 gcry_randomize (&pidArr[i],
46 sizeof (struct GNUNET_PeerIdentity), 46 sizeof (struct GNUNET_PeerIdentity),
47 GCRY_STRONG_RANDOM); 47 GCRY_STRONG_RANDOM);
48 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 48 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
49 "Peer %d: %s\n", i, GNUNET_i2s (&pidArr[i])); 49 "Peer %d: %s\n", i, GNUNET_i2s (&pidArr[i]));
diff --git a/src/util/test_plugin.c b/src/util/test_plugin.c
index e819e678a..135447da8 100644
--- a/src/util/test_plugin.c
+++ b/src/util/test_plugin.c
@@ -53,7 +53,7 @@ main (int argc, char *argv[])
53 ret = GNUNET_PLUGIN_load ("libgnunet_plugin_test", "in"); 53 ret = GNUNET_PLUGIN_load ("libgnunet_plugin_test", "in");
54 if (ret == NULL) 54 if (ret == NULL)
55 return 1; 55 return 1;
56 if (0 != strcmp (ret, "Hello")) 56 if (0 != strcmp (ret, "Hello"))
57 return 2; 57 return 2;
58 ret = GNUNET_PLUGIN_unload ("libgnunet_plugin_test", "out"); 58 ret = GNUNET_PLUGIN_unload ("libgnunet_plugin_test", "out");
59 if (ret == NULL) 59 if (ret == NULL)
diff --git a/src/util/test_resolver_api.c b/src/util/test_resolver_api.c
index ea18629f4..bcbaf4f04 100644
--- a/src/util/test_resolver_api.c
+++ b/src/util/test_resolver_api.c
@@ -353,7 +353,7 @@ main (int argc, char *argv[])
353 int ok = 1 + 2 + 4 + 8; 353 int ok = 1 + 2 + 4 + 8;
354 char *fn; 354 char *fn;
355 struct GNUNET_OS_Process *proc; 355 struct GNUNET_OS_Process *proc;
356 char *const argvx[] = { 356 char *const argvx[] = {
357 "test-resolver-api", "-c", "test_resolver_api_data.conf", NULL 357 "test-resolver-api", "-c", "test_resolver_api_data.conf", NULL
358 }; 358 };
359 struct GNUNET_GETOPT_CommandLineOption options[] = 359 struct GNUNET_GETOPT_CommandLineOption options[] =
@@ -363,9 +363,9 @@ main (int argc, char *argv[])
363 "WARNING", 363 "WARNING",
364 NULL); 364 NULL);
365 fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); 365 fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver");
366 proc = GNUNET_OS_start_process (GNUNET_YES, 366 proc = GNUNET_OS_start_process (GNUNET_YES,
367 GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 367 GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
368 NULL, NULL, fn, 368 NULL, NULL, fn,
369 "gnunet-service-resolver", 369 "gnunet-service-resolver",
370 "-c", "test_resolver_api_data.conf", NULL); 370 "-c", "test_resolver_api_data.conf", NULL);
371 GNUNET_assert (NULL != proc); 371 GNUNET_assert (NULL != proc);
diff --git a/src/util/test_scheduler_delay.c b/src/util/test_scheduler_delay.c
index ce96213c7..66fc95d0a 100644
--- a/src/util/test_scheduler_delay.c
+++ b/src/util/test_scheduler_delay.c
@@ -76,7 +76,7 @@ main (int argc, char *argv[])
76 GNUNET_log_setup ("test-scheduler-delay", "WARNING", NULL); 76 GNUNET_log_setup ("test-scheduler-delay", "WARNING", NULL);
77 target = GNUNET_TIME_absolute_get (); 77 target = GNUNET_TIME_absolute_get ();
78 GNUNET_SCHEDULER_run (&test_task, NULL); 78 GNUNET_SCHEDULER_run (&test_task, NULL);
79 FPRINTF (stdout, 79 FPRINTF (stdout,
80 "Sleep precision: %llu microseconds (average delta). ", 80 "Sleep precision: %llu microseconds (average delta). ",
81 cumDelta / (MAXV / INCR)); 81 cumDelta / (MAXV / INCR));
82 if (cumDelta <= 500 * MAXV / INCR) 82 if (cumDelta <= 500 * MAXV / INCR)
diff --git a/src/util/test_server_mst_interrupt.c b/src/util/test_server_mst_interrupt.c
index cfd891522..4cc5e95b4 100644
--- a/src/util/test_server_mst_interrupt.c
+++ b/src/util/test_server_mst_interrupt.c
@@ -50,8 +50,8 @@ main (int argc, char *argv[])
50 msg[0].size = htons (sizeof (msg)); 50 msg[0].size = htons (sizeof (msg));
51 msg[0].type = htons (sizeof (GNUNET_MESSAGE_TYPE_DUMMY)); 51 msg[0].type = htons (sizeof (GNUNET_MESSAGE_TYPE_DUMMY));
52 mst = GNUNET_SERVER_mst_create(mst_cb, NULL); 52 mst = GNUNET_SERVER_mst_create(mst_cb, NULL);
53 GNUNET_SERVER_mst_receive (mst, &id, 53 GNUNET_SERVER_mst_receive (mst, &id,
54 (const char *) &msg, 2 * sizeof (msg), 54 (const char *) &msg, 2 * sizeof (msg),
55 GNUNET_NO, GNUNET_NO); 55 GNUNET_NO, GNUNET_NO);
56 /* If we reach this line, it did not crash */ 56 /* If we reach this line, it did not crash */
57 return 0; 57 return 0;
diff --git a/src/util/test_service.c b/src/util/test_service.c
index eee0cecc1..728db0a8f 100644
--- a/src/util/test_service.c
+++ b/src/util/test_service.c
@@ -154,7 +154,7 @@ check ()
154 154
155 155
156static void 156static void
157ready6 (void *cls, 157ready6 (void *cls,
158 int result) 158 int result)
159{ 159{
160 const struct GNUNET_CONFIGURATION_Handle *cfg = cls; 160 const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
@@ -236,7 +236,7 @@ check_start_stop ()
236 GNUNET_assert (GNUNET_OK == 236 GNUNET_assert (GNUNET_OK ==
237 GNUNET_PROGRAM_run (3, argv, "test-service-program", "no help", 237 GNUNET_PROGRAM_run (3, argv, "test-service-program", "no help",
238 options, &start_stop_main, &ret)); 238 options, &start_stop_main, &ret));
239 239
240 GNUNET_break (0 == ret); 240 GNUNET_break (0 == ret);
241 return ret; 241 return ret;
242} 242}
diff --git a/src/util/test_speedup.c b/src/util/test_speedup.c
index a2e6bb29c..2b540af4b 100644
--- a/src/util/test_speedup.c
+++ b/src/util/test_speedup.c
@@ -58,14 +58,14 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
58 } 58 }
59 end = GNUNET_TIME_absolute_get(); 59 end = GNUNET_TIME_absolute_get();
60 fprintf (stderr, "\n"); 60 fprintf (stderr, "\n");
61 fflush(stdout); 61 fflush(stdout);
62} 62}
63 63
64 64
65/** 65/**
66 * 66 *
67 */ 67 */
68static void 68static void
69check (void *cls, char *const *args, 69check (void *cls, char *const *args,
70 const char *cfgfile, 70 const char *cfgfile,
71 const struct GNUNET_CONFIGURATION_Handle * 71 const struct GNUNET_CONFIGURATION_Handle *
@@ -90,7 +90,7 @@ main (int argc, char *argv[])
90 time_t start_real; 90 time_t start_real;
91 time_t end_real; 91 time_t end_real;
92 struct GNUNET_TIME_Relative delta; 92 struct GNUNET_TIME_Relative delta;
93 93
94 start_real = time (NULL); 94 start_real = time (NULL);
95 start = GNUNET_TIME_absolute_get(); 95 start = GNUNET_TIME_absolute_get();
96 GNUNET_PROGRAM_run ((sizeof (argvn) / sizeof (char *)) - 1, argvn, "test-speedup", 96 GNUNET_PROGRAM_run ((sizeof (argvn) / sizeof (char *)) - 1, argvn, "test-speedup",
@@ -101,19 +101,19 @@ main (int argc, char *argv[])
101 101
102 if (delta.rel_value_us > ((end_real - start_real) * 1500LL * 1000LL)) 102 if (delta.rel_value_us > ((end_real - start_real) * 1500LL * 1000LL))
103 { 103 {
104 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 104 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
105 "Execution time in GNUnet time: %s\n", 105 "Execution time in GNUnet time: %s\n",
106 GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_YES)); 106 GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_YES));
107 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 107 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
108 "Execution time in system time: %llu ms\n", 108 "Execution time in system time: %llu ms\n",
109 (unsigned long long) ((end_real - start_real) * 1000LL)); 109 (unsigned long long) ((end_real - start_real) * 1000LL));
110 return 0; 110 return 0;
111 } 111 }
112 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 112 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
113 "Execution time in GNUnet time: %s\n", 113 "Execution time in GNUnet time: %s\n",
114 GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_YES)); 114 GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_YES));
115 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 115 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
116 "Execution time in system time: %llu ms\n", 116 "Execution time in system time: %llu ms\n",
117 (unsigned long long) ((end_real - start_real) * 1000LL)); 117 (unsigned long long) ((end_real - start_real) * 1000LL));
118 return 1; 118 return 1;
119} 119}
diff --git a/src/util/test_strings.c b/src/util/test_strings.c
index f6f872211..26ca5dc6a 100644
--- a/src/util/test_strings.c
+++ b/src/util/test_strings.c
@@ -99,7 +99,7 @@ main (int argc, char *argv[])
99 } 99 }
100 b = GNUNET_STRINGS_to_utf8 ("TEST", 4, "ASCII"); 100 b = GNUNET_STRINGS_to_utf8 ("TEST", 4, "ASCII");
101 WANT ("TEST", b); 101 WANT ("TEST", b);
102 102
103 at = GNUNET_TIME_UNIT_FOREVER_ABS; 103 at = GNUNET_TIME_UNIT_FOREVER_ABS;
104 bc = GNUNET_STRINGS_absolute_time_to_string (at); 104 bc = GNUNET_STRINGS_absolute_time_to_string (at);
105 GNUNET_assert (GNUNET_OK == 105 GNUNET_assert (GNUNET_OK ==
diff --git a/src/util/test_strings_to_data.c b/src/util/test_strings_to_data.c
index 125101e55..a0521cf70 100644
--- a/src/util/test_strings_to_data.c
+++ b/src/util/test_strings_to_data.c
@@ -34,7 +34,7 @@ main (int argc, char *argv[])
34 char dst[128]; 34 char dst[128];
35 unsigned int i; 35 unsigned int i;
36 int ret = 0; 36 int ret = 0;
37 37
38 GNUNET_log_setup ("util", "DEBUG", NULL); 38 GNUNET_log_setup ("util", "DEBUG", NULL);
39 for (i=0;i<sizeof(src);i++) 39 for (i=0;i<sizeof(src);i++)
40 { 40 {
@@ -44,7 +44,7 @@ main (int argc, char *argv[])
44 end = GNUNET_STRINGS_data_to_string (&src, i, buf, sizeof (buf)); 44 end = GNUNET_STRINGS_data_to_string (&src, i, buf, sizeof (buf));
45 GNUNET_assert (NULL != end); 45 GNUNET_assert (NULL != end);
46 end[0] = '\0'; 46 end[0] = '\0';
47 if (GNUNET_OK != 47 if (GNUNET_OK !=
48 GNUNET_STRINGS_string_to_data (buf, strlen (buf), dst, i)) 48 GNUNET_STRINGS_string_to_data (buf, strlen (buf), dst, i))
49 { 49 {
50 fprintf (stderr, "%u failed decode (%u bytes)\n", i, (unsigned int) strlen (buf)); 50 fprintf (stderr, "%u failed decode (%u bytes)\n", i, (unsigned int) strlen (buf));
diff --git a/src/util/time.c b/src/util/time.c
index 6b1b43062..19f3e488f 100644
--- a/src/util/time.c
+++ b/src/util/time.c
@@ -50,7 +50,7 @@ GNUNET_TIME_set_offset (long long offset)
50 * 50 *
51 * @return the offset we currently skew the locale time by 51 * @return the offset we currently skew the locale time by
52 */ 52 */
53long long 53long long
54GNUNET_TIME_get_offset () 54GNUNET_TIME_get_offset ()
55{ 55{
56 return timestamp_offset; 56 return timestamp_offset;
@@ -579,10 +579,10 @@ GNUNET_TIME_get_current_year ()
579/** 579/**
580 * Convert an expiration time to the respective year (rounds) 580 * Convert an expiration time to the respective year (rounds)
581 * 581 *
582 * @param at absolute time 582 * @param at absolute time
583 * @return year a year (after 1970), 0 on error 583 * @return year a year (after 1970), 0 on error
584 */ 584 */
585unsigned int 585unsigned int
586GNUNET_TIME_time_to_year (struct GNUNET_TIME_Absolute at) 586GNUNET_TIME_time_to_year (struct GNUNET_TIME_Absolute at)
587{ 587{
588 struct tm *t; 588 struct tm *t;
diff --git a/src/util/win.c b/src/util/win.c
index 88763c9b2..299d1c070 100644
--- a/src/util/win.c
+++ b/src/util/win.c
@@ -45,7 +45,7 @@ int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows);
45 ULONG Length; \ 45 ULONG Length; \
46 DWORD Flags; \ 46 DWORD Flags; \
47 }; \ 47 }; \
48 }; 48 };
49 49
50#define _IP_ADAPTER_UNICAST_ADDRESS_BASE \ 50#define _IP_ADAPTER_UNICAST_ADDRESS_BASE \
51 SOCKET_ADDRESS Address; \ 51 SOCKET_ADDRESS Address; \
@@ -106,7 +106,7 @@ typedef enum _NET_IF_CONNECTION_TYPE {
106 NET_IF_CONNECTION_DEDICATED = 1, 106 NET_IF_CONNECTION_DEDICATED = 1,
107 NET_IF_CONNECTION_PASSIVE, 107 NET_IF_CONNECTION_PASSIVE,
108 NET_IF_CONNECTION_DEMAND, 108 NET_IF_CONNECTION_DEMAND,
109 NET_IF_CONNECTION_MAXIMUM 109 NET_IF_CONNECTION_MAXIMUM
110} NET_IF_CONNECTION_TYPE, *PNET_IF_CONNECTION_TYPE; 110} NET_IF_CONNECTION_TYPE, *PNET_IF_CONNECTION_TYPE;
111 111
112typedef enum { 112typedef enum {
@@ -116,7 +116,7 @@ typedef enum {
116 TUNNEL_TYPE_6TO4, 116 TUNNEL_TYPE_6TO4,
117 TUNNEL_TYPE_ISATAP, 117 TUNNEL_TYPE_ISATAP,
118 TUNNEL_TYPE_TEREDO, 118 TUNNEL_TYPE_TEREDO,
119 TUNNEL_TYPE_IPHTTPS 119 TUNNEL_TYPE_IPHTTPS
120} TUNNEL_TYPE, *PTUNNEL_TYPE; 120} TUNNEL_TYPE, *PTUNNEL_TYPE;
121#endif 121#endif
122 122
@@ -209,7 +209,7 @@ typedef struct _IP_ADAPTER_ADDRESSES##suffix { \
209 _IP_ADAPTER_ADDRESSES_BASE \ 209 _IP_ADAPTER_ADDRESSES_BASE \
210 addition \ 210 addition \
211} IP_ADAPTER_ADDRESSES##suffix, *PIP_ADAPTER_ADDRESSES##suffix; 211} IP_ADAPTER_ADDRESSES##suffix, *PIP_ADAPTER_ADDRESSES##suffix;
212 212
213 213
214/* _IP_ADAPTER_ADDRESSES_DEFINE(,) defined in w32api headers */ 214/* _IP_ADAPTER_ADDRESSES_DEFINE(,) defined in w32api headers */
215_IP_ADAPTER_ADDRESSES_DEFINE(_XPSP1,_IP_ADAPTER_ADDRESSES_ADD_XPSP1) 215_IP_ADAPTER_ADDRESSES_DEFINE(_XPSP1,_IP_ADAPTER_ADDRESSES_ADD_XPSP1)
diff --git a/src/vpn/gnunet-helper-vpn-windows.c b/src/vpn/gnunet-helper-vpn-windows.c
index 15dc5a667..3f4920a6f 100644
--- a/src/vpn/gnunet-helper-vpn-windows.c
+++ b/src/vpn/gnunet-helper-vpn-windows.c
@@ -19,8 +19,8 @@
19 */ 19 */
20/** 20/**
21 * @file vpn/gnunet-helper-vpn-windows.c 21 * @file vpn/gnunet-helper-vpn-windows.c
22 * @brief the helper for the VPN service in win32 builds. 22 * @brief the helper for the VPN service in win32 builds.
23 * Opens a virtual network-interface, sends data received on the if to stdout, 23 * Opens a virtual network-interface, sends data received on the if to stdout,
24 * sends data received on stdin to the interface 24 * sends data received on stdin to the interface
25 * @author Christian M. Fuchs 25 * @author Christian M. Fuchs
26 * 26 *
@@ -68,7 +68,7 @@
68#endif 68#endif
69 69
70/** 70/**
71 * Will this binary be run in permissions testing mode? 71 * Will this binary be run in permissions testing mode?
72 */ 72 */
73static boolean privilege_testing = FALSE; 73static boolean privilege_testing = FALSE;
74 74
@@ -90,7 +90,7 @@ static boolean privilege_testing = FALSE;
90#define INF_FILE64 "share/gnunet/openvpn-tap32/tapw64/OemWin2k.inf" 90#define INF_FILE64 "share/gnunet/openvpn-tap32/tapw64/OemWin2k.inf"
91 91
92/** 92/**
93 * Hardware ID used in the inf-file. 93 * Hardware ID used in the inf-file.
94 * This might change over time, as openvpn advances their driver 94 * This might change over time, as openvpn advances their driver
95 */ 95 */
96#define HARDWARE_ID "tap0901" 96#define HARDWARE_ID "tap0901"
@@ -101,7 +101,7 @@ static boolean privilege_testing = FALSE;
101#define TAP_WIN_MIN_MAJOR 9 101#define TAP_WIN_MIN_MAJOR 9
102 102
103/** 103/**
104 * Minimum minor-id of the driver version we can work with. 104 * Minimum minor-id of the driver version we can work with.
105 * v <= 7 has buggy IPv6. 105 * v <= 7 has buggy IPv6.
106 * v == 8 is broken for small IPv4 Packets 106 * v == 8 is broken for small IPv4 Packets
107 */ 107 */
@@ -109,7 +109,7 @@ static boolean privilege_testing = FALSE;
109 109
110/** 110/**
111 * Time in seconds to wait for our virtual device to go up after telling it to do so. 111 * Time in seconds to wait for our virtual device to go up after telling it to do so.
112 * 112 *
113 * openvpn doesn't specify a value, 4 seems sane for testing, even for openwrt 113 * openvpn doesn't specify a value, 4 seems sane for testing, even for openwrt
114 * (in fact, 4 was chosen by a fair dice roll...) 114 * (in fact, 4 was chosen by a fair dice roll...)
115 */ 115 */
@@ -121,7 +121,7 @@ static boolean privilege_testing = FALSE;
121#define INTERFACE_REGISTRY_LOCATION "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}" 121#define INTERFACE_REGISTRY_LOCATION "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
122 122
123/** 123/**
124 * Our local process' PID. Used for creating a sufficiently unique additional 124 * Our local process' PID. Used for creating a sufficiently unique additional
125 * hardware ID for our device. 125 * hardware ID for our device.
126 */ 126 */
127static char secondary_hwid[LINE_LEN / 2]; 127static char secondary_hwid[LINE_LEN / 2];
@@ -132,13 +132,13 @@ static char secondary_hwid[LINE_LEN / 2];
132 */ 132 */
133static char device_visible_name[256]; 133static char device_visible_name[256];
134 134
135/** 135/**
136 * This is our own local instance of a virtual network interface 136 * This is our own local instance of a virtual network interface
137 * It is (somewhat) equivalent to using tun/tap in unixoid systems 137 * It is (somewhat) equivalent to using tun/tap in unixoid systems
138 * 138 *
139 * Upon initialization, we create such an device node. 139 * Upon initialization, we create such an device node.
140 * Upon termination, we remove it again. 140 * Upon termination, we remove it again.
141 * 141 *
142 * If we crash this device might stay around. 142 * If we crash this device might stay around.
143 */ 143 */
144static HDEVINFO DeviceInfo = INVALID_HANDLE_VALUE; 144static HDEVINFO DeviceInfo = INVALID_HANDLE_VALUE;
@@ -149,7 +149,7 @@ static HDEVINFO DeviceInfo = INVALID_HANDLE_VALUE;
149static SP_DEVINFO_DATA DeviceNode; 149static SP_DEVINFO_DATA DeviceNode;
150 150
151/** 151/**
152 * GUID of our virtual device in the form of 152 * GUID of our virtual device in the form of
153 * {12345678-1234-1234-1234-123456789abc} - in hex 153 * {12345678-1234-1234-1234-123456789abc} - in hex
154 */ 154 */
155static char device_guid[256]; 155static char device_guid[256];
@@ -161,36 +161,36 @@ static char device_guid[256];
161enum IO_State 161enum IO_State
162{ 162{
163 163
164 /** 164 /**
165 * overlapped I/O is ready for work 165 * overlapped I/O is ready for work
166 */ 166 */
167 IOSTATE_READY = 0, 167 IOSTATE_READY = 0,
168 168
169 /** 169 /**
170 * overlapped I/O has been queued 170 * overlapped I/O has been queued
171 */ 171 */
172 IOSTATE_QUEUED, 172 IOSTATE_QUEUED,
173 173
174 /** 174 /**
175 * overlapped I/O has finished, but is waiting for it's write-partner 175 * overlapped I/O has finished, but is waiting for it's write-partner
176 */ 176 */
177 IOSTATE_WAITING, 177 IOSTATE_WAITING,
178 178
179 /** 179 /**
180 * there is a full buffer waiting 180 * there is a full buffer waiting
181 */ 181 */
182 IOSTATE_RESUME, 182 IOSTATE_RESUME,
183 183
184 /** 184 /**
185 * Operlapped IO states for facility objects 185 * Operlapped IO states for facility objects
186 * overlapped I/O has failed, stop processing 186 * overlapped I/O has failed, stop processing
187 */ 187 */
188 IOSTATE_FAILED 188 IOSTATE_FAILED
189 189
190}; 190};
191 191
192 192
193/** 193/**
194 * A IO Object + read/writebuffer + buffer-size for windows asynchronous IO handling 194 * A IO Object + read/writebuffer + buffer-size for windows asynchronous IO handling
195 */ 195 */
196struct io_facility 196struct io_facility
@@ -229,7 +229,7 @@ struct io_facility
229 * Amount of data actually written or read by readfile/writefile. 229 * Amount of data actually written or read by readfile/writefile.
230 */ 230 */
231 DWORD buffer_size_processed; 231 DWORD buffer_size_processed;
232 232
233 /** 233 /**
234 * How much of this buffer we have writte in total 234 * How much of this buffer we have writte in total
235 */ 235 */
@@ -248,32 +248,32 @@ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
248 248
249/** 249/**
250 * Determines if the host OS is win32 or win64 250 * Determines if the host OS is win32 or win64
251 * 251 *
252 * @return true if 252 * @return true if
253 */ 253 */
254BOOL 254BOOL
255is_win64 () 255is_win64 ()
256{ 256{
257#if defined(_WIN64) 257#if defined(_WIN64)
258 //this is a win64 binary, 258 //this is a win64 binary,
259 return TRUE; 259 return TRUE;
260#elif defined(_WIN32) 260#elif defined(_WIN32)
261 //this is a 32bit binary, and we need to check if we are running in WOW64 261 //this is a 32bit binary, and we need to check if we are running in WOW64
262 BOOL success = FALSE; 262 BOOL success = FALSE;
263 BOOL on_wow64 = FALSE; 263 BOOL on_wow64 = FALSE;
264 LPFN_ISWOW64PROCESS IsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress (GetModuleHandle ("kernel32"), "IsWow64Process"); 264 LPFN_ISWOW64PROCESS IsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress (GetModuleHandle ("kernel32"), "IsWow64Process");
265 265
266 if (NULL != IsWow64Process) 266 if (NULL != IsWow64Process)
267 success = IsWow64Process (GetCurrentProcess (), &on_wow64); 267 success = IsWow64Process (GetCurrentProcess (), &on_wow64);
268 268
269 return success && on_wow64; 269 return success && on_wow64;
270#endif 270#endif
271} 271}
272/** 272/**
273 * Wrapper for executing a shellcommand in windows. 273 * Wrapper for executing a shellcommand in windows.
274 * 274 *
275 * @param command - the command + parameters to execute 275 * @param command - the command + parameters to execute
276 * @return * exitcode of the program executed, 276 * @return * exitcode of the program executed,
277 * * EINVAL (cmd/file not found) 277 * * EINVAL (cmd/file not found)
278 * * EPIPE (could not read STDOUT) 278 * * EPIPE (could not read STDOUT)
279 */ 279 */
@@ -365,7 +365,7 @@ remove_address6 (const char *address)
365 365
366 /* Did it work?*/ 366 /* Did it work?*/
367 if (0 != ret) 367 if (0 != ret)
368 fprintf (stderr, 368 fprintf (stderr,
369 "FATAL: removing IPv6 address failed: %s\n", 369 "FATAL: removing IPv6 address failed: %s\n",
370 strerror (ret)); 370 strerror (ret));
371} 371}
@@ -410,8 +410,8 @@ set_address4 (const char *address, const char *mask)
410 410
411 /* Did it work?*/ 411 /* Did it work?*/
412 if (0 != ret) 412 if (0 != ret)
413 fprintf (stderr, 413 fprintf (stderr,
414 "FATAL: Setting IPv4 address failed: %s\n", 414 "FATAL: Setting IPv4 address failed: %s\n",
415 strerror (ret)); 415 strerror (ret));
416 return ret; 416 return ret;
417} 417}
@@ -448,8 +448,8 @@ remove_address4 (const char *address)
448 448
449 449
450/** 450/**
451 * Setup a new virtual interface to use for tunneling. 451 * Setup a new virtual interface to use for tunneling.
452 * 452 *
453 * @return: TRUE if setup was successful, else FALSE 453 * @return: TRUE if setup was successful, else FALSE
454 */ 454 */
455static BOOL 455static BOOL
@@ -457,7 +457,7 @@ setup_interface ()
457{ 457{
458 /* 458 /*
459 * where to find our inf-file. (+ the "full" path, after windows found") 459 * where to find our inf-file. (+ the "full" path, after windows found")
460 * 460 *
461 * We do not directly input all the props here, because openvpn will update 461 * We do not directly input all the props here, because openvpn will update
462 * these details over time. 462 * these details over time.
463 */ 463 */
@@ -468,22 +468,22 @@ setup_interface ()
468 GUID class_guid; 468 GUID class_guid;
469 int str_length = 0; 469 int str_length = 0;
470 470
471 /** 471 /**
472 * Set the device's hardware ID and add it to a list. 472 * Set the device's hardware ID and add it to a list.
473 * This information will later on identify this device in registry. 473 * This information will later on identify this device in registry.
474 */ 474 */
475 strncpy (hwidlist, HARDWARE_ID, LINE_LEN); 475 strncpy (hwidlist, HARDWARE_ID, LINE_LEN);
476 /** 476 /**
477 * this is kind of over-complicated, but allows keeps things independent of 477 * this is kind of over-complicated, but allows keeps things independent of
478 * how the openvpn-hwid is actually stored. 478 * how the openvpn-hwid is actually stored.
479 * 479 *
480 * A HWID list is double-\0 terminated and \0 separated 480 * A HWID list is double-\0 terminated and \0 separated
481 */ 481 */
482 str_length = strlen (hwidlist) + 1; 482 str_length = strlen (hwidlist) + 1;
483 strncpy (&hwidlist[str_length], secondary_hwid, LINE_LEN); 483 strncpy (&hwidlist[str_length], secondary_hwid, LINE_LEN);
484 str_length += strlen (&hwidlist[str_length]) + 1; 484 str_length += strlen (&hwidlist[str_length]) + 1;
485 485
486 /** 486 /**
487 * Locate the inf-file, we need to store it somewhere where the system can 487 * Locate the inf-file, we need to store it somewhere where the system can
488 * find it. We need to pick the correct driver for win32/win64. 488 * find it. We need to pick the correct driver for win32/win64.
489 */ 489 */
@@ -493,7 +493,7 @@ setup_interface ()
493 GetFullPathNameA (INF_FILE, MAX_PATH, inf_file_path, &temp_inf_filename); 493 GetFullPathNameA (INF_FILE, MAX_PATH, inf_file_path, &temp_inf_filename);
494 494
495 fprintf (stderr, "INFO: Located our driver's .inf file at %s\n", inf_file_path); 495 fprintf (stderr, "INFO: Located our driver's .inf file at %s\n", inf_file_path);
496 /** 496 /**
497 * Bootstrap our device info using the drivers inf-file 497 * Bootstrap our device info using the drivers inf-file
498 */ 498 */
499 if ( ! SetupDiGetINFClassA (inf_file_path, 499 if ( ! SetupDiGetINFClassA (inf_file_path,
@@ -502,9 +502,9 @@ setup_interface ()
502 NULL)) 502 NULL))
503 return FALSE; 503 return FALSE;
504 504
505 /** 505 /**
506 * Collect all the other needed information... 506 * Collect all the other needed information...
507 * let the system fill our this form 507 * let the system fill our this form
508 */ 508 */
509 DeviceInfo = SetupDiCreateDeviceInfoList (&class_guid, NULL); 509 DeviceInfo = SetupDiCreateDeviceInfoList (&class_guid, NULL);
510 if (DeviceInfo == INVALID_HANDLE_VALUE) 510 if (DeviceInfo == INVALID_HANDLE_VALUE)
@@ -549,9 +549,9 @@ setup_interface ()
549 549
550 550
551/** 551/**
552 * Remove our new virtual interface to use for tunneling. 552 * Remove our new virtual interface to use for tunneling.
553 * This function must be called AFTER setup_interface! 553 * This function must be called AFTER setup_interface!
554 * 554 *
555 * @return: TRUE if destruction was successful, else FALSE 555 * @return: TRUE if destruction was successful, else FALSE
556 */ 556 */
557static BOOL 557static BOOL
@@ -567,7 +567,7 @@ remove_interface ()
567 remove.Scope = DI_REMOVEDEVICE_GLOBAL; 567 remove.Scope = DI_REMOVEDEVICE_GLOBAL;
568 remove.ClassInstallHeader.InstallFunction = DIF_REMOVE; 568 remove.ClassInstallHeader.InstallFunction = DIF_REMOVE;
569 /* 569 /*
570 * 1. Prepare our existing device information set, and place the 570 * 1. Prepare our existing device information set, and place the
571 * uninstall related information into the structure 571 * uninstall related information into the structure
572 */ 572 */
573 if ( ! SetupDiSetClassInstallParamsA (DeviceInfo, 573 if ( ! SetupDiSetClassInstallParamsA (DeviceInfo,
@@ -584,7 +584,7 @@ remove_interface ()
584 return FALSE; 584 return FALSE;
585 585
586 SetupDiDestroyDeviceInfoList (DeviceInfo); 586 SetupDiDestroyDeviceInfoList (DeviceInfo);
587 587
588 fprintf (stderr, "DEBUG: removed interface successfully\n"); 588 fprintf (stderr, "DEBUG: removed interface successfully\n");
589 589
590 return TRUE; 590 return TRUE;
@@ -593,8 +593,8 @@ remove_interface ()
593 593
594/** 594/**
595 * Do all the lookup necessary to retrieve the inteface's actual name 595 * Do all the lookup necessary to retrieve the inteface's actual name
596 * off the registry. 596 * off the registry.
597 * 597 *
598 * @return: TRUE if we were able to lookup the interface's name, else FALSE 598 * @return: TRUE if we were able to lookup the interface's name, else FALSE
599 */ 599 */
600static BOOL 600static BOOL
@@ -618,7 +618,7 @@ resolve_interface_name ()
618 0, //must be 0 618 0, //must be 0
619 NULL)) //hMachine, we are local 619 NULL)) //hMachine, we are local
620 return FALSE; 620 return FALSE;
621 621
622 fprintf (stderr, "DEBUG: Resolving interface name for network device %s\n",pnp_instance_id); 622 fprintf (stderr, "DEBUG: Resolving interface name for network device %s\n",pnp_instance_id);
623 623
624 /* Registry is incredibly slow, retry for up to 30 seconds to allow registry to refresh */ 624 /* Registry is incredibly slow, retry for up to 30 seconds to allow registry to refresh */
@@ -636,7 +636,7 @@ resolve_interface_name ()
636 &adapter_key_handle)) 636 &adapter_key_handle))
637 return FALSE; 637 return FALSE;
638 638
639 /* Of course there is a multitude of entries here, with arbitrary names, 639 /* Of course there is a multitude of entries here, with arbitrary names,
640 * thus we need to iterate through there. 640 * thus we need to iterate through there.
641 */ 641 */
642 while (!retval) 642 while (!retval)
@@ -661,7 +661,7 @@ resolve_interface_name ()
661 NULL, 661 NULL,
662 NULL); 662 NULL);
663 663
664 /* this may fail due to one of two reasons: 664 /* this may fail due to one of two reasons:
665 * we are at the end of the list*/ 665 * we are at the end of the list*/
666 if (ERROR_NO_MORE_ITEMS == status) 666 if (ERROR_NO_MORE_ITEMS == status)
667 break; 667 break;
@@ -712,8 +712,8 @@ resolve_interface_name ()
712 if (status != ERROR_SUCCESS || data_type != REG_SZ) 712 if (status != ERROR_SUCCESS || data_type != REG_SZ)
713 goto cleanup; 713 goto cleanup;
714 714
715 /* 715 /*
716 * we have successfully found OUR instance, 716 * we have successfully found OUR instance,
717 * save the device GUID before exiting 717 * save the device GUID before exiting
718 */ 718 */
719 719
@@ -735,7 +735,7 @@ cleanup:
735 735
736/** 736/**
737 * Determines the version of the installed TAP32 driver and checks if it's sufficiently new for GNUNET 737 * Determines the version of the installed TAP32 driver and checks if it's sufficiently new for GNUNET
738 * 738 *
739 * @param handle the handle to our tap device 739 * @param handle the handle to our tap device
740 * @return TRUE if the version is sufficient, else FALSE 740 * @return TRUE if the version is sufficient, else FALSE
741 */ 741 */
@@ -761,7 +761,7 @@ check_tapw32_version (HANDLE handle)
761 TAP_WIN_MIN_MINOR); 761 TAP_WIN_MIN_MINOR);
762 return FALSE; 762 return FALSE;
763 } 763 }
764 764
765 return TRUE; 765 return TRUE;
766} 766}
767 767
@@ -827,8 +827,8 @@ init_tun ()
827 827
828/** 828/**
829 * Brings a TAP device up and sets it to connected state. 829 * Brings a TAP device up and sets it to connected state.
830 * 830 *
831 * @param handle the handle to our TAP device 831 * @param handle the handle to our TAP device
832 * @return True if the operation succeeded, else false 832 * @return True if the operation succeeded, else false
833 */ 833 */
834static BOOL 834static BOOL
@@ -854,25 +854,25 @@ tun_up (HANDLE handle)
854 854
855/** 855/**
856 * Attempts to read off an input facility (tap or named pipe) in overlapped mode. 856 * Attempts to read off an input facility (tap or named pipe) in overlapped mode.
857 * 857 *
858 * 1. 858 * 1.
859 * If the input facility is in IOSTATE_READY, it will issue a new read operation to the 859 * If the input facility is in IOSTATE_READY, it will issue a new read operation to the
860 * input handle. Then it goes into IOSTATE_QUEUED state. 860 * input handle. Then it goes into IOSTATE_QUEUED state.
861 * In case the read succeeded instantly the input facility enters 3. 861 * In case the read succeeded instantly the input facility enters 3.
862 * 862 *
863 * 2. 863 * 2.
864 * If the input facility is in IOSTATE_QUEUED state, it will check if the queued read has finished already. 864 * If the input facility is in IOSTATE_QUEUED state, it will check if the queued read has finished already.
865 * If it has finished, go to state 3. 865 * If it has finished, go to state 3.
866 * If it has failed, set IOSTATE_FAILED 866 * If it has failed, set IOSTATE_FAILED
867 * 867 *
868 * 3. 868 * 3.
869 * If the output facility is in state IOSTATE_READY, the read-buffer is copied to the output buffer. 869 * If the output facility is in state IOSTATE_READY, the read-buffer is copied to the output buffer.
870 * The input facility enters state IOSTATE_READY 870 * The input facility enters state IOSTATE_READY
871 * The output facility enters state IOSTATE_READY 871 * The output facility enters state IOSTATE_READY
872 * If the output facility is in state IOSTATE_QUEUED, the input facility enters IOSTATE_WAITING 872 * If the output facility is in state IOSTATE_QUEUED, the input facility enters IOSTATE_WAITING
873 * 873 *
874 * IOSTATE_WAITING is reset by the output facility, once it has completed. 874 * IOSTATE_WAITING is reset by the output facility, once it has completed.
875 * 875 *
876 * @param input_facility input named pipe or file to work with. 876 * @param input_facility input named pipe or file to work with.
877 * @param output_facility output pipe or file to hand over data to. 877 * @param output_facility output pipe or file to hand over data to.
878 * @return false if an event reset was impossible (OS error), else true 878 * @return false if an event reset was impossible (OS error), else true
@@ -883,11 +883,11 @@ attempt_read_tap (struct io_facility * input_facility,
883{ 883{
884 struct GNUNET_MessageHeader * hdr; 884 struct GNUNET_MessageHeader * hdr;
885 unsigned short size; 885 unsigned short size;
886 886
887 switch (input_facility->facility_state) 887 switch (input_facility->facility_state)
888 { 888 {
889 case IOSTATE_READY: 889 case IOSTATE_READY:
890 { 890 {
891 if (! ResetEvent (input_facility->overlapped.hEvent)) 891 if (! ResetEvent (input_facility->overlapped.hEvent))
892 { 892 {
893 return FALSE; 893 return FALSE;
@@ -906,9 +906,9 @@ attempt_read_tap (struct io_facility * input_facility,
906 /* reset event manually*/ 906 /* reset event manually*/
907 if (! SetEvent (input_facility->overlapped.hEvent)) 907 if (! SetEvent (input_facility->overlapped.hEvent))
908 return FALSE; 908 return FALSE;
909 909
910 fprintf (stderr, "DEBUG: tap read succeeded immediately\n"); 910 fprintf (stderr, "DEBUG: tap read succeeded immediately\n");
911 911
912 /* we successfully read something from the TAP and now need to 912 /* we successfully read something from the TAP and now need to
913 * send it our via STDOUT. Is that possible at the moment? */ 913 * send it our via STDOUT. Is that possible at the moment? */
914 if ((IOSTATE_READY == output_facility->facility_state || 914 if ((IOSTATE_READY == output_facility->facility_state ||
@@ -917,7 +917,7 @@ attempt_read_tap (struct io_facility * input_facility,
917 { /* hand over this buffers content and apply message header for gnunet */ 917 { /* hand over this buffers content and apply message header for gnunet */
918 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer; 918 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer;
919 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader); 919 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader);
920 920
921 memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader), 921 memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
922 input_facility->buffer, 922 input_facility->buffer,
923 input_facility->buffer_size); 923 input_facility->buffer_size);
@@ -964,7 +964,7 @@ attempt_read_tap (struct io_facility * input_facility,
964 return FALSE; 964 return FALSE;
965 965
966 fprintf (stderr, "DEBUG: tap read succeeded delayed\n"); 966 fprintf (stderr, "DEBUG: tap read succeeded delayed\n");
967 967
968 /* we successfully read something from the TAP and now need to 968 /* we successfully read something from the TAP and now need to
969 * send it our via STDOUT. Is that possible at the moment? */ 969 * send it our via STDOUT. Is that possible at the moment? */
970 if ((IOSTATE_READY == output_facility->facility_state || 970 if ((IOSTATE_READY == output_facility->facility_state ||
@@ -973,7 +973,7 @@ attempt_read_tap (struct io_facility * input_facility,
973 { /* hand over this buffers content and apply message header for gnunet */ 973 { /* hand over this buffers content and apply message header for gnunet */
974 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer; 974 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer;
975 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader); 975 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader);
976 976
977 memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader), 977 memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
978 input_facility->buffer, 978 input_facility->buffer,
979 input_facility->buffer_size); 979 input_facility->buffer_size);
@@ -1026,26 +1026,26 @@ attempt_read_tap (struct io_facility * input_facility,
1026 1026
1027/** 1027/**
1028 * Attempts to read off an input facility (tap or named pipe) in overlapped mode. 1028 * Attempts to read off an input facility (tap or named pipe) in overlapped mode.
1029 * 1029 *
1030 * 1. 1030 * 1.
1031 * If the input facility is in IOSTATE_READY, it will issue a new read operation to the 1031 * If the input facility is in IOSTATE_READY, it will issue a new read operation to the
1032 * input handle. Then it goes into IOSTATE_QUEUED state. 1032 * input handle. Then it goes into IOSTATE_QUEUED state.
1033 * In case the read succeeded instantly the input facility enters 3. 1033 * In case the read succeeded instantly the input facility enters 3.
1034 * 1034 *
1035 * 2. 1035 * 2.
1036 * If the input facility is in IOSTATE_QUEUED state, it will check if the queued read has finished already. 1036 * If the input facility is in IOSTATE_QUEUED state, it will check if the queued read has finished already.
1037 * If it has finished, go to state 3. 1037 * If it has finished, go to state 3.
1038 * If it has failed, set IOSTATE_FAILED 1038 * If it has failed, set IOSTATE_FAILED
1039 * 1039 *
1040 * 3. 1040 * 3.
1041 * If the facility is finished with ready 1041 * If the facility is finished with ready
1042 * The read-buffer is copied to the output buffer, except for the GNUNET_MessageHeader. 1042 * The read-buffer is copied to the output buffer, except for the GNUNET_MessageHeader.
1043 * The input facility enters state IOSTATE_READY 1043 * The input facility enters state IOSTATE_READY
1044 * The output facility enters state IOSTATE_READY 1044 * The output facility enters state IOSTATE_READY
1045 * If the output facility is in state IOSTATE_QUEUED, the input facility enters IOSTATE_WAITING 1045 * If the output facility is in state IOSTATE_QUEUED, the input facility enters IOSTATE_WAITING
1046 * 1046 *
1047 * IOSTATE_WAITING is reset by the output facility, once it has completed. 1047 * IOSTATE_WAITING is reset by the output facility, once it has completed.
1048 * 1048 *
1049 * @param input_facility input named pipe or file to work with. 1049 * @param input_facility input named pipe or file to work with.
1050 * @param output_facility output pipe or file to hand over data to. 1050 * @param output_facility output pipe or file to hand over data to.
1051 * @return false if an event reset was impossible (OS error), else true 1051 * @return false if an event reset was impossible (OS error), else true
@@ -1055,17 +1055,17 @@ attempt_read_stdin (struct io_facility * input_facility,
1055 struct io_facility * output_facility) 1055 struct io_facility * output_facility)
1056{ 1056{
1057 struct GNUNET_MessageHeader * hdr; 1057 struct GNUNET_MessageHeader * hdr;
1058 1058
1059 switch (input_facility->facility_state) 1059 switch (input_facility->facility_state)
1060 { 1060 {
1061 case IOSTATE_READY: 1061 case IOSTATE_READY:
1062 { 1062 {
1063 input_facility->buffer_size = 0; 1063 input_facility->buffer_size = 0;
1064 1064
1065partial_read_iostate_ready: 1065partial_read_iostate_ready:
1066 if (! ResetEvent (input_facility->overlapped.hEvent)) 1066 if (! ResetEvent (input_facility->overlapped.hEvent))
1067 return FALSE; 1067 return FALSE;
1068 1068
1069 /* Check how the task is handled */ 1069 /* Check how the task is handled */
1070 if (ReadFile (input_facility->handle, 1070 if (ReadFile (input_facility->handle,
1071 input_facility->buffer + input_facility->buffer_size, 1071 input_facility->buffer + input_facility->buffer_size,
@@ -1113,7 +1113,7 @@ partial_read_iostate_ready:
1113 input_facility->facility_state = IOSTATE_WAITING; 1113 input_facility->facility_state = IOSTATE_WAITING;
1114 else /* we read nothing */ 1114 else /* we read nothing */
1115 input_facility->facility_state = IOSTATE_READY; 1115 input_facility->facility_state = IOSTATE_READY;
1116 } 1116 }
1117 else /* operation was either queued or failed*/ 1117 else /* operation was either queued or failed*/
1118 { 1118 {
1119 int err = GetLastError (); 1119 int err = GetLastError ();
@@ -1141,13 +1141,13 @@ partial_read_iostate_ready:
1141 FALSE)) 1141 FALSE))
1142 {/* successful return for a queued operation */ 1142 {/* successful return for a queued operation */
1143 hdr = (struct GNUNET_MessageHeader *) input_facility->buffer; 1143 hdr = (struct GNUNET_MessageHeader *) input_facility->buffer;
1144 1144
1145 if (! ResetEvent (input_facility->overlapped.hEvent)) 1145 if (! ResetEvent (input_facility->overlapped.hEvent))
1146 return FALSE; 1146 return FALSE;
1147 1147
1148 fprintf (stderr, "DEBUG: stdin read succeeded delayed\n"); 1148 fprintf (stderr, "DEBUG: stdin read succeeded delayed\n");
1149 input_facility->buffer_size += input_facility->buffer_size_processed; 1149 input_facility->buffer_size += input_facility->buffer_size_processed;
1150 1150
1151 if ((ntohs (hdr->type) != GNUNET_MESSAGE_TYPE_VPN_HELPER) || 1151 if ((ntohs (hdr->type) != GNUNET_MESSAGE_TYPE_VPN_HELPER) ||
1152 (ntohs (hdr->size) > sizeof (input_facility->buffer))) 1152 (ntohs (hdr->size) > sizeof (input_facility->buffer)))
1153 { 1153 {
@@ -1209,7 +1209,7 @@ partial_read_iostate_ready:
1209 * Attempts to write to an output facility (tap or named pipe) in overlapped mode. 1209 * Attempts to write to an output facility (tap or named pipe) in overlapped mode.
1210 * 1210 *
1211 * TODO: high level description 1211 * TODO: high level description
1212 * 1212 *
1213 * @param output_facility output pipe or file to hand over data to. 1213 * @param output_facility output pipe or file to hand over data to.
1214 * @param input_facility input named pipe or file to work with. 1214 * @param input_facility input named pipe or file to work with.
1215 * @return false if an event reset was impossible (OS error), else true 1215 * @return false if an event reset was impossible (OS error), else true
@@ -1222,7 +1222,7 @@ attempt_write (struct io_facility * output_facility,
1222 { 1222 {
1223 case IOSTATE_READY: 1223 case IOSTATE_READY:
1224 output_facility->buffer_size_written = 0; 1224 output_facility->buffer_size_written = 0;
1225 1225
1226continue_partial_write: 1226continue_partial_write:
1227 if (! ResetEvent (output_facility->overlapped.hEvent)) 1227 if (! ResetEvent (output_facility->overlapped.hEvent))
1228 return FALSE; 1228 return FALSE;
@@ -1237,7 +1237,7 @@ continue_partial_write:
1237 1237
1238 fprintf (stderr, "DEBUG: write succeeded immediately\n"); 1238 fprintf (stderr, "DEBUG: write succeeded immediately\n");
1239 output_facility->buffer_size_written += output_facility->buffer_size_processed; 1239 output_facility->buffer_size_written += output_facility->buffer_size_processed;
1240 1240
1241 /* reset event manually*/ 1241 /* reset event manually*/
1242 if (! SetEvent (output_facility->overlapped.hEvent)) 1242 if (! SetEvent (output_facility->overlapped.hEvent))
1243 return FALSE; 1243 return FALSE;
@@ -1245,7 +1245,7 @@ continue_partial_write:
1245 /* partial write */ 1245 /* partial write */
1246 if (output_facility->buffer_size_written < output_facility->buffer_size) 1246 if (output_facility->buffer_size_written < output_facility->buffer_size)
1247 goto continue_partial_write; 1247 goto continue_partial_write;
1248 1248
1249 /* we are now waiting for our buffer to be filled*/ 1249 /* we are now waiting for our buffer to be filled*/
1250 output_facility->facility_state = IOSTATE_WAITING; 1250 output_facility->facility_state = IOSTATE_WAITING;
1251 1251
@@ -1272,7 +1272,7 @@ continue_partial_write:
1272 return TRUE; 1272 return TRUE;
1273 case IOSTATE_QUEUED: 1273 case IOSTATE_QUEUED:
1274 // there was an operation going on already, check if that has completed now. 1274 // there was an operation going on already, check if that has completed now.
1275 1275
1276 if (GetOverlappedResult (output_facility->handle, 1276 if (GetOverlappedResult (output_facility->handle,
1277 &output_facility->overlapped, 1277 &output_facility->overlapped,
1278 &output_facility->buffer_size_processed, 1278 &output_facility->buffer_size_processed,
@@ -1280,17 +1280,17 @@ continue_partial_write:
1280 {/* successful return for a queued operation */ 1280 {/* successful return for a queued operation */
1281 if (! ResetEvent (output_facility->overlapped.hEvent)) 1281 if (! ResetEvent (output_facility->overlapped.hEvent))
1282 return FALSE; 1282 return FALSE;
1283 1283
1284 fprintf (stderr, "DEBUG: write succeeded delayed\n"); 1284 fprintf (stderr, "DEBUG: write succeeded delayed\n");
1285 output_facility->buffer_size_written += output_facility->buffer_size_processed; 1285 output_facility->buffer_size_written += output_facility->buffer_size_processed;
1286 1286
1287 /* partial write */ 1287 /* partial write */
1288 if (output_facility->buffer_size_written < output_facility->buffer_size) 1288 if (output_facility->buffer_size_written < output_facility->buffer_size)
1289 goto continue_partial_write; 1289 goto continue_partial_write;
1290 1290
1291 /* we are now waiting for our buffer to be filled*/ 1291 /* we are now waiting for our buffer to be filled*/
1292 output_facility->facility_state = IOSTATE_WAITING; 1292 output_facility->facility_state = IOSTATE_WAITING;
1293 1293
1294 /* we successfully wrote something and now need to reset our reader */ 1294 /* we successfully wrote something and now need to reset our reader */
1295 if (IOSTATE_WAITING == input_facility->facility_state) 1295 if (IOSTATE_WAITING == input_facility->facility_state)
1296 input_facility->facility_state = IOSTATE_RESUME; 1296 input_facility->facility_state = IOSTATE_RESUME;
@@ -1307,7 +1307,7 @@ continue_partial_write:
1307 fprintf (stderr, "FATAL: Write to handle failed, exiting\n"); 1307 fprintf (stderr, "FATAL: Write to handle failed, exiting\n");
1308 } 1308 }
1309 } 1309 }
1310 default: 1310 default:
1311 return TRUE; 1311 return TRUE;
1312 } 1312 }
1313} 1313}
@@ -1315,7 +1315,7 @@ continue_partial_write:
1315 1315
1316/** 1316/**
1317 * Initialize a overlapped structure 1317 * Initialize a overlapped structure
1318 * 1318 *
1319 * @param elem the element to initilize 1319 * @param elem the element to initilize
1320 * @param initial_state the initial state for this instance 1320 * @param initial_state the initial state for this instance
1321 * @param signaled if the hEvent created should default to signaled or not 1321 * @param signaled if the hEvent created should default to signaled or not
@@ -1361,7 +1361,7 @@ run (HANDLE tap_handle)
1361 /* tun up: */ 1361 /* tun up: */
1362 /* we do this HERE and not beforehand (in init_tun()), in contrast to openvpn 1362 /* we do this HERE and not beforehand (in init_tun()), in contrast to openvpn
1363 * to remove the need to flush the arp cache, handle DHCP and wrong IPs. 1363 * to remove the need to flush the arp cache, handle DHCP and wrong IPs.
1364 * 1364 *
1365 * DHCP and such are all features we will never use in gnunet afaik. 1365 * DHCP and such are all features we will never use in gnunet afaik.
1366 * But for openvpn those are essential. 1366 * But for openvpn those are essential.
1367 */ 1367 */
@@ -1383,12 +1383,12 @@ run (HANDLE tap_handle)
1383 /* Debug output to console STDIN/STDOUT*/ 1383 /* Debug output to console STDIN/STDOUT*/
1384 std_in.handle = parent_std_in_handle; 1384 std_in.handle = parent_std_in_handle;
1385 std_out.handle = parent_std_out_handle; 1385 std_out.handle = parent_std_out_handle;
1386 1386
1387#else 1387#else
1388 fprintf (stderr, "DEBUG: reopening stdin/out for overlapped IO\n"); 1388 fprintf (stderr, "DEBUG: reopening stdin/out for overlapped IO\n");
1389 /* 1389 /*
1390 * Find out the types of our handles. 1390 * Find out the types of our handles.
1391 * This part is a problem, because in windows we need to handle files, 1391 * This part is a problem, because in windows we need to handle files,
1392 * pipes and the console differently. 1392 * pipes and the console differently.
1393 */ 1393 */
1394 if ((FILE_TYPE_PIPE != GetFileType (parent_std_in_handle)) || 1394 if ((FILE_TYPE_PIPE != GetFileType (parent_std_in_handle)) ||
@@ -1472,16 +1472,16 @@ main (int argc, char **argv)
1472 int global_ret = 0; 1472 int global_ret = 0;
1473 BOOL have_ip4 = FALSE; 1473 BOOL have_ip4 = FALSE;
1474 BOOL have_ip6 = FALSE; 1474 BOOL have_ip6 = FALSE;
1475 1475
1476 if (argc > 1 && 0 != strcmp (argv[1], "-d")){ 1476 if (argc > 1 && 0 != strcmp (argv[1], "-d")){
1477 privilege_testing = TRUE; 1477 privilege_testing = TRUE;
1478 fprintf (stderr, 1478 fprintf (stderr,
1479 "%s", 1479 "%s",
1480 "DEBUG: Running binary in privilege testing mode."); 1480 "DEBUG: Running binary in privilege testing mode.");
1481 argv++; 1481 argv++;
1482 argc--; 1482 argc--;
1483 } 1483 }
1484 1484
1485 if (6 != argc) 1485 if (6 != argc)
1486 { 1486 {
1487 fprintf (stderr, 1487 fprintf (stderr,
@@ -1493,9 +1493,9 @@ main (int argc, char **argv)
1493 strncpy (hwid, argv[1], LINE_LEN); 1493 strncpy (hwid, argv[1], LINE_LEN);
1494 hwid[LINE_LEN - 1] = '\0'; 1494 hwid[LINE_LEN - 1] = '\0';
1495 1495
1496 /* 1496 /*
1497 * We use our PID for finding/resolving the control-panel name of our virtual 1497 * We use our PID for finding/resolving the control-panel name of our virtual
1498 * device. PIDs are (of course) unique at runtime, thus we can safely use it 1498 * device. PIDs are (of course) unique at runtime, thus we can safely use it
1499 * as additional hardware-id for our device. 1499 * as additional hardware-id for our device.
1500 */ 1500 */
1501 snprintf (secondary_hwid, LINE_LEN / 2, "%s-%d", 1501 snprintf (secondary_hwid, LINE_LEN / 2, "%s-%d",
diff --git a/src/vpn/gnunet-helper-vpn.c b/src/vpn/gnunet-helper-vpn.c
index c8f4530eb..57e5008e0 100644
--- a/src/vpn/gnunet-helper-vpn.c
+++ b/src/vpn/gnunet-helper-vpn.c
@@ -585,7 +585,7 @@ main (int argc, char **argv)
585 585
586 set_address4 (dev, address, mask); 586 set_address4 (dev, address, mask);
587 } 587 }
588 588
589 uid_t uid = getuid (); 589 uid_t uid = getuid ();
590#ifdef HAVE_SETRESUID 590#ifdef HAVE_SETRESUID
591 if (0 != setresuid (uid, uid, uid)) 591 if (0 != setresuid (uid, uid, uid))
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c
index 13cbf5021..4ecd0dfc1 100644
--- a/src/vpn/gnunet-service-vpn.c
+++ b/src/vpn/gnunet-service-vpn.c
@@ -22,7 +22,7 @@
22 * @file vpn/gnunet-service-vpn.c 22 * @file vpn/gnunet-service-vpn.c
23 * @brief service that opens a virtual interface and allows its clients 23 * @brief service that opens a virtual interface and allows its clients
24 * to allocate IPs on the virtual interface and to then redirect 24 * to allocate IPs on the virtual interface and to then redirect
25 * IP traffic received on those IPs via the GNUnet mesh 25 * IP traffic received on those IPs via the GNUnet mesh
26 * @author Philipp Toelke 26 * @author Philipp Toelke
27 * @author Christian Grothoff 27 * @author Christian Grothoff
28 * 28 *
@@ -150,14 +150,14 @@ struct DestinationEntry
150 150
151 } service_destination; 151 } service_destination;
152 152
153 struct 153 struct
154 { 154 {
155 155
156 /** 156 /**
157 * Address family used (AF_INET or AF_INET6). 157 * Address family used (AF_INET or AF_INET6).
158 */ 158 */
159 int af; 159 int af;
160 160
161 /** 161 /**
162 * IP address of the ultimate destination (only used for exit tunnels). 162 * IP address of the ultimate destination (only used for exit tunnels).
163 */ 163 */
@@ -177,7 +177,7 @@ struct DestinationEntry
177 } exit_destination; 177 } exit_destination;
178 178
179 } details; 179 } details;
180 180
181}; 181};
182 182
183 183
@@ -195,7 +195,7 @@ struct TunnelMessageQueueEntry
195 * This is a doubly-linked list. 195 * This is a doubly-linked list.
196 */ 196 */
197 struct TunnelMessageQueueEntry *prev; 197 struct TunnelMessageQueueEntry *prev;
198 198
199 /** 199 /**
200 * Number of bytes in 'msg'. 200 * Number of bytes in 'msg'.
201 */ 201 */
@@ -244,7 +244,7 @@ struct TunnelState
244 /** 244 /**
245 * Tail of list of messages scheduled for transmission. 245 * Tail of list of messages scheduled for transmission.
246 */ 246 */
247 struct TunnelMessageQueueEntry *tmq_tail; 247 struct TunnelMessageQueueEntry *tmq_tail;
248 248
249 /** 249 /**
250 * Destination entry that has a pointer to this tunnel state; 250 * Destination entry that has a pointer to this tunnel state;
@@ -284,7 +284,7 @@ struct TunnelState
284 * Address if af is AF_INET. 284 * Address if af is AF_INET.
285 */ 285 */
286 struct in_addr v4; 286 struct in_addr v4;
287 287
288 /** 288 /**
289 * Address if af is AF_INET6. 289 * Address if af is AF_INET6.
290 */ 290 */
@@ -302,7 +302,7 @@ struct TunnelState
302 * Address if af is AF_INET. 302 * Address if af is AF_INET.
303 */ 303 */
304 struct in_addr v4; 304 struct in_addr v4;
305 305
306 /** 306 /**
307 * Address if af is AF_INET6. 307 * Address if af is AF_INET6.
308 */ 308 */
@@ -506,7 +506,7 @@ send_client_reply (struct GNUNET_SERVER_Client *client,
506 switch (result_af) 506 switch (result_af)
507 { 507 {
508 case AF_INET: 508 case AF_INET:
509 rlen = sizeof (struct in_addr); 509 rlen = sizeof (struct in_addr);
510 break; 510 break;
511 case AF_INET6: 511 case AF_INET6:
512 rlen = sizeof (struct in6_addr); 512 rlen = sizeof (struct in6_addr);
@@ -632,8 +632,8 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf)
632 ret = tnq->len; 632 ret = tnq->len;
633 GNUNET_free (tnq); 633 GNUNET_free (tnq);
634 if (NULL != (tnq = ts->tmq_head)) 634 if (NULL != (tnq = ts->tmq_head))
635 ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, 635 ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel,
636 GNUNET_NO /* cork */, 636 GNUNET_NO /* cork */,
637 GNUNET_TIME_UNIT_FOREVER_REL, 637 GNUNET_TIME_UNIT_FOREVER_REL,
638 tnq->len, 638 tnq->len,
639 &send_to_peer_notify_callback, 639 &send_to_peer_notify_callback,
@@ -678,12 +678,12 @@ send_to_tunnel (struct TunnelMessageQueueEntry *tnq,
678 ts->th = NULL; 678 ts->th = NULL;
679 GNUNET_STATISTICS_update (stats, 679 GNUNET_STATISTICS_update (stats,
680 gettext_noop ("# Bytes dropped in mesh queue (overflow)"), 680 gettext_noop ("# Bytes dropped in mesh queue (overflow)"),
681 dq->len, 681 dq->len,
682 GNUNET_NO); 682 GNUNET_NO);
683 GNUNET_free (dq); 683 GNUNET_free (dq);
684 } 684 }
685 if (NULL == ts->th) 685 if (NULL == ts->th)
686 ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, 686 ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel,
687 GNUNET_NO /* cork */, 687 GNUNET_NO /* cork */,
688 GNUNET_TIME_UNIT_FOREVER_REL, 688 GNUNET_TIME_UNIT_FOREVER_REL,
689 tnq->len, 689 tnq->len,
@@ -803,7 +803,7 @@ create_tunnel_to_destination (struct DestinationTunnel *dt,
803 char address[GNUNET_TUN_IPV4_REGEXLEN]; 803 char address[GNUNET_TUN_IPV4_REGEXLEN];
804 804
805 GNUNET_TUN_ipv4toregexsearch (&dt->destination->details.exit_destination.ip.v4, 805 GNUNET_TUN_ipv4toregexsearch (&dt->destination->details.exit_destination.ip.v4,
806 "255.255.255.255", 806 "255.255.255.255",
807 address); 807 address);
808 GNUNET_asprintf (&policy, "%s%s%s:%u", 808 GNUNET_asprintf (&policy, "%s%s%s:%u",
809 GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, 809 GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX,
@@ -815,7 +815,7 @@ create_tunnel_to_destination (struct DestinationTunnel *dt,
815 case AF_INET6: 815 case AF_INET6:
816 { 816 {
817 char address[GNUNET_TUN_IPV6_REGEXLEN]; 817 char address[GNUNET_TUN_IPV6_REGEXLEN];
818 818
819 GNUNET_TUN_ipv6toregexsearch (&dt->destination->details.exit_destination.ip.v6, 819 GNUNET_TUN_ipv6toregexsearch (&dt->destination->details.exit_destination.ip.v6,
820 128, address); 820 128, address);
821 GNUNET_asprintf (&policy, "%s%s%s:%u", 821 GNUNET_asprintf (&policy, "%s%s%s:%u",
@@ -862,7 +862,7 @@ expire_tunnel (struct TunnelState *except)
862 862
863 863
864/** 864/**
865 * Route a packet via mesh to the given destination. 865 * Route a packet via mesh to the given destination.
866 * 866 *
867 * @param destination description of the destination 867 * @param destination description of the destination
868 * @param af address family on this end (AF_INET or AF_INET6) 868 * @param af address family on this end (AF_INET or AF_INET6)
@@ -930,7 +930,7 @@ route_packet (struct DestinationEntry *destination,
930 /* blame kernel? */ 930 /* blame kernel? */
931 GNUNET_break (0); 931 GNUNET_break (0);
932 return; 932 return;
933 } 933 }
934 udp = NULL; /* make compiler happy */ 934 udp = NULL; /* make compiler happy */
935 icmp = NULL; /* make compiler happy */ 935 icmp = NULL; /* make compiler happy */
936 tcp = payload; 936 tcp = payload;
@@ -950,8 +950,8 @@ route_packet (struct DestinationEntry *destination,
950 &key); 950 &key);
951 } 951 }
952 break; 952 break;
953 case IPPROTO_ICMP: 953 case IPPROTO_ICMP:
954 case IPPROTO_ICMPV6: 954 case IPPROTO_ICMPV6:
955 { 955 {
956 if ( (AF_INET == af) ^ (protocol == IPPROTO_ICMP) ) 956 if ( (AF_INET == af) ^ (protocol == IPPROTO_ICMP) )
957 { 957 {
@@ -986,7 +986,7 @@ route_packet (struct DestinationEntry *destination,
986 } 986 }
987 alen = 0; 987 alen = 0;
988 if (! destination->is_service) 988 if (! destination->is_service)
989 { 989 {
990 switch (destination->details.exit_destination.af) 990 switch (destination->details.exit_destination.af)
991 { 991 {
992 case AF_INET: 992 case AF_INET:
@@ -1003,7 +1003,7 @@ route_packet (struct DestinationEntry *destination,
1003 char sbuf[INET6_ADDRSTRLEN]; 1003 char sbuf[INET6_ADDRSTRLEN];
1004 char dbuf[INET6_ADDRSTRLEN]; 1004 char dbuf[INET6_ADDRSTRLEN];
1005 char xbuf[INET6_ADDRSTRLEN]; 1005 char xbuf[INET6_ADDRSTRLEN];
1006 1006
1007 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1007 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1008 "Routing %s packet from %s:%u -> %s:%u to destination %s:%u\n", 1008 "Routing %s packet from %s:%u -> %s:%u to destination %s:%u\n",
1009 (protocol == IPPROTO_TCP) ? "TCP" : "UDP", 1009 (protocol == IPPROTO_TCP) ? "TCP" : "UDP",
@@ -1025,7 +1025,7 @@ route_packet (struct DestinationEntry *destination,
1025 { 1025 {
1026 char sbuf[INET6_ADDRSTRLEN]; 1026 char sbuf[INET6_ADDRSTRLEN];
1027 char dbuf[INET6_ADDRSTRLEN]; 1027 char dbuf[INET6_ADDRSTRLEN];
1028 1028
1029 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1029 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1030 "Routing %s packet from %s:%u -> %s:%u to service %s at peer %s\n", 1030 "Routing %s packet from %s:%u -> %s:%u to service %s at peer %s\n",
1031 (protocol == IPPROTO_TCP) ? "TCP" : "UDP", 1031 (protocol == IPPROTO_TCP) ? "TCP" : "UDP",
@@ -1066,7 +1066,7 @@ route_packet (struct DestinationEntry *destination,
1066 ts->destination_container = NULL; /* no longer 'contained' */ 1066 ts->destination_container = NULL; /* no longer 'contained' */
1067 /* now bind existing "unbound" tunnel to our IP/port tuple */ 1067 /* now bind existing "unbound" tunnel to our IP/port tuple */
1068 ts->protocol = protocol; 1068 ts->protocol = protocol;
1069 ts->af = af; 1069 ts->af = af;
1070 if (AF_INET == af) 1070 if (AF_INET == af)
1071 { 1071 {
1072 ts->source_ip.v4 = * (const struct in_addr *) source_ip; 1072 ts->source_ip.v4 = * (const struct in_addr *) source_ip;
@@ -1086,7 +1086,7 @@ route_packet (struct DestinationEntry *destination,
1086 GNUNET_CONTAINER_multihashmap_put (tunnel_map, 1086 GNUNET_CONTAINER_multihashmap_put (tunnel_map,
1087 &key, 1087 &key,
1088 ts, 1088 ts,
1089 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 1089 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
1090 GNUNET_STATISTICS_update (stats, 1090 GNUNET_STATISTICS_update (stats,
1091 gettext_noop ("# Active tunnels"), 1091 gettext_noop ("# Active tunnels"),
1092 1, GNUNET_NO); 1092 1, GNUNET_NO);
@@ -1096,12 +1096,12 @@ route_packet (struct DestinationEntry *destination,
1096 else 1096 else
1097 { 1097 {
1098 is_new = GNUNET_NO; 1098 is_new = GNUNET_NO;
1099 GNUNET_CONTAINER_heap_update_cost (tunnel_heap, 1099 GNUNET_CONTAINER_heap_update_cost (tunnel_heap,
1100 ts->heap_node, 1100 ts->heap_node,
1101 GNUNET_TIME_absolute_get ().abs_value_us); 1101 GNUNET_TIME_absolute_get ().abs_value_us);
1102 } 1102 }
1103 GNUNET_assert (NULL != ts->tunnel); 1103 GNUNET_assert (NULL != ts->tunnel);
1104 1104
1105 /* send via tunnel */ 1105 /* send via tunnel */
1106 switch (protocol) 1106 switch (protocol)
1107 { 1107 {
@@ -1110,7 +1110,7 @@ route_packet (struct DestinationEntry *destination,
1110 { 1110 {
1111 struct GNUNET_EXIT_UdpServiceMessage *usm; 1111 struct GNUNET_EXIT_UdpServiceMessage *usm;
1112 1112
1113 mlen = sizeof (struct GNUNET_EXIT_UdpServiceMessage) + 1113 mlen = sizeof (struct GNUNET_EXIT_UdpServiceMessage) +
1114 payload_length - sizeof (struct GNUNET_TUN_UdpHeader); 1114 payload_length - sizeof (struct GNUNET_TUN_UdpHeader);
1115 if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 1115 if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
1116 { 1116 {
@@ -1139,7 +1139,7 @@ route_packet (struct DestinationEntry *destination,
1139 struct in6_addr *ip6dst; 1139 struct in6_addr *ip6dst;
1140 void *payload; 1140 void *payload;
1141 1141
1142 mlen = sizeof (struct GNUNET_EXIT_UdpInternetMessage) + 1142 mlen = sizeof (struct GNUNET_EXIT_UdpInternetMessage) +
1143 alen + payload_length - sizeof (struct GNUNET_TUN_UdpHeader); 1143 alen + payload_length - sizeof (struct GNUNET_TUN_UdpHeader);
1144 if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 1144 if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
1145 { 1145 {
@@ -1151,7 +1151,7 @@ route_packet (struct DestinationEntry *destination,
1151 tnq->msg = &tnq[1]; 1151 tnq->msg = &tnq[1];
1152 uim = (struct GNUNET_EXIT_UdpInternetMessage *) &tnq[1]; 1152 uim = (struct GNUNET_EXIT_UdpInternetMessage *) &tnq[1];
1153 uim->header.size = htons ((uint16_t) mlen); 1153 uim->header.size = htons ((uint16_t) mlen);
1154 uim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET); 1154 uim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET);
1155 uim->af = htonl (destination->details.exit_destination.af); 1155 uim->af = htonl (destination->details.exit_destination.af);
1156 uim->source_port = (ntohs (udp->source_port) < 32000) ? udp->source_port : 0; 1156 uim->source_port = (ntohs (udp->source_port) < 32000) ? udp->source_port : 0;
1157 uim->destination_port = udp->destination_port; 1157 uim->destination_port = udp->destination_port;
@@ -1182,7 +1182,7 @@ route_packet (struct DestinationEntry *destination,
1182 { 1182 {
1183 struct GNUNET_EXIT_TcpServiceStartMessage *tsm; 1183 struct GNUNET_EXIT_TcpServiceStartMessage *tsm;
1184 1184
1185 mlen = sizeof (struct GNUNET_EXIT_TcpServiceStartMessage) + 1185 mlen = sizeof (struct GNUNET_EXIT_TcpServiceStartMessage) +
1186 payload_length - sizeof (struct GNUNET_TUN_TcpHeader); 1186 payload_length - sizeof (struct GNUNET_TUN_TcpHeader);
1187 if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 1187 if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
1188 { 1188 {
@@ -1209,7 +1209,7 @@ route_packet (struct DestinationEntry *destination,
1209 struct in6_addr *ip6dst; 1209 struct in6_addr *ip6dst;
1210 void *payload; 1210 void *payload;
1211 1211
1212 mlen = sizeof (struct GNUNET_EXIT_TcpInternetStartMessage) + 1212 mlen = sizeof (struct GNUNET_EXIT_TcpInternetStartMessage) +
1213 alen + payload_length - sizeof (struct GNUNET_TUN_TcpHeader); 1213 alen + payload_length - sizeof (struct GNUNET_TUN_TcpHeader);
1214 if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 1214 if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
1215 { 1215 {
@@ -1248,7 +1248,7 @@ route_packet (struct DestinationEntry *destination,
1248 { 1248 {
1249 struct GNUNET_EXIT_TcpDataMessage *tdm; 1249 struct GNUNET_EXIT_TcpDataMessage *tdm;
1250 1250
1251 mlen = sizeof (struct GNUNET_EXIT_TcpDataMessage) + 1251 mlen = sizeof (struct GNUNET_EXIT_TcpDataMessage) +
1252 payload_length - sizeof (struct GNUNET_TUN_TcpHeader); 1252 payload_length - sizeof (struct GNUNET_TUN_TcpHeader);
1253 if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 1253 if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
1254 { 1254 {
@@ -1274,7 +1274,7 @@ route_packet (struct DestinationEntry *destination,
1274 { 1274 {
1275 struct GNUNET_EXIT_IcmpServiceMessage *ism; 1275 struct GNUNET_EXIT_IcmpServiceMessage *ism;
1276 1276
1277 mlen = sizeof (struct GNUNET_EXIT_IcmpServiceMessage) + 1277 mlen = sizeof (struct GNUNET_EXIT_IcmpServiceMessage) +
1278 payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); 1278 payload_length - sizeof (struct GNUNET_TUN_IcmpHeader);
1279 if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 1279 if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
1280 { 1280 {
@@ -1303,7 +1303,7 @@ route_packet (struct DestinationEntry *destination,
1303 case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH: 1303 case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH:
1304 case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED: 1304 case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED:
1305 /* throw away ICMP payload, won't be useful for the other side anyway */ 1305 /* throw away ICMP payload, won't be useful for the other side anyway */
1306 payload_length = sizeof (struct GNUNET_TUN_IcmpHeader); 1306 payload_length = sizeof (struct GNUNET_TUN_IcmpHeader);
1307 break; 1307 break;
1308 default: 1308 default:
1309 GNUNET_STATISTICS_update (stats, 1309 GNUNET_STATISTICS_update (stats,
@@ -1321,7 +1321,7 @@ route_packet (struct DestinationEntry *destination,
1321 case GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED: 1321 case GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED:
1322 case GNUNET_TUN_ICMPTYPE6_PARAMETER_PROBLEM: 1322 case GNUNET_TUN_ICMPTYPE6_PARAMETER_PROBLEM:
1323 /* throw away ICMP payload, won't be useful for the other side anyway */ 1323 /* throw away ICMP payload, won't be useful for the other side anyway */
1324 payload_length = sizeof (struct GNUNET_TUN_IcmpHeader); 1324 payload_length = sizeof (struct GNUNET_TUN_IcmpHeader);
1325 break; 1325 break;
1326 case GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST: 1326 case GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST:
1327 case GNUNET_TUN_ICMPTYPE6_ECHO_REPLY: 1327 case GNUNET_TUN_ICMPTYPE6_ECHO_REPLY:
@@ -1340,8 +1340,8 @@ route_packet (struct DestinationEntry *destination,
1340 } 1340 }
1341 1341
1342 /* update length calculations, as payload_length may have changed */ 1342 /* update length calculations, as payload_length may have changed */
1343 mlen = sizeof (struct GNUNET_EXIT_IcmpServiceMessage) + 1343 mlen = sizeof (struct GNUNET_EXIT_IcmpServiceMessage) +
1344 alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); 1344 alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader);
1345 tnq->len = mlen; 1345 tnq->len = mlen;
1346 ism->header.size = htons ((uint16_t) mlen); 1346 ism->header.size = htons ((uint16_t) mlen);
1347 /* finally, copy payload (if there is any left...) */ 1347 /* finally, copy payload (if there is any left...) */
@@ -1356,7 +1356,7 @@ route_packet (struct DestinationEntry *destination,
1356 struct in6_addr *ip6dst; 1356 struct in6_addr *ip6dst;
1357 void *payload; 1357 void *payload;
1358 1358
1359 mlen = sizeof (struct GNUNET_EXIT_IcmpInternetMessage) + 1359 mlen = sizeof (struct GNUNET_EXIT_IcmpInternetMessage) +
1360 alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); 1360 alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader);
1361 if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 1361 if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
1362 { 1362 {
@@ -1366,7 +1366,7 @@ route_packet (struct DestinationEntry *destination,
1366 tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueueEntry) + mlen); 1366 tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueueEntry) + mlen);
1367 tnq->msg = &tnq[1]; 1367 tnq->msg = &tnq[1];
1368 iim = (struct GNUNET_EXIT_IcmpInternetMessage *) &tnq[1]; 1368 iim = (struct GNUNET_EXIT_IcmpInternetMessage *) &tnq[1];
1369 iim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_INTERNET); 1369 iim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_INTERNET);
1370 iim->icmp_header = *icmp; 1370 iim->icmp_header = *icmp;
1371 /* Perform ICMP protocol-translation (depending on destination AF and source AF) 1371 /* Perform ICMP protocol-translation (depending on destination AF and source AF)
1372 and throw away ICMP payload depending on ICMP message type */ 1372 and throw away ICMP payload depending on ICMP message type */
@@ -1375,11 +1375,11 @@ route_packet (struct DestinationEntry *destination,
1375 case AF_INET: 1375 case AF_INET:
1376 switch (icmp->type) 1376 switch (icmp->type)
1377 { 1377 {
1378 case GNUNET_TUN_ICMPTYPE_ECHO_REPLY: 1378 case GNUNET_TUN_ICMPTYPE_ECHO_REPLY:
1379 if (destination->details.exit_destination.af == AF_INET6) 1379 if (destination->details.exit_destination.af == AF_INET6)
1380 iim->icmp_header.type = GNUNET_TUN_ICMPTYPE6_ECHO_REPLY; 1380 iim->icmp_header.type = GNUNET_TUN_ICMPTYPE6_ECHO_REPLY;
1381 break; 1381 break;
1382 case GNUNET_TUN_ICMPTYPE_ECHO_REQUEST: 1382 case GNUNET_TUN_ICMPTYPE_ECHO_REQUEST:
1383 if (destination->details.exit_destination.af == AF_INET6) 1383 if (destination->details.exit_destination.af == AF_INET6)
1384 iim->icmp_header.type = GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST; 1384 iim->icmp_header.type = GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST;
1385 break; 1385 break;
@@ -1411,7 +1411,7 @@ route_packet (struct DestinationEntry *destination,
1411 GNUNET_STATISTICS_update (stats, 1411 GNUNET_STATISTICS_update (stats,
1412 gettext_noop ("# ICMPv4 packets dropped (type not allowed)"), 1412 gettext_noop ("# ICMPv4 packets dropped (type not allowed)"),
1413 1, GNUNET_NO); 1413 1, GNUNET_NO);
1414 GNUNET_free (tnq); 1414 GNUNET_free (tnq);
1415 return; 1415 return;
1416 } 1416 }
1417 /* end of AF_INET */ 1417 /* end of AF_INET */
@@ -1467,17 +1467,17 @@ route_packet (struct DestinationEntry *destination,
1467 GNUNET_STATISTICS_update (stats, 1467 GNUNET_STATISTICS_update (stats,
1468 gettext_noop ("# ICMPv6 packets dropped (type not allowed)"), 1468 gettext_noop ("# ICMPv6 packets dropped (type not allowed)"),
1469 1, GNUNET_NO); 1469 1, GNUNET_NO);
1470 GNUNET_free (tnq); 1470 GNUNET_free (tnq);
1471 return; 1471 return;
1472 } 1472 }
1473 /* end of AF_INET6 */ 1473 /* end of AF_INET6 */
1474 break; 1474 break;
1475 default: 1475 default:
1476 GNUNET_assert (0); 1476 GNUNET_assert (0);
1477 } 1477 }
1478 /* update length calculations, as payload_length may have changed */ 1478 /* update length calculations, as payload_length may have changed */
1479 mlen = sizeof (struct GNUNET_EXIT_IcmpInternetMessage) + 1479 mlen = sizeof (struct GNUNET_EXIT_IcmpInternetMessage) +
1480 alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); 1480 alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader);
1481 tnq->len = mlen; 1481 tnq->len = mlen;
1482 iim->header.size = htons ((uint16_t) mlen); 1482 iim->header.size = htons ((uint16_t) mlen);
1483 1483
@@ -1549,7 +1549,7 @@ message_token (void *cls,
1549 case ETH_P_IPV6: 1549 case ETH_P_IPV6:
1550 { 1550 {
1551 const struct GNUNET_TUN_IPv6Header *pkt6; 1551 const struct GNUNET_TUN_IPv6Header *pkt6;
1552 1552
1553 if (mlen < sizeof (struct GNUNET_TUN_IPv6Header)) 1553 if (mlen < sizeof (struct GNUNET_TUN_IPv6Header))
1554 { 1554 {
1555 /* blame kernel */ 1555 /* blame kernel */
@@ -1576,8 +1576,8 @@ message_token (void *cls,
1576 route_packet (de, 1576 route_packet (de,
1577 AF_INET6, 1577 AF_INET6,
1578 pkt6->next_header, 1578 pkt6->next_header,
1579 &pkt6->source_address, 1579 &pkt6->source_address,
1580 &pkt6->destination_address, 1580 &pkt6->destination_address,
1581 &pkt6[1], 1581 &pkt6[1],
1582 mlen - sizeof (struct GNUNET_TUN_IPv6Header)); 1582 mlen - sizeof (struct GNUNET_TUN_IPv6Header));
1583 } 1583 }
@@ -1612,14 +1612,14 @@ message_token (void *cls,
1612 if (pkt4->header_length * 4 != sizeof (struct GNUNET_TUN_IPv4Header)) 1612 if (pkt4->header_length * 4 != sizeof (struct GNUNET_TUN_IPv4Header))
1613 { 1613 {
1614 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1614 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1615 _("Received IPv4 packet with options (dropping it)\n")); 1615 _("Received IPv4 packet with options (dropping it)\n"));
1616 return GNUNET_OK; 1616 return GNUNET_OK;
1617 } 1617 }
1618 route_packet (de, 1618 route_packet (de,
1619 AF_INET, 1619 AF_INET,
1620 pkt4->protocol, 1620 pkt4->protocol,
1621 &pkt4->source_address, 1621 &pkt4->source_address,
1622 &pkt4->destination_address, 1622 &pkt4->destination_address,
1623 &pkt4[1], 1623 &pkt4[1],
1624 mlen - sizeof (struct GNUNET_TUN_IPv4Header)); 1624 mlen - sizeof (struct GNUNET_TUN_IPv4Header));
1625 } 1625 }
@@ -1696,7 +1696,7 @@ make_up_icmpv6_payload (struct TunnelState *ts,
1696 * @param message the actual message 1696 * @param message the actual message
1697 * @return #GNUNET_OK to keep the connection open, 1697 * @return #GNUNET_OK to keep the connection open,
1698 * #GNUNET_SYSERR to close it (signal serious error) 1698 * #GNUNET_SYSERR to close it (signal serious error)
1699 */ 1699 */
1700static int 1700static int
1701receive_icmp_back (void *cls, 1701receive_icmp_back (void *cls,
1702 struct GNUNET_MESH_Tunnel *tunnel, 1702 struct GNUNET_MESH_Tunnel *tunnel,
@@ -1731,7 +1731,7 @@ receive_icmp_back (void *cls,
1731 { 1731 {
1732 char sbuf[INET6_ADDRSTRLEN]; 1732 char sbuf[INET6_ADDRSTRLEN];
1733 char dbuf[INET6_ADDRSTRLEN]; 1733 char dbuf[INET6_ADDRSTRLEN];
1734 1734
1735 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1735 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1736 "Received ICMP packet from mesh, sending %u bytes from %s -> %s via TUN\n", 1736 "Received ICMP packet from mesh, sending %u bytes from %s -> %s via TUN\n",
1737 (unsigned int) mlen, 1737 (unsigned int) mlen,
@@ -1742,8 +1742,8 @@ receive_icmp_back (void *cls,
1742 { 1742 {
1743 case AF_INET: 1743 case AF_INET:
1744 { 1744 {
1745 size_t size = sizeof (struct GNUNET_TUN_IPv4Header) 1745 size_t size = sizeof (struct GNUNET_TUN_IPv4Header)
1746 + sizeof (struct GNUNET_TUN_IcmpHeader) 1746 + sizeof (struct GNUNET_TUN_IcmpHeader)
1747 + sizeof (struct GNUNET_MessageHeader) + 1747 + sizeof (struct GNUNET_MessageHeader) +
1748 sizeof (struct GNUNET_TUN_Layer2PacketHeader) + 1748 sizeof (struct GNUNET_TUN_Layer2PacketHeader) +
1749 mlen; 1749 mlen;
@@ -1767,12 +1767,12 @@ receive_icmp_back (void *cls,
1767 memcpy (&icmp[1], 1767 memcpy (&icmp[1],
1768 &i2v[1], 1768 &i2v[1],
1769 mlen); 1769 mlen);
1770 /* For some ICMP types, we need to adjust (make up) the payload here. 1770 /* For some ICMP types, we need to adjust (make up) the payload here.
1771 Also, depending on the AF used on the other side, we have to 1771 Also, depending on the AF used on the other side, we have to
1772 do ICMP PT (translate ICMP types) */ 1772 do ICMP PT (translate ICMP types) */
1773 switch (ntohl (i2v->af)) 1773 switch (ntohl (i2v->af))
1774 { 1774 {
1775 case AF_INET: 1775 case AF_INET:
1776 switch (icmp->type) 1776 switch (icmp->type)
1777 { 1777 {
1778 case GNUNET_TUN_ICMPTYPE_ECHO_REPLY: 1778 case GNUNET_TUN_ICMPTYPE_ECHO_REPLY:
@@ -1780,11 +1780,11 @@ receive_icmp_back (void *cls,
1780 break; 1780 break;
1781 case GNUNET_TUN_ICMPTYPE_DESTINATION_UNREACHABLE: 1781 case GNUNET_TUN_ICMPTYPE_DESTINATION_UNREACHABLE:
1782 case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH: 1782 case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH:
1783 case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED: 1783 case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED:
1784 { 1784 {
1785 struct GNUNET_TUN_IPv4Header *ipp = (struct GNUNET_TUN_IPv4Header *) &icmp[1]; 1785 struct GNUNET_TUN_IPv4Header *ipp = (struct GNUNET_TUN_IPv4Header *) &icmp[1];
1786 struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; 1786 struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1];
1787 1787
1788 if (mlen != 0) 1788 if (mlen != 0)
1789 { 1789 {
1790 /* sender did not strip ICMP payload? */ 1790 /* sender did not strip ICMP payload? */
@@ -1814,7 +1814,7 @@ receive_icmp_back (void *cls,
1814 { 1814 {
1815 struct GNUNET_TUN_IPv4Header *ipp = (struct GNUNET_TUN_IPv4Header *) &icmp[1]; 1815 struct GNUNET_TUN_IPv4Header *ipp = (struct GNUNET_TUN_IPv4Header *) &icmp[1];
1816 struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; 1816 struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1];
1817 1817
1818 if (mlen != 0) 1818 if (mlen != 0)
1819 { 1819 {
1820 /* sender did not strip ICMP payload? */ 1820 /* sender did not strip ICMP payload? */
@@ -1831,7 +1831,7 @@ receive_icmp_back (void *cls,
1831 { 1831 {
1832 struct GNUNET_TUN_IPv4Header *ipp = (struct GNUNET_TUN_IPv4Header *) &icmp[1]; 1832 struct GNUNET_TUN_IPv4Header *ipp = (struct GNUNET_TUN_IPv4Header *) &icmp[1];
1833 struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; 1833 struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1];
1834 1834
1835 if (mlen != 0) 1835 if (mlen != 0)
1836 { 1836 {
1837 /* sender did not strip ICMP payload? */ 1837 /* sender did not strip ICMP payload? */
@@ -1881,8 +1881,8 @@ receive_icmp_back (void *cls,
1881 break; 1881 break;
1882 case AF_INET6: 1882 case AF_INET6:
1883 { 1883 {
1884 size_t size = sizeof (struct GNUNET_TUN_IPv6Header) 1884 size_t size = sizeof (struct GNUNET_TUN_IPv6Header)
1885 + sizeof (struct GNUNET_TUN_IcmpHeader) 1885 + sizeof (struct GNUNET_TUN_IcmpHeader)
1886 + sizeof (struct GNUNET_MessageHeader) + 1886 + sizeof (struct GNUNET_MessageHeader) +
1887 sizeof (struct GNUNET_TUN_Layer2PacketHeader) + 1887 sizeof (struct GNUNET_TUN_Layer2PacketHeader) +
1888 mlen; 1888 mlen;
@@ -1905,12 +1905,12 @@ receive_icmp_back (void *cls,
1905 &i2v[1], 1905 &i2v[1],
1906 mlen); 1906 mlen);
1907 1907
1908 /* For some ICMP types, we need to adjust (make up) the payload here. 1908 /* For some ICMP types, we need to adjust (make up) the payload here.
1909 Also, depending on the AF used on the other side, we have to 1909 Also, depending on the AF used on the other side, we have to
1910 do ICMP PT (translate ICMP types) */ 1910 do ICMP PT (translate ICMP types) */
1911 switch (ntohl (i2v->af)) 1911 switch (ntohl (i2v->af))
1912 { 1912 {
1913 case AF_INET: 1913 case AF_INET:
1914 /* ICMP PT 4-to-6 and possibly making up payloads */ 1914 /* ICMP PT 4-to-6 and possibly making up payloads */
1915 switch (icmp->type) 1915 switch (icmp->type)
1916 { 1916 {
@@ -1925,7 +1925,7 @@ receive_icmp_back (void *cls,
1925 { 1925 {
1926 struct GNUNET_TUN_IPv6Header *ipp = (struct GNUNET_TUN_IPv6Header *) &icmp[1]; 1926 struct GNUNET_TUN_IPv6Header *ipp = (struct GNUNET_TUN_IPv6Header *) &icmp[1];
1927 struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; 1927 struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1];
1928 1928
1929 if (mlen != 0) 1929 if (mlen != 0)
1930 { 1930 {
1931 /* sender did not strip ICMP payload? */ 1931 /* sender did not strip ICMP payload? */
@@ -1937,12 +1937,12 @@ receive_icmp_back (void *cls,
1937 make_up_icmpv6_payload (ts, ipp, udp); 1937 make_up_icmpv6_payload (ts, ipp, udp);
1938 } 1938 }
1939 break; 1939 break;
1940 case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED: 1940 case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED:
1941 icmp->type = GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED; 1941 icmp->type = GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED;
1942 { 1942 {
1943 struct GNUNET_TUN_IPv6Header *ipp = (struct GNUNET_TUN_IPv6Header *) &icmp[1]; 1943 struct GNUNET_TUN_IPv6Header *ipp = (struct GNUNET_TUN_IPv6Header *) &icmp[1];
1944 struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; 1944 struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1];
1945 1945
1946 if (mlen != 0) 1946 if (mlen != 0)
1947 { 1947 {
1948 /* sender did not strip ICMP payload? */ 1948 /* sender did not strip ICMP payload? */
@@ -1957,7 +1957,7 @@ receive_icmp_back (void *cls,
1957 case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH: 1957 case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH:
1958 GNUNET_STATISTICS_update (stats, 1958 GNUNET_STATISTICS_update (stats,
1959 gettext_noop ("# ICMPv4 packets dropped (impossible PT to v6)"), 1959 gettext_noop ("# ICMPv4 packets dropped (impossible PT to v6)"),
1960 1, GNUNET_NO); 1960 1, GNUNET_NO);
1961 return GNUNET_OK; 1961 return GNUNET_OK;
1962 default: 1962 default:
1963 GNUNET_break_op (0); 1963 GNUNET_break_op (0);
@@ -1978,7 +1978,7 @@ receive_icmp_back (void *cls,
1978 { 1978 {
1979 struct GNUNET_TUN_IPv6Header *ipp = (struct GNUNET_TUN_IPv6Header *) &icmp[1]; 1979 struct GNUNET_TUN_IPv6Header *ipp = (struct GNUNET_TUN_IPv6Header *) &icmp[1];
1980 struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; 1980 struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1];
1981 1981
1982 if (mlen != 0) 1982 if (mlen != 0)
1983 { 1983 {
1984 /* sender did not strip ICMP payload? */ 1984 /* sender did not strip ICMP payload? */
@@ -2018,7 +2018,7 @@ receive_icmp_back (void *cls,
2018 default: 2018 default:
2019 GNUNET_assert (0); 2019 GNUNET_assert (0);
2020 } 2020 }
2021 GNUNET_CONTAINER_heap_update_cost (tunnel_heap, 2021 GNUNET_CONTAINER_heap_update_cost (tunnel_heap,
2022 ts->heap_node, 2022 ts->heap_node,
2023 GNUNET_TIME_absolute_get ().abs_value_us); 2023 GNUNET_TIME_absolute_get ().abs_value_us);
2024 return GNUNET_OK; 2024 return GNUNET_OK;
@@ -2035,7 +2035,7 @@ receive_icmp_back (void *cls,
2035 * @param message the actual message 2035 * @param message the actual message
2036 * @return #GNUNET_OK to keep the connection open, 2036 * @return #GNUNET_OK to keep the connection open,
2037 * #GNUNET_SYSERR to close it (signal serious error) 2037 * #GNUNET_SYSERR to close it (signal serious error)
2038 */ 2038 */
2039static int 2039static int
2040receive_udp_back (void *cls, 2040receive_udp_back (void *cls,
2041 struct GNUNET_MESH_Tunnel *tunnel, 2041 struct GNUNET_MESH_Tunnel *tunnel,
@@ -2070,7 +2070,7 @@ receive_udp_back (void *cls,
2070 { 2070 {
2071 char sbuf[INET6_ADDRSTRLEN]; 2071 char sbuf[INET6_ADDRSTRLEN];
2072 char dbuf[INET6_ADDRSTRLEN]; 2072 char dbuf[INET6_ADDRSTRLEN];
2073 2073
2074 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2074 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2075 "Received UDP reply from mesh, sending %u bytes from %s:%u -> %s:%u via TUN\n", 2075 "Received UDP reply from mesh, sending %u bytes from %s:%u -> %s:%u via TUN\n",
2076 (unsigned int) mlen, 2076 (unsigned int) mlen,
@@ -2083,8 +2083,8 @@ receive_udp_back (void *cls,
2083 { 2083 {
2084 case AF_INET: 2084 case AF_INET:
2085 { 2085 {
2086 size_t size = sizeof (struct GNUNET_TUN_IPv4Header) 2086 size_t size = sizeof (struct GNUNET_TUN_IPv4Header)
2087 + sizeof (struct GNUNET_TUN_UdpHeader) 2087 + sizeof (struct GNUNET_TUN_UdpHeader)
2088 + sizeof (struct GNUNET_MessageHeader) + 2088 + sizeof (struct GNUNET_MessageHeader) +
2089 sizeof (struct GNUNET_TUN_Layer2PacketHeader) + 2089 sizeof (struct GNUNET_TUN_Layer2PacketHeader) +
2090 mlen; 2090 mlen;
@@ -2128,8 +2128,8 @@ receive_udp_back (void *cls,
2128 break; 2128 break;
2129 case AF_INET6: 2129 case AF_INET6:
2130 { 2130 {
2131 size_t size = sizeof (struct GNUNET_TUN_IPv6Header) 2131 size_t size = sizeof (struct GNUNET_TUN_IPv6Header)
2132 + sizeof (struct GNUNET_TUN_UdpHeader) 2132 + sizeof (struct GNUNET_TUN_UdpHeader)
2133 + sizeof (struct GNUNET_MessageHeader) + 2133 + sizeof (struct GNUNET_MessageHeader) +
2134 sizeof (struct GNUNET_TUN_Layer2PacketHeader) + 2134 sizeof (struct GNUNET_TUN_Layer2PacketHeader) +
2135 mlen; 2135 mlen;
@@ -2173,7 +2173,7 @@ receive_udp_back (void *cls,
2173 default: 2173 default:
2174 GNUNET_assert (0); 2174 GNUNET_assert (0);
2175 } 2175 }
2176 GNUNET_CONTAINER_heap_update_cost (tunnel_heap, 2176 GNUNET_CONTAINER_heap_update_cost (tunnel_heap,
2177 ts->heap_node, 2177 ts->heap_node,
2178 GNUNET_TIME_absolute_get ().abs_value_us); 2178 GNUNET_TIME_absolute_get ().abs_value_us);
2179 return GNUNET_OK; 2179 return GNUNET_OK;
@@ -2190,7 +2190,7 @@ receive_udp_back (void *cls,
2190 * @param message the actual message 2190 * @param message the actual message
2191 * @return #GNUNET_OK to keep the connection open, 2191 * @return #GNUNET_OK to keep the connection open,
2192 * #GNUNET_SYSERR to close it (signal serious error) 2192 * #GNUNET_SYSERR to close it (signal serious error)
2193 */ 2193 */
2194static int 2194static int
2195receive_tcp_back (void *cls, 2195receive_tcp_back (void *cls,
2196 struct GNUNET_MESH_Tunnel *tunnel, 2196 struct GNUNET_MESH_Tunnel *tunnel,
@@ -2220,7 +2220,7 @@ receive_tcp_back (void *cls,
2220 { 2220 {
2221 char sbuf[INET6_ADDRSTRLEN]; 2221 char sbuf[INET6_ADDRSTRLEN];
2222 char dbuf[INET6_ADDRSTRLEN]; 2222 char dbuf[INET6_ADDRSTRLEN];
2223 2223
2224 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2224 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2225 "Received TCP reply from mesh, sending %u bytes from %s:%u -> %s:%u via TUN\n", 2225 "Received TCP reply from mesh, sending %u bytes from %s:%u -> %s:%u via TUN\n",
2226 (unsigned int) mlen, 2226 (unsigned int) mlen,
@@ -2238,8 +2238,8 @@ receive_tcp_back (void *cls,
2238 { 2238 {
2239 case AF_INET: 2239 case AF_INET:
2240 { 2240 {
2241 size_t size = sizeof (struct GNUNET_TUN_IPv4Header) 2241 size_t size = sizeof (struct GNUNET_TUN_IPv4Header)
2242 + sizeof (struct GNUNET_TUN_TcpHeader) 2242 + sizeof (struct GNUNET_TUN_TcpHeader)
2243 + sizeof (struct GNUNET_MessageHeader) + 2243 + sizeof (struct GNUNET_MessageHeader) +
2244 sizeof (struct GNUNET_TUN_Layer2PacketHeader) + 2244 sizeof (struct GNUNET_TUN_Layer2PacketHeader) +
2245 mlen; 2245 mlen;
@@ -2277,8 +2277,8 @@ receive_tcp_back (void *cls,
2277 break; 2277 break;
2278 case AF_INET6: 2278 case AF_INET6:
2279 { 2279 {
2280 size_t size = sizeof (struct GNUNET_TUN_IPv6Header) 2280 size_t size = sizeof (struct GNUNET_TUN_IPv6Header)
2281 + sizeof (struct GNUNET_TUN_TcpHeader) 2281 + sizeof (struct GNUNET_TUN_TcpHeader)
2282 + sizeof (struct GNUNET_MessageHeader) + 2282 + sizeof (struct GNUNET_MessageHeader) +
2283 sizeof (struct GNUNET_TUN_Layer2PacketHeader) + 2283 sizeof (struct GNUNET_TUN_Layer2PacketHeader) +
2284 mlen; 2284 mlen;
@@ -2315,7 +2315,7 @@ receive_tcp_back (void *cls,
2315 } 2315 }
2316 break; 2316 break;
2317 } 2317 }
2318 GNUNET_CONTAINER_heap_update_cost (tunnel_heap, 2318 GNUNET_CONTAINER_heap_update_cost (tunnel_heap,
2319 ts->heap_node, 2319 ts->heap_node,
2320 GNUNET_TIME_absolute_get ().abs_value_us); 2320 GNUNET_TIME_absolute_get ().abs_value_us);
2321 return GNUNET_OK; 2321 return GNUNET_OK;
@@ -2342,10 +2342,10 @@ allocate_v4_address (struct in_addr *v4)
2342 unsigned int tries; 2342 unsigned int tries;
2343 2343
2344 GNUNET_assert (1 == inet_pton (AF_INET, ipv4addr, &addr)); 2344 GNUNET_assert (1 == inet_pton (AF_INET, ipv4addr, &addr));
2345 GNUNET_assert (1 == inet_pton (AF_INET, ipv4mask, &mask)); 2345 GNUNET_assert (1 == inet_pton (AF_INET, ipv4mask, &mask));
2346 /* Given 192.168.0.1/255.255.0.0, we want a mask 2346 /* Given 192.168.0.1/255.255.0.0, we want a mask
2347 of '192.168.255.255', thus: */ 2347 of '192.168.255.255', thus: */
2348 mask.s_addr = addr.s_addr | ~mask.s_addr; 2348 mask.s_addr = addr.s_addr | ~mask.s_addr;
2349 tries = 0; 2349 tries = 0;
2350 do 2350 do
2351 { 2351 {
@@ -2357,9 +2357,9 @@ allocate_v4_address (struct in_addr *v4)
2357 return GNUNET_SYSERR; 2357 return GNUNET_SYSERR;
2358 } 2358 }
2359 /* Pick random IPv4 address within the subnet, except 'addr' or 'mask' itself */ 2359 /* Pick random IPv4 address within the subnet, except 'addr' or 'mask' itself */
2360 rnd.s_addr = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 2360 rnd.s_addr = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
2361 UINT32_MAX); 2361 UINT32_MAX);
2362 v4->s_addr = (addr.s_addr | rnd.s_addr) & mask.s_addr; 2362 v4->s_addr = (addr.s_addr | rnd.s_addr) & mask.s_addr;
2363 get_destination_key_from_ip (AF_INET, 2363 get_destination_key_from_ip (AF_INET,
2364 v4, 2364 v4,
2365 &key); 2365 &key);
@@ -2399,7 +2399,7 @@ allocate_v6_address (struct in6_addr *v6)
2399 mask = addr; 2399 mask = addr;
2400 for (i=127;i>=ipv6prefix;i--) 2400 for (i=127;i>=ipv6prefix;i--)
2401 mask.s6_addr[i / 8] |= (1 << (i % 8)); 2401 mask.s6_addr[i / 8] |= (1 << (i % 8));
2402 2402
2403 /* Pick random IPv6 address within the subnet, except 'addr' or 'mask' itself */ 2403 /* Pick random IPv6 address within the subnet, except 'addr' or 'mask' itself */
2404 tries = 0; 2404 tries = 0;
2405 do 2405 do
@@ -2414,7 +2414,7 @@ allocate_v6_address (struct in6_addr *v6)
2414 } 2414 }
2415 for (i=0;i<16;i++) 2415 for (i=0;i<16;i++)
2416 { 2416 {
2417 rnd.s6_addr[i] = (unsigned char) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 2417 rnd.s6_addr[i] = (unsigned char) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
2418 256); 2418 256);
2419 v6->s6_addr[i] 2419 v6->s6_addr[i]
2420 = (addr.s6_addr[i] | rnd.s6_addr[i]) & mask.s6_addr[i]; 2420 = (addr.s6_addr[i] | rnd.s6_addr[i]) & mask.s6_addr[i];
@@ -2466,7 +2466,7 @@ free_destination_entry (struct DestinationEntry *de)
2466 if (NULL != de->heap_node) 2466 if (NULL != de->heap_node)
2467 { 2467 {
2468 GNUNET_CONTAINER_heap_remove_node (de->heap_node); 2468 GNUNET_CONTAINER_heap_remove_node (de->heap_node);
2469 de->heap_node = NULL; 2469 de->heap_node = NULL;
2470 GNUNET_assert (GNUNET_YES == 2470 GNUNET_assert (GNUNET_YES ==
2471 GNUNET_CONTAINER_multihashmap_remove (destination_map, 2471 GNUNET_CONTAINER_multihashmap_remove (destination_map,
2472 &de->key, 2472 &de->key,
@@ -2481,7 +2481,7 @@ free_destination_entry (struct DestinationEntry *de)
2481 * 2481 *
2482 * @param except destination that must NOT be cleaned up, even if it is the oldest 2482 * @param except destination that must NOT be cleaned up, even if it is the oldest
2483 */ 2483 */
2484static void 2484static void
2485expire_destination (struct DestinationEntry *except) 2485expire_destination (struct DestinationEntry *except)
2486{ 2486{
2487 struct DestinationEntry *de; 2487 struct DestinationEntry *de;
@@ -2495,13 +2495,13 @@ expire_destination (struct DestinationEntry *except)
2495 2495
2496 2496
2497/** 2497/**
2498 * Allocate an IP address for the response. 2498 * Allocate an IP address for the response.
2499 * 2499 *
2500 * @param result_af desired address family; set to the actual 2500 * @param result_af desired address family; set to the actual
2501 * address family; can initially be AF_UNSPEC if there 2501 * address family; can initially be AF_UNSPEC if there
2502 * is no preference; will be set to AF_UNSPEC if the 2502 * is no preference; will be set to AF_UNSPEC if the
2503 * allocation failed 2503 * allocation failed
2504 * @param addr set to either v4 or v6 depending on which 2504 * @param addr set to either v4 or v6 depending on which
2505 * storage location was used; set to NULL if allocation failed 2505 * storage location was used; set to NULL if allocation failed
2506 * @param v4 storage space for an IPv4 address 2506 * @param v4 storage space for an IPv4 address
2507 * @param v6 storage space for an IPv6 address 2507 * @param v6 storage space for an IPv6 address
@@ -2550,7 +2550,7 @@ allocate_response_ip (int *result_af,
2550 return GNUNET_SYSERR; 2550 return GNUNET_SYSERR;
2551 } 2551 }
2552 return GNUNET_OK; 2552 return GNUNET_OK;
2553} 2553}
2554 2554
2555 2555
2556/** 2556/**
@@ -2577,7 +2577,7 @@ service_redirect_to_ip (void *cls,
2577 void *addr; 2577 void *addr;
2578 struct DestinationEntry *de; 2578 struct DestinationEntry *de;
2579 struct GNUNET_HashCode key; 2579 struct GNUNET_HashCode key;
2580 2580
2581 /* validate and parse request */ 2581 /* validate and parse request */
2582 mlen = ntohs (message->size); 2582 mlen = ntohs (message->size);
2583 if (mlen < sizeof (struct RedirectToIpRequestMessage)) 2583 if (mlen < sizeof (struct RedirectToIpRequestMessage))
@@ -2596,7 +2596,7 @@ service_redirect_to_ip (void *cls,
2596 { 2596 {
2597 GNUNET_break (0); 2597 GNUNET_break (0);
2598 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 2598 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
2599 return; 2599 return;
2600 } 2600 }
2601 break; 2601 break;
2602 case AF_INET6: 2602 case AF_INET6:
@@ -2604,13 +2604,13 @@ service_redirect_to_ip (void *cls,
2604 { 2604 {
2605 GNUNET_break (0); 2605 GNUNET_break (0);
2606 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 2606 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
2607 return; 2607 return;
2608 } 2608 }
2609 break; 2609 break;
2610 default: 2610 default:
2611 GNUNET_break (0); 2611 GNUNET_break (0);
2612 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 2612 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
2613 return; 2613 return;
2614 } 2614 }
2615 2615
2616 /* allocate response IP */ 2616 /* allocate response IP */
@@ -2620,13 +2620,13 @@ service_redirect_to_ip (void *cls,
2620 &v4, &v6)) 2620 &v4, &v6))
2621 { 2621 {
2622 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 2622 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
2623 return; 2623 return;
2624 } 2624 }
2625 /* send reply with our IP address */ 2625 /* send reply with our IP address */
2626 send_client_reply (client, 2626 send_client_reply (client,
2627 msg->request_id, 2627 msg->request_id,
2628 result_af, 2628 result_af,
2629 addr); 2629 addr);
2630 if (result_af == AF_UNSPEC) 2630 if (result_af == AF_UNSPEC)
2631 { 2631 {
2632 /* failure, we're done */ 2632 /* failure, we're done */
@@ -2637,14 +2637,14 @@ service_redirect_to_ip (void *cls,
2637 { 2637 {
2638 char sbuf[INET6_ADDRSTRLEN]; 2638 char sbuf[INET6_ADDRSTRLEN];
2639 char dbuf[INET6_ADDRSTRLEN]; 2639 char dbuf[INET6_ADDRSTRLEN];
2640 2640
2641 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2641 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2642 "Allocated address %s for redirection via exit to %s\n", 2642 "Allocated address %s for redirection via exit to %s\n",
2643 inet_ntop (result_af, addr, sbuf, sizeof (sbuf)), 2643 inet_ntop (result_af, addr, sbuf, sizeof (sbuf)),
2644 inet_ntop (addr_af, 2644 inet_ntop (addr_af,
2645 &msg[1], dbuf, sizeof (dbuf))); 2645 &msg[1], dbuf, sizeof (dbuf)));
2646 } 2646 }
2647 2647
2648 /* setup destination record */ 2648 /* setup destination record */
2649 de = GNUNET_new (struct DestinationEntry); 2649 de = GNUNET_new (struct DestinationEntry);
2650 de->is_service = GNUNET_NO; 2650 de->is_service = GNUNET_NO;
@@ -2683,7 +2683,7 @@ service_redirect_to_ip (void *cls,
2683 * @param message redirection request (a `struct RedirectToPeerRequestMessage`) 2683 * @param message redirection request (a `struct RedirectToPeerRequestMessage`)
2684 */ 2684 */
2685static void 2685static void
2686service_redirect_to_service (void *cls, 2686service_redirect_to_service (void *cls,
2687 struct GNUNET_SERVER_Client *client, 2687 struct GNUNET_SERVER_Client *client,
2688 const struct GNUNET_MessageHeader *message) 2688 const struct GNUNET_MessageHeader *message)
2689{ 2689{
@@ -2696,7 +2696,7 @@ service_redirect_to_service (void *cls,
2696 struct GNUNET_HashCode key; 2696 struct GNUNET_HashCode key;
2697 struct TunnelState *ts; 2697 struct TunnelState *ts;
2698 struct DestinationTunnel *dt; 2698 struct DestinationTunnel *dt;
2699 2699
2700 /* parse request */ 2700 /* parse request */
2701 msg = (const struct RedirectToServiceRequestMessage *) message; 2701 msg = (const struct RedirectToServiceRequestMessage *) message;
2702 2702
@@ -2707,12 +2707,12 @@ service_redirect_to_service (void *cls,
2707 &v4, &v6)) 2707 &v4, &v6))
2708 { 2708 {
2709 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 2709 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
2710 return; 2710 return;
2711 } 2711 }
2712 send_client_reply (client, 2712 send_client_reply (client,
2713 msg->request_id, 2713 msg->request_id,
2714 result_af, 2714 result_af,
2715 addr); 2715 addr);
2716 if (result_af == AF_UNSPEC) 2716 if (result_af == AF_UNSPEC)
2717 { 2717 {
2718 /* failure, we're done */ 2718 /* failure, we're done */
@@ -2724,14 +2724,14 @@ service_redirect_to_service (void *cls,
2724 2724
2725 { 2725 {
2726 char sbuf[INET6_ADDRSTRLEN]; 2726 char sbuf[INET6_ADDRSTRLEN];
2727 2727
2728 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2728 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2729 "Allocated address %s for redirection to service %s on peer %s\n", 2729 "Allocated address %s for redirection to service %s on peer %s\n",
2730 inet_ntop (result_af, addr, sbuf, sizeof (sbuf)), 2730 inet_ntop (result_af, addr, sbuf, sizeof (sbuf)),
2731 GNUNET_h2s (&msg->service_descriptor), 2731 GNUNET_h2s (&msg->service_descriptor),
2732 GNUNET_i2s (&msg->target)); 2732 GNUNET_i2s (&msg->target));
2733 } 2733 }
2734 2734
2735 /* setup destination record */ 2735 /* setup destination record */
2736 de = GNUNET_new (struct DestinationEntry); 2736 de = GNUNET_new (struct DestinationEntry);
2737 de->is_service = GNUNET_YES; 2737 de->is_service = GNUNET_YES;
@@ -2778,15 +2778,15 @@ service_redirect_to_service (void *cls,
2778/** 2778/**
2779 * Function called whenever a tunnel is destroyed. Should clean up 2779 * Function called whenever a tunnel is destroyed. Should clean up
2780 * any associated state. 2780 * any associated state.
2781 * 2781 *
2782 * @param cls closure (set from #GNUNET_MESH_connect) 2782 * @param cls closure (set from #GNUNET_MESH_connect)
2783 * @param tunnel connection to the other end (henceforth invalid) 2783 * @param tunnel connection to the other end (henceforth invalid)
2784 * @param tunnel_ctx place where local state associated 2784 * @param tunnel_ctx place where local state associated
2785 * with the tunnel is stored (our `struct TunnelState`) 2785 * with the tunnel is stored (our `struct TunnelState`)
2786 */ 2786 */
2787static void 2787static void
2788tunnel_cleaner (void *cls, 2788tunnel_cleaner (void *cls,
2789 const struct GNUNET_MESH_Tunnel *tunnel, 2789 const struct GNUNET_MESH_Tunnel *tunnel,
2790 void *tunnel_ctx) 2790 void *tunnel_ctx)
2791{ 2791{
2792 struct TunnelState *ts = tunnel_ctx; 2792 struct TunnelState *ts = tunnel_ctx;
@@ -2851,7 +2851,7 @@ cleanup (void *cls,
2851 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2851 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2852 "VPN is shutting down\n"); 2852 "VPN is shutting down\n");
2853 if (NULL != destination_map) 2853 if (NULL != destination_map)
2854 { 2854 {
2855 GNUNET_CONTAINER_multihashmap_iterate (destination_map, 2855 GNUNET_CONTAINER_multihashmap_iterate (destination_map,
2856 &cleanup_destination, 2856 &cleanup_destination,
2857 NULL); 2857 NULL);
@@ -2864,7 +2864,7 @@ cleanup (void *cls,
2864 destination_heap = NULL; 2864 destination_heap = NULL;
2865 } 2865 }
2866 if (NULL != tunnel_map) 2866 if (NULL != tunnel_map)
2867 { 2867 {
2868 GNUNET_CONTAINER_multihashmap_iterate (tunnel_map, 2868 GNUNET_CONTAINER_multihashmap_iterate (tunnel_map,
2869 &cleanup_tunnel, 2869 &cleanup_tunnel,
2870 NULL); 2870 NULL);
@@ -2916,8 +2916,8 @@ run (void *cls,
2916 static const struct GNUNET_SERVER_MessageHandler service_handlers[] = { 2916 static const struct GNUNET_SERVER_MessageHandler service_handlers[] = {
2917 /* callback, cls, type, size */ 2917 /* callback, cls, type, size */
2918 { &service_redirect_to_ip, NULL, GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_IP, 0}, 2918 { &service_redirect_to_ip, NULL, GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_IP, 0},
2919 { &service_redirect_to_service, NULL, 2919 { &service_redirect_to_service, NULL,
2920 GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_SERVICE, 2920 GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_SERVICE,
2921 sizeof (struct RedirectToServiceRequestMessage) }, 2921 sizeof (struct RedirectToServiceRequestMessage) },
2922 {NULL, NULL, 0, 0} 2922 {NULL, NULL, 0, 0}
2923 }; 2923 };
@@ -2982,7 +2982,7 @@ run (void *cls,
2982 &ipv6addr) || 2982 &ipv6addr) ||
2983 (1 != inet_pton (AF_INET6, ipv6addr, &v6))) ) 2983 (1 != inet_pton (AF_INET6, ipv6addr, &v6))) )
2984 { 2984 {
2985 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV6ADDR", 2985 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV6ADDR",
2986 _("Must specify valid IPv6 address")); 2986 _("Must specify valid IPv6 address"));
2987 GNUNET_SCHEDULER_shutdown (); 2987 GNUNET_SCHEDULER_shutdown ();
2988 return; 2988 return;
@@ -3023,7 +3023,7 @@ run (void *cls,
3023 &ipv4addr) || 3023 &ipv4addr) ||
3024 (1 != inet_pton (AF_INET, ipv4addr, &v4))) ) 3024 (1 != inet_pton (AF_INET, ipv4addr, &v4))) )
3025 { 3025 {
3026 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV4ADDR", 3026 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV4ADDR",
3027 _("Must specify valid IPv4 address")); 3027 _("Must specify valid IPv4 address"));
3028 GNUNET_SCHEDULER_shutdown (); 3028 GNUNET_SCHEDULER_shutdown ();
3029 return; 3029 return;
@@ -3051,9 +3051,9 @@ run (void *cls,
3051 vpn_argv[6] = NULL; 3051 vpn_argv[6] = NULL;
3052 3052
3053 mesh_handle = 3053 mesh_handle =
3054 GNUNET_MESH_connect (cfg_, NULL, 3054 GNUNET_MESH_connect (cfg_, NULL,
3055 NULL, 3055 NULL,
3056 &tunnel_cleaner, 3056 &tunnel_cleaner,
3057 mesh_handlers, 3057 mesh_handlers,
3058 NULL); 3058 NULL);
3059 helper_handle = GNUNET_HELPER_start (GNUNET_NO, 3059 helper_handle = GNUNET_HELPER_start (GNUNET_NO,
@@ -3076,7 +3076,7 @@ int
3076main (int argc, char *const *argv) 3076main (int argc, char *const *argv)
3077{ 3077{
3078 return (GNUNET_OK == 3078 return (GNUNET_OK ==
3079 GNUNET_SERVICE_run (argc, argv, "vpn", 3079 GNUNET_SERVICE_run (argc, argv, "vpn",
3080 GNUNET_SERVICE_OPTION_NONE, 3080 GNUNET_SERVICE_OPTION_NONE,
3081 &run, NULL)) ? global_ret : 1; 3081 &run, NULL)) ? global_ret : 1;
3082} 3082}
diff --git a/src/vpn/gnunet-vpn.c b/src/vpn/gnunet-vpn.c
index b4d6824d9..5a35a0df5 100644
--- a/src/vpn/gnunet-vpn.c
+++ b/src/vpn/gnunet-vpn.c
@@ -122,7 +122,7 @@ do_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
122 * will match 'result_af' from the request 122 * will match 'result_af' from the request
123 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af') 123 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af')
124 * that the VPN allocated for the redirection; 124 * that the VPN allocated for the redirection;
125 * traffic to this IP will now be redirected to the 125 * traffic to this IP will now be redirected to the
126 * specified target peer; NULL on error 126 * specified target peer; NULL on error
127 */ 127 */
128static void 128static void
@@ -167,7 +167,7 @@ run (void *cls, char *const *args, const char *cfgfile,
167{ 167{
168 int dst_af; 168 int dst_af;
169 int req_af; 169 int req_af;
170 struct GNUNET_PeerIdentity peer; 170 struct GNUNET_PeerIdentity peer;
171 struct GNUNET_HashCode sd; 171 struct GNUNET_HashCode sd;
172 const void *addr; 172 const void *addr;
173 struct in_addr v4; 173 struct in_addr v4;
@@ -194,7 +194,7 @@ run (void *cls, char *const *args, const char *cfgfile,
194 } 194 }
195 if (ipv6) 195 if (ipv6)
196 req_af = AF_INET6; 196 req_af = AF_INET6;
197 197
198 if (NULL == target_ip) 198 if (NULL == target_ip)
199 { 199 {
200 if (NULL == service_name) 200 if (NULL == service_name)
@@ -233,7 +233,7 @@ run (void *cls, char *const *args, const char *cfgfile,
233 FPRINTF (stderr, _("`%s' is not a valid peer identifier.\n"), 233 FPRINTF (stderr, _("`%s' is not a valid peer identifier.\n"),
234 peer_id); 234 peer_id);
235 goto error; 235 goto error;
236 } 236 }
237 GNUNET_CRYPTO_hash (service_name, 237 GNUNET_CRYPTO_hash (service_name,
238 strlen (service_name), 238 strlen (service_name),
239 &sd); 239 &sd);
@@ -265,7 +265,7 @@ run (void *cls, char *const *args, const char *cfgfile,
265 { 265 {
266 dst_af = AF_INET6; 266 dst_af = AF_INET6;
267 addr = &v6; 267 addr = &v6;
268 } 268 }
269 request = GNUNET_VPN_redirect_to_ip (handle, 269 request = GNUNET_VPN_redirect_to_ip (handle,
270 req_af, 270 req_af,
271 dst_af, 271 dst_af,
diff --git a/src/vpn/vpn.h b/src/vpn/vpn.h
index b74b5b766..a487d8113 100644
--- a/src/vpn/vpn.h
+++ b/src/vpn/vpn.h
@@ -46,7 +46,7 @@ struct RedirectToIpRequestMessage
46 * Always zero. 46 * Always zero.
47 */ 47 */
48 uint32_t reserved GNUNET_PACKED; 48 uint32_t reserved GNUNET_PACKED;
49 49
50 /** 50 /**
51 * How long should the redirection be maintained at most? 51 * How long should the redirection be maintained at most?
52 */ 52 */
@@ -69,7 +69,7 @@ struct RedirectToIpRequestMessage
69 uint64_t request_id GNUNET_PACKED; 69 uint64_t request_id GNUNET_PACKED;
70 70
71 /* followed by destination address ('struct in_addr' or 'struct in6_addr') */ 71 /* followed by destination address ('struct in_addr' or 'struct in6_addr') */
72 72
73}; 73};
74 74
75 75
@@ -89,7 +89,7 @@ struct RedirectToServiceRequestMessage
89 * Always zero. 89 * Always zero.
90 */ 90 */
91 uint32_t reserved GNUNET_PACKED; 91 uint32_t reserved GNUNET_PACKED;
92 92
93 /** 93 /**
94 * How long should the redirection be maintained at most? 94 * How long should the redirection be maintained at most?
95 */ 95 */
@@ -99,7 +99,7 @@ struct RedirectToServiceRequestMessage
99 * Desired protocol (IPPROTO_UDP or IPPROTO_TCP) 99 * Desired protocol (IPPROTO_UDP or IPPROTO_TCP)
100 */ 100 */
101 int32_t protocol GNUNET_PACKED; 101 int32_t protocol GNUNET_PACKED;
102 102
103 /** 103 /**
104 * Address family desired for the result (AF_INET or AF_INET6 or AF_UNSPEC, in nbo) 104 * Address family desired for the result (AF_INET or AF_INET6 or AF_UNSPEC, in nbo)
105 */ 105 */
@@ -130,7 +130,7 @@ struct RedirectToServiceRequestMessage
130 */ 130 */
131struct RedirectToIpResponseMessage 131struct RedirectToIpResponseMessage
132{ 132{
133 133
134 /** 134 /**
135 * Type is #GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP 135 * Type is #GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP
136 */ 136 */
@@ -148,7 +148,7 @@ struct RedirectToIpResponseMessage
148 uint64_t request_id GNUNET_PACKED; 148 uint64_t request_id GNUNET_PACKED;
149 149
150 /* followed by destination address ('struct in_addr' or 'struct in6_addr') */ 150 /* followed by destination address ('struct in_addr' or 'struct in6_addr') */
151 151
152}; 152};
153 153
154GNUNET_NETWORK_STRUCT_END 154GNUNET_NETWORK_STRUCT_END
diff --git a/src/vpn/vpn_api.c b/src/vpn/vpn_api.c
index 8539a6a37..cf493cc52 100644
--- a/src/vpn/vpn_api.c
+++ b/src/vpn/vpn_api.c
@@ -106,7 +106,7 @@ struct GNUNET_VPN_RedirectionRequest
106 * Function to call with the designated IP address. 106 * Function to call with the designated IP address.
107 */ 107 */
108 GNUNET_VPN_AllocationCallback cb; 108 GNUNET_VPN_AllocationCallback cb;
109 109
110 /** 110 /**
111 * Closure for 'cb'. 111 * Closure for 'cb'.
112 */ 112 */
@@ -120,7 +120,7 @@ struct GNUNET_VPN_RedirectionRequest
120 /** 120 /**
121 * For service redirection, service descriptor. 121 * For service redirection, service descriptor.
122 */ 122 */
123 struct GNUNET_HashCode serv; 123 struct GNUNET_HashCode serv;
124 124
125 /** 125 /**
126 * At what time should the created service mapping expire? 126 * At what time should the created service mapping expire?
@@ -141,7 +141,7 @@ struct GNUNET_VPN_RedirectionRequest
141 * Address family of 'addr'. AF_INET or AF_INET6. 141 * Address family of 'addr'. AF_INET or AF_INET6.
142 */ 142 */
143 int addr_af; 143 int addr_af;
144 144
145 /** 145 /**
146 * For service redirection, IPPROT_UDP or IPPROTO_TCP. 146 * For service redirection, IPPROT_UDP or IPPROTO_TCP.
147 */ 147 */
@@ -165,7 +165,7 @@ reconnect (struct GNUNET_VPN_Handle *vh);
165 * @param cls the 'struct GNUNET_VPN_Handle' 165 * @param cls the 'struct GNUNET_VPN_Handle'
166 * @param msg message received, NULL on timeout or fatal error 166 * @param msg message received, NULL on timeout or fatal error
167 */ 167 */
168static void 168static void
169receive_response (void *cls, 169receive_response (void *cls,
170 const struct GNUNET_MessageHeader* msg) 170 const struct GNUNET_MessageHeader* msg)
171{ 171{
@@ -176,7 +176,7 @@ receive_response (void *cls,
176 size_t alen; 176 size_t alen;
177 int af; 177 int af;
178 178
179 if (NULL == msg) 179 if (NULL == msg)
180 { 180 {
181 reconnect (vh); 181 reconnect (vh);
182 return; 182 return;
@@ -212,10 +212,10 @@ receive_response (void *cls,
212 GNUNET_break (0); 212 GNUNET_break (0);
213 reconnect (vh); 213 reconnect (vh);
214 return; 214 return;
215 } 215 }
216 GNUNET_CLIENT_receive (vh->client, 216 GNUNET_CLIENT_receive (vh->client,
217 &receive_response, vh, 217 &receive_response, vh,
218 GNUNET_TIME_UNIT_FOREVER_REL); 218 GNUNET_TIME_UNIT_FOREVER_REL);
219 for (rr = vh->rr_head; NULL != rr; rr = rr->next) 219 for (rr = vh->rr_head; NULL != rr; rr = rr->next)
220 { 220 {
221 if (rr->request_id == rm->request_id) 221 if (rr->request_id == rm->request_id)
@@ -260,9 +260,9 @@ transmit_request (void *cls,
260 while ( (NULL != rr) && 260 while ( (NULL != rr) &&
261 (0 != rr->request_id) ) 261 (0 != rr->request_id) )
262 rr = rr->next; 262 rr = rr->next;
263 if (NULL == rr) 263 if (NULL == rr)
264 return 0; 264 return 0;
265 if (0 == size) 265 if (0 == size)
266 { 266 {
267 reconnect (vh); 267 reconnect (vh);
268 return 0; 268 return 0;
@@ -272,7 +272,7 @@ transmit_request (void *cls,
272 if (0 == vh->request_id_gen) 272 if (0 == vh->request_id_gen)
273 GNUNET_CLIENT_receive (vh->client, 273 GNUNET_CLIENT_receive (vh->client,
274 &receive_response, vh, 274 &receive_response, vh,
275 GNUNET_TIME_UNIT_FOREVER_REL); 275 GNUNET_TIME_UNIT_FOREVER_REL);
276 if (NULL == rr->addr) 276 if (NULL == rr->addr)
277 { 277 {
278 ret = sizeof (struct RedirectToServiceRequestMessage); 278 ret = sizeof (struct RedirectToServiceRequestMessage);
@@ -285,7 +285,7 @@ transmit_request (void *cls,
285 rs.result_af = htonl (rr->result_af); 285 rs.result_af = htonl (rr->result_af);
286 rs.target = rr->peer; 286 rs.target = rr->peer;
287 rs.service_descriptor = rr->serv; 287 rs.service_descriptor = rr->serv;
288 rs.request_id = rr->request_id = ++vh->request_id_gen; 288 rs.request_id = rr->request_id = ++vh->request_id_gen;
289 memcpy (buf, &rs, sizeof (struct RedirectToServiceRequestMessage)); 289 memcpy (buf, &rs, sizeof (struct RedirectToServiceRequestMessage));
290 } 290 }
291 else 291 else
@@ -332,7 +332,7 @@ transmit_request (void *cls,
332 332
333/** 333/**
334 * Add a request to our request queue and transmit it. 334 * Add a request to our request queue and transmit it.
335 * 335 *
336 * @param rr request to queue and transmit. 336 * @param rr request to queue and transmit.
337 */ 337 */
338static void 338static void
@@ -366,12 +366,12 @@ connect_task (void *cls,
366 const struct GNUNET_SCHEDULER_TaskContext *tc) 366 const struct GNUNET_SCHEDULER_TaskContext *tc)
367{ 367{
368 struct GNUNET_VPN_Handle *vh = cls; 368 struct GNUNET_VPN_Handle *vh = cls;
369 369
370 vh->rt = GNUNET_SCHEDULER_NO_TASK; 370 vh->rt = GNUNET_SCHEDULER_NO_TASK;
371 vh->client = GNUNET_CLIENT_connect ("vpn", vh->cfg); 371 vh->client = GNUNET_CLIENT_connect ("vpn", vh->cfg);
372 GNUNET_assert (NULL != vh->client); 372 GNUNET_assert (NULL != vh->client);
373 GNUNET_assert (NULL == vh->th); 373 GNUNET_assert (NULL == vh->th);
374 if (NULL != vh->rr_head) 374 if (NULL != vh->rr_head)
375 vh->th = GNUNET_CLIENT_notify_transmit_ready (vh->client, 375 vh->th = GNUNET_CLIENT_notify_transmit_ready (vh->client,
376 sizeof (struct RedirectToServiceRequestMessage), 376 sizeof (struct RedirectToServiceRequestMessage),
377 GNUNET_TIME_UNIT_FOREVER_REL, 377 GNUNET_TIME_UNIT_FOREVER_REL,
@@ -395,7 +395,7 @@ reconnect (struct GNUNET_VPN_Handle *vh)
395 { 395 {
396 GNUNET_CLIENT_notify_transmit_ready_cancel (vh->th); 396 GNUNET_CLIENT_notify_transmit_ready_cancel (vh->th);
397 vh->th = NULL; 397 vh->th = NULL;
398 } 398 }
399 GNUNET_CLIENT_disconnect (vh->client); 399 GNUNET_CLIENT_disconnect (vh->client);
400 vh->client = NULL; 400 vh->client = NULL;
401 vh->request_id_gen = 0; 401 vh->request_id_gen = 0;
@@ -405,7 +405,7 @@ reconnect (struct GNUNET_VPN_Handle *vh)
405 GNUNET_TIME_relative_min (GNUNET_TIME_relative_multiply (vh->backoff, 2), 405 GNUNET_TIME_relative_min (GNUNET_TIME_relative_multiply (vh->backoff, 2),
406 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30))); 406 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)));
407 vh->rt = GNUNET_SCHEDULER_add_delayed (vh->backoff, 407 vh->rt = GNUNET_SCHEDULER_add_delayed (vh->backoff,
408 &connect_task, 408 &connect_task,
409 vh); 409 vh);
410} 410}
411 411
@@ -540,7 +540,7 @@ GNUNET_VPN_redirect_to_ip (struct GNUNET_VPN_Handle *vh,
540 * Connect to the VPN service 540 * Connect to the VPN service
541 * 541 *
542 * @param cfg configuration to use 542 * @param cfg configuration to use
543 * @return VPN handle 543 * @return VPN handle
544 */ 544 */
545struct GNUNET_VPN_Handle * 545struct GNUNET_VPN_Handle *
546GNUNET_VPN_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) 546GNUNET_VPN_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)