From 61c39c60565b386e0e12ea669556b030e8cd7180 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 6 Oct 2013 20:55:28 +0000 Subject: -remove trailing whitespace --- src/arm/arm.h | 14 +- src/arm/arm_api.c | 60 +-- src/arm/arm_monitor_api.c | 2 +- src/arm/do_start_process.c | 2 +- src/arm/gnunet-arm.c | 52 +-- src/arm/gnunet-service-arm.c | 54 +-- src/arm/test_arm_api.c | 24 +- src/arm/test_exponential_backoff.c | 10 +- src/arm/test_gnunet_service_arm.c | 20 +- src/ats-tool/gnunet-ats.c | 6 +- src/ats/gnunet-service-ats-solver_mlp.c | 50 +-- src/ats/gnunet-service-ats-solver_proportional.c | 4 +- src/ats/gnunet-service-ats-solver_ril.c | 2 +- src/ats/gnunet-service-ats_addresses.c | 26 +- src/ats/gnunet-service-ats_normalization.c | 8 +- src/ats/gnunet-service-ats_reservations.c | 2 +- src/ats/perf_ats_mlp.c | 18 +- src/ats/test_ats_api_bandwidth_consumption.c | 2 +- src/ats/test_ats_api_performance_address_info.c | 2 +- src/ats/test_ats_api_performance_feedback.c | 2 +- src/ats/test_ats_api_scheduling_add_address.c | 2 +- ...test_ats_api_scheduling_add_address_duplicate.c | 2 +- .../test_ats_api_scheduling_add_address_inbound.c | 2 +- src/ats/test_ats_api_scheduling_add_session.c | 2 +- src/ats/test_ats_api_scheduling_block_and_reset.c | 36 +- src/ats/test_ats_api_scheduling_destroy_address.c | 2 +- ...test_ats_api_scheduling_destroy_address_twice.c | 2 +- ...ats_api_scheduling_destroy_inbound_connection.c | 2 +- src/ats/test_ats_api_scheduling_destroy_session.c | 2 +- src/ats/test_ats_api_scheduling_init.c | 2 +- src/ats/test_ats_api_scheduling_min_bw.c | 2 +- src/block/block.c | 6 +- src/block/plugin_block_template.c | 2 +- src/block/plugin_block_test.c | 2 +- src/consensus/consensus_api.c | 10 +- src/consensus/gnunet-consensus-profiler.c | 2 +- src/consensus/gnunet-service-consensus.c | 22 +- src/consensus/test_consensus_api.c | 2 +- src/conversation/conversation.h | 8 +- src/conversation/conversation_api.c | 56 +-- src/conversation/gnunet-conversation-test.c | 12 +- src/conversation/gnunet-conversation.c | 58 +-- src/conversation/gnunet-helper-audio-playback.c | 54 +-- src/conversation/gnunet-helper-audio-record.c | 64 +-- src/conversation/gnunet-service-conversation.c | 70 ++-- src/conversation/microphone.c | 16 +- src/conversation/speaker.c | 18 +- src/conversation/test_conversation_api.c | 2 +- src/core/core_api.c | 8 +- src/core/gnunet-core.c | 2 +- src/core/gnunet-service-core.c | 4 +- src/core/gnunet-service-core_clients.c | 12 +- src/core/gnunet-service-core_kx.c | 62 +-- src/core/gnunet-service-core_neighbours.c | 4 +- src/core/gnunet-service-core_sessions.c | 2 +- src/core/test_core_api.c | 6 +- src/core/test_core_api_reliability.c | 2 +- src/core/test_core_api_send_to_self.c | 4 +- src/core/test_core_api_start_only.c | 2 +- src/core/test_core_quota_compliance.c | 2 +- src/datacache/datacache.c | 12 +- src/datacache/perf_datacache.c | 2 +- src/datacache/plugin_datacache_heap.c | 18 +- src/datacache/plugin_datacache_postgres.c | 20 +- src/datacache/plugin_datacache_sqlite.c | 12 +- src/datacache/test_datacache.c | 8 +- src/datastore/datastore_api.c | 8 +- src/datastore/gnunet-datastore.c | 18 +- src/datastore/gnunet-service-datastore.c | 8 +- src/datastore/perf_datastore_api.c | 2 +- src/datastore/perf_plugin_datastore.c | 6 +- src/datastore/plugin_datastore_heap.c | 56 +-- src/datastore/plugin_datastore_mysql.c | 10 +- src/datastore/plugin_datastore_postgres.c | 8 +- src/datastore/test_datastore_api.c | 4 +- src/datastore/test_datastore_api_management.c | 2 +- src/datastore/test_plugin_datastore.c | 2 +- src/dht/dht.h | 4 +- src/dht/dht_api.c | 56 +-- src/dht/dht_test_lib.c | 16 +- src/dht/dht_test_lib.h | 2 +- src/dht/gnunet-dht-get.c | 4 +- src/dht/gnunet-dht-monitor.c | 12 +- src/dht/gnunet-service-dht_clients.c | 14 +- src/dht/gnunet-service-dht_clients.h | 4 +- src/dht/gnunet-service-dht_datacache.c | 4 +- src/dht/gnunet-service-dht_hello.c | 4 +- src/dht/gnunet-service-dht_neighbours.c | 34 +- src/dht/gnunet-service-dht_neighbours.h | 2 +- src/dht/gnunet-service-dht_routing.c | 4 +- src/dht/test_dht_api.c | 2 +- src/dht/test_dht_monitor.c | 32 +- src/dht/test_dht_topo.c | 44 +-- src/dns/dns.h | 4 +- src/dns/dns_api.c | 34 +- src/dns/dnsparser.c | 86 ++-- src/dns/dnsstub.c | 40 +- src/dns/gnunet-dns-monitor.c | 12 +- src/dns/gnunet-dns-redirector.c | 14 +- src/dns/gnunet-helper-dns.c | 82 ++-- src/dns/gnunet-service-dns.c | 64 +-- src/dns/plugin_block_dns.c | 10 +- src/dv/dv.h | 4 +- src/dv/dv_api.c | 26 +- src/dv/gnunet-dv.c | 10 +- src/dv/gnunet-service-dv.c | 128 +++--- src/dv/plugin_transport_dv.c | 46 +-- src/dv/test_transport_blacklist.c | 2 +- src/env/env.c | 16 +- src/env/test_env.c | 2 +- src/exit/exit.h | 8 +- src/exit/gnunet-daemon-exit.c | 292 +++++++------- src/exit/gnunet-helper-exit-windows.c | 250 ++++++------ src/exit/gnunet-helper-exit.c | 50 +-- .../gnunet-daemon-experimentation.h | 96 ++--- .../gnunet-daemon-experimentation_experiments.c | 96 ++--- .../gnunet-daemon-experimentation_nodes.c | 128 +++--- .../gnunet-daemon-experimentation_scheduler.c | 4 +- .../test_experimentation_clique_connect.c | 2 +- src/fragmentation/defragmentation.c | 8 +- src/fragmentation/fragmentation.c | 10 +- src/fragmentation/test_fragmentation.c | 4 +- src/fs/fs_api.c | 34 +- src/fs/fs_api.h | 14 +- src/fs/fs_dirmetascan.c | 52 +-- src/fs/fs_download.c | 24 +- src/fs/fs_namespace.c | 26 +- src/fs/fs_publish.c | 48 +-- src/fs/fs_publish_ksk.c | 8 +- src/fs/fs_publish_ublock.c | 14 +- src/fs/fs_publish_ublock.h | 4 +- src/fs/fs_search.c | 52 +-- src/fs/fs_sharetree.c | 16 +- src/fs/fs_test_lib.c | 30 +- src/fs/fs_unindex.c | 22 +- src/fs/fs_uri.c | 24 +- src/fs/gnunet-auto-share.c | 26 +- src/fs/gnunet-daemon-fsprofiler.c | 42 +- src/fs/gnunet-download.c | 8 +- src/fs/gnunet-fs-profiler.c | 6 +- src/fs/gnunet-helper-fs-publish.c | 46 +-- src/fs/gnunet-publish.c | 36 +- src/fs/gnunet-service-fs.c | 8 +- src/fs/gnunet-service-fs_cp.c | 24 +- src/fs/gnunet-service-fs_indexing.c | 4 +- src/fs/gnunet-service-fs_lc.c | 2 +- src/fs/gnunet-service-fs_mesh.h | 2 +- src/fs/gnunet-service-fs_mesh_client.c | 30 +- src/fs/gnunet-service-fs_mesh_server.c | 32 +- src/fs/gnunet-service-fs_pe.c | 6 +- src/fs/gnunet-service-fs_pe.h | 2 +- src/fs/gnunet-service-fs_pr.c | 38 +- src/fs/gnunet-service-fs_put.c | 6 +- src/fs/perf_gnunet_service_fs_p2p.c | 20 +- src/fs/perf_gnunet_service_fs_p2p_respect.c | 18 +- src/fs/test_fs_download.c | 10 +- src/fs/test_fs_download_persistence.c | 2 +- src/fs/test_fs_namespace.c | 6 +- src/fs/test_fs_namespace_list_updateable.c | 2 +- src/fs/test_fs_publish.c | 2 +- src/fs/test_fs_publish_persistence.c | 4 +- src/fs/test_fs_search.c | 2 +- src/fs/test_fs_search_probes.c | 2 +- src/fs/test_fs_start_stop.c | 2 +- src/fs/test_fs_test_lib.c | 12 +- src/fs/test_fs_unindex_persistence.c | 2 +- src/fs/test_gnunet_service_fs_migration.c | 4 +- src/fs/test_gnunet_service_fs_p2p.c | 12 +- src/gns/gns.h | 6 +- src/gns/gns_api.c | 54 +-- src/gns/gnunet-dns2gns.c | 40 +- src/gns/gnunet-gns-helper-service-w32.c | 10 +- src/gns/gnunet-gns-proxy.c | 308 +++++++-------- src/gns/gnunet-gns.c | 38 +- src/gns/gnunet-service-gns.c | 88 ++--- src/gns/gnunet-service-gns_interceptor.c | 38 +- src/gns/gnunet-service-gns_resolver.c | 154 ++++---- src/gns/gnunet-service-gns_resolver.h | 2 +- src/gns/gnunet-service-gns_shorten.c | 40 +- src/gns/gnunet_w32nsp_lib.h | 16 +- src/gns/nss/nss_gns.c | 40 +- src/gns/nss/nss_gns_query.c | 12 +- src/gns/plugin_block_gns.c | 4 +- src/gns/test_gns_proxy.c | 26 +- src/gns/test_gns_pseu_shorten.c | 36 +- src/gns/test_gns_revocation.c | 6 +- src/gns/test_gns_simple_shorten.c | 18 +- src/gns/test_gns_simple_srv_lookup.c | 6 +- src/gns/test_gns_simple_zkey_lookup.c | 12 +- src/gns/w32nsp-install.c | 162 ++++---- src/gns/w32nsp-resolve.c | 8 +- src/gns/w32nsp-uninstall.c | 58 +-- src/hello/gnunet-hello.c | 14 +- src/hello/hello.c | 24 +- src/hostlist/hostlist-client.c | 2 +- src/hostlist/hostlist-server.c | 6 +- .../test_gnunet_daemon_hostlist_reconnect.c | 2 +- src/identity/gnunet-identity.c | 12 +- src/identity/gnunet-service-identity.c | 68 ++-- src/identity/identity.h | 6 +- src/identity/identity_api.c | 44 +-- src/identity/identity_api_lookup.c | 16 +- src/identity/test_identity.c | 28 +- src/identity/test_identity_defaults.c | 32 +- src/include/block_regex.h | 2 +- src/include/gnunet_arm_service.h | 28 +- src/include/gnunet_bio_lib.h | 2 +- src/include/gnunet_block_lib.h | 4 +- src/include/gnunet_block_plugin.h | 2 +- src/include/gnunet_client_lib.h | 2 +- src/include/gnunet_common.h | 14 +- src/include/gnunet_configuration_lib.h | 6 +- src/include/gnunet_consensus_service.h | 4 +- src/include/gnunet_constants.h | 2 +- src/include/gnunet_container_lib.h | 104 ++--- src/include/gnunet_conversation_service.h | 20 +- src/include/gnunet_core_service.h | 2 +- src/include/gnunet_crypto_lib.h | 18 +- src/include/gnunet_datastore_plugin.h | 4 +- src/include/gnunet_dht_service.h | 18 +- src/include/gnunet_disk_lib.h | 36 +- src/include/gnunet_dns_service.h | 8 +- src/include/gnunet_dnsparser_lib.h | 46 +-- src/include/gnunet_dnsstub_lib.h | 4 +- src/include/gnunet_env_lib.h | 68 ++-- src/include/gnunet_fs_service.h | 24 +- src/include/gnunet_helper_lib.h | 8 +- src/include/gnunet_identity_service.h | 32 +- src/include/gnunet_lockmanager_service.h | 6 +- src/include/gnunet_mesh_service.h | 24 +- src/include/gnunet_mesh_service_enc.h | 20 +- src/include/gnunet_microphone_lib.h | 6 +- src/include/gnunet_mq_lib.h | 22 +- src/include/gnunet_multicast_service.h | 114 +++--- src/include/gnunet_mysql_lib.h | 2 +- src/include/gnunet_namestore_plugin.h | 10 +- src/include/gnunet_namestore_service.h | 40 +- src/include/gnunet_nat_lib.h | 2 +- src/include/gnunet_network_lib.h | 2 +- src/include/gnunet_os_lib.h | 10 +- src/include/gnunet_peerinfo_service.h | 2 +- src/include/gnunet_postgres_lib.h | 6 +- src/include/gnunet_protocols.h | 10 +- src/include/gnunet_psyc_service.h | 86 ++-- src/include/gnunet_psycstore_plugin.h | 38 +- src/include/gnunet_psycstore_service.h | 70 ++-- src/include/gnunet_regex_service.h | 6 +- src/include/gnunet_resolver_service.h | 2 +- src/include/gnunet_revocation_service.h | 2 +- src/include/gnunet_scalarproduct_service.h | 12 +- src/include/gnunet_scheduler_lib.h | 2 +- src/include/gnunet_server_lib.h | 14 +- src/include/gnunet_service_lib.h | 6 +- src/include/gnunet_set_service.h | 6 +- src/include/gnunet_social_service.h | 94 ++--- src/include/gnunet_speaker_lib.h | 6 +- src/include/gnunet_strings_lib.h | 50 +-- src/include/gnunet_testbed_logger_service.h | 2 +- src/include/gnunet_testbed_service.h | 8 +- src/include/gnunet_testing_lib.h | 22 +- src/include/gnunet_time_lib.h | 6 +- src/include/gnunet_transport_plugin.h | 2 +- src/include/gnunet_tun_lib.h | 98 ++--- src/include/gnunet_vpn_service.h | 8 +- src/include/tap-windows.h | 160 ++++---- src/integration-tests/connection_watchdog.c | 52 +-- src/mesh/gnunet-mesh.c | 2 +- src/mesh/gnunet-service-mesh-enc.c | 34 +- src/mesh/gnunet-service-mesh.c | 94 ++--- src/mesh/gnunet-service-mesh_channel.c | 14 +- src/mesh/gnunet-service-mesh_channel.h | 2 +- src/mesh/gnunet-service-mesh_connection.c | 22 +- src/mesh/gnunet-service-mesh_connection.h | 2 +- src/mesh/gnunet-service-mesh_local.c | 12 +- src/mesh/gnunet-service-mesh_local.h | 4 +- src/mesh/gnunet-service-mesh_peer.c | 50 +-- src/mesh/mesh.h | 8 +- src/mesh/mesh_api.c | 34 +- src/mesh/mesh_api_enc.c | 26 +- src/mesh/mesh_enc.h | 4 +- src/mesh/mesh_protocol.h | 4 +- src/mesh/mesh_protocol_enc.h | 2 +- src/mesh/mesh_test_lib.c | 14 +- src/mesh/mesh_test_lib.h | 2 +- src/mesh/mesh_tunnel_tree.c | 2 +- src/mesh/test_mesh_local.c | 12 +- src/mesh/test_mesh_single.c | 12 +- src/mesh/test_mesh_small.c | 20 +- src/multicast/multicast.h | 6 +- src/multicast/multicast_api.c | 78 ++-- src/namestore/gnunet-namestore-fcfsd.c | 58 +-- src/namestore/gnunet-namestore.c | 78 ++-- src/namestore/gnunet-service-namestore.c | 128 +++--- src/namestore/namestore.h | 10 +- src/namestore/namestore_api.c | 116 +++--- src/namestore/namestore_api_common.c | 116 +++--- src/namestore/namestore_api_monitor.c | 8 +- src/namestore/plugin_namestore_postgres.c | 84 ++-- src/namestore/plugin_namestore_sqlite.c | 156 ++++---- src/namestore/test_namestore_api_cache_block.c | 8 +- src/namestore/test_namestore_api_lookup_public.c | 10 +- src/namestore/test_namestore_api_monitoring.c | 10 +- .../test_namestore_api_monitoring_existing.c | 10 +- src/namestore/test_namestore_api_put.c | 6 +- src/namestore/test_namestore_api_remove.c | 22 +- ...test_namestore_api_remove_not_existing_record.c | 2 +- src/namestore/test_namestore_api_store.c | 10 +- src/namestore/test_namestore_api_store_update.c | 18 +- src/namestore/test_namestore_api_zone_iteration.c | 6 +- ...st_namestore_api_zone_iteration_specific_zone.c | 2 +- .../test_namestore_api_zone_iteration_stop.c | 2 +- src/namestore/test_namestore_api_zone_to_name.c | 2 +- src/namestore/test_plugin_namestore.c | 10 +- src/nat/gnunet-helper-nat-client-windows.c | 18 +- src/nat/gnunet-helper-nat-server-windows.c | 6 +- src/nat/gnunet-helper-nat-server.c | 2 +- src/nat/nat.c | 2 +- src/nat/nat_auto.c | 30 +- src/nse/gnunet-nse-profiler.c | 48 +-- src/nse/gnunet-service-nse.c | 72 ++-- src/nse/nse_api.c | 12 +- src/nse/perf_kdf.c | 2 +- src/nse/test_nse_api.c | 2 +- src/nse/test_nse_multipeer.c | 18 +- src/peerinfo-tool/gnunet-peerinfo.c | 42 +- src/peerinfo/gnunet-service-peerinfo.c | 52 +-- src/peerinfo/peerinfo_api.c | 14 +- src/peerinfo/perf_peerinfo_api.c | 2 +- src/peerinfo/test_peerinfo_api.c | 2 +- src/peerinfo/test_peerinfo_api_friend_only.c | 2 +- .../test_peerinfo_api_notify_friend_only.c | 2 +- src/peerinfo/test_peerinfo_shipped_hellos.c | 2 +- src/psyc/gnunet-service-psyc.c | 2 +- src/psyc/psyc_api.c | 56 +-- src/psycstore/gnunet-service-psycstore.c | 2 +- src/psycstore/plugin_psycstore_sqlite.c | 72 ++-- src/psycstore/psycstore_api.c | 52 +-- src/pt/gnunet-daemon-pt.c | 76 ++-- src/pt/test_gns_vpn.c | 66 ++-- src/pt/test_gnunet_vpn.c | 16 +- src/regex/gnunet-daemon-regexprofiler.c | 4 +- src/regex/gnunet-regex-profiler.c | 16 +- src/regex/gnunet-service-regex.c | 18 +- src/regex/perf-regex.c | 12 +- src/regex/plugin_block_regex.c | 4 +- src/regex/regex_api.c | 32 +- src/regex/regex_block_lib.c | 32 +- src/regex/regex_block_lib.h | 4 +- src/regex/regex_internal.c | 112 +++--- src/regex/regex_internal_dht.c | 58 +-- src/regex/regex_internal_lib.h | 12 +- src/regex/regex_ipc.h | 4 +- src/regex/regex_test_lib.c | 14 +- src/regex/regex_test_lib.h | 6 +- src/regex/test_regex_api.c | 4 +- src/regex/test_regex_iterate_api.c | 2 +- src/revocation/gnunet-revocation.c | 20 +- src/revocation/gnunet-service-revocation.c | 60 +-- src/revocation/revocation_api.c | 14 +- src/scalarproduct/gnunet-scalarproduct.c | 14 +- src/scalarproduct/gnunet-service-scalarproduct.c | 122 +++--- src/scalarproduct/scalarproduct.h | 18 +- src/scalarproduct/scalarproduct_api.c | 34 +- src/scalarproduct/scalarproduct_testing.h | 22 +- src/scalarproduct/test_scalarproduct_api.c | 38 +- src/set/gnunet-service-set.c | 12 +- src/set/gnunet-service-set.h | 2 +- src/set/gnunet-service-set_intersection.c | 30 +- src/set/gnunet-service-set_union.c | 28 +- src/set/gnunet-set-ibf-profiler.c | 2 +- src/set/gnunet-set-profiler.c | 2 +- src/set/ibf.c | 2 +- src/set/ibf.h | 2 +- src/set/set_api.c | 6 +- src/set/test_set_api.c | 2 +- src/statistics/gnunet-service-statistics.c | 6 +- src/statistics/gnunet-statistics.c | 14 +- src/statistics/statistics_api.c | 44 +-- src/statistics/test_statistics_api.c | 4 +- src/statistics/test_statistics_api_loop.c | 2 +- src/statistics/test_statistics_api_watch.c | 4 +- src/testbed/gnunet-daemon-testbed-blacklist.c | 8 +- src/testbed/gnunet-helper-testbed.c | 18 +- src/testbed/gnunet-service-test-barriers.c | 6 +- src/testbed/gnunet-service-testbed-logger.c | 4 +- src/testbed/gnunet-service-testbed.c | 12 +- src/testbed/gnunet-service-testbed_barriers.c | 52 +-- src/testbed/gnunet-service-testbed_barriers.h | 2 +- src/testbed/gnunet-service-testbed_cache.c | 6 +- .../gnunet-service-testbed_connectionpool.c | 24 +- .../gnunet-service-testbed_connectionpool.h | 4 +- src/testbed/gnunet-service-testbed_cpustatus.c | 14 +- src/testbed/gnunet-service-testbed_links.c | 42 +- src/testbed/gnunet-service-testbed_oc.c | 42 +- src/testbed/gnunet-service-testbed_peers.c | 46 +-- src/testbed/gnunet-testbed-profiler.c | 4 +- src/testbed/gnunet_testbed_mpi_spawn.c | 16 +- src/testbed/test_getcwd.c | 2 +- src/testbed/test_testbed_api.c | 2 +- src/testbed/test_testbed_api_barriers.c | 18 +- src/testbed/test_testbed_api_hosts.c | 6 +- src/testbed/test_testbed_api_operations.c | 8 +- .../test_testbed_api_peer_reconfiguration.c | 10 +- .../test_testbed_api_peers_manage_services.c | 6 +- src/testbed/test_testbed_api_sd.c | 4 +- src/testbed/test_testbed_api_statistics.c | 10 +- src/testbed/test_testbed_api_testbed_run.c | 2 +- src/testbed/test_testbed_logger_api.c | 8 +- src/testbed/testbed.h | 10 +- src/testbed/testbed_api.c | 48 +-- src/testbed/testbed_api.h | 4 +- src/testbed/testbed_api_barriers.c | 28 +- src/testbed/testbed_api_barriers.h | 2 +- src/testbed/testbed_api_hosts.c | 40 +- src/testbed/testbed_api_hosts.h | 4 +- src/testbed/testbed_api_operations.c | 50 +-- src/testbed/testbed_api_peers.c | 16 +- src/testbed/testbed_api_peers.h | 6 +- src/testbed/testbed_api_sd.c | 2 +- src/testbed/testbed_api_sd.h | 2 +- src/testbed/testbed_api_statistics.c | 24 +- src/testbed/testbed_api_testbed.c | 22 +- src/testbed/testbed_api_topology.c | 16 +- src/testbed/testbed_logger_api.c | 12 +- src/testing/gnunet-testing.c | 12 +- src/testing/test_testing_peerstartup.c | 10 +- src/testing/test_testing_peerstartup2.c | 18 +- src/testing/test_testing_sharedservices.c | 8 +- src/testing/testing.c | 122 +++--- src/topology/gnunet-daemon-topology.c | 10 +- src/topology/test_gnunet_daemon_topology.c | 4 +- src/transport/gnunet-helper-transport-bluetooth.c | 440 ++++++++++----------- src/transport/gnunet-helper-transport-wlan-dummy.c | 2 +- src/transport/gnunet-helper-transport-wlan.c | 146 +++---- src/transport/gnunet-service-transport.c | 2 +- src/transport/gnunet-service-transport_blacklist.c | 14 +- src/transport/gnunet-service-transport_clients.c | 2 +- src/transport/gnunet-service-transport_hello.c | 4 +- .../gnunet-service-transport_manipulation.c | 34 +- .../gnunet-service-transport_neighbours.c | 150 +++---- .../gnunet-service-transport_validation.c | 6 +- .../gnunet-transport-certificate-creation.c | 8 +- src/transport/gnunet-transport-wlan-receiver.c | 8 +- src/transport/gnunet-transport-wlan-sender.c | 18 +- src/transport/gnunet-transport.c | 8 +- src/transport/plugin_transport_bluetooth.c | 106 ++--- src/transport/plugin_transport_http.c | 4 +- src/transport/plugin_transport_http_client.c | 26 +- src/transport/plugin_transport_http_server.c | 14 +- src/transport/plugin_transport_tcp.c | 102 ++--- src/transport/plugin_transport_template.c | 2 +- src/transport/plugin_transport_udp.c | 84 ++-- src/transport/plugin_transport_unix.c | 92 ++--- src/transport/plugin_transport_wlan.c | 102 ++--- src/transport/plugin_transport_wlan.h | 2 +- src/transport/test_plugin_transport.c | 2 +- src/transport/test_transport_api_limited_sockets.c | 2 +- src/transport/test_transport_api_timeout.c | 4 +- src/transport/transport_api.c | 8 +- src/transport/transport_api_address_lookup.c | 8 +- src/tun/regex.c | 10 +- src/tun/test_tun.c | 2 +- src/tun/tun.c | 22 +- src/util/bandwidth.c | 8 +- src/util/bio.c | 28 +- src/util/client.c | 36 +- src/util/common_allocation.c | 6 +- src/util/common_endian.c | 10 +- src/util/common_logging.c | 28 +- src/util/configuration.c | 30 +- src/util/connection.c | 18 +- src/util/container_bloomfilter.c | 4 +- src/util/container_meta_data.c | 2 +- src/util/container_multihashmap.c | 36 +- src/util/container_multihashmap32.c | 4 +- src/util/container_multipeermap.c | 36 +- src/util/crypto_ecc.c | 58 +-- src/util/crypto_hash.c | 8 +- src/util/crypto_random.c | 8 +- src/util/crypto_symmetric.c | 34 +- src/util/disk.c | 20 +- src/util/gnunet-config.c | 8 +- src/util/gnunet-ecc.c | 6 +- src/util/gnunet-resolver.c | 6 +- src/util/gnunet-service-resolver.c | 22 +- src/util/gnunet-uri.c | 6 +- src/util/helper.c | 60 +-- src/util/mq.c | 16 +- src/util/network.c | 22 +- src/util/os_installation.c | 26 +- src/util/os_network.c | 2 +- src/util/os_priority.c | 30 +- src/util/peer.c | 2 +- src/util/perf_malloc.c | 2 +- src/util/resolver_api.c | 4 +- src/util/scheduler.c | 22 +- src/util/server.c | 16 +- src/util/server_nc.c | 2 +- src/util/service.c | 34 +- src/util/speedup.c | 8 +- src/util/strings.c | 46 +-- src/util/test_common_logging_runtime_loglevels.c | 2 +- src/util/test_configuration.c | 6 +- src/util/test_crypto_ecc.c | 6 +- src/util/test_crypto_symmetric.c | 6 +- src/util/test_mq.c | 2 +- src/util/test_os_start_process.c | 8 +- src/util/test_peer.c | 2 +- src/util/test_plugin.c | 2 +- src/util/test_resolver_api.c | 8 +- src/util/test_scheduler_delay.c | 2 +- src/util/test_server_mst_interrupt.c | 4 +- src/util/test_service.c | 4 +- src/util/test_speedup.c | 20 +- src/util/test_strings.c | 2 +- src/util/test_strings_to_data.c | 4 +- src/util/time.c | 6 +- src/util/win.c | 8 +- src/vpn/gnunet-helper-vpn-windows.c | 234 +++++------ src/vpn/gnunet-helper-vpn.c | 2 +- src/vpn/gnunet-service-vpn.c | 258 ++++++------ src/vpn/gnunet-vpn.c | 10 +- src/vpn/vpn.h | 12 +- src/vpn/vpn_api.c | 34 +- 524 files changed, 6539 insertions(+), 6539 deletions(-) (limited to 'src') 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 { /** - * Reply to client, of type is GNUNET_MESSAGE_TYPE_ARM_STATUS. + * Reply to client, of type is GNUNET_MESSAGE_TYPE_ARM_STATUS. */ struct GNUNET_MessageHeader header; - + /** * Status from the 'enum GNUNET_ARM_ServiceStatus' */ @@ -58,12 +58,12 @@ struct GNUNET_ARM_Message { /** * Reply to client, type is GNUNET_MESSAGE_TYPE_ARM_RESULT or - * GNUNET_MESSAGE_TYPE_ARM_LIST_RESULT. + * GNUNET_MESSAGE_TYPE_ARM_LIST_RESULT. * OR * Request from client, type is GNUNET_MESSAGE_TYPE_ARM_REQUEST */ struct GNUNET_MessageHeader header; - + /** * ID of a request that is being replied to. * OR @@ -85,7 +85,7 @@ struct GNUNET_ARM_ResultMessage * Reply to client, of type is GNUNET_MESSAGE_TYPE_ARM_RESULT, with an ID. */ struct GNUNET_ARM_Message arm_msg; - + /** * Result from the 'enum GNUNET_ARM_Result' */ @@ -93,8 +93,8 @@ struct GNUNET_ARM_ResultMessage }; /** - * Reply from ARM to client for the - * GNUNET_MESSAGE_TYPE_ARM_LIST request followed by count + * Reply from ARM to client for the + * GNUNET_MESSAGE_TYPE_ARM_LIST request followed by count * '\0' terminated strings. header->size contains the * total size (including all strings). */ 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) GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task); h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->retry_backoff, &reconnect_arm_task, h); - /* Don't clear pending messages on disconnection, deliver them later + /* Don't clear pending messages on disconnection, deliver them later clear_pending_messages (h, GNUNET_ARM_REQUEST_DISCONNECTED); GNUNET_assert (NULL == h->control_pending_head); */ @@ -285,7 +285,7 @@ arm_termination_handler (void *cls, const struct GNUNET_MessageHeader *msg) if (NULL != msg) { - GNUNET_break (0); + GNUNET_break (0); GNUNET_CLIENT_receive (h->client, &arm_termination_handler, h, GNUNET_TIME_UNIT_FOREVER_REL); return; @@ -296,10 +296,10 @@ arm_termination_handler (void *cls, const struct GNUNET_MessageHeader *msg) GNUNET_CLIENT_disconnect (h->client); h->client = NULL; if (NULL != cm->result_cont) - cm->result_cont (cm->cont_cls, + cm->result_cont (cm->cont_cls, GNUNET_ARM_REQUEST_SENT_OK, - (const char *) &cm->msg[1], - GNUNET_ARM_RESULT_STOPPED); + (const char *) &cm->msg[1], + GNUNET_ARM_RESULT_STOPPED); GNUNET_free (cm->msg); GNUNET_free (cm); } @@ -354,7 +354,7 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Message with unknown id %llu\n", id); return; - } + } fail = GNUNET_NO; switch (ntohs (msg->type)) { @@ -377,7 +377,7 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) rcount = ntohs (lres->count); { unsigned int i; - + list = GNUNET_malloc (sizeof (const char *) * rcount); pos = (const char *)&lres[1]; for (i = 0; i < rcount; i++) @@ -429,9 +429,9 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) if (NULL != h->thm) { GNUNET_break (0); - cm->result_cont (h->thm->cont_cls, + cm->result_cont (h->thm->cont_cls, GNUNET_ARM_REQUEST_SENT_OK, - (const char *) &h->thm->msg[1], + (const char *) &h->thm->msg[1], GNUNET_ARM_RESULT_IS_NOT_KNOWN); GNUNET_free (h->thm->msg); GNUNET_free (h->thm); @@ -440,12 +440,12 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) GNUNET_CLIENT_receive (h->client, &arm_termination_handler, h, GNUNET_TIME_UNIT_FOREVER_REL); return; - } + } GNUNET_CLIENT_receive (h->client, &client_notify_handler, h, GNUNET_TIME_UNIT_FOREVER_REL); switch (ntohs (msg->type)) { - case GNUNET_MESSAGE_TYPE_ARM_RESULT: + case GNUNET_MESSAGE_TYPE_ARM_RESULT: res = (const struct GNUNET_ARM_ResultMessage *) msg; LOG (GNUNET_ERROR_TYPE_DEBUG, "Received response from ARM for service `%s': %u\n", @@ -461,7 +461,7 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) list); GNUNET_free (list); break; - } + } GNUNET_free (cm->msg); GNUNET_free (cm); } @@ -473,7 +473,7 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) * @param cls closure with the 'struct GNUNET_ARM_Handle' * @param size number of bytes available in buf * @param buf where the callee should write the message - * @return number of bytes written to buf + * @return number of bytes written to buf */ static size_t transmit_arm_message (void *cls, size_t size, void *buf) @@ -490,7 +490,7 @@ transmit_arm_message (void *cls, size_t size, void *buf) "transmit_arm_message is running with %p buffer of size %lu. ARM is known to be %s\n", buf, size, h->currently_down ? "unconnected" : "connected"); GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task); - h->cth = NULL; + h->cth = NULL; if ((GNUNET_YES == h->currently_down) && (NULL != buf)) { h->currently_down = GNUNET_NO; @@ -658,14 +658,14 @@ void GNUNET_ARM_disconnect_and_free (struct GNUNET_ARM_Handle *h) { struct ARMControlMessage *cm; - + LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from ARM service\n"); if (NULL != h->cth) { GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth); h->cth = NULL; } - while ((NULL != (cm = h->control_pending_head)) + while ((NULL != (cm = h->control_pending_head)) || (NULL != (cm = h->control_sent_head)) ) { if (NULL != h->control_pending_head) @@ -764,13 +764,13 @@ arm_service_report (void *cls, if ((GNUNET_YES == test_is_active) && (GNUNET_YES == result)) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Looks like `%s' is already running.\n", "gnunet-service-arm"); /* arm is running! */ if (cm->result_cont) - cm->result_cont (cm->cont_cls, - GNUNET_ARM_REQUEST_SENT_OK, "arm", + cm->result_cont (cm->cont_cls, + GNUNET_ARM_REQUEST_SENT_OK, "arm", GNUNET_ARM_RESULT_IS_STARTED_ALREADY); } if (GNUNET_NO == test_is_active) @@ -802,8 +802,8 @@ arm_service_report (void *cls, { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, "arm", "BINARY"); if (cm->result_cont) - cm->result_cont (cm->cont_cls, - GNUNET_ARM_REQUEST_SENT_OK, "arm", + cm->result_cont (cm->cont_cls, + GNUNET_ARM_REQUEST_SENT_OK, "arm", GNUNET_ARM_RESULT_IS_NOT_KNOWN); GNUNET_free (cm); GNUNET_free (loprefix); @@ -935,9 +935,9 @@ change_service (struct GNUNET_ARM_Handle *h, const char *service_name, */ void GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, - const char *service_name, + const char *service_name, enum GNUNET_OS_InheritStdioFlags std_inheritance, - struct GNUNET_TIME_Relative timeout, + struct GNUNET_TIME_Relative timeout, GNUNET_ARM_ResultCallback cont, void *cont_cls) { @@ -1026,14 +1026,14 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, */ void GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h, - const char *service_name, + const char *service_name, struct GNUNET_TIME_Relative timeout, - GNUNET_ARM_ResultCallback cont, + GNUNET_ARM_ResultCallback cont, void *cont_cls) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Stopping service `%s' within %s\n", - service_name, + service_name, GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_NO)); change_service (h, service_name, timeout, cont, cont_cls, GNUNET_MESSAGE_TYPE_ARM_STOP); @@ -1051,14 +1051,14 @@ GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h, void GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h, struct GNUNET_TIME_Relative timeout, - GNUNET_ARM_ServiceListCallback cont, + GNUNET_ARM_ServiceListCallback cont, void *cont_cls) { struct ARMControlMessage *cm; struct GNUNET_ARM_Message *msg; - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Requesting LIST from ARM service with timeout: %s\n", + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Requesting LIST from ARM service with timeout: %s\n", GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_YES)); cm = GNUNET_malloc (sizeof (struct ARMControlMessage)); 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) * @param cls closure with the 'struct GNUNET_ARM_MonitorHandle' * @param size number of bytes available in buf * @param buf where the callee should write the message - * @return number of bytes written to buf + * @return number of bytes written to buf */ static size_t transmit_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, va_end (ap); argv[argv_size] = NULL; binary_path = argv[0]; - proc = GNUNET_OS_start_process_v (pipe_control, std_inheritance, lsocks, + proc = GNUNET_OS_start_process_v (pipe_control, std_inheritance, lsocks, binary_path, argv); while (argv_size > 0) 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 () { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Failed to remove servicehome directory %s\n"), dir); - + } } @@ -269,7 +269,7 @@ ret_string (enum GNUNET_ARM_Result result) * @param cls closure * @param tc scheudler context */ -static void +static void action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); @@ -283,11 +283,11 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); * GNUNET_SYSERR on error. */ static void -conn_status (void *cls, +conn_status (void *cls, int connected) { static int once; - + if ( (GNUNET_SYSERR == connected) && (0 == once) ) { @@ -335,7 +335,7 @@ start_callback (void *cls, GNUNET_free (msg); GNUNET_SCHEDULER_shutdown (); return; - } + } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ARM service [re]start successful\n"); start = 0; GNUNET_SCHEDULER_add_now (action_loop, NULL); @@ -355,7 +355,7 @@ start_callback (void *cls, * according to ARM */ static void -stop_callback (void *cls, +stop_callback (void *cls, enum GNUNET_ARM_RequestStatus rs, const char *service, enum GNUNET_ARM_Result result) { @@ -363,7 +363,7 @@ stop_callback (void *cls, if (GNUNET_ARM_REQUEST_SENT_OK != rs) { - GNUNET_asprintf (&msg, "%s", + GNUNET_asprintf (&msg, "%s", _("Failed to send a stop request to the ARM service: %s\n")); FPRINTF (stdout, msg, req_string (rs)); GNUNET_free (msg); @@ -380,14 +380,14 @@ stop_callback (void *cls, GNUNET_SCHEDULER_shutdown (); return; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ARM service shutdown successful\n"); end = 0; if (restart) { restart = 0; start = 1; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Initiating an ARM restart\n"); } GNUNET_SCHEDULER_add_now (&action_loop, NULL); @@ -407,12 +407,12 @@ stop_callback (void *cls, * according to ARM */ static void -init_callback (void *cls, +init_callback (void *cls, enum GNUNET_ARM_RequestStatus rs, const char *service, enum GNUNET_ARM_Result result) { char *msg; - + if (GNUNET_ARM_REQUEST_SENT_OK != rs) { GNUNET_asprintf (&msg, _("Failed to send a request to start the `%s' service: %%s\n"), init); @@ -431,8 +431,8 @@ init_callback (void *cls, GNUNET_SCHEDULER_shutdown (); return; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Service %s [re]started successfully\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Service %s [re]started successfully\n", init); init = NULL; GNUNET_SCHEDULER_add_now (&action_loop, NULL); @@ -452,7 +452,7 @@ init_callback (void *cls, * according to ARM */ static void -term_callback (void *cls, +term_callback (void *cls, enum GNUNET_ARM_RequestStatus rs, const char *service, enum GNUNET_ARM_Result result) { @@ -470,7 +470,7 @@ term_callback (void *cls, if ((GNUNET_ARM_RESULT_STOPPED != result) && (GNUNET_ARM_RESULT_IS_STOPPED_ALREADY != result)) { - GNUNET_asprintf (&msg, + GNUNET_asprintf (&msg, _("Failed to kill the `%s' service: %s\n"), term, ret_string (result)); FPRINTF (stdout, msg, service); @@ -479,7 +479,7 @@ term_callback (void *cls, return; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service %s stopped successfully\n", term); term = NULL; GNUNET_SCHEDULER_add_now (&action_loop, NULL); @@ -497,7 +497,7 @@ term_callback (void *cls, * @param list list of services that are running */ static void -list_callback (void *cls, +list_callback (void *cls, enum GNUNET_ARM_RequestStatus rs, unsigned int count, const char *const*list) { @@ -546,7 +546,7 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (NULL != term) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Termination action\n"); - GNUNET_ARM_request_service_stop (h, term, + GNUNET_ARM_request_service_stop (h, term, (0 == timeout.rel_value_us) ? STOP_TIMEOUT : timeout, &term_callback, NULL); return; @@ -556,7 +556,7 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (end || restart) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "End action\n"); - GNUNET_ARM_request_service_stop (h, "arm", + GNUNET_ARM_request_service_stop (h, "arm", (0 == timeout.rel_value_us) ? STOP_TIMEOUT_ARM : timeout, &stop_callback, NULL); return; @@ -585,7 +585,7 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } break; case 4: - if (list) + if (list) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Going to list all running services controlled by ARM.\n"); @@ -593,10 +593,10 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) (0 == timeout.rel_value_us) ? LIST_TIMEOUT : timeout, &list_callback, &list); return; - } + } break; case 5: - if (monitor) + if (monitor) { if (! quiet) fprintf (stderr, @@ -621,7 +621,7 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param status status of the service */ static void -srv_status (void *cls, +srv_status (void *cls, const char *service, enum GNUNET_ARM_ServiceStatus status) { const char *msg; @@ -663,8 +663,8 @@ srv_status (void *cls, * @param c configuration */ static void -run (void *cls, - char *const *args, +run (void *cls, + char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) { @@ -672,7 +672,7 @@ run (void *cls, cfg = GNUNET_CONFIGURATION_dup (c); config_file = cfgfile; - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "PATHS", "SERVICEHOME", &dir)) { 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) return 0; /* error, not much we can do */ } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Sending status response %u to client\n", + "Sending status response %u to client\n", (unsigned int) msg->result); msize = msg->arm_msg.header.size; GNUNET_assert (size >= msize); @@ -275,7 +275,7 @@ write_result (void *cls, size_t size, void *buf) /** * Transmit the list of running services. - * + * * @param cls pointer to `struct GNUNET_ARM_ListResultMessage` with the message * @param size number of bytes available in @a buf * @param buf where to copy the message, NULL on error @@ -286,7 +286,7 @@ write_list_result (void *cls, size_t size, void *buf) { struct GNUNET_ARM_ListResultMessage *msg = cls; size_t rslt_size; - + if (buf == NULL) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, @@ -294,14 +294,14 @@ write_list_result (void *cls, size_t size, void *buf) GNUNET_free (msg); return 0; /* error, not much we can do */ } - + rslt_size = msg->arm_msg.header.size; GNUNET_assert (size >= rslt_size); msg->arm_msg.header.size = htons (msg->arm_msg.header.size); msg->arm_msg.header.type = htons (msg->arm_msg.header.type); msg->arm_msg.request_id = GNUNET_htonll (msg->arm_msg.request_id); msg->count = htons (msg->count); - + memcpy (buf, msg, rslt_size); GNUNET_free (msg); return rslt_size; @@ -319,7 +319,7 @@ write_list_result (void *cls, size_t size, void *buf) * @return NULL if it was not found */ static void -signal_result (struct GNUNET_SERVER_Client *client, +signal_result (struct GNUNET_SERVER_Client *client, const char *name, uint64_t request_id, enum GNUNET_ARM_Result result) @@ -335,7 +335,7 @@ signal_result (struct GNUNET_SERVER_Client *client, msg->arm_msg.request_id = request_id; GNUNET_SERVER_notify_transmit_ready (client, msize, - GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_TIME_UNIT_FOREVER_REL, write_result, msg); } @@ -492,7 +492,7 @@ start_process (struct ServiceList *sl, struct GNUNET_SERVER_Client *client, uint if (NULL == sl->config) sl->proc = do_start_process (sl->pipe_control, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, - lsocks, loprefix, binary, + lsocks, loprefix, binary, options, NULL); else sl->proc = @@ -693,7 +693,7 @@ handle_start (void *cls, struct GNUNET_SERVER_Client *client, uint64_t request_id; struct GNUNET_ARM_Message *amsg; - amsg = (struct GNUNET_ARM_Message *) message; + amsg = (struct GNUNET_ARM_Message *) message; request_id = GNUNET_ntohll (amsg->request_id); size = ntohs (amsg->header.size); size -= sizeof (struct GNUNET_ARM_Message); @@ -762,7 +762,7 @@ handle_stop (void *cls, struct GNUNET_SERVER_Client *client, uint64_t request_id; struct GNUNET_ARM_Message *amsg; - amsg = (struct GNUNET_ARM_Message *) message; + amsg = (struct GNUNET_ARM_Message *) message; request_id = GNUNET_ntohll (amsg->request_id); size = ntohs (amsg->header.size); size -= sizeof (struct GNUNET_ARM_Message); @@ -847,10 +847,10 @@ handle_list (void *cls, struct GNUNET_SERVER_Client *client, size_t total_size; struct ServiceList *sl; uint16_t count; - + if (NULL == client) return; - + request = (struct GNUNET_ARM_Message *) message; count = 0; string_list_size = 0; @@ -866,16 +866,16 @@ handle_list (void *cls, struct GNUNET_SERVER_Client *client, } } - total_size = sizeof (struct GNUNET_ARM_ListResultMessage) + total_size = sizeof (struct GNUNET_ARM_ListResultMessage) + string_list_size; msg = GNUNET_malloc (total_size); msg->arm_msg.header.size = total_size; msg->arm_msg.header.type = GNUNET_MESSAGE_TYPE_ARM_LIST_RESULT; msg->arm_msg.request_id = GNUNET_ntohll (request->request_id); msg->count = count; - + char *pos = (char *)&msg[1]; - for (sl = running_head; sl != NULL; sl = sl->next) + for (sl = running_head; sl != NULL; sl = sl->next) { if (sl->proc != NULL) { @@ -884,7 +884,7 @@ handle_list (void *cls, struct GNUNET_SERVER_Client *client, pos += s; } } - + GNUNET_SERVER_notify_transmit_ready (client, total_size, GNUNET_TIME_UNIT_FOREVER_REL, @@ -926,7 +926,7 @@ list_count (struct ServiceList *running_head) unsigned int res = 0; for (res = 0, i = running_head; i; i = i->next, res++) - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s\n", i->name); return res; @@ -946,7 +946,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct ServiceList *nxt; struct ServiceListeningInfo *sli; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "First shutdown phase\n"); if (GNUNET_SCHEDULER_NO_TASK != child_restart_task) { @@ -979,7 +979,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) nxt = pos->next; if (pos->proc != NULL) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stopping service `%s'\n", pos->name); pos->killed_at = GNUNET_TIME_absolute_get (); @@ -996,7 +996,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) do_shutdown (); else GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Delaying shutdown, have %u childs still running\n", + "Delaying shutdown, have %u childs still running\n", list_count (running_head)); } @@ -1063,12 +1063,12 @@ delayed_restart_task (void *cls, } if (lowestRestartDelay.rel_value_us != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Will restart process in %s\n", GNUNET_STRINGS_relative_time_to_string (lowestRestartDelay, GNUNET_YES)); child_restart_task = GNUNET_SCHEDULER_add_delayed_with_priority (lowestRestartDelay, - GNUNET_SCHEDULER_PRIORITY_IDLE, + GNUNET_SCHEDULER_PRIORITY_IDLE, &delayed_restart_task, NULL); } } @@ -1275,7 +1275,7 @@ setup_service (void *cls, const char *section) { if (NULL != config) { - GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, + GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, section, "CONFIG", STRERROR (errno)); GNUNET_free (config); @@ -1293,7 +1293,7 @@ setup_service (void *cls, const char *section) #else if (GNUNET_CONFIGURATION_have_value (cfg, section, "PIPECONTROL")) sl->pipe_control = GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "PIPECONTROL"); -#endif +#endif GNUNET_CONTAINER_DLL_insert (running_head, running_tail, sl); if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "AUTOSTART")) @@ -1363,9 +1363,9 @@ run (void *cls, struct GNUNET_SERVER_Handle *serv, static const struct GNUNET_SERVER_MessageHandler handlers[] = { {&handle_start, NULL, GNUNET_MESSAGE_TYPE_ARM_START, 0}, {&handle_stop, NULL, GNUNET_MESSAGE_TYPE_ARM_STOP, 0}, - {&handle_monitor, NULL, GNUNET_MESSAGE_TYPE_ARM_MONITOR, + {&handle_monitor, NULL, GNUNET_MESSAGE_TYPE_ARM_MONITOR, sizeof (struct GNUNET_MessageHeader)}, - {&handle_list, NULL, GNUNET_MESSAGE_TYPE_ARM_LIST, + {&handle_list, NULL, GNUNET_MESSAGE_TYPE_ARM_LIST, sizeof (struct GNUNET_ARM_Message)}, {NULL, NULL, 0, 0} }; @@ -1456,7 +1456,7 @@ main (int argc, char *const *argv) GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); ret = (GNUNET_OK == - GNUNET_SERVICE_run (argc, argv, "arm", + GNUNET_SERVICE_run (argc, argv, "arm", GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN, &run, NULL)) ? 0 : 1; GNUNET_SIGNAL_handler_uninstall (shc_chld); 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; static int phase = 0; static void -arm_stop_cb (void *cls, - enum GNUNET_ARM_RequestStatus status, - const char *servicename, +arm_stop_cb (void *cls, + enum GNUNET_ARM_RequestStatus status, + const char *servicename, enum GNUNET_ARM_Result result) { /* (6), a stop request should be sent to ARM successfully */ @@ -59,8 +59,8 @@ arm_stop_cb (void *cls, static void -resolver_stop_cb (void *cls, - enum GNUNET_ARM_RequestStatus status, +resolver_stop_cb (void *cls, + enum GNUNET_ARM_RequestStatus status, const char *servicename, enum GNUNET_ARM_Result result) { /* (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) static void -resolver_start_cb (void *cls, - enum GNUNET_ARM_RequestStatus status, - const char *servicename, +resolver_start_cb (void *cls, + enum GNUNET_ARM_RequestStatus status, + const char *servicename, enum GNUNET_ARM_Result result) { /* (2), the start request for resolver should be sent successfully @@ -129,7 +129,7 @@ trigger_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -arm_conn (void *cls, +arm_conn (void *cls, int connected) { if (GNUNET_SYSERR == connected) @@ -163,9 +163,9 @@ arm_conn (void *cls, static void -arm_start_cb (void *cls, - enum GNUNET_ARM_RequestStatus status, - const char *servicename, +arm_start_cb (void *cls, + enum GNUNET_ARM_RequestStatus status, + const char *servicename, enum GNUNET_ARM_Result result) { /* (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) { struct ShutdownContext *shutdown_ctx = cls; - if (NULL == msg) + if (NULL == msg) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service shutdown complete.\n"); if (shutdown_ctx->cont != NULL) shutdown_ctx->cont (shutdown_ctx->cont_cls, GNUNET_NO); - + GNUNET_SCHEDULER_cancel (shutdown_ctx->cancel_task); GNUNET_CLIENT_disconnect (shutdown_ctx->sock); GNUNET_free (shutdown_ctx); @@ -253,7 +253,7 @@ kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc) if (NULL != cbData) { waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt); - LOG ("Waited for: %s\n", + LOG ("Waited for: %s\n", GNUNET_STRINGS_relative_time_to_string (waitedFor, GNUNET_YES)); } else @@ -347,7 +347,7 @@ arm_start_cb (void *cls, enum GNUNET_ARM_RequestStatus status, const char *servi GNUNET_break (status == GNUNET_ARM_REQUEST_SENT_OK); GNUNET_break (result == GNUNET_ARM_RESULT_STARTING); GNUNET_break (phase == 0); - LOG ("Sent 'START' request for arm to ARM %s\n", + LOG ("Sent 'START' request for arm to ARM %s\n", (status == GNUNET_ARM_REQUEST_SENT_OK) ? "successfully" : "unsuccessfully"); } @@ -431,7 +431,7 @@ init () return GNUNET_SYSERR; GNUNET_assert (0 < GNUNET_asprintf (&binary, "%s/%s", pwd, BINARY)); GNUNET_CONFIGURATION_set_value_string (cfg, SERVICE, "BINARY", binary); - GNUNET_free (binary); + GNUNET_free (binary); if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg, CFGFILENAME)) { 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 @@ Boston, MA 02111-1307, USA. */ /** - * @file arm/test_gnunet_service_arm.c + * @file arm/test_gnunet_service_arm.c * @brief testcase for gnunet-service-arm.c; tests ARM by making it start the resolver * @author Safey * @author Christian Grothoff @@ -55,9 +55,9 @@ trigger_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -arm_stop_cb (void *cls, - enum GNUNET_ARM_RequestStatus status, - const char *servicename, +arm_stop_cb (void *cls, + enum GNUNET_ARM_RequestStatus status, + const char *servicename, enum GNUNET_ARM_Result result) { GNUNET_break (status == GNUNET_ARM_REQUEST_SENT_OK); @@ -69,12 +69,12 @@ arm_stop_cb (void *cls, static void -service_list (void *cls, +service_list (void *cls, enum GNUNET_ARM_RequestStatus rs, unsigned int count, const char *const*list) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "%u services are are currently running\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "%u services are are currently running\n", count); GNUNET_break (count == 1); GNUNET_break (0 == strcasecmp (list[0], "resolver (gnunet-service-resolver)")); @@ -107,9 +107,9 @@ hostNameResolveCB (void *cls, const struct sockaddr *addr, socklen_t addrlen) static void -arm_start_cb (void *cls, - enum GNUNET_ARM_RequestStatus status, - const char *servicename, +arm_start_cb (void *cls, + enum GNUNET_ARM_RequestStatus status, + const char *servicename, enum GNUNET_ARM_Result result) { 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; static struct PendingResolutions *tail; -static void +static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { @@ -149,7 +149,7 @@ end (void *cls, } -static void +static void transport_addr_to_str_cb (void *cls, const char *address) { struct PendingResolutions * pr = cls; @@ -226,7 +226,7 @@ transport_addr_to_str_cb (void *cls, const char *address) } -static void +static void ats_perf_cb (void *cls, const struct GNUNET_HELLO_Address *address, 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) * @return GNUNET_OK */ static int -reset_peers (void *cls, - const struct GNUNET_PeerIdentity *key, +reset_peers (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { struct ATS_Peer *peer = value; @@ -239,7 +239,7 @@ mlp_delete_problem (struct GAS_MLP_Handle *mlp) mlp->p.ci = MLP_UNDEFINED; - GNUNET_CONTAINER_multipeermap_iterate (mlp->requested_peers, + GNUNET_CONTAINER_multipeermap_iterate (mlp->requested_peers, &reset_peers, NULL); } @@ -393,7 +393,7 @@ struct CountContext }; static int -mlp_create_problem_count_addresses_it (void *cls, +mlp_create_problem_count_addresses_it (void *cls, const struct GNUNET_PeerIdentity *key, void *value) { @@ -406,7 +406,7 @@ mlp_create_problem_count_addresses_it (void *cls, } -static int +static int mlp_create_problem_count_addresses (const struct GNUNET_CONTAINER_MultiPeerMap *peers, const struct GNUNET_CONTAINER_MultiPeerMap *addresses) { @@ -414,7 +414,7 @@ mlp_create_problem_count_addresses (const struct GNUNET_CONTAINER_MultiPeerMap * cctx.peers = peers; cctx.result = 0; - GNUNET_CONTAINER_multipeermap_iterate (addresses, + GNUNET_CONTAINER_multipeermap_iterate (addresses, &mlp_create_problem_count_addresses_it, &cctx); return cctx.result; } @@ -600,8 +600,8 @@ mlp_create_problem_create_constraint (struct MLP_Problem *p, char *name, * - Set address dependent entries in problem matrix as well */ static int -mlp_create_problem_add_address_information (void *cls, - const struct GNUNET_PeerIdentity *key, +mlp_create_problem_add_address_information (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { struct GAS_MLP_Handle *mlp = cls; @@ -842,7 +842,7 @@ mlp_create_problem (struct GAS_MLP_Handle *mlp) LOG (GNUNET_ERROR_TYPE_DEBUG, "Rebuilding problem for %u peer(s) and %u addresse(s) and %u quality metrics == %u elements\n", p->num_peers, - p->num_addresses, + p->num_addresses, mlp->pv.m_q, p->num_elements); @@ -874,8 +874,8 @@ mlp_create_problem (struct GAS_MLP_Handle *mlp) mlp_create_problem_add_invariant_rows (mlp, p); /* Adding address dependent columns constraint rows */ - GNUNET_CONTAINER_multipeermap_iterate (mlp->addresses, - &mlp_create_problem_add_address_information, + GNUNET_CONTAINER_multipeermap_iterate (mlp->addresses, + &mlp_create_problem_add_address_information, mlp); /* Load the matrix */ @@ -961,8 +961,8 @@ mlp_solve_mlp_problem (struct GAS_MLP_Handle *mlp) * @return #GNUNET_OK to continue */ int -mlp_propagate_results (void *cls, - const struct GNUNET_PeerIdentity *key, +mlp_propagate_results (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { struct GAS_MLP_Handle *mlp = cls; @@ -973,7 +973,7 @@ mlp_propagate_results (void *cls, double mlp_use = MLP_NaN; /* Check if we have to add this peer due to a pending request */ - if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (mlp->requested_peers, + if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (mlp->requested_peers, key)) { return GNUNET_OK; @@ -1224,12 +1224,12 @@ GAS_mlp_address_add (void *solver, address->solver_information = GNUNET_new (struct MLP_information); } else - LOG (GNUNET_ERROR_TYPE_ERROR, - _("Adding address for peer `%s' multiple times\n"), + LOG (GNUNET_ERROR_TYPE_ERROR, + _("Adding address for peer `%s' multiple times\n"), GNUNET_i2s(&address->peer)); /* Is this peer included in the problem? */ - if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers, + if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers, &address->peer))) { 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, * @return GNUNET_OK */ static int -mlp_get_preferred_address_it (void *cls, - const struct GNUNET_PeerIdentity *key, +mlp_get_preferred_address_it (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { static int counter = 0; @@ -1563,7 +1563,7 @@ mlp_get_preferred_address_it (void *cls, } -static double +static double get_peer_pref_value (struct GAS_MLP_Handle *mlp, const struct GNUNET_PeerIdentity *peer) { double res; @@ -1616,8 +1616,8 @@ GAS_mlp_get_preferred_address (void *solver, p = GNUNET_malloc (sizeof (struct ATS_Peer)); p->id = (*peer); p->f = get_peer_pref_value (mlp, peer); - GNUNET_CONTAINER_multipeermap_put (mlp->requested_peers, - peer, p, + GNUNET_CONTAINER_multipeermap_put (mlp->requested_peers, + peer, p, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); /* Added new peer, we have to rebuild problem before solving */ @@ -1780,7 +1780,7 @@ GAS_mlp_address_preference_feedback (void *solver, static int -mlp_free_peers (void *cls, +mlp_free_peers (void *cls, const struct GNUNET_PeerIdentity *key, void *value) { struct GNUNET_CONTAINER_MultiPeerMap *map = cls; @@ -1807,8 +1807,8 @@ GAS_mlp_done (void *solver) LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down mlp solver\n"); mlp_delete_problem (mlp); - GNUNET_CONTAINER_multipeermap_iterate (mlp->requested_peers, - &mlp_free_peers, + GNUNET_CONTAINER_multipeermap_iterate (mlp->requested_peers, + &mlp_free_peers, mlp->requested_peers); GNUNET_CONTAINER_multipeermap_destroy (mlp->requested_peers); 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) * @return GNUNET_OK (continue to iterate) */ static int -find_best_address_it (void *cls, +find_best_address_it (void *cls, const struct GNUNET_PeerIdentity *key, void *value) { @@ -721,7 +721,7 @@ get_network (struct GAS_PROPORTIONAL_Handle *s, uint32_t type) * @return #GNUNET_NO on double active address else #GNUNET_YES; */ static int -get_active_address_it (void *cls, +get_active_address_it (void *cls, const struct GNUNET_PeerIdentity *key, void *value) { 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 * for (cur = solver->agents_head; NULL != cur; cur = cur->next) { - if (0 == memcmp (peer, + if (0 == memcmp (peer, &cur->peer, sizeof (struct GNUNET_PeerIdentity))) { 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 * @return #GNUNET_YES to continue, #GNUNET_NO if address is founce */ static int -compare_address_it (void *cls, - const struct GNUNET_PeerIdentity *key, +compare_address_it (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { struct CompareAddressContext *cac = cls; @@ -675,7 +675,7 @@ find_equivalent_address (struct GAS_Addresses_Handle *handle, cac.base_address = NULL; cac.search = addr; GNUNET_CONTAINER_multipeermap_get_multiple (handle->addresses, - peer, + peer, &compare_address_it, &cac); if (cac.exact_address == NULL) @@ -1076,7 +1076,7 @@ destroy_by_session_id (void *cls, /* Notify solver about deletion */ GNUNET_assert( - GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (handle->addresses, + GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (handle->addresses, &aa->peer, aa)); handle->s_del (handle->solver, aa, GNUNET_NO); free_address (aa); @@ -1321,16 +1321,16 @@ GAS_addresses_request_address (struct GAS_Addresses_Handle *handle, * @return #GNUNET_OK to continue */ static int -reset_address_it (void *cls, - const struct GNUNET_PeerIdentity *key, +reset_address_it (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { struct ATS_Address *aa = value; GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Resetting interval for peer `%s' address %p from %llu to 0\n", - GNUNET_i2s (&aa->peer), - aa, + GNUNET_i2s (&aa->peer), + aa, aa->block_interval); aa->blocked_until = GNUNET_TIME_UNIT_ZERO_ABS; aa->block_interval = GNUNET_TIME_UNIT_ZERO; @@ -1846,7 +1846,7 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_ATS_NetworkTypeCount); ah->solver = ah->s_init (cfg, stats, ah->addresses, quotas, quotas_in, - quotas_out, quota_count, + quotas_out, quota_count, &bandwidth_changed_cb, ah, &get_preferences_cb, NULL, &get_property_cb, NULL ); if (NULL == ah->solver) @@ -1873,7 +1873,7 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, * @return #GNUNET_OK (continue to iterate) */ static int -destroy_all_address_it (void *cls, +destroy_all_address_it (void *cls, const struct GNUNET_PeerIdentity *key, void *value) { @@ -1881,7 +1881,7 @@ destroy_all_address_it (void *cls, struct ATS_Address *aa = value; /* Remove */ - GNUNET_assert(GNUNET_YES == + GNUNET_assert(GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (handle->addresses, key, value)); /* Notify */ handle->s_del (handle->solver, aa, GNUNET_NO); @@ -1958,7 +1958,7 @@ struct PeerIteratorContext * @return #GNUNET_OK to continue */ static int -peer_it (void *cls, +peer_it (void *cls, const struct GNUNET_PeerIdentity *key, void *value) { @@ -2000,7 +2000,7 @@ GAS_addresses_iterate_peers (struct GAS_Addresses_Handle *handle, ip_ctx.it_cls = p_it_cls; ip_ctx.peers_returned = GNUNET_CONTAINER_multipeermap_create (size, GNUNET_NO); - GNUNET_CONTAINER_multipeermap_iterate (handle->addresses, + GNUNET_CONTAINER_multipeermap_iterate (handle->addresses, &peer_it, &ip_ctx); 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, static int -normalize_address (void *cls, +normalize_address (void *cls, const struct GNUNET_PeerIdentity *h, void *k) { @@ -693,8 +693,8 @@ normalize_address (void *cls, */ static void property_normalize (struct GNUNET_CONTAINER_MultiPeerMap *addresses, - struct Property *p, - struct ATS_Address *address, + struct Property *p, + struct ATS_Address *address, uint32_t avg_value) { struct FindMinMaxCtx find_ctx; @@ -762,7 +762,7 @@ property_normalize (struct GNUNET_CONTAINER_MultiPeerMap *addresses, */ void GAS_normalization_normalize_property (struct GNUNET_CONTAINER_MultiPeerMap *addresses, - struct ATS_Address *address, + struct ATS_Address *address, const struct GNUNET_ATS_Information *atsi, uint32_t atsi_count) { 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 () * @return GNUNET_OK (continue to iterate) */ static int -free_tracker (void *cls, +free_tracker (void *cls, const struct GNUNET_PeerIdentity *key, void *value) { 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, (GLP_YES == full_lp_presolv) ? "YES" : "NO", (GNUNET_OK == full_mip_presolv) ? "YES" : "NO", (unsigned long long) full_build_dur.rel_value_us, - (unsigned long long) full_lp_dur.rel_value_us, + (unsigned long long) full_lp_dur.rel_value_us, (unsigned long long) full_mip_dur.rel_value_us); if ((0 < opt_update_quantity) || (0 < opt_update_percent)) - fprintf (stderr, + fprintf (stderr, "Update: %03u peers each %02u addresses; rebuild: LP/MIP state [%3s/%3s] presolv [%3s/%3s], (build/LP/MIP in us) %04llu / %04llu / %04llu\n", cp + 1, ca, (GNUNET_OK == update_lp_res) ? "OK" : "FAIL", @@ -385,31 +385,31 @@ check (void *cls, char *const *args, const char *cfgfile, (GLP_YES == update_lp_presolv) ? "YES" : "NO", (GNUNET_OK == update_mip_presolv) ? "YES" : "NO", (unsigned long long) update_build_dur.rel_value_us, - (unsigned long long) update_lp_dur.rel_value_us, + (unsigned long long) update_lp_dur.rel_value_us, (unsigned long long) update_mip_dur.rel_value_us); } else { - fprintf (stderr, + fprintf (stderr, "Rebuild;%u;%u;%s;%s;%s;%s;%04llu;%04llu;%04llu\n", cp + 1, ca, (GNUNET_OK == full_lp_res) ? "OK" : "FAIL", (GNUNET_OK == full_mip_res) ? "OK" : "FAIL", (GLP_YES == full_lp_presolv) ? "YES" : "NO", (GNUNET_OK == full_mip_presolv) ? "YES" : "NO", - (unsigned long long) full_build_dur.rel_value_us, - (unsigned long long) full_lp_dur.rel_value_us, + (unsigned long long) full_build_dur.rel_value_us, + (unsigned long long) full_lp_dur.rel_value_us, (unsigned long long) full_mip_dur.rel_value_us); if ((0 < opt_update_quantity) || (0 < opt_update_percent)) - fprintf (stderr, + fprintf (stderr, "Update;%u;%u;%s;%s;%s;%s;%04llu;%04llu;%04llu\n", cp + 1, ca, (GNUNET_OK == update_lp_res) ? "OK" : "FAIL", (GNUNET_OK == update_mip_res) ? "OK" : "FAIL", (GLP_YES == update_lp_presolv) ? "YES" : "NO", (GNUNET_OK == update_mip_presolv) ? "YES" : "NO", - (unsigned long long) update_build_dur.rel_value_us, - (unsigned long long) update_lp_dur.rel_value_us, + (unsigned long long) update_build_dur.rel_value_us, + (unsigned long long) update_lp_dur.rel_value_us, (unsigned long long) update_mip_dur.rel_value_us); } } 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, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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) } static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg, struct GNUNET_TESTING_Peer *peer) { 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) } static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg, struct GNUNET_TESTING_Peer *peer) { 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, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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, if (3 == stage) { /* Suggestion after resetting block interval */ - reset_block_duration = GNUNET_TIME_absolute_get_difference (reset_block_start, + reset_block_duration = GNUNET_TIME_absolute_get_difference (reset_block_start, GNUNET_TIME_absolute_get()); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Address suggestion after resetting blocking took about %s!\n", @@ -180,7 +180,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, if (((initial_duration.rel_value_us * 3) <= block_duration.rel_value_us) && ((reset_block_duration.rel_value_us * 3) <= block_duration.rel_value_us)) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Address suggestion after resetting blocking and initial suggestion (%llu us) much faster than with blocking (%llu us)\n", (unsigned long long) initial_duration.rel_value_us, (unsigned long long) block_duration.rel_value_us); @@ -188,7 +188,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, } else { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Address suggestion after resetting blocking and initial suggestion (%llu us) not faster than with blocking (%llu us)\n", (unsigned long long) initial_duration.rel_value_us, (unsigned long long) block_duration.rel_value_us); @@ -211,7 +211,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stage %u: Callback with correct address `%s'\n", stage, GNUNET_i2s (&address->peer)); ret = 0; @@ -228,7 +228,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: Callback with incorrect ats info \n"); GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); GNUNET_SCHEDULER_add_now (&end, NULL); @@ -246,16 +246,16 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, /* Initial suggestion */ if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Stage %u: Callback with correct address `%s'\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Stage %u: Callback with correct address `%s'\n", stage, GNUNET_i2s (&address->peer)); ret = 0; } else { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Stage %u: Callback with invalid address `%s'\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Stage %u: Callback with invalid address `%s'\n", stage, GNUNET_i2s (&address->peer)); GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); @@ -265,7 +265,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: Callback with incorrect ats info\n", stage); GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); @@ -274,8 +274,8 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, } stage++; initial_duration = GNUNET_TIME_absolute_get_difference(initial_start, GNUNET_TIME_absolute_get()); - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Stage %u: Initial suggestion took about %s\n", + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Stage %u: Initial suggestion took about %s\n", stage, GNUNET_STRINGS_relative_time_to_string (block_duration, GNUNET_YES)); @@ -288,8 +288,8 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, /* Startup suggestion */ if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Stage %u: Callback with correct address `%s'\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Stage %u: Callback with correct address `%s'\n", stage, GNUNET_i2s (&address->peer)); ret = 0; @@ -297,7 +297,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, else { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Stage %u: Callback with invalid address `%s'\n", + "Stage %u: Callback with invalid address `%s'\n", stage, GNUNET_i2s (&address->peer)); GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); @@ -307,7 +307,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, if (GNUNET_OK != compare_ats (atsi, ats_count, test_ats_info, test_ats_count)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: Callback with incorrect ats info\n", stage); GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); @@ -325,7 +325,7 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { @@ -336,7 +336,7 @@ run (void *cls, sched_ats = GNUNET_ATS_scheduling_init (cfg, &address_suggest_cb, NULL); if (sched_ats == NULL) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not connect to ATS scheduling!\n"); ret = 1; 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, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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, } static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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, * @param lib_ret the plugin API */ static void -add_plugin (void *cls, - const char *library_name, +add_plugin (void *cls, + const char *library_name, void *lib_ret) { struct GNUNET_BLOCK_Context *ctx = cls; struct GNUNET_BLOCK_PluginFunctions *api = lib_ret; struct Plugin *plugin; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Loading block plugin `%s'\n", library_name); 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, struct GNUNET_HashCode chash; struct GNUNET_HashCode mhash; /* FIXME: check validity first... */ - + /* mandatory duplicate-detection code... */ if (NULL != bf) { 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, * Entry point for the plugin. * * @param cls NULL - * @return the exported block API + * @return the exported block API */ void * libgnunet_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 @@ /** * @file consensus/consensus_api.c - * @brief + * @brief * @author Florian Dold */ #include "platform.h" @@ -103,7 +103,7 @@ struct InsertDoneInfo /** * Called when the server has sent is a new element - * + * * @param cls consensus handle * @param mh element message */ @@ -129,7 +129,7 @@ handle_new_element (void *cls, /** * Called when the server has announced * that the conclusion is over. - * + * * @param cls consensus handle * @param msg conclude done message */ @@ -220,7 +220,7 @@ idc_adapter (void *cls) * * @param consensus handle for the consensus session * @param element the element to be inserted - * @param idc function called when we are done with this element and it + * @param idc function called when we are done with this element and it * is thus allowed to call GNUNET_CONSENSUS_insert again * @param idc_cls closure for 'idc' */ @@ -240,7 +240,7 @@ GNUNET_CONSENSUS_insert (struct GNUNET_CONSENSUS_Handle *consensus, GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_INSERT); memcpy (&element_msg[1], element->data, element->size); - + if (NULL != idc) { 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, int idx = chp - consensus_handles; GNUNET_assert (NULL != cls); - + results_for_peer[idx]++; 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 * Only valid once the current round is not CONSENSUS_ROUND_BEGIN. */ struct GNUNET_TIME_Relative conclude_timeout; - + /** * Timeout task identifier for the current round. */ @@ -286,7 +286,7 @@ have_exp_subround_finished (const struct ConsensusSession *session) { int not_finished; not_finished = 0; - if ( (NULL != session->partner_outgoing) && + if ( (NULL != session->partner_outgoing) && (GNUNET_NO == session->partner_outgoing->exp_subround_finished) ) not_finished++; if ( (NULL != session->partner_incoming) && @@ -300,7 +300,7 @@ have_exp_subround_finished (const struct ConsensusSession *session) /** * Destroy a session, free all resources associated with it. - * + * * @param session the session to destroy */ static void @@ -404,7 +404,7 @@ send_to_client_iter (void *cls, * @param tc task context, for when this task is invoked by the scheduler, * NULL if invoked for another reason */ -static void +static void round_over (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct ConsensusSession *session; @@ -459,7 +459,7 @@ shuffle (struct ConsensusSession *session) if (NULL == session->shuffle_inv) session->shuffle_inv = GNUNET_malloc (session->num_peers * sizeof (*session->shuffle_inv)); - GNUNET_CRYPTO_kdf (randomness, sizeof (randomness), + GNUNET_CRYPTO_kdf (randomness, sizeof (randomness), &session->exp_round, sizeof (uint32_t), &session->global_id, sizeof (struct GNUNET_HashCode), NULL); @@ -559,7 +559,7 @@ find_partners (struct ConsensusSession *session) * @param element a result element, only valid if status is GNUNET_SET_STATUS_OK * @param status see enum GNUNET_SET_Status */ -static void +static void set_result_cb (void *cls, const struct GNUNET_SET_Element *element, enum GNUNET_SET_Status status) @@ -674,7 +674,7 @@ subround_over (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_SCHEDULER_cancel (session->round_timeout_tid); session->round_timeout_tid = GNUNET_SCHEDULER_NO_TASK; } - + if (session->exp_round >= NUM_EXP_ROUNDS) { round_over (session, NULL); @@ -700,7 +700,7 @@ subround_over (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) session->exp_subround = 0; shuffle (session); } - else + else { session->exp_subround++; } @@ -810,7 +810,7 @@ get_peer_idx (const struct GNUNET_PeerIdentity *peer, const struct ConsensusSess * @param session_id local id of the consensus session */ static void -compute_global_id (struct ConsensusSession *session, +compute_global_id (struct ConsensusSession *session, const struct GNUNET_HashCode *session_id) { int i; @@ -865,7 +865,7 @@ initialize_session_peer_list (struct ConsensusSession *session, /* peers in the join message, may or may not include the local peer */ listed_peers = ntohl (join_msg->num_peers); - + session->num_peers = listed_peers; msg_peers = (struct GNUNET_PeerIdentity *) &join_msg[1]; @@ -1025,7 +1025,7 @@ initialize_session (struct ConsensusSession *session, other_session = sessions_head; while (NULL != other_session) { - if ((other_session != session) && + if ((other_session != session) && (0 == GNUNET_CRYPTO_hash_cmp (&session->global_id, &other_session->global_id))) { 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, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICK_UP */ struct GNUNET_MessageHeader header; - + /* followed by variable length 0-terminated string with meta data */ }; @@ -132,7 +132,7 @@ struct ClientPhoneHangupMessage * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP */ struct GNUNET_MessageHeader header; - + /* followed by variable length 0-terminated string with meta data */ }; @@ -190,7 +190,7 @@ struct ClientPhonePickedupMessage * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP */ struct GNUNET_MessageHeader header; - + /* followed by variable length 0-terminated string with meta data */ }; @@ -233,7 +233,7 @@ struct MeshPhoneRingMessage /** * When does the signature expire? - */ + */ struct GNUNET_TIME_AbsoluteNBO expiration_time; /** 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 @@ /* This file is part of GNUnet (C) 2013 Christian Grothoff (and other contributing authors) - + GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. - + GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, @@ -75,7 +75,7 @@ struct GNUNET_CONVERSATION_Phone * Our configuration. */ const struct GNUNET_CONFIGURATION_Handle *cfg; - + /** * Handle to talk with CONVERSATION service. */ @@ -103,7 +103,7 @@ struct GNUNET_CONVERSATION_Phone /** * Connection to NAMESTORE (for reverse lookup). - */ + */ struct GNUNET_NAMESTORE_Handle *ns; /** @@ -119,7 +119,7 @@ struct GNUNET_CONVERSATION_Phone /** * This phone's record. */ - struct GNUNET_CONVERSATION_PhoneRecord my_record; + struct GNUNET_CONVERSATION_PhoneRecord my_record; /** * My GNS zone. @@ -316,7 +316,7 @@ handle_phone_audio_message (void *cls, /** - * We encountered an error talking with the conversation service. + * We encountered an error talking with the conversation service. * * @param cls the `struct GNUNET_CONVERSATION_Phone` * @param error details about the error @@ -326,7 +326,7 @@ phone_error_handler (void *cls, enum GNUNET_MQ_Error error) { struct GNUNET_CONVERSATION_Phone *phone = cls; - + GNUNET_break (0); FPRINTF (stderr, _("Internal error %d\n"), @@ -346,15 +346,15 @@ reconnect_phone (struct GNUNET_CONVERSATION_Phone *phone) static struct GNUNET_MQ_MessageHandler handlers[] = { { &handle_phone_ring, - GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING, + GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING, sizeof (struct ClientPhoneRingMessage) }, { &handle_phone_hangup, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP, 0 }, { &handle_phone_audio_message, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO, - 0 }, - { NULL, 0, 0 } + 0 }, + { NULL, 0, 0 } }; struct GNUNET_MQ_Envelope *e; struct ClientPhoneRegisterMessage *reg; @@ -408,7 +408,7 @@ GNUNET_CONVERSATION_phone_create (const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned long long line; if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_number (cfg, + GNUNET_CONFIGURATION_get_value_number (cfg, "CONVERSATION", "LINE", &line)) @@ -478,7 +478,7 @@ transmit_phone_audio (void *cls, struct ClientAudioMessage *am; GNUNET_assert (PS_ACTIVE == phone->state); - e = GNUNET_MQ_msg_extra (am, + e = GNUNET_MQ_msg_extra (am, data_size, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO); memcpy (&am[1], data, data_size); @@ -487,7 +487,7 @@ transmit_phone_audio (void *cls, /** - * Picks up a (ringing) phone. This will connect the speaker + * Picks up a (ringing) phone. This will connect the speaker * to the microphone of the other party, and vice versa. * * @param phone phone to pick up @@ -630,7 +630,7 @@ struct GNUNET_CONVERSATION_Call * Our configuration. */ const struct GNUNET_CONFIGURATION_Handle *cfg; - + /** * Handle to talk with CONVERSATION service. */ @@ -655,7 +655,7 @@ struct GNUNET_CONVERSATION_Call * Our microphone. */ struct GNUNET_MICROPHONE_Handle *mic; - + /** * Function to call with events. */ @@ -673,7 +673,7 @@ struct GNUNET_CONVERSATION_Call /** * Connection to GNS (can be NULL). - */ + */ struct GNUNET_GNS_Handle *gns; /** @@ -754,7 +754,7 @@ transmit_call_audio (void *cls, struct ClientAudioMessage *am; GNUNET_assert (CS_ACTIVE == call->state); - e = GNUNET_MQ_msg_extra (am, + e = GNUNET_MQ_msg_extra (am, data_size, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO); memcpy (&am[1], data, data_size); @@ -782,7 +782,7 @@ handle_call_picked_up (void *cls, metadata = (const char *) &am[1]; if ( (0 == size) || ('\0' != metadata[size - 1]) ) - metadata = NULL; + metadata = NULL; switch (call->state) { case CS_LOOKUP: @@ -830,7 +830,7 @@ handle_call_hangup (void *cls, reason = (const char *) &am[1]; if ( (0 == size) || ('\0' != reason[size - 1]) ) - reason = NULL; + reason = NULL; switch (call->state) { case CS_LOOKUP: @@ -900,7 +900,7 @@ handle_call_audio_message (void *cls, * @param rd_count number of records in @a rd * @param rd the records in reply */ -static void +static void handle_gns_response (void *cls, uint32_t rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -919,7 +919,7 @@ handle_gns_response (void *cls, { GNUNET_break_op (0); continue; - } + } memcpy (&call->phone_record, rd[i].data, rd[i].data_size); @@ -942,7 +942,7 @@ handle_gns_response (void *cls, /** - * We encountered an error talking with the conversation service. + * We encountered an error talking with the conversation service. * * @param cls the `struct GNUNET_CONVERSATION_Call` * @param error details about the error @@ -972,18 +972,18 @@ reconnect_call (struct GNUNET_CONVERSATION_Call *call) static struct GNUNET_MQ_MessageHandler handlers[] = { { &handle_call_busy, - GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_BUSY, + GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_BUSY, sizeof (struct ClientPhoneBusyMessage) }, { &handle_call_picked_up, - GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP, + GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP, 0 }, { &handle_call_hangup, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP, 0 }, { &handle_call_audio_message, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO, - 0 }, - { NULL, 0, 0 } + 0 }, + { NULL, 0, 0 } }; struct GNUNET_CRYPTO_EccPublicSignKey my_zone; @@ -1013,7 +1013,7 @@ reconnect_call (struct GNUNET_CONVERSATION_Call *call) call->state = CS_LOOKUP; GNUNET_IDENTITY_ego_get_public_key (call->caller_id, &my_zone); - call->gns_lookup = GNUNET_GNS_lookup (call->gns, + call->gns_lookup = GNUNET_GNS_lookup (call->gns, call->callee, &my_zone, 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 @@ */ #include "platform.h" #include "gnunet_util_lib.h" -#include "gnunet_speaker_lib.h" -#include "gnunet_microphone_lib.h" +#include "gnunet_speaker_lib.h" +#include "gnunet_microphone_lib.h" /** * How long do we record before we replay? @@ -117,7 +117,7 @@ do_shutdown (void *cls, rec); GNUNET_free (rec); } - fprintf (stderr, + fprintf (stderr, _("\nEnd of transmission. Have a GNU day.\n")); } @@ -145,7 +145,7 @@ switch_to_speaker (void *cls, GNUNET_SCHEDULER_shutdown (); return; } - fprintf (stderr, + fprintf (stderr, _("\nWe are now playing your recording back. If you can hear it, your audio settings are working...")); for (rec=rec_head; NULL != rec; rec = rec->next) { @@ -170,7 +170,7 @@ switch_to_speaker (void *cls, * @param data_size number of bytes in @a data * @param data audio data to play */ -static void +static void record (void *cls, size_t data_size, const void *data) @@ -211,7 +211,7 @@ run (void *cls, char *const *args, const char *cfgfile, st = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_shutdown, NULL); - fprintf (stderr, + fprintf (stderr, _("We will now be recording you for %s. After that time, the recording will be played back to you..."), GNUNET_STRINGS_relative_time_to_string (TIMEOUT, GNUNET_YES)); 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 @@ /* This file is part of GNUnet. (C) 2013 Christian Grothoff (and other contributing authors) - + GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. - + GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, @@ -173,7 +173,7 @@ phone_event_handler (void *cls, ...) { va_list va; - + va_start (va, code); switch (code) { @@ -268,7 +268,7 @@ call_event_handler (void *cls, ...) { va_list va; - + va_start (va, code); switch (code) { @@ -338,7 +338,7 @@ struct VoipCommand * Command the user needs to enter. */ const char *command; - + /** * Function to call on command. */ @@ -380,8 +380,8 @@ do_quit (const char *args) static void do_unknown (const char *msg) { - FPRINTF (stderr, - _("Unknown command `%s'\n"), + FPRINTF (stderr, + _("Unknown command `%s'\n"), msg); } @@ -403,7 +403,7 @@ do_call (const char *arg) } switch (state) { - case CS_LOOKUP_EGO: + case CS_LOOKUP_EGO: FPRINTF (stderr, _("Ego `%s' not available\n"), ego_name); @@ -470,7 +470,7 @@ do_accept (const char *args) { switch (state) { - case CS_LOOKUP_EGO: + case CS_LOOKUP_EGO: case CS_LISTEN: case CS_ERROR: FPRINTF (stderr, @@ -497,7 +497,7 @@ do_accept (const char *args) return; } GNUNET_assert (NULL != phone); - GNUNET_CONVERSATION_phone_pick_up (phone, + GNUNET_CONVERSATION_phone_pick_up (phone, args, speaker, mic); @@ -536,7 +536,7 @@ do_status (const char *args) { switch (state) { - case CS_LOOKUP_EGO: + case CS_LOOKUP_EGO: FPRINTF (stdout, _("We are currently trying to locate the private key for the ego `%s'.\n"), ego_name); @@ -586,7 +586,7 @@ do_reject (const char *args) { switch (state) { - case CS_LOOKUP_EGO: + case CS_LOOKUP_EGO: case CS_LISTEN: case CS_ERROR: FPRINTF (stderr, @@ -604,7 +604,7 @@ do_reject (const char *args) if (NULL == call) { GNUNET_assert (NULL != phone); - GNUNET_CONVERSATION_phone_hang_up (phone, + GNUNET_CONVERSATION_phone_hang_up (phone, args); state = CS_LISTEN; } @@ -621,9 +621,9 @@ do_reject (const char *args) * List of supported commands. */ static struct VoipCommand commands[] = { - {"/address", &do_address, + {"/address", &do_address, gettext_noop ("Use `/address' to find out which address this phone should have in GNS")}, - {"/call", &do_call, + {"/call", &do_call, gettext_noop ("Use `/call USER.gnu' to call USER")}, {"/accept", &do_accept, gettext_noop ("Use `/accept MESSAGE' to accept an incoming call")}, @@ -631,11 +631,11 @@ static struct VoipCommand commands[] = { gettext_noop ("Use `/cancel MESSAGE' to reject or terminate a call")}, {"/status", &do_status, gettext_noop ("Use `/status' to print status information")}, - {"/quit", &do_quit, + {"/quit", &do_quit, gettext_noop ("Use `/quit' to terminate gnunet-conversation")}, {"/help", &do_help, gettext_noop ("Use `/help command' to get help for a specific command")}, - {"", &do_unknown, + {"", &do_unknown, NULL}, {NULL, NULL, NULL}, }; @@ -650,8 +650,8 @@ static void do_help (const char *args) { unsigned int i; - - i = 0; + + i = 0; while ( (NULL != args) && (0 != strlen (args)) && (commands[i].Action != &do_help)) @@ -659,7 +659,7 @@ do_help (const char *args) if (0 == strncasecmp (&args[1], &commands[i].command[1], strlen (args) - 1)) { - FPRINTF (stdout, + FPRINTF (stdout, "%s\n", gettext (commands[i].helptext)); return; @@ -667,13 +667,13 @@ do_help (const char *args) i++; } i = 0; - FPRINTF (stdout, - "%s", + FPRINTF (stdout, + "%s", "Available commands:\n"); while (commands[i].Action != &do_help) { - FPRINTF (stdout, - "%s\n", + FPRINTF (stdout, + "%s\n", gettext (commands[i].command)); i++; } @@ -710,7 +710,7 @@ do_stop_task (void *cls, { GNUNET_SCHEDULER_cancel (handle_cmd_task); handle_cmd_task = GNUNET_SCHEDULER_NO_TASK; - } + } if (NULL != id) { GNUNET_IDENTITY_disconnect (id); @@ -799,7 +799,7 @@ identity_cb (void *cls, ego_name)) return; if (NULL == ego) - { + { if (verbose) FPRINTF (stdout, _("Our ego `%s' was deleted!\n"), @@ -826,7 +826,7 @@ identity_cb (void *cls, */ static void run (void *cls, - char *const *args, + char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) { @@ -851,7 +851,7 @@ run (void *cls, } -/** +/** * The main function to conversation. * * @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]; * Message callback */ static int -stdin_receiver (void *cls, +stdin_receiver (void *cls, void *client, const struct GNUNET_MessageHeader *msg) { @@ -113,7 +113,7 @@ stdin_receiver (void *cls, { case GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO: audio = (struct AudioMessage *) msg; - + ret = opus_decode_float (dec, (const unsigned char *) &audio[1], ntohs (audio->header.size) - sizeof (struct AudioMessage), @@ -132,12 +132,12 @@ stdin_receiver (void *cls, if (pa_stream_write (stream_out, pcm_buffer, pcm_length, NULL, 0, PA_SEEK_RELATIVE) < 0) - { + { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_stream_write() failed: %s\n"), pa_strerror (pa_context_errno (context))); return GNUNET_OK; - } + } break; default: break; @@ -161,8 +161,8 @@ quit (int ret) * Callback when data is there for playback */ static void -stream_write_callback (pa_stream * s, - size_t length, +stream_write_callback (pa_stream * s, + size_t length, void *userdata) { /* unblock 'main' */ @@ -192,7 +192,7 @@ exit_signal_callback (pa_mainloop_api * m, pa_signal_event * e, int sig, * Pulseaudio stream state callback */ static void -context_state_callback (pa_context * c, +context_state_callback (pa_context * c, void *userdata) { int p; @@ -203,7 +203,7 @@ context_state_callback (pa_context * c, case PA_CONTEXT_CONNECTING: case PA_CONTEXT_AUTHORIZING: case PA_CONTEXT_SETTING_NAME: - break; + break; case PA_CONTEXT_READY: { GNUNET_assert (!stream_out); @@ -216,12 +216,12 @@ context_state_callback (pa_context * c, _("pa_stream_new() failed: %s\n"), pa_strerror (pa_context_errno (c))); goto fail; - } - pa_stream_set_write_callback (stream_out, + } + pa_stream_set_write_callback (stream_out, &stream_write_callback, NULL); if ((p = - pa_stream_connect_playback (stream_out, NULL, + pa_stream_connect_playback (stream_out, NULL, NULL, PA_STREAM_ADJUST_LATENCY | PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE, NULL, NULL)) < 0) @@ -232,19 +232,19 @@ context_state_callback (pa_context * c, goto fail; } break; - } + } case PA_CONTEXT_TERMINATED: quit (0); break; - + case PA_CONTEXT_FAILED: default: - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Connection failure: %s\n"), pa_strerror (pa_context_errno (c))); goto fail; - } - return; + } + return; fail: quit (1); } @@ -260,13 +260,13 @@ pa_init () if (!pa_sample_spec_valid (&sample_spec)) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Wrong Spec\n")); - } - /* set up threaded playback mainloop */ + } + /* set up threaded playback mainloop */ if (!(m = pa_threaded_mainloop_new ())) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_mainloop_new() failed.\n")); } mainloop_api = pa_threaded_mainloop_get_api (m); @@ -280,9 +280,9 @@ pa_init () /* connect to the main pulseaudio context */ if (!(context = pa_context_new (mainloop_api, "GNUnet VoIP"))) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_context_new() failed.\n")); - } + } pa_context_set_state_callback (context, context_state_callback, NULL); if (pa_context_connect (context, NULL, 0, NULL) < 0) @@ -290,10 +290,10 @@ pa_init () GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_context_connect() failed: %s\n"), pa_strerror (pa_context_errno (context))); - } + } if (pa_threaded_mainloop_start (m) < 0) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_mainloop_run() failed.\n")); } } @@ -354,7 +354,7 @@ main (int argc, char *argv[]) ready_pipe[1] = -1; while (1) { - ret = read (0, readbuf, sizeof (readbuf)); + ret = read (0, readbuf, sizeof (readbuf)); toff += ret; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %d bytes of audio data (total: %llu)\n", @@ -363,10 +363,10 @@ main (int argc, char *argv[]) if (0 > ret) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _("Read error from STDIN: %s\n"), + _("Read error from STDIN: %s\n"), strerror (errno)); break; - } + } if (0 == ret) break; 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; static float *pcm_buffer; /** - * Length of the pcm data needed for one OPUS frame + * Length of the pcm data needed for one OPUS frame */ static int pcm_length; @@ -151,7 +151,7 @@ packetizer () size_t off; ssize_t ret; int len; // FIXME: int? - size_t msg_size; + size_t msg_size; while (transmit_buffer_length >= transmit_buffer_index + pcm_length) { @@ -195,9 +195,9 @@ packetizer () if (0 != new_size) { nbuf = pa_xmalloc (new_size); - memmove (nbuf, + memmove (nbuf, &transmit_buffer[transmit_buffer_index], - new_size); + new_size); pa_xfree (transmit_buffer); transmit_buffer = nbuf; } @@ -207,7 +207,7 @@ packetizer () transmit_buffer = NULL; } transmit_buffer_index = 0; - transmit_buffer_length = new_size; + transmit_buffer_length = new_size; } @@ -216,7 +216,7 @@ packetizer () */ static void stream_read_callback (pa_stream * s, - size_t length, + size_t length, void *userdata) { const void *data; @@ -233,7 +233,7 @@ stream_read_callback (pa_stream * s, if (pa_stream_peek (s, (const void **) &data, &length) < 0) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_stream_peek() failed: %s\n"), pa_strerror (pa_context_errno (context))); quit (1); @@ -243,9 +243,9 @@ stream_read_callback (pa_stream * s, GNUNET_assert (length > 0); if (NULL != transmit_buffer) { - transmit_buffer = pa_xrealloc (transmit_buffer, + transmit_buffer = pa_xrealloc (transmit_buffer, transmit_buffer_length + length); - memcpy (&transmit_buffer[transmit_buffer_length], + memcpy (&transmit_buffer[transmit_buffer_length], data, length); transmit_buffer_length += length; @@ -266,12 +266,12 @@ stream_read_callback (pa_stream * s, * Exit callback for SIGTERM and SIGINT */ static void -exit_signal_callback (pa_mainloop_api * m, - pa_signal_event * e, +exit_signal_callback (pa_mainloop_api * m, + pa_signal_event * e, int sig, void *userdata) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Got signal, exiting.\n")); quit (1); } @@ -289,17 +289,17 @@ stream_state_callback (pa_stream * s, void *userdata) { case PA_STREAM_CREATING: case PA_STREAM_TERMINATED: - break; + break; case PA_STREAM_READY: { const pa_buffer_attr *a; char cmt[PA_CHANNEL_MAP_SNPRINT_MAX], sst[PA_SAMPLE_SPEC_SNPRINT_MAX]; - + GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Stream successfully created.\n")); - + if (!(a = pa_stream_get_buffer_attr (s))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -313,24 +313,24 @@ stream_state_callback (pa_stream * s, void *userdata) GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Buffer metrics: maxlength=%u, fragsize=%u\n"), a->maxlength, a->fragsize); - } + } GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Using sample spec '%s', channel map '%s'.\n"), pa_sample_spec_snprint (sst, sizeof (sst), pa_stream_get_sample_spec (s)), pa_channel_map_snprint (cmt, sizeof (cmt), pa_stream_get_channel_map (s))); - + GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connected to device %s (%u, %ssuspended).\n"), pa_stream_get_device_name (s), pa_stream_get_device_index (s), pa_stream_is_suspended (s) ? "" : "not "); - } + } break; case PA_STREAM_FAILED: default: - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Stream error: %s\n"), pa_strerror (pa_context_errno (pa_stream_get_context (s)))); quit (1); @@ -357,9 +357,9 @@ context_state_callback (pa_context * c, { int r; pa_buffer_attr na; - - GNUNET_assert (!stream_in); - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + + GNUNET_assert (!stream_in); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connection established.\n")); if (! (stream_in = pa_stream_new (c, "GNUNET_VoIP recorder", &sample_spec, NULL))) @@ -374,7 +374,7 @@ context_state_callback (pa_context * c, memset (&na, 0, sizeof (na)); na.maxlength = UINT32_MAX; na.fragsize = pcm_length; - if ((r = pa_stream_connect_record (stream_in, NULL, &na, + if ((r = pa_stream_connect_record (stream_in, NULL, &na, PA_STREAM_ADJUST_LATENCY)) < 0) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -382,12 +382,12 @@ context_state_callback (pa_context * c, pa_strerror (pa_context_errno (c))); goto fail; } - + break; - } + } case PA_CONTEXT_TERMINATED: quit (0); - break; + break; case PA_CONTEXT_FAILED: default: GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -413,13 +413,13 @@ pa_init () if (!pa_sample_spec_valid (&sample_spec)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Wrong Spec\n")); } /* set up main record loop */ if (!(m = pa_mainloop_new ())) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_mainloop_new() failed.\n")); } mainloop_api = pa_mainloop_get_api (m); @@ -434,9 +434,9 @@ pa_init () if (!(context = pa_context_new (mainloop_api, "GNUNET VoIP"))) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_context_new() failed.\n")); - } + } pa_context_set_state_callback (context, &context_state_callback, NULL); if (pa_context_connect (context, NULL, 0, NULL) < 0) { @@ -446,7 +446,7 @@ pa_init () } if (pa_mainloop_run (m, &i) < 0) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("pa_mainloop_run() failed.\n")); } } @@ -466,7 +466,7 @@ opus_init () pcm_buffer = pa_xmalloc (pcm_length); opus_data = GNUNET_malloc (max_payload_bytes); enc = opus_encoder_create (SAMPLING_RATE, - channels, + channels, OPUS_APPLICATION_VOIP, &err); 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 @@ /* This file is part of GNUnet. (C) 2013 Christian Grothoff (and other contributing authors) - + GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. - + GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, @@ -105,7 +105,7 @@ struct Line * Handle for the reliable tunnel (contol data) */ struct GNUNET_MESH_Tunnel *tunnel_reliable; - + /** * Handle for unreliable tunnel (audio data) */ @@ -153,7 +153,7 @@ struct Line /** * Current status of this line. - */ + */ enum LineStatus status; }; @@ -374,7 +374,7 @@ mq_done_finish_caller_shutdown (void *cls) case LS_CALLER_SHUTDOWN: destroy_line_mesh_tunnels (line); break; - } + } } @@ -536,7 +536,7 @@ transmit_line_audio (void *cls, { struct Line *line = cls; struct MeshAudioMessage *mam = buf; - + line->unreliable_mth = NULL; if ( (NULL == buf) || (size < sizeof (struct MeshAudioMessage) + line->audio_size) ) @@ -553,7 +553,7 @@ transmit_line_audio (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending %u bytes of audio data via mesh\n", line->audio_size); - return sizeof (struct MeshAudioMessage) + line->audio_size; + return sizeof (struct MeshAudioMessage) + line->audio_size; } @@ -610,7 +610,7 @@ handle_client_audio_message (void *cls, { GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK, _("Mesh audio channel not ready; audio data dropped\n")); - GNUNET_SERVER_receive_done (client, GNUNET_OK); + GNUNET_SERVER_receive_done (client, GNUNET_OK); return; } if (NULL != line->unreliable_mth) @@ -632,7 +632,7 @@ handle_client_audio_message (void *cls, line->unreliable_mth = GNUNET_MESH_notify_transmit_ready (line->tunnel_unreliable, GNUNET_NO, GNUNET_TIME_UNIT_FOREVER_REL, - sizeof (struct MeshAudioMessage) + sizeof (struct MeshAudioMessage) + line->audio_size, &transmit_line_audio, line); @@ -641,7 +641,7 @@ handle_client_audio_message (void *cls, /** - * We are done signalling shutdown to the other peer. + * We are done signalling shutdown to the other peer. * Destroy the tunnel. * * @param cls the `struct GNUNET_MESH_tunnel` to destroy @@ -650,7 +650,7 @@ static void mq_done_destroy_tunnel (void *cls) { struct GNUNET_MESH_Tunnel *tunnel = cls; - + GNUNET_MESH_tunnel_destroy (tunnel); } @@ -675,7 +675,7 @@ handle_mesh_ring_message (void *cls, struct GNUNET_MQ_Envelope *e; struct MeshPhoneBusyMessage *busy; struct ClientPhoneRingMessage cring; - + msg = (const struct MeshPhoneRingMessage *) message; if ( (msg->purpose.size != htonl (sizeof (struct GNUNET_PeerIdentity) * 2 + sizeof (struct GNUNET_TIME_AbsoluteNBO) + @@ -690,11 +690,11 @@ handle_mesh_ring_message (void *cls, GNUNET_break_op (0); return GNUNET_SYSERR; } - for (line = lines_head; NULL != line; line = line->next) + for (line = lines_head; NULL != line; line = line->next) if ( (line->local_line == ntohl (msg->remote_line)) && (LS_CALLEE_LISTEN == line->status) ) break; - if (NULL == line) + if (NULL == line) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("No available phone for incoming call on line %u, sending BUSY signal\n"), @@ -748,7 +748,7 @@ handle_mesh_hangup_message (void *cls, size_t len = ntohs (message->size) - sizeof (struct MeshPhoneHangupMessage); char buf[len + sizeof (struct ClientPhoneHangupMessage)]; struct ClientPhoneHangupMessage *hup; - + msg = (const struct MeshPhoneHangupMessage *) message; len = ntohs (msg->header.size) - sizeof (struct MeshPhoneHangupMessage); reason = (const char *) &msg[1]; @@ -831,7 +831,7 @@ handle_mesh_pickup_message (void *cls, size_t len = ntohs (message->size) - sizeof (struct MeshPhonePickupMessage); char buf[len + sizeof (struct ClientPhonePickupMessage)]; struct ClientPhonePickupMessage *pick; - + msg = (const struct MeshPhonePickupMessage *) message; len = ntohs (msg->header.size) - sizeof (struct MeshPhonePickupMessage); metadata = (const char *) &msg[1]; @@ -895,7 +895,7 @@ handle_mesh_pickup_message (void *cls, if (NULL == line->tunnel_unreliable) { GNUNET_break (0); - } + } return GNUNET_OK; } @@ -988,7 +988,7 @@ handle_mesh_audio_message (void *cls, char buf[msize + sizeof (struct ClientAudioMessage)]; struct ClientAudioMessage *cam; const union GNUNET_MESH_TunnelInfo *info; - + msg = (const struct MeshAudioMessage *) message; if (NULL == line) { @@ -1014,7 +1014,7 @@ handle_mesh_audio_message (void *cls, "Received AUDIO data for non-existing line %u, dropping.\n", ntohl (msg->remote_line)); return GNUNET_SYSERR; - } + } line->tunnel_unreliable = tunnel; *tunnel_ctx = line; } @@ -1047,11 +1047,11 @@ handle_mesh_audio_message (void *cls, static void * inbound_tunnel (void *cls, struct GNUNET_MESH_Tunnel *tunnel, - const struct GNUNET_PeerIdentity *initiator, + const struct GNUNET_PeerIdentity *initiator, uint32_t port) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _("Received incoming tunnel on port %u\n"), + _("Received incoming tunnel on port %u\n"), (unsigned int) port); return NULL; } @@ -1131,7 +1131,7 @@ inbound_end (void *cls, * @param client identification of the client */ static void -handle_client_disconnect (void *cls, +handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) { struct Line *line; @@ -1155,7 +1155,7 @@ handle_client_disconnect (void *cls, /** * Shutdown nicely - * + * * @param cls closure, NULL * @param tc the task context */ @@ -1184,7 +1184,7 @@ do_shutdown (void *cls, * @param c configuration */ static void -run (void *cls, +run (void *cls, struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c) { @@ -1210,23 +1210,23 @@ run (void *cls, {&handle_mesh_ring_message, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING, sizeof (struct MeshPhoneRingMessage)}, - {&handle_mesh_hangup_message, + {&handle_mesh_hangup_message, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP, 0}, - {&handle_mesh_pickup_message, + {&handle_mesh_pickup_message, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP, 0}, - {&handle_mesh_busy_message, + {&handle_mesh_busy_message, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_BUSY, sizeof (struct MeshPhoneBusyMessage)}, {&handle_mesh_audio_message, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO, 0}, {NULL, 0, 0} }; - static uint32_t ports[] = { + static uint32_t ports[] = { GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL, GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO, - 0 + 0 }; cfg = c; @@ -1236,8 +1236,8 @@ run (void *cls, mesh = GNUNET_MESH_connect (cfg, NULL, &inbound_tunnel, - &inbound_end, - mesh_handlers, + &inbound_end, + mesh_handlers, ports); if (NULL == mesh) @@ -1249,7 +1249,7 @@ run (void *cls, nc = GNUNET_SERVER_notification_context_create (server, 16); GNUNET_SERVER_add_handlers (server, server_handlers); GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL); - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_shutdown, NULL); } @@ -1263,12 +1263,12 @@ run (void *cls, * @return 0 ok, 1 on error */ int -main (int argc, +main (int argc, char *const *argv) { return (GNUNET_OK == GNUNET_SERVICE_run (argc, argv, - "conversation", + "conversation", GNUNET_SERVICE_OPTION_NONE, &run, NULL)) ? 0 : 1; } 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 @@ /* This file is part of GNUnet (C) 2013 Christian Grothoff (and other contributing authors) - + GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. - + GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, @@ -101,8 +101,8 @@ enable (void *cls, GNUNET_MICROPHONE_RecordedDataCallback rdc, void *rdc_cls) { - struct Microphone *mic = cls; - static char * const record_helper_argv[] = + struct Microphone *mic = cls; + static char * const record_helper_argv[] = { "gnunet-helper-audio-record", NULL @@ -113,14 +113,14 @@ enable (void *cls, mic->record_helper = GNUNET_HELPER_start (GNUNET_NO, "gnunet-helper-audio-record", record_helper_argv, - &process_record_messages, - NULL, mic); + &process_record_messages, + NULL, mic); if (NULL == mic->record_helper) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Could not start record audio helper\n")); return GNUNET_SYSERR; - } + } return GNUNET_OK; } 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 @@ /* This file is part of GNUnet (C) 2013 Christian Grothoff (and other contributing authors) - + GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. - + GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, @@ -57,17 +57,17 @@ struct Speaker static int enable (void *cls) { - struct Speaker *spe = cls; - static char *playback_helper_argv[] = + struct Speaker *spe = cls; + static char *playback_helper_argv[] = { "gnunet-helper-audio-playback", NULL }; - + spe->playback_helper = GNUNET_HELPER_start (GNUNET_NO, "gnunet-helper-audio-playback", playback_helper_argv, - NULL, + NULL, NULL, spe); if (NULL == spe->playback_helper) { @@ -143,8 +143,8 @@ play (void *cls, am->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO); memcpy (&am[1], data, data_size); (void) GNUNET_HELPER_send (spe->playback_helper, - &am->header, - GNUNET_NO, + &am->header, + GNUNET_NO, NULL, NULL); } 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 () int main (int argc, char *argv[]) { - GNUNET_log_setup ("test_conversation_api", + GNUNET_log_setup ("test_conversation_api", "WARNING", NULL); 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) * @return #GNUNET_YES (continue) */ static int -disconnect_and_free_peer_entry (void *cls, +disconnect_and_free_peer_entry (void *cls, const struct GNUNET_PeerIdentity *key, void *value) { @@ -572,7 +572,7 @@ transmission_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param cls closure with the 'struct GNUNET_CORE_Handle' * @param size number of bytes available in @a buf * @param buf where the callee should write the message - * @return number of bytes written to buf + * @return number of bytes written to buf */ static size_t transmit_message (void *cls, size_t size, void *buf) @@ -649,7 +649,7 @@ transmit_message (void *cls, size_t size, void *buf) ret = th->get_message (th->get_message_cls, size - sizeof (struct SendMessage), &sm[1]); - + LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting SEND request to `%s' yielded %u bytes.\n", GNUNET_i2s (&pr->peer), ret); @@ -1093,7 +1093,7 @@ reconnect (struct GNUNET_CORE_Handle *h) else opt |= GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND; } - LOG (GNUNET_ERROR_TYPE_INFO, + LOG (GNUNET_ERROR_TYPE_INFO, "(Re)connecting to CORE service, monitoring messages of type %u\n", opt); 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, * @param peer peer identity this notification is about */ static void -connected_peer_callback (void *cls, +connected_peer_callback (void *cls, const struct GNUNET_PeerIdentity *peer) { 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; /** * Last task run during shutdown. Disconnects us from * the transport. - * + * * @param cls NULL, unused * @param tc scheduler context, unused */ @@ -114,7 +114,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, pk = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile); GNUNET_free (keyfile); GNUNET_assert (NULL != pk); - if ((GNUNET_OK != GSC_KX_init (pk)) || + if ((GNUNET_OK != GSC_KX_init (pk)) || (GNUNET_OK != GSC_NEIGHBOURS_init ())) { 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, GNUNET_snprintf (buf, sizeof (buf), gettext_noop ("# bytes of messages of type %u received"), (unsigned int) ntohs (message->type)); - GNUNET_STATISTICS_update (GSC_stats, buf, ntohs (message->size), GNUNET_NO); + GNUNET_STATISTICS_update (GSC_stats, buf, ntohs (message->size), GNUNET_NO); if (0 == memcmp (&car->target, &GSC_my_identity, sizeof (struct GNUNET_PeerIdentity))) @@ -536,7 +536,7 @@ client_tokenizer_callback (void *cls, void *client, GNUNET_CORE_OPTION_SEND_FULL_INBOUND); GSC_CLIENTS_deliver_message (&GSC_my_identity, message, sizeof (struct GNUNET_MessageHeader), - GNUNET_CORE_OPTION_SEND_HDR_INBOUND); + GNUNET_CORE_OPTION_SEND_HDR_INBOUND); } else { @@ -548,7 +548,7 @@ client_tokenizer_callback (void *cls, void *client, GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND); GSC_CLIENTS_deliver_message (&car->target, message, sizeof (struct GNUNET_MessageHeader), - GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND); + GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND); GSC_SESSIONS_transmit (car, message, tc->cork); } return GNUNET_OK; @@ -564,7 +564,7 @@ client_tokenizer_callback (void *cls, void *client, * @return #GNUNET_YES (continue iteration) */ static int -destroy_active_client_request (void *cls, +destroy_active_client_request (void *cls, const struct GNUNET_PeerIdentity *key, void *value) { @@ -765,7 +765,7 @@ GSC_CLIENTS_notify_clients_about_neighbour (const struct GNUNET_PeerIdentity struct GSC_Client *c; for (c = client_head; c != NULL; c = c->next) - GSC_CLIENTS_notify_client_about_neighbour (c, neighbour, + GSC_CLIENTS_notify_client_about_neighbour (c, neighbour, tmap_old, tmap_new); } @@ -784,7 +784,7 @@ GSC_CLIENTS_notify_clients_about_neighbour (const struct GNUNET_PeerIdentity void GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender, const struct GNUNET_MessageHeader *msg, - uint16_t msize, + uint16_t msize, uint32_t options) { 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 * At what time was this key created (beginning of validity). */ struct GNUNET_TIME_AbsoluteNBO creation_time; - + /** * When does the given ephemeral key expire (end of validity). */ @@ -111,7 +111,7 @@ struct EphemeralKeyMessage * Ephemeral public ECC key (always for NIST P-521) encoded in a format suitable * for network transmission as created using 'gcry_sexp_sprint'. */ - struct GNUNET_CRYPTO_EccPublicEncryptKey ephemeral_key; + struct GNUNET_CRYPTO_EccPublicEncryptKey ephemeral_key; /** * Public key of the signing peer (persistent version, not the ephemeral public key). @@ -407,7 +407,7 @@ static struct GSC_KeyExchangeInfo *kx_tail; /** * Task scheduled for periodic re-generation (and thus rekeying) of our * ephemeral key. - */ + */ static GNUNET_SCHEDULER_TaskIdentifier rekey_task; @@ -424,10 +424,10 @@ derive_auth_key (struct GNUNET_CRYPTO_AuthKey *akey, { static const char ctx[] = "authentication key"; - GNUNET_CRYPTO_hmac_derive_key (akey, skey, - &seed, sizeof (seed), - skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), - ctx, sizeof (ctx), + GNUNET_CRYPTO_hmac_derive_key (akey, skey, + &seed, sizeof (seed), + skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), + ctx, sizeof (ctx), NULL); } @@ -473,8 +473,8 @@ derive_pong_iv (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, GNUNET_CRYPTO_symmetric_derive_iv (iv, skey, &seed, sizeof (seed), identity, sizeof (struct GNUNET_PeerIdentity), - &challenge, sizeof (challenge), - ctx, sizeof (ctx), + &challenge, sizeof (challenge), + ctx, sizeof (ctx), NULL); } @@ -485,7 +485,7 @@ derive_pong_iv (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, * @param sender peer identity of the sender * @param receiver peer identity of the sender * @param key_material high entropy key material to use - * @param skey set to derived session key + * @param skey set to derived session key */ static void derive_aes_key (const struct GNUNET_PeerIdentity *sender, @@ -661,7 +661,7 @@ GSC_KX_start (const struct GNUNET_PeerIdentity *pid) struct GNUNET_HashCode h1; struct GNUNET_HashCode h2; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Initiating key exchange with `%s'\n", GNUNET_i2s (pid)); GNUNET_STATISTICS_update (GSC_stats, @@ -675,12 +675,12 @@ GSC_KX_start (const struct GNUNET_PeerIdentity *pid) kx); GNUNET_CRYPTO_hash (pid, sizeof (struct GNUNET_PeerIdentity), &h1); GNUNET_CRYPTO_hash (&GSC_my_identity, sizeof (struct GNUNET_PeerIdentity), &h2); - - if (0 < GNUNET_CRYPTO_hash_cmp (&h1, + + if (0 < GNUNET_CRYPTO_hash_cmp (&h1, &h2)) { /* peer with "lower" identity starts KX, otherwise we typically end up - with both peers starting the exchange and transmit the 'set key' + with both peers starting the exchange and transmit the 'set key' message twice */ kx->status = KX_STATE_KEY_SENT; send_key (kx); @@ -744,10 +744,10 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, struct GNUNET_TIME_Absolute start_t; struct GNUNET_TIME_Absolute end_t; struct GNUNET_TIME_Absolute now; - enum KxStateMachine sender_status; + enum KxStateMachine sender_status; uint16_t size; struct GNUNET_HashCode key_material; - + size = ntohs (msg->size); if (sizeof (struct EphemeralKeyMessage) != size) { @@ -758,7 +758,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, end_t = GNUNET_TIME_absolute_ntoh (m->expiration_time); if ( ( (KX_STATE_KEY_RECEIVED == kx->status) || (KX_STATE_UP == kx->status) || - (KX_STATE_REKEY_SENT == kx->status) ) && + (KX_STATE_REKEY_SENT == kx->status) ) && (end_t.abs_value_us <= kx->foreign_key_expires.abs_value_us) ) { GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# old ephemeral keys ignored"), @@ -777,7 +777,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, memcmp (&m->origin_identity, &kx->peer.public_key, sizeof (struct GNUNET_PeerIdentity))) - { + { GNUNET_break_op (0); return; } @@ -810,7 +810,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, } if (GNUNET_OK != GNUNET_CRYPTO_ecc_ecdh (my_ephemeral_key, - &m->ephemeral_key, + &m->ephemeral_key, &key_material)) { GNUNET_break (0); @@ -834,7 +834,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, setup_fresh_ping (kx); /* check if we still need to send the sender our key */ - sender_status = (enum KxStateMachine) ntohl (m->sender_status); + sender_status = (enum KxStateMachine) ntohl (m->sender_status); switch (sender_status) { case KX_STATE_DOWN: @@ -844,7 +844,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, /* fine, need to send our key after updating our status, see below */ break; case KX_STATE_KEY_RECEIVED: - case KX_STATE_UP: + case KX_STATE_UP: case KX_STATE_REKEY_SENT: /* other peer already got our key */ break; @@ -875,7 +875,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, send_key (kx); send_ping (kx); break; - case KX_STATE_UP: + case KX_STATE_UP: kx->status = KX_STATE_REKEY_SENT; if (KX_STATE_KEY_SENT == sender_status) send_key (kx); @@ -922,7 +922,7 @@ GSC_KX_handle_ping (struct GSC_KeyExchangeInfo *kx, GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# PING messages received"), 1, GNUNET_NO); - if ( (kx->status != KX_STATE_KEY_RECEIVED) && + if ( (kx->status != KX_STATE_KEY_RECEIVED) && (kx->status != KX_STATE_UP) && (kx->status != KX_STATE_REKEY_SENT)) { @@ -1128,7 +1128,7 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx, { GNUNET_SCHEDULER_cancel (kx->retry_set_key_task); kx->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK; - } + } switch (kx->status) { case KX_STATE_DOWN: @@ -1184,11 +1184,11 @@ send_key (struct GSC_KeyExchangeInfo *kx) kx->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK; } /* always update sender status in SET KEY message */ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending key to `%s' (my status: %d)\n", GNUNET_i2s (&kx->peer), kx->status); - current_ekm.sender_status = htonl ((int32_t) (kx->status)); + current_ekm.sender_status = htonl ((int32_t) (kx->status)); GSC_NEIGHBOURS_transmit (&kx->peer, ¤t_ekm.header, kx->set_key_retry_frequency); kx->retry_set_key_task = @@ -1236,8 +1236,8 @@ GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx, used - ENCRYPTED_HEADER_SIZE)); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypted %u bytes for %s\n", used - ENCRYPTED_HEADER_SIZE, GNUNET_i2s (&kx->peer)); - derive_auth_key (&auth_key, - &kx->encrypt_key, + derive_auth_key (&auth_key, + &kx->encrypt_key, ph->iv_seed); GNUNET_CRYPTO_hmac (&auth_key, &em->sequence_number, used - ENCRYPTED_HEADER_SIZE, &em->hmac); @@ -1327,8 +1327,8 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx, if (0 != memcmp (&ph, &m->hmac, sizeof (struct GNUNET_HashCode))) { /* checksum failed */ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Failed checksum validation for a message from `%s'\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Failed checksum validation for a message from `%s'\n", GNUNET_i2s (&kx->peer)); return; } @@ -1542,7 +1542,7 @@ GSC_KX_init (struct GNUNET_CRYPTO_EccPrivateKey *pk) { GNUNET_assert (NULL != pk); my_private_key = pk; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, + GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, &GSC_my_identity.public_key); if (GNUNET_YES == 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 () * @return GNUNET_OK (continue to iterate) */ static int -free_neighbour_helper (void *cls, - const struct GNUNET_PeerIdentity * key, +free_neighbour_helper (void *cls, + const struct GNUNET_PeerIdentity * key, void *value) { 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) GNUNET_free (sme); } GNUNET_SCHEDULER_cancel (session->typemap_task); - GSC_CLIENTS_notify_clients_about_neighbour (&session->peer, + GSC_CLIENTS_notify_clients_about_neighbour (&session->peer, session->tmap, NULL); GNUNET_assert (GNUNET_YES == 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) static void -init_notify (void *cls, +init_notify (void *cls, const struct GNUNET_PeerIdentity *my_identity) { struct PeerContext *p = cls; @@ -299,8 +299,8 @@ setup_peer (struct PeerContext *p, const char *cfgname) binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); p->cfg = GNUNET_CONFIGURATION_create (); p->arm_proc = - GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, - NULL, NULL, + GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, + NULL, NULL, binary, "gnunet-service-arm", "-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[] = { static void -init_notify (void *cls, +init_notify (void *cls, const struct GNUNET_PeerIdentity *my_identity) { 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) static void -init (void *cls, +init (void *cls, const struct GNUNET_PeerIdentity *my_identity) { if (NULL == my_identity) @@ -152,7 +152,7 @@ run (void *cls, }; core = GNUNET_CORE_connect (cfg, NULL, &init, &connect_cb, NULL, NULL, - 0, NULL, 0, handlers); + 0, NULL, 0, handlers); die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (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) static void -init_notify (void *cls, +init_notify (void *cls, const struct GNUNET_PeerIdentity *my_identity) { 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[] = { static void -init_notify (void *cls, +init_notify (void *cls, const struct GNUNET_PeerIdentity *my_identity) { 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, bf_size = quota / 32; /* 8 bit per entry, 1 bit per 32 kb in DB */ ret = GNUNET_malloc (sizeof (struct GNUNET_DATACACHE_Handle)); - + if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "DISABLE_BF")) { @@ -166,12 +166,12 @@ GNUNET_DATACACHE_create (const struct GNUNET_CONFIGURATION_Handle *cfg, if (NULL != ret->bloom_name) { ret->filter = GNUNET_CONTAINER_bloomfilter_load (ret->bloom_name, quota / 1024, /* 8 bit per entry in DB, expect 1k entries */ - 5); - } + 5); + } if (NULL == ret->filter) { ret->filter = GNUNET_CONTAINER_bloomfilter_init (NULL, bf_size, 5); /* approx. 3% false positives at max use */ - } + } } ret->stats = GNUNET_STATISTICS_create ("datacache", cfg); ret->section = GNUNET_strdup (section); @@ -247,8 +247,8 @@ GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, { ssize_t used; - used = h->api->put (h->api->cls, key, - size, data, + used = h->api->put (h->api->cls, key, + size, data, type, discard_time, path_info_len, path_info); 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; static int -checkIt (void *cls, +checkIt (void *cls, const struct GNUNET_HashCode * key, size_t size, const char *data, enum GNUNET_BLOCK_Type type, 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 * Type of the block. */ enum GNUNET_BLOCK_Type type; - + }; @@ -110,7 +110,7 @@ struct PutContext /** * Expiration time for the new value. */ - struct GNUNET_TIME_Absolute discard_time; + struct GNUNET_TIME_Absolute discard_time; /** * Data for the new value. @@ -155,7 +155,7 @@ struct PutContext * * @param cls the 'struct PutContext' * @param key the key for the value(s) - * @param value an existing value + * @param value an existing value * @return GNUNET_YES if not found (to continue to iterate) */ static int @@ -170,16 +170,16 @@ put_cb (void *cls, (val->type == put_ctx->type) && (0 == memcmp (&val[1], put_ctx->data, put_ctx->size)) ) { - put_ctx->found = GNUNET_YES; + put_ctx->found = GNUNET_YES; val->discard_time = GNUNET_TIME_absolute_max (val->discard_time, put_ctx->discard_time); /* replace old path with new path */ GNUNET_array_grow (val->path_info, val->path_info_len, put_ctx->path_info_len); - memcpy (val->path_info, + memcpy (val->path_info, put_ctx->path_info, - put_ctx->path_info_len * sizeof (struct GNUNET_PeerIdentity)); + put_ctx->path_info_len * sizeof (struct GNUNET_PeerIdentity)); GNUNET_CONTAINER_heap_update_cost (put_ctx->heap, val->hn, val->discard_time.abs_value_us); @@ -289,7 +289,7 @@ struct GetContext * * @param cls the 'struct GetContext' * @param key the key for the value(s) - * @param value an existing value + * @param value an existing value * @return GNUNET_YES to continue to iterate */ static int @@ -341,7 +341,7 @@ heap_plugin_get (void *cls, const struct GNUNET_HashCode * key, get_ctx.type = type; get_ctx.iter = iter; - get_ctx.iter_cls = iter_cls; + get_ctx.iter_cls = iter_cls; get_ctx.cnt = 0; GNUNET_CONTAINER_multihashmap_get_multiple (plugin->map, key, @@ -363,7 +363,7 @@ heap_plugin_del (void *cls) { struct Plugin *plugin = cls; struct Value *val; - + val = GNUNET_CONTAINER_heap_remove_root (plugin->heap); if (NULL == val) 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) " value BYTEA NOT NULL DEFAULT ''," " path BYTEA DEFAULT '')" "WITH OIDS"); - if ( (ret == NULL) || - ((PQresultStatus (ret) != PGRES_COMMAND_OK) && + if ( (ret == NULL) || + ((PQresultStatus (ret) != PGRES_COMMAND_OK) && (0 != strcmp ("42P07", /* duplicate table */ PQresultErrorField (ret, PG_DIAG_SQLSTATE))))) { - (void) GNUNET_POSTGRES_check_result (plugin->dbh, ret, + (void) GNUNET_POSTGRES_check_result (plugin->dbh, ret, PGRES_COMMAND_OK, "CREATE TABLE", "gn090dc"); PQfinish (plugin->dbh); @@ -198,7 +198,7 @@ postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size, PQexecPrepared (plugin->dbh, "put", 5, paramValues, paramLengths, paramFormats, 1); if (GNUNET_OK != - GNUNET_POSTGRES_check_result (plugin->dbh, ret, + GNUNET_POSTGRES_check_result (plugin->dbh, ret, PGRES_COMMAND_OK, "PQexecPrepared", "put")) return -1; PQclear (ret); @@ -258,7 +258,7 @@ postgres_plugin_get (void *cls, const struct GNUNET_HashCode * key, if (0 == (cnt = PQntuples (res))) { /* no result */ - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Ending iteration (no more results)\n"); PQclear (res); return 0; @@ -289,7 +289,7 @@ postgres_plugin_get (void *cls, const struct GNUNET_HashCode * key, } path_len %= sizeof (struct GNUNET_PeerIdentity); path = (const struct GNUNET_PeerIdentity *) PQgetvalue (res, i, 3); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Found result of size %u bytes and type %u in database\n", (unsigned int) size, (unsigned int) type); if (GNUNET_SYSERR == @@ -299,7 +299,7 @@ postgres_plugin_get (void *cls, const struct GNUNET_HashCode * key, path_len, path)) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Ending iteration (client error)\n"); PQclear (res); return cnt; @@ -330,14 +330,14 @@ postgres_plugin_del (void *cls) if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, res, PGRES_TUPLES_OK, "PQexecPrepared", "getm")) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Ending iteration (postgres error)\n"); return 0; } if (0 == PQntuples (res)) { /* no result */ - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Ending iteration (no more results)\n"); PQclear (res); return GNUNET_SYSERR; @@ -388,7 +388,7 @@ libgnunet_plugin_datacache_postgres_init (void *cls) api->get = &postgres_plugin_get; api->put = &postgres_plugin_put; api->del = &postgres_plugin_del; - LOG (GNUNET_ERROR_TYPE_INFO, + LOG (GNUNET_ERROR_TYPE_INFO, _("Postgres datacache running\n")); return api; } 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 * @param type type of the value * @param discard_time when to discard the value in any case * @param path_info_len number of entries in 'path_info' - * @param path_info array of peers that have processed the request + * @param path_info array of peers that have processed the request * @return 0 if duplicate, -1 on error, number of bytes used otherwise */ static ssize_t sqlite_plugin_put (void *cls, const struct GNUNET_HashCode *key, - size_t size, const char *data, + size_t size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute discard_time, unsigned int path_info_len, @@ -135,11 +135,11 @@ sqlite_plugin_put (void *cls, key, sizeof (struct GNUNET_HashCode), SQLITE_TRANSIENT)) || (SQLITE_OK != sqlite3_bind_blob (stmt, 4, - data, size, + data, size, SQLITE_TRANSIENT)) || - (SQLITE_OK != sqlite3_bind_blob (stmt, 5, - path_info, - path_info_len * sizeof (struct GNUNET_PeerIdentity), + (SQLITE_OK != sqlite3_bind_blob (stmt, 5, + path_info, + path_info_len * sizeof (struct GNUNET_PeerIdentity), SQLITE_TRANSIENT))) { 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; static int -checkIt (void *cls, - const struct GNUNET_HashCode *key, +checkIt (void *cls, + const struct GNUNET_HashCode *key, size_t size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute exp, @@ -75,7 +75,7 @@ run (void *cls, char *const *args, const char *cfgfile, if (h == NULL) { FPRINTF (stderr, - "%s", + "%s", "Failed to initialize datacache. Database likely not setup, skipping test.\n"); return; } @@ -87,7 +87,7 @@ run (void *cls, char *const *args, const char *cfgfile, GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n); ASSERT (GNUNET_OK == GNUNET_DATACACHE_put (h, &k, sizeof (struct GNUNET_HashCode), - (const char *) &n, 1 + i % 16, exp, + (const char *) &n, 1 + i % 16, exp, 0, NULL)); k = n; } 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, GNUNET_assert (pos->response_proc != NULL); /* move 'pos' element to head so that it will be * killed on 'NULL' call below */ - LOG (GNUNET_ERROR_TYPE_DEBUG, "Dropping request from datastore queue\n"); + LOG (GNUNET_ERROR_TYPE_DEBUG, "Dropping request from datastore queue\n"); GNUNET_CONTAINER_DLL_remove (h->queue_head, h->queue_tail, pos); GNUNET_CONTAINER_DLL_insert (h->queue_head, h->queue_tail, pos); GNUNET_STATISTICS_update (h->stats, @@ -691,7 +691,7 @@ process_queue (struct GNUNET_DATASTORE_Handle *h) * @param emsg error message */ static void -drop_status_cont (void *cls, int32_t result, +drop_status_cont (void *cls, int32_t result, struct GNUNET_TIME_Absolute min_expiration, const char *emsg) { @@ -800,7 +800,7 @@ process_status_message (void *cls, const struct GNUNET_MessageHeader *msg) h->retry_time = GNUNET_TIME_UNIT_ZERO; process_queue (h); if (rc.cont != NULL) - rc.cont (rc.cont_cls, status, + rc.cont (rc.cont_cls, status, GNUNET_TIME_absolute_ntoh (sm->min_expiration), emsg); } @@ -1039,7 +1039,7 @@ GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, uint64_t uid, cont = &drop_status_cont; LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to update entry %llu raising priority by %u and expiration to %s\n", - uid, + uid, (unsigned int) priority, GNUNET_STRINGS_absolute_time_to_string (expiration)); 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, /** * Perform next GET operation. */ -static void +static void do_get (void); @@ -101,7 +101,7 @@ do_get (void); * space for 0-priority content * @param msg NULL on success, otherwise an error message */ -static void +static void do_finish (void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiration, @@ -135,7 +135,7 @@ do_finish (void *cls, * @param uid unique identifier for the datum; * maybe 0 if no unique identifier is available */ -static void +static void do_put (void *cls, const struct GNUNET_HashCode *key, size_t size, const void *data, @@ -156,8 +156,8 @@ do_put (void *cls, first_uid = uid; qe = GNUNET_DATASTORE_put (db_dst, 0, key, size, data, type, - priority, anonymity, - 0 /* FIXME: replication is lost... */, + priority, anonymity, + 0 /* FIXME: replication is lost... */, expiration, 0, 1, GNUNET_TIME_UNIT_FOREVER_REL, &do_finish, NULL); @@ -167,7 +167,7 @@ do_put (void *cls, /** * Perform next GET operation. */ -static void +static void do_get () { qe = GNUNET_DATASTORE_get_key (db_src, @@ -185,7 +185,7 @@ do_get () * * @param cls closure * @param args remaining command-line arguments - * @param cfgfile name of the configuration file used + * @param cfgfile name of the configuration file used * @param cfg configuration -- for destination datastore */ static void @@ -196,7 +196,7 @@ run (void *cls, char *const *args, const char *cfgfile, return; /* nothing to be done */ if (0 == strcmp (cfgfile, alternative_cfg)) { - fprintf (stderr, + fprintf (stderr, _("Cannot use the same configuration for source and destination\n")); ret = 1; return; @@ -253,7 +253,7 @@ main (int argc, char *const *argv) if (GNUNET_OK != GNUNET_PROGRAM_run (argc, argv, "gnunet-datastore", gettext_noop ("Manipulate GNUnet datastore"), - options, &run, NULL)) + options, &run, NULL)) ret = 1; GNUNET_free ((void*) argv); 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, "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", (unsigned long long) (size + GNUNET_DATASTORE_ENTRY_OVERHEAD), (unsigned int) priority, - GNUNET_h2s (key), type, + GNUNET_h2s (key), type, GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (expiration), GNUNET_YES), *need); @@ -1473,7 +1473,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, sizeof (struct GNUNET_MessageHeader)}, {NULL, NULL, 0, 0} }; - char *fn; + char *fn; char *pfn; unsigned int bf_size; int refresh_bf; @@ -1504,7 +1504,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, cache_size = quota / 8; /* Or should we make this an option? */ GNUNET_STATISTICS_set (stats, gettext_noop ("# cache size"), cache_size, GNUNET_NO); - if (quota / (32 * 1024LL) > (1 << 31)) + if (quota / (32 * 1024LL) > (1 << 31)) bf_size = (1 << 31); /* absolute limit: ~2 GB, beyond that BF just won't help anyway */ else 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, GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Rebuilding bloomfilter. Please be patient.\n")); if (NULL != plugin->api->get_keys) - plugin->api->get_keys (plugin->api->cls, &add_key_to_bloomfilter, filter); + plugin->api->get_keys (plugin->api->cls, &add_key_to_bloomfilter, filter); else GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("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 static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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, memcpy (&i, &cdata[4], sizeof (i)); hits[i / 8] |= (1 << (i % 8)); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found result %d type=%u, priority=%u, size=%u, expire=%s\n", i, - type, priority, size, + type, priority, size, GNUNET_STRINGS_absolute_time_to_string (expiration)); crc->cnt++; if (crc->cnt == PUT_10 / 4 - 1) @@ -349,7 +349,7 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_break (0); crc->phase = RP_ERROR; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "In phase %d, iteration %u\n", crc->phase, crc->cnt); switch (crc->phase) { 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 @@ /** * A value that we are storing. - */ + */ struct Value { @@ -67,11 +67,11 @@ struct Value * only used if anonymity is zero. */ unsigned int zero_anon_offset; - + /** * Number of bytes in 'data'. */ - uint32_t size; + uint32_t size; /** * Priority of the value. @@ -82,7 +82,7 @@ struct Value * Anonymity level for the value. */ uint32_t anonymity; - + /** * Replication level for the value. */ @@ -209,10 +209,10 @@ heap_plugin_estimate_size (void *cls) * @return GNUNET_OK on success */ static int -heap_plugin_put (void *cls, - const struct GNUNET_HashCode * key, +heap_plugin_put (void *cls, + const struct GNUNET_HashCode * key, uint32_t size, - const void *data, + const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, uint32_t anonymity, uint32_t replication, @@ -328,7 +328,7 @@ struct GetContext * The plugin. */ struct Plugin *plugin; - + /** * Requested value hash. */ @@ -343,7 +343,7 @@ struct GetContext * Function to call with the result. */ PluginDatumProcessor proc; - + /** * Closure for 'proc'. */ @@ -358,7 +358,7 @@ struct GetContext * @param value the value to check against the query * @return GNUNET_YES if the value matches */ -static int +static int match (const struct GetContext *gc, struct Value *value) { @@ -421,7 +421,7 @@ get_iterator (void *cls, if (0 != gc->offset--) return GNUNET_OK; if (GNUNET_NO == - gc->proc (gc->proc_cls, + gc->proc (gc->proc_cls, key, value->size, &value[1], @@ -476,7 +476,7 @@ heap_plugin_get_key (void *cls, uint64_t offset, &gc); if (0 == gc.offset) { - proc (proc_cls, + proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); return; } @@ -489,11 +489,11 @@ heap_plugin_get_key (void *cls, uint64_t offset, { GNUNET_CONTAINER_multihashmap_get_multiple (plugin->keyvalue, key, - &count_iterator, + &count_iterator, &gc); if (0 == gc.offset) { - proc (proc_cls, + proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); return; } @@ -518,7 +518,7 @@ heap_plugin_get_key (void *cls, uint64_t offset, * @param proc_cls closure for proc */ static void -heap_plugin_get_replication (void *cls, +heap_plugin_get_replication (void *cls, PluginDatumProcessor proc, void *proc_cls) { @@ -528,7 +528,7 @@ heap_plugin_get_replication (void *cls, value = GNUNET_CONTAINER_heap_remove_root (plugin->by_replication); if (NULL == value) { - proc (proc_cls, + proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); return; } @@ -537,18 +537,18 @@ heap_plugin_get_replication (void *cls, value->replication--; value->replication_heap = GNUNET_CONTAINER_heap_insert (plugin->by_replication, value, - value->replication); + value->replication); } else { /* need a better way to pick a random item, replication level is always 0 */ value->replication_heap = GNUNET_CONTAINER_heap_insert (plugin->by_replication, value, - value->replication); + value->replication); value = GNUNET_CONTAINER_heap_walk_get_next (plugin->by_replication); } if (GNUNET_NO == - proc (proc_cls, + proc (proc_cls, &value->key, value->size, &value[1], @@ -579,12 +579,12 @@ heap_plugin_get_expiration (void *cls, PluginDatumProcessor proc, value = GNUNET_CONTAINER_heap_peek (plugin->by_expiration); if (NULL == value) { - proc (proc_cls, + proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); return; } if (GNUNET_NO == - proc (proc_cls, + proc (proc_cls, &value->key, value->size, &value[1], @@ -618,8 +618,8 @@ heap_plugin_get_expiration (void *cls, PluginDatumProcessor proc, * @return GNUNET_OK on success */ static int -heap_plugin_update (void *cls, - uint64_t uid, +heap_plugin_update (void *cls, + uint64_t uid, int delta, struct GNUNET_TIME_Absolute expire, char **msg) { @@ -675,10 +675,10 @@ heap_plugin_get_zero_anonymity (void *cls, uint64_t offset, } if (0 == count) { - proc (proc_cls, + proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); return; - } + } offset = offset % count; for (zabt = plugin->zero_head; NULL != zabt; zabt = zabt->next) { @@ -695,7 +695,7 @@ heap_plugin_get_zero_anonymity (void *cls, uint64_t offset, GNUNET_assert (NULL != zabt); value = zabt->array[offset]; if (GNUNET_NO == - proc (proc_cls, + proc (proc_cls, &value->key, value->size, &value[1], @@ -749,8 +749,8 @@ return_value (void *cls, void *val) { struct GetAllContext *gac = cls; - - gac->proc (gac->proc_cls, + + gac->proc (gac->proc_cls, key, 1); 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, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating value %llu adding %d to priority and maxing exp at %s\n", - vkey, delta, + vkey, delta, GNUNET_STRINGS_absolute_time_to_string (expire)); ret = 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 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found %u-byte value under key `%s' with prio %u, anon %u, expire %s selecting from gn090 table\n", (unsigned int) size, GNUNET_h2s (&key), - priority, anonymity, + priority, anonymity, GNUNET_STRINGS_absolute_time_to_string (expiration)); GNUNET_assert (size < MAX_DATUM_SIZE); ret = @@ -769,7 +769,7 @@ mysql_plugin_get_keys (void *cls, struct GNUNET_HashCode key; MYSQL_BIND cbind[1]; unsigned long length; - + statement = GNUNET_MYSQL_statement_get_stmt (plugin->mc, plugin->get_all_keys); if (statement == NULL) @@ -812,14 +812,14 @@ mysql_plugin_get_keys (void *cls, while (0 == (ret = mysql_stmt_fetch (statement))) { if (sizeof (struct GNUNET_HashCode) == length) - proc (proc_cls, &key, 1); + proc (proc_cls, &key, 1); } if (ret != MYSQL_NO_DATA) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("`%s' failed at %s:%d with error: %s\n"), "mysql_stmt_fetch", __FILE__, __LINE__, - mysql_stmt_error (statement)); + mysql_stmt_error (statement)); GNUNET_MYSQL_statements_invalidate (plugin->mc); return; } 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) /** * Store an item in the datastore. * - * @param cls closure with the 'struct Plugin' + * @param cls closure with the 'struct Plugin' * @param key key for the item * @param size number of bytes in data * @param data content stored @@ -335,7 +335,7 @@ postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t siz */ static void process_result (struct Plugin *plugin, PluginDatumProcessor proc, - void *proc_cls, PGresult * res, + void *proc_cls, PGresult * res, const char *filename, int line) { int iret; @@ -802,7 +802,7 @@ postgres_plugin_get_keys (void *cls, if (sizeof (struct GNUNET_HashCode) != PQgetlength (res, i, 0)) { memcpy (&key, PQgetvalue (res, i, 0), sizeof (struct GNUNET_HashCode)); - proc (proc_cls, &key, 1); + proc (proc_cls, &key, 1); } } PQclear (res); @@ -819,7 +819,7 @@ static void postgres_plugin_drop (void *cls) { struct Plugin *plugin = cls; - + if (GNUNET_OK != GNUNET_POSTGRES_exec (plugin->dbh, "DROP TABLE gn090")) GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "postgres", _("Failed to drop table from database.\n")); } 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, return; } #if 0 - FPRINTF (stderr, + FPRINTF (stderr, "Check value got `%s' of size %u, type %d, expire %s\n", GNUNET_h2s (key), (unsigned int) size, type, GNUNET_STRINGS_absolute_time_to_string (expiration)); @@ -464,7 +464,7 @@ run_tests (void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiratio static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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 static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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) GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test aborted.\n"); crc->phase = RP_ERROR; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "In phase %d, iteration %u\n", crc->phase, crc->cnt); switch (crc->phase) { 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 * Hop count so far. */ uint32_t hop_count GNUNET_PACKED; - + /** * Replication level for this message */ @@ -377,7 +377,7 @@ struct GNUNET_DHT_MonitorGetMessage * Hop count */ uint32_t hop_count GNUNET_PACKED; - + /** * Replication level for this message */ 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 GNUNET_DHT_PutContinuation cont; /** - * Pending message associated with this PUT operation, + * Pending message associated with this PUT operation, * NULL after the message has been transmitted to the service. */ struct PendingMessage *pending; @@ -181,7 +181,7 @@ struct GNUNET_DHT_GetHandle /** * Key that this get request is for */ - struct GNUNET_HashCode key; + struct GNUNET_HashCode key; /** * Unique identifier for this request (for key collisions). @@ -201,7 +201,7 @@ struct GNUNET_DHT_GetHandle unsigned int seen_results_end; /** - * Offset into the 'seen_results' array marking the + * Offset into the 'seen_results' array marking the * position up to where we've send the hash codes to * the DHT for blocking (needed as we might not be * able to send all hash codes at once). @@ -226,7 +226,7 @@ struct GNUNET_DHT_MonitorHandle * DLL. */ struct GNUNET_DHT_MonitorHandle *prev; - + /** * Main handle to this DHT api. */ @@ -261,7 +261,7 @@ struct GNUNET_DHT_MonitorHandle * Closure for cb. */ void *cb_cls; - + }; @@ -297,7 +297,7 @@ struct GNUNET_DHT_Handle struct PendingMessage *pending_tail; /** - * Head of linked list of messages we would like to monitor. + * Head of linked list of messages we would like to monitor. */ struct GNUNET_DHT_MonitorHandle *monitor_head; @@ -353,7 +353,7 @@ struct GNUNET_DHT_Handle * @param msg the incoming message */ static void -service_message_handler (void *cls, +service_message_handler (void *cls, const struct GNUNET_MessageHeader *msg); @@ -401,7 +401,7 @@ queue_filter_messages (struct GNUNET_DHT_GetHandle *get_handle) if (delta > max) delta = max; msize = sizeof (struct GNUNET_DHT_ClientGetResultSeenMessage) + delta * sizeof (struct GNUNET_HashCode); - + pm = GNUNET_malloc (sizeof (struct PendingMessage) + msize); msg = (struct GNUNET_DHT_ClientGetResultSeenMessage *) &pm[1]; pm->msg = &msg->header; @@ -419,7 +419,7 @@ queue_filter_messages (struct GNUNET_DHT_GetHandle *get_handle) get_handle->seen_results_transmission_offset += delta; GNUNET_CONTAINER_DLL_insert_tail (get_handle->dht_handle->pending_head, get_handle->dht_handle->pending_tail, - pm); + pm); } } @@ -434,8 +434,8 @@ queue_filter_messages (struct GNUNET_DHT_GetHandle *get_handle) * @return #GNUNET_YES (always) */ static int -add_request_to_pending (void *cls, - const struct GNUNET_HashCode *key, +add_request_to_pending (void *cls, + const struct GNUNET_HashCode *key, void *value) { struct GNUNET_DHT_Handle *handle = cls; @@ -472,7 +472,7 @@ process_pending_messages (struct GNUNET_DHT_Handle *handle); * @param tc scheduler context */ static void -try_reconnect (void *cls, +try_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_DHT_Handle *handle = cls; @@ -542,8 +542,8 @@ do_disconnect (struct GNUNET_DHT_Handle *handle) * @return number of bytes written to @a buf */ static size_t -transmit_pending (void *cls, - size_t size, +transmit_pending (void *cls, + size_t size, void *buf); @@ -591,8 +591,8 @@ process_pending_messages (struct GNUNET_DHT_Handle *handle) * @return number of bytes written to @a buf */ static size_t -transmit_pending (void *cls, - size_t size, +transmit_pending (void *cls, + size_t size, void *buf) { struct GNUNET_DHT_Handle *handle = cls; @@ -601,7 +601,7 @@ transmit_pending (void *cls, handle->th = NULL; if (NULL == buf) - { + { LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmission to DHT service failed! Reconnecting!\n"); do_disconnect (handle); @@ -653,8 +653,8 @@ transmit_pending (void *cls, * #GNUNET_NO if the reply is malformed or we found a matching request */ static int -process_reply (void *cls, - const struct GNUNET_HashCode *key, +process_reply (void *cls, + const struct GNUNET_HashCode *key, void *value) { const struct GNUNET_DHT_ClientResultMessage *dht_msg = cls; @@ -700,14 +700,14 @@ process_reply (void *cls, data = &get_path[get_path_length]; /* remember that we've seen this result */ GNUNET_CRYPTO_hash (data, data_length, &hc); - if (get_handle->seen_results_size == get_handle->seen_results_end) + if (get_handle->seen_results_size == get_handle->seen_results_end) GNUNET_array_grow (get_handle->seen_results, get_handle->seen_results_size, get_handle->seen_results_size * 2 + 1); GNUNET_assert (get_handle->seen_results_end == get_handle->seen_results_transmission_offset); get_handle->seen_results[get_handle->seen_results_end++] = hc; /* no need to block it explicitly, service already knows about it! */ - get_handle->seen_results_transmission_offset++; + get_handle->seen_results_transmission_offset++; get_handle->iter (get_handle->iter_cls, GNUNET_TIME_absolute_ntoh (dht_msg->expiration), key, get_path, get_path_length, put_path, put_path_length, @@ -746,7 +746,7 @@ process_monitor_get_message (struct GNUNET_DHT_Handle *handle, ntohl (msg->desired_replication_level), ntohl (msg->get_path_length), (struct GNUNET_PeerIdentity *) &msg[1], - &msg->key); + &msg->key); } return GNUNET_OK; } @@ -879,7 +879,7 @@ process_put_confirmation_message (struct GNUNET_DHT_Handle *handle, cont = ph->cont; cont_cls = ph->cont_cls; GNUNET_DHT_put_cancel (ph); - if (NULL != cont) + if (NULL != cont) cont (cont_cls, GNUNET_OK); return GNUNET_OK; } @@ -1132,11 +1132,11 @@ mark_put_message_gone (void *cls, * @param cont_cls closure for @a cont */ struct GNUNET_DHT_PutHandle * -GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, +GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, const struct GNUNET_HashCode * key, uint32_t desired_replication_level, enum GNUNET_DHT_RouteOption options, - enum GNUNET_BLOCK_Type type, size_t size, + enum GNUNET_BLOCK_Type type, size_t size, const void *data, struct GNUNET_TIME_Absolute exp, struct GNUNET_TIME_Relative timeout, @@ -1194,7 +1194,7 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, * go out over the network (we can't stop that); However, if the PUT * has not yet been sent to the service, cancelling the PUT will stop * this from happening (but there is no way for the user of this API - * to tell if that is the case). The only use for this API is to + * to tell if that is the case). The only use for this API is to * prevent a later call to 'cont' from #GNUNET_DHT_put (i.e. because * the system is shutting down). * @@ -1310,7 +1310,7 @@ GNUNET_DHT_get_filter_known_results (struct GNUNET_DHT_GetHandle *get_handle, unsigned int needed; needed = get_handle->seen_results_end + num_results; - if (needed > get_handle->seen_results_size) + if (needed > get_handle->seen_results_size) GNUNET_array_grow (get_handle->seen_results, get_handle->seen_results_size, needed); @@ -1483,7 +1483,7 @@ GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *handle) pending); pending->in_pending_queue = GNUNET_YES; process_pending_messages (handle->dht_handle); - + GNUNET_free_non_null (handle->key); GNUNET_free (handle); } 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 * Main function of the test to run once all DHTs are available. */ GNUNET_DHT_TEST_AppMain app_main; - + /** * Closure for 'app_main'. */ @@ -73,7 +73,7 @@ struct GNUNET_DHT_TEST_Context * from GNUNET_TESTBED_service_connect() * @return service handle to return in 'op_result', NULL on error */ -static void * +static void * dht_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) { @@ -88,7 +88,7 @@ dht_connect_adapter (void *cls, * @param cls closure * @param op_result service handle returned from the connect adapter */ -static void +static void dht_disconnect_adapter (void *cls, void *op_result) { @@ -107,7 +107,7 @@ dht_disconnect_adapter (void *cls, * @param emsg error message in case the operation has failed; will be NULL if * operation has executed successfully. */ -static void +static void dht_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, @@ -115,7 +115,7 @@ dht_connect_cb (void *cls, { struct GNUNET_DHT_TEST_Context *ctx = cls; unsigned int i; - + if (NULL != emsg) { fprintf (stderr, "Failed to connect to DHT service: %s\n", @@ -134,7 +134,7 @@ dht_connect_cb (void *cls, ctx, ctx->num_peers, ctx->peers, - ctx->dhts); + ctx->dhts); } @@ -192,7 +192,7 @@ dht_test_run (void *cls, * @param tmain main function to run once the testbed is ready * @param tmain_cls closure for 'tmain' */ -void +void GNUNET_DHT_TEST_run (const char *testname, const char *cfgname, unsigned int num_peers, @@ -200,7 +200,7 @@ GNUNET_DHT_TEST_run (const char *testname, void *tmain_cls) { struct GNUNET_DHT_TEST_Context *ctx; - + ctx = GNUNET_malloc (sizeof (struct GNUNET_DHT_TEST_Context)); ctx->num_peers = num_peers; 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, * @param tmain main function to run once the testbed is ready * @param tmain_cls closure for 'tmain' */ -void +void GNUNET_DHT_TEST_run (const char *testname, const char *cfgname, 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, unsigned int put_path_length, enum GNUNET_BLOCK_Type type, size_t size, const void *data) { - FPRINTF (stdout, - _("Result %d, type %d:\n%.*s\n"), + FPRINTF (stdout, + _("Result %d, type %d:\n%.*s\n"), result_count, type, (unsigned int) size, (char *) data); 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, const void *data, size_t size) { - FPRINTF (stdout, + FPRINTF (stdout, "RESPONSE #%u: type %d, key `%s', data `%.*s'\n", result_count, (int) type, @@ -191,7 +191,7 @@ put_callback (void *cls, const void *data, size_t size) { - FPRINTF (stdout, + FPRINTF (stdout, "PUT %u: type %d, key `%s', data `%.*s'\n", result_count, (int) type, @@ -221,14 +221,14 @@ run (void *cls, char *const *args, const char *cfgfile, if (NULL == (dht_handle = GNUNET_DHT_connect (cfg, 1))) { - FPRINTF (stderr, "%s", + FPRINTF (stderr, "%s", _("Failed to connect to DHT service!\n")); ret = 1; return; } if (GNUNET_BLOCK_TYPE_ANY == block_type) /* Type of data not set */ block_type = GNUNET_BLOCK_TYPE_TEST; - if (NULL != query_key) + if (NULL != query_key) { key = &hc; if (GNUNET_OK != @@ -240,8 +240,8 @@ run (void *cls, char *const *args, const char *cfgfile, key = NULL; } if (verbose) - FPRINTF (stderr, - "Monitoring for %s\n", + FPRINTF (stderr, + "Monitoring for %s\n", GNUNET_STRINGS_relative_time_to_string (timeout_request, GNUNET_NO)); GNUNET_SCHEDULER_add_delayed (timeout_request, &cleanup_task, NULL); 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 * Previous element in DLL. */ struct ClientMonitorRecord *prev; - + /** * Type of blocks that are of interest */ @@ -367,7 +367,7 @@ handle_client_disconnect (void *cls, struct ClientMonitorRecord *monitor; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Local client %p disconnects\n", + "Local client %p disconnects\n", client); pos = find_active_client (client); GNUNET_CONTAINER_DLL_remove (client_head, client_tail, pos); @@ -384,7 +384,7 @@ handle_client_disconnect (void *cls, if (monitor->client == pos) { struct ClientMonitorRecord *next; - + GNUNET_free_non_null (monitor->key); next = monitor->next; GNUNET_CONTAINER_DLL_remove (monitor_head, monitor_tail, monitor); @@ -550,7 +550,7 @@ handle_dht_local_put (void *cls, struct GNUNET_SERVER_Client *client, &dht_msg[1], size - sizeof (struct GNUNET_DHT_ClientPutMessage)); GNUNET_CONTAINER_bloomfilter_free (peer_bf); - pm = GNUNET_malloc (sizeof (struct PendingMessage) + + pm = GNUNET_malloc (sizeof (struct PendingMessage) + sizeof (struct GNUNET_DHT_ClientPutConfirmationMessage)); conf = (struct GNUNET_DHT_ClientPutConfirmationMessage *) &pm[1]; 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, } r = r->next; } - + GNUNET_SERVER_receive_done (client, GNUNET_OK); } @@ -1226,7 +1226,7 @@ void GDS_CLIENTS_process_get (uint32_t options, enum GNUNET_BLOCK_Type type, uint32_t hop_count, - uint32_t desired_replication_level, + uint32_t desired_replication_level, unsigned int path_length, const struct GNUNET_PeerIdentity *path, const struct GNUNET_HashCode * key) @@ -1386,7 +1386,7 @@ void GDS_CLIENTS_process_put (uint32_t options, enum GNUNET_BLOCK_Type type, uint32_t hop_count, - uint32_t desired_replication_level, + uint32_t desired_replication_level, unsigned int path_length, const struct GNUNET_PeerIdentity *path, 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 GDS_CLIENTS_process_get (uint32_t options, enum GNUNET_BLOCK_Type type, uint32_t hop_count, - uint32_t desired_replication_level, + uint32_t desired_replication_level, unsigned int path_length, const struct GNUNET_PeerIdentity *path, const struct GNUNET_HashCode * key); @@ -121,7 +121,7 @@ void GDS_CLIENTS_process_put (uint32_t options, enum GNUNET_BLOCK_Type type, uint32_t hop_count, - uint32_t desired_replication_level, + uint32_t desired_replication_level, unsigned int path_length, const struct GNUNET_PeerIdentity *path, 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 * to stop iteration. */ static int -datacache_get_iterator (void *cls, +datacache_get_iterator (void *cls, const struct GNUNET_HashCode * key, size_t size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute exp, @@ -239,7 +239,7 @@ GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key, ctx.xquery_size = xquery_size; ctx.reply_bf = reply_bf; ctx.reply_bf_mutator = reply_bf_mutator; - r = GNUNET_DATACACHE_get (datacache, key, type, &datacache_get_iterator, + r = GNUNET_DATACACHE_get (datacache, key, type, &datacache_get_iterator, &ctx); LOG (GNUNET_ERROR_TYPE_DEBUG, "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 () * Free memory occopied by the HELLO. */ static int -free_hello (void *cls, - const struct GNUNET_PeerIdentity *key, +free_hello (void *cls, + const struct GNUNET_PeerIdentity *key, void *hello) { 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 struct PeerInfo *prev; /** - * Count of outstanding messages for peer. + * Count of outstanding messages for peer. */ unsigned int pending_count; @@ -553,8 +553,8 @@ struct BloomConstructorContext * @return #GNUNET_YES (we should continue to iterate) */ static int -add_known_to_bloom (void *cls, - const struct GNUNET_PeerIdentity *key, +add_known_to_bloom (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { struct BloomConstructorContext *ctx = cls; @@ -649,7 +649,7 @@ handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer) /* Check for connect to self message */ if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity))) return; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected to %s\n", GNUNET_i2s (peer)); if (GNUNET_YES == @@ -714,7 +714,7 @@ handle_core_disconnect (void *cls, /* Check for disconnect from self message */ if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity))) return; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnected %s\n", GNUNET_i2s (peer)); to_remove = @@ -919,14 +919,14 @@ get_forward_count (uint32_t hop_count, uint32_t target_replication) * Differences in the lower bits must count stronger than differences * in the higher bits. * - * @param target + * @param target * @param have * @return 0 if have==target, otherwise a number * that is larger as the distance between * the two hash codes increases */ static unsigned int -get_distance (const struct GNUNET_HashCode *target, +get_distance (const struct GNUNET_HashCode *target, const struct GNUNET_HashCode *have) { unsigned int bucket; @@ -1197,7 +1197,7 @@ get_target_peers (const struct GNUNET_HashCode *key, struct GNUNET_HashCode nhash; GNUNET_assert (NULL != bloom); - ret = get_forward_count (hop_count, target_replication); + ret = get_forward_count (hop_count, target_replication); if (0 == ret) { *targets = NULL; @@ -1231,7 +1231,7 @@ get_target_peers (const struct GNUNET_HashCode *key, *targets = rtargets; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Forwarding query `%s' to %u peers (goal was %u peers)\n", - GNUNET_h2s (key), + GNUNET_h2s (key), off, ret); return off; @@ -1601,7 +1601,7 @@ core_init (void *cls, * #GNUNET_SYSERR to close it (signal serious error) */ static int -handle_dht_p2p_put (void *cls, +handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message) { @@ -1654,7 +1654,7 @@ handle_dht_p2p_put (void *cls, tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, - "XDHT PUT %s: %s->%s (%u, %u=>%u)\n", + "XDHT PUT %s: %s->%s (%u, %u=>%u)\n", GNUNET_h2s (&put->key), GNUNET_i2s (peer), tmp, ntohl(put->hop_count), GNUNET_CRYPTO_hash_matching_bits (&phash, &put->key), @@ -1913,7 +1913,7 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer, tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, - "XDHT GET %s: %s->%s (%u, %u=>%u) xq: %.*s\n", + "XDHT GET %s: %s->%s (%u, %u=>%u) xq: %.*s\n", GNUNET_h2s (&get->key), GNUNET_i2s (peer), tmp, ntohl(get->hop_count), GNUNET_CRYPTO_hash_matching_bits (&phash, &get->key), @@ -2059,7 +2059,7 @@ handle_dht_p2p_result (void *cls, const struct GNUNET_PeerIdentity *peer, char *tmp; tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); - LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, "XDHT RESULT %s: %s->%s (%u)\n", + LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, "XDHT RESULT %s: %s->%s (%u)\n", GNUNET_h2s (&prm->key), GNUNET_i2s (peer), tmp, get_path_length + 1); GNUNET_free (tmp); @@ -2132,10 +2132,10 @@ handle_dht_p2p_result (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_PeerIdentity xput_path[get_path_length + 1 + put_path_length]; memcpy (xput_path, put_path, put_path_length * sizeof (struct GNUNET_PeerIdentity)); - memcpy (&xput_path[put_path_length], - xget_path, + memcpy (&xput_path[put_path_length], + xget_path, get_path_length * sizeof (struct GNUNET_PeerIdentity)); - + GDS_DATACACHE_handle_put (GNUNET_TIME_absolute_ntoh (prm->expiration_time), &prm->key, get_path_length + put_path_length, xput_path, @@ -2214,7 +2214,7 @@ GDS_NEIGHBOURS_done () /** * Get the ID of the local node. - * + * * @return identity of the local node */ struct 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); /** * Get the ID of the local node. - * + * * @return identity of the local node */ struct 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 () GNUNET_CONTAINER_heap_remove_node (recent_req->heap_node); GNUNET_CONTAINER_bloomfilter_free (recent_req->reply_bf); GNUNET_assert (GNUNET_YES == - GNUNET_CONTAINER_multihashmap_remove (recent_map, - &recent_req->key, + GNUNET_CONTAINER_multihashmap_remove (recent_map, + &recent_req->key, recent_req)); GNUNET_free (recent_req); } 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) retry_context.next_timeout = BASE_TIMEOUT; get_handle = - GNUNET_DHT_get_start (dht_handle, + GNUNET_DHT_get_start (dht_handle, GNUNET_BLOCK_TYPE_TEST, &hash, 1, GNUNET_DHT_RO_NONE, NULL, 0, &test_get_iterator, 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 @@ /** * Information we keep for each GET operation. */ -struct GetOperation +struct GetOperation { /** * DLL. @@ -79,7 +79,7 @@ static struct GetOperation *get_tail; /** * Array of the testbed's peers. - */ + */ static struct GNUNET_TESTBED_Peer **my_peers; /** @@ -109,9 +109,9 @@ static unsigned int monitor_counter; * * @param cls the 'struct GNUNET_DHT_TestContext' * @param tc scheduler context - */ + */ static void -shutdown_task (void *cls, +shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_DHT_TEST_Context *ctx = cls; @@ -177,7 +177,7 @@ dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp, GNUNET_break (0); return; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get successful\n"); GNUNET_DHT_get_stop (get_op->get); GNUNET_CONTAINER_DLL_remove (get_head, @@ -195,7 +195,7 @@ dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp, /** * Task to put the id of each peer into the DHT. - * + * * @param cls array with NUM_PEERS DHT handles * @param tc Task context */ @@ -208,7 +208,7 @@ do_puts (void *cls, struct GNUNET_HashCode value; unsigned int i; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Putting values into DHT\n"); for (i = 0; i < NUM_PEERS; i++) { @@ -217,13 +217,13 @@ do_puts (void *cls, GNUNET_DHT_put (hs[i], &key, 10U, GNUNET_DHT_RO_RECORD_ROUTE | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, - GNUNET_BLOCK_TYPE_TEST, - sizeof (value), &value, + GNUNET_BLOCK_TYPE_TEST, + sizeof (value), &value, GNUNET_TIME_UNIT_FOREVER_ABS, - GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL); } - put_task = GNUNET_SCHEDULER_add_delayed (PUT_FREQUENCY, + put_task = GNUNET_SCHEDULER_add_delayed (PUT_FREQUENCY, &do_puts, hs); } @@ -296,7 +296,7 @@ monitor_put_cb (void *cls, i = (unsigned int) (long) cls; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u got a PUT message for key %s with %u bytes\n", - i, + i, GNUNET_h2s (key), size); monitor_counter++; } @@ -334,7 +334,7 @@ monitor_res_cb (void *cls, i = (unsigned int) (long) cls; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u got a REPLY message for key %s with %u bytes\n", - i, + i, GNUNET_h2s (key), size); monitor_counter++; } @@ -372,7 +372,7 @@ run (void *cls, &monitor_res_cb, &monitor_put_cb, (void *)(long)i); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers setup, starting test\n"); put_task = GNUNET_SCHEDULER_add_now (&do_puts, dhts); for (i=0;iget = GNUNET_DHT_get_start (dhts[j], + get_op->get = GNUNET_DHT_get_start (dhts[j], GNUNET_BLOCK_TYPE_TEST, /* type */ &key, /*key to search */ 4U, /* replication level */ @@ -394,7 +394,7 @@ run (void *cls, &dht_get_handler, get_op); } } - timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, + timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &shutdown_task, ctx); } 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 @@ /** * Information we keep for each GET operation. */ -struct GetOperation +struct GetOperation { /** * DLL. @@ -90,7 +90,7 @@ static struct GetOperation *get_tail; /** * Array of the testbed's peers. - */ + */ static struct GNUNET_TESTBED_Peer **my_peers; /** @@ -173,10 +173,10 @@ stats_finished (void *cls, return; } for (i = 0; NULL != stats[i].name; i++) - FPRINTF (stderr, - "%6s/%60s = %12llu\n", + FPRINTF (stderr, + "%6s/%60s = %12llu\n", stats[i].subsystem, - stats[i].name, + stats[i].name, stats[i].total); GNUNET_SCHEDULER_cancel (put_task); GNUNET_DHT_TEST_cleanup (ctx); @@ -194,7 +194,7 @@ stats_finished (void *cls, * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration */ -static int +static int handle_stats (void *cls, const struct GNUNET_TESTBED_Peer *peer, const char *subsystem, @@ -221,9 +221,9 @@ handle_stats (void *cls, * * @param cls the 'struct GNUNET_DHT_TestContext' * @param tc scheduler context - */ + */ static void -shutdown_task (void *cls, +shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_DHT_TEST_Context *ctx = cls; @@ -285,7 +285,7 @@ dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp, GNUNET_break (0); return; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get successful\n"); #if 0 { @@ -318,7 +318,7 @@ dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp, /** * Task to put the id of each peer into the DHT. - * + * * @param cls array with NUM_PEERS DHT handles * @param tc Task context */ @@ -331,7 +331,7 @@ do_puts (void *cls, struct GNUNET_HashCode value; unsigned int i; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Putting values into DHT\n"); for (i = 0; i < NUM_PEERS; i++) { @@ -340,13 +340,13 @@ do_puts (void *cls, GNUNET_DHT_put (hs[i], &key, 10U, GNUNET_DHT_RO_RECORD_ROUTE | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, - GNUNET_BLOCK_TYPE_TEST, - sizeof (value), &value, + GNUNET_BLOCK_TYPE_TEST, + sizeof (value), &value, GNUNET_TIME_UNIT_FOREVER_ABS, - GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL); } - put_task = GNUNET_SCHEDULER_add_delayed (PUT_FREQUENCY, + put_task = GNUNET_SCHEDULER_add_delayed (PUT_FREQUENCY, &do_puts, hs); } @@ -374,7 +374,7 @@ run (void *cls, GNUNET_assert (NUM_PEERS == num_peers); my_peers = peers; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers setup, starting test\n"); put_task = GNUNET_SCHEDULER_add_now (&do_puts, dhts); for (i=0;iget = GNUNET_DHT_get_start (dhts[j], + get_op->get = GNUNET_DHT_get_start (dhts[j], GNUNET_BLOCK_TYPE_TEST, /* type */ &key, /*key to search */ 4U, /* replication level */ @@ -396,7 +396,7 @@ run (void *cls, &dht_get_handler, get_op); } } - timeout_task = GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, + timeout_task = GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &shutdown_task, ctx); } @@ -409,7 +409,7 @@ main (int xargc, char *xargv[]) { const char *cfg_filename; const char *test_name; - + if (NULL != strstr (xargv[0], "test_dht_2dtorus")) { cfg_filename = "test_dht_2dtorus.conf"; @@ -418,19 +418,19 @@ main (int xargc, char *xargv[]) } else if (NULL != strstr (xargv[0], "test_dht_line")) { - cfg_filename = "test_dht_line.conf"; + cfg_filename = "test_dht_line.conf"; test_name = "test-dht-line"; NUM_PEERS = 5; } else if (NULL != strstr (xargv[0], "test_dht_twopeer")) { - cfg_filename = "test_dht_line.conf"; + cfg_filename = "test_dht_line.conf"; test_name = "test-dht-twopeer"; NUM_PEERS = 2; } else if (NULL != strstr (xargv[0], "test_dht_multipeer")) { - cfg_filename = "test_dht_multipeer.conf"; + cfg_filename = "test_dht_multipeer.conf"; test_name = "test-dht-multipeer"; NUM_PEERS = 10; } 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 * Always zero. */ uint32_t reserved GNUNET_PACKED; - + /** * Unique request ID. */ @@ -85,7 +85,7 @@ struct GNUNET_DNS_Response * Zero to drop, 1 for no change (no payload), 2 for update (message has payload). */ uint32_t drop_flag GNUNET_PACKED; - + /** * Unique request ID. */ 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 @@ /** * @file dns/dns_api.c - * @brief API to access the DNS service. + * @brief API to access the DNS service. * @author Christian Grothoff */ #include "platform.h" @@ -100,7 +100,7 @@ struct GNUNET_DNS_Handle * Function to call to get replies. */ GNUNET_DNS_RequestHandler rh; - + /** * Closure for 'rh'. */ @@ -125,7 +125,7 @@ struct GNUNET_DNS_Handle * Re-connect counter, to make sure we did not reconnect in the meantime. */ uint32_t generation; - + /** * Flags for events we care about. */ @@ -253,7 +253,7 @@ request_handler (void *cls, req = (const struct GNUNET_DNS_Request *) msg; GNUNET_break (ntohl (req->reserved) == 0); payload_length = ntohs (req->header.size) - sizeof (struct GNUNET_DNS_Request); - GNUNET_CLIENT_receive (dh->dns_connection, + GNUNET_CLIENT_receive (dh->dns_connection, &request_handler, dh, GNUNET_TIME_UNIT_FOREVER_REL); @@ -261,7 +261,7 @@ request_handler (void *cls, rh = GNUNET_malloc (sizeof (struct GNUNET_DNS_RequestHandle)); rh->dh =dh; rh->request_id = req->request_id; - rh->generation = dh->generation; + rh->generation = dh->generation; dh->pending_requests++; dh->rh (dh->rh_cls, rh, @@ -285,7 +285,7 @@ send_response (void *cls, size_t size, void *buf) struct GNUNET_DNS_Handle *dh = cls; struct ReplyQueueEntry *qe; size_t len; - + dh->dns_transmit_handle = NULL; if (NULL == buf) { @@ -300,12 +300,12 @@ send_response (void *cls, size_t size, void *buf) return 0; len = ntohs (qe->msg->size); if (len > size) - { + { dh->dns_transmit_handle = GNUNET_CLIENT_notify_transmit_ready (dh->dns_connection, len, GNUNET_TIME_UNIT_FOREVER_REL, - GNUNET_NO, + GNUNET_NO, &send_response, dh); return 0; } @@ -317,7 +317,7 @@ send_response (void *cls, size_t size, void *buf) if (GNUNET_NO == dh->in_receive) { dh->in_receive = GNUNET_YES; - GNUNET_CLIENT_receive (dh->dns_connection, + GNUNET_CLIENT_receive (dh->dns_connection, &request_handler, dh, GNUNET_TIME_UNIT_FOREVER_REL); } @@ -327,11 +327,11 @@ send_response (void *cls, size_t size, void *buf) GNUNET_CLIENT_notify_transmit_ready (dh->dns_connection, ntohs (qe->msg->size), GNUNET_TIME_UNIT_FOREVER_REL, - GNUNET_NO, + GNUNET_NO, &send_response, dh); } return len; -} +} /** @@ -344,7 +344,7 @@ static void queue_reply (struct GNUNET_DNS_Handle *dh, struct ReplyQueueEntry *qe) { - if (NULL == dh->dns_connection) + if (NULL == dh->dns_connection) { GNUNET_free (qe); return; @@ -354,12 +354,12 @@ queue_reply (struct GNUNET_DNS_Handle *dh, qe); if (NULL != dh->dns_transmit_handle) return; - /* trigger sending */ + /* trigger sending */ dh->dns_transmit_handle = GNUNET_CLIENT_notify_transmit_ready (dh->dns_connection, ntohs (dh->rq_head->msg->size), GNUNET_TIME_UNIT_FOREVER_REL, - GNUNET_NO, + GNUNET_NO, &send_response, dh); } @@ -440,7 +440,7 @@ GNUNET_DNS_request_drop (struct GNUNET_DNS_RequestHandle *rh) * @param reply reply data */ void -GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh, +GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh, uint16_t reply_length, const char *reply) { @@ -480,7 +480,7 @@ GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh, * @param flags when to call rh * @param rh function to call with DNS requests * @param rh_cls closure to pass to rh - * @return DNS handle + * @return DNS handle */ struct GNUNET_DNS_Handle * GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, @@ -489,7 +489,7 @@ GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *rh_cls) { struct GNUNET_DNS_Handle *dh; - + dh = GNUNET_malloc (sizeof (struct GNUNET_DNS_Handle)); dh->cfg = cfg; 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 @@ /** * @file dns/dnsparser.c - * @brief helper library to parse DNS packets. + * @brief helper library to parse DNS packets. * @author Philipp Toelke * @author Christian Grothoff */ @@ -47,10 +47,10 @@ GNUNET_DNSPARSER_check_label (const char *label) { char *output; size_t slen; - + if (NULL != strchr (label, '.')) return GNUNET_SYSERR; /* not a label! Did you mean GNUNET_DNSPARSER_check_name? */ - if (IDNA_SUCCESS != + if (IDNA_SUCCESS != idna_to_ascii_8z (label, &output, IDNA_ALLOW_UNASSIGNED)) return GNUNET_SYSERR; slen = strlen (output); @@ -78,7 +78,7 @@ GNUNET_DNSPARSER_check_name (const char *name) char *output; size_t slen; char *tok; - + ldup = GNUNET_strdup (name); for (tok = strtok (ldup, "."); NULL != tok; tok = strtok (NULL, ".")) if (GNUNET_OK != @@ -88,7 +88,7 @@ GNUNET_DNSPARSER_check_name (const char *name) return GNUNET_SYSERR; } GNUNET_free (ldup); - if (IDNA_SUCCESS != + if (IDNA_SUCCESS != idna_to_ascii_8z (name, &output, IDNA_ALLOW_UNASSIGNED)) return GNUNET_SYSERR; slen = strlen (output); @@ -113,7 +113,7 @@ GNUNET_DNSPARSER_free_soa (struct GNUNET_DNSPARSER_SoaRecord *soa) return; GNUNET_free_non_null (soa->mname); GNUNET_free_non_null (soa->rname); - GNUNET_free (soa); + GNUNET_free (soa); } @@ -131,7 +131,7 @@ GNUNET_DNSPARSER_free_srv (struct GNUNET_DNSPARSER_SrvRecord *srv) GNUNET_free_non_null (srv->domain_name); GNUNET_free_non_null (srv->proto); GNUNET_free_non_null (srv->service); - GNUNET_free (srv); + GNUNET_free (srv); } @@ -146,13 +146,13 @@ GNUNET_DNSPARSER_free_mx (struct GNUNET_DNSPARSER_MxRecord *mx) if (NULL == mx) return; GNUNET_free_non_null (mx->mxhost); - GNUNET_free (mx); + GNUNET_free (mx); } /** * Free the given DNS record. - * + * * @param r record to free */ void @@ -206,7 +206,7 @@ parse_name (const char *udp_payload, size_t xoff; char *utf8; Idna_rc rc; - + ret = GNUNET_strdup (""); while (1) { @@ -301,7 +301,7 @@ parse_name (const char *udp_payload, *off += 2; /* pointers always terminate names */ break; - } + } else { /* neither pointer nor inline string, not supported... */ @@ -312,7 +312,7 @@ parse_name (const char *udp_payload, if (0 < strlen(ret)) ret[strlen(ret)-1] = '\0'; /* eat tailing '.' */ return ret; - error: + error: GNUNET_break_op (0); GNUNET_free (ret); return NULL; @@ -356,7 +356,7 @@ GNUNET_DNSPARSER_parse_query (const char *udp_payload, char *name; struct GNUNET_TUN_DnsQueryLine ql; - name = GNUNET_DNSPARSER_parse_name (udp_payload, + name = GNUNET_DNSPARSER_parse_name (udp_payload, udp_payload_length, off); if (NULL == name) @@ -414,7 +414,7 @@ GNUNET_DNSPARSER_parse_soa (const char *udp_payload, return NULL; } memcpy (&soa_bin, - &udp_payload[*off], + &udp_payload[*off], sizeof (struct GNUNET_TUN_DnsSoaRecord)); soa->serial = ntohl (soa_bin.serial); soa->refresh = ntohl (soa_bin.refresh); @@ -450,7 +450,7 @@ GNUNET_DNSPARSER_parse_mx (const char *udp_payload, GNUNET_break_op (0); return NULL; } - memcpy (&mxpref, &udp_payload[*off], sizeof (uint16_t)); + memcpy (&mxpref, &udp_payload[*off], sizeof (uint16_t)); (*off) += sizeof (uint16_t); mx = GNUNET_new (struct GNUNET_DNSPARSER_MxRecord); mx->preference = ntohs (mxpref); @@ -498,8 +498,8 @@ GNUNET_DNSPARSER_parse_srv (const char *r_name, if (*off + sizeof (struct GNUNET_TUN_DnsSrvRecord) > udp_payload_length) return NULL; memcpy (&srv_bin, - &udp_payload[*off], - sizeof (struct GNUNET_TUN_DnsSrvRecord)); + &udp_payload[*off], + sizeof (struct GNUNET_TUN_DnsSrvRecord)); (*off) += sizeof (struct GNUNET_TUN_DnsSrvRecord); srv = GNUNET_new (struct GNUNET_DNSPARSER_SrvRecord); srv->priority = ntohs (srv_bin.prio); @@ -565,7 +565,7 @@ GNUNET_DNSPARSER_parse_record (const char *udp_payload, size_t old_off; uint16_t data_len; - name = GNUNET_DNSPARSER_parse_name (udp_payload, + name = GNUNET_DNSPARSER_parse_name (udp_payload, udp_payload_length, off); if (NULL == name) @@ -599,7 +599,7 @@ GNUNET_DNSPARSER_parse_record (const char *udp_payload, case GNUNET_DNSPARSER_TYPE_PTR: r->data.hostname = GNUNET_DNSPARSER_parse_name (udp_payload, udp_payload_length, - off); + off); if ( (NULL == r->data.hostname) || (old_off + data_len != *off) ) return GNUNET_SYSERR; @@ -645,7 +645,7 @@ GNUNET_DNSPARSER_parse_record (const char *udp_payload, break; } (*off) += data_len; - return GNUNET_OK; + return GNUNET_OK; } @@ -654,7 +654,7 @@ GNUNET_DNSPARSER_parse_record (const char *udp_payload, * processing and manipulation. * * @param udp_payload wire-format of the DNS packet - * @param udp_payload_length number of bytes in @a udp_payload + * @param udp_payload_length number of bytes in @a udp_payload * @return NULL on error, otherwise the parsed packet */ struct GNUNET_DNSPARSER_Packet * @@ -664,7 +664,7 @@ GNUNET_DNSPARSER_parse (const char *udp_payload, struct GNUNET_DNSPARSER_Packet *p; const struct GNUNET_TUN_DnsHeader *dns; size_t off; - unsigned int n; + unsigned int n; unsigned int i; if (udp_payload_length < sizeof (struct GNUNET_TUN_DnsHeader)) @@ -711,7 +711,7 @@ GNUNET_DNSPARSER_parse (const char *udp_payload, udp_payload_length, &off, &p->authority_records[i])) - goto error; + goto error; } n = ntohs (dns->additional_rcount); if (n > 0) @@ -724,7 +724,7 @@ GNUNET_DNSPARSER_parse (const char *udp_payload, udp_payload_length, &off, &p->additional_records[i])) - goto error; + goto error; } return p; error: @@ -793,7 +793,7 @@ GNUNET_DNSPARSER_builder_add_name (char *dst, if (NULL == name) return GNUNET_SYSERR; - if (IDNA_SUCCESS != + if (IDNA_SUCCESS != (rc = idna_to_ascii_8z (name, &idna_start, IDNA_ALLOW_UNASSIGNED))) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -815,7 +815,7 @@ GNUNET_DNSPARSER_builder_add_name (char *dst, else len = dot - idna_name; if ( (len >= 64) || (0 == len) ) - goto fail; /* segment too long or empty */ + goto fail; /* segment too long or empty */ dst[pos++] = (char) (uint8_t) len; memcpy (&dst[pos], idna_name, len); pos += len; @@ -836,7 +836,7 @@ GNUNET_DNSPARSER_builder_add_name (char *dst, #else free (idna_start); #endif - return GNUNET_NO; + return GNUNET_NO; } @@ -1004,7 +1004,7 @@ add_record (char *dst, size_t pos; struct GNUNET_TUN_DnsRecordLine rl; char *name; - + start = *off; /* for SRV records, we can create the name from the details of the record if needed */ @@ -1025,9 +1025,9 @@ add_record (char *dst, pos = *off + sizeof (struct GNUNET_TUN_DnsRecordLine); switch (record->type) - { + { case GNUNET_DNSPARSER_TYPE_MX: - ret = GNUNET_DNSPARSER_builder_add_mx (dst, dst_len, &pos, record->data.mx); + ret = GNUNET_DNSPARSER_builder_add_mx (dst, dst_len, &pos, record->data.mx); break; case GNUNET_DNSPARSER_TYPE_SOA: ret = GNUNET_DNSPARSER_builder_add_soa (dst, dst_len, &pos, record->data.soa); @@ -1069,14 +1069,14 @@ add_record (char *dst, rl.data_len = htons ((uint16_t) (pos - (*off + sizeof (struct GNUNET_TUN_DnsRecordLine)))); memcpy (&dst[*off], &rl, sizeof (struct GNUNET_TUN_DnsRecordLine)); *off = pos; - return GNUNET_OK; + return GNUNET_OK; } /** * Given a DNS packet @a p, generate the corresponding UDP payload. * Note that we do not attempt to pack the strings with pointers - * as this would complicate the code and this is about being + * as this would complicate the code and this is about being * simple and secure, not fast, fancy and broken like bind. * * @param p packet to pack @@ -1092,14 +1092,14 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p, uint16_t max, char **buf, size_t *buf_length) -{ +{ struct GNUNET_TUN_DnsHeader dns; size_t off; char tmp[max]; unsigned int i; int ret; int trc; - + if ( (p->num_queries > UINT16_MAX) || (p->num_answers > UINT16_MAX) || (p->num_authority_records > UINT16_MAX) || @@ -1116,55 +1116,55 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p, trc = GNUNET_NO; for (i=0;inum_queries;i++) { - ret = GNUNET_DNSPARSER_builder_add_query (tmp, sizeof (tmp), &off, &p->queries[i]); + ret = GNUNET_DNSPARSER_builder_add_query (tmp, sizeof (tmp), &off, &p->queries[i]); if (GNUNET_SYSERR == ret) return GNUNET_SYSERR; if (GNUNET_NO == ret) { dns.query_count = htons ((uint16_t) (i-1)); - trc = GNUNET_YES; + trc = GNUNET_YES; break; } } for (i=0;inum_answers;i++) { - ret = add_record (tmp, sizeof (tmp), &off, &p->answers[i]); + ret = add_record (tmp, sizeof (tmp), &off, &p->answers[i]); if (GNUNET_SYSERR == ret) return GNUNET_SYSERR; if (GNUNET_NO == ret) { dns.answer_rcount = htons ((uint16_t) (i-1)); - trc = GNUNET_YES; + trc = GNUNET_YES; break; } } for (i=0;inum_authority_records;i++) { - ret = add_record (tmp, sizeof (tmp), &off, &p->authority_records[i]); + ret = add_record (tmp, sizeof (tmp), &off, &p->authority_records[i]); if (GNUNET_SYSERR == ret) return GNUNET_SYSERR; if (GNUNET_NO == ret) { dns.authority_rcount = htons ((uint16_t) (i-1)); - trc = GNUNET_YES; + trc = GNUNET_YES; break; } } for (i=0;inum_additional_records;i++) { - ret = add_record (tmp, sizeof (tmp), &off, &p->additional_records[i]); + ret = add_record (tmp, sizeof (tmp), &off, &p->additional_records[i]); if (GNUNET_SYSERR == ret) return GNUNET_SYSERR; if (GNUNET_NO == ret) { dns.additional_rcount = htons (i-1); - trc = GNUNET_YES; + trc = GNUNET_YES; break; } } if (GNUNET_YES == trc) - dns.flags.message_truncated = 1; + dns.flags.message_truncated = 1; memcpy (tmp, &dns, sizeof (struct GNUNET_TUN_DnsHeader)); *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 @@ */ struct GNUNET_DNSSTUB_RequestSocket { - + /** * UDP socket we use for this request for IPv4 */ @@ -89,12 +89,12 @@ struct GNUNET_DNSSTUB_RequestSocket /** * Handle to the stub resolver. - */ + */ struct GNUNET_DNSSTUB_Context { /** - * Array of all open sockets for DNS requests. + * Array of all open sockets for DNS requests. */ struct GNUNET_DNSSTUB_RequestSocket sockets[DNS_SOCKET_MAX]; @@ -138,7 +138,7 @@ cleanup_rs (struct GNUNET_DNSSTUB_RequestSocket *rs) * * @param af AF_INET or AF_INET6 * @return GNUNET_OK on success - */ + */ static struct GNUNET_NETWORK_Handle * open_socket (int af) { @@ -168,11 +168,11 @@ open_socket (int af) } sa->sa_family = af; if (GNUNET_OK != GNUNET_NETWORK_socket_bind (ret, - sa, + sa, alen, 0)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Could not bind to any port: %s\n"), STRERROR (errno)); GNUNET_NETWORK_socket_close (ret); @@ -195,7 +195,7 @@ read_response (void *cls, /** * Get a socket of the specified address family to send out a - * UDP DNS request to the Internet. + * UDP DNS request to the Internet. * * @param ctx the DNSSTUB context * @param af desired address family @@ -208,7 +208,7 @@ get_request_socket (struct GNUNET_DNSSTUB_Context *ctx, struct GNUNET_DNSSTUB_RequestSocket *rs; struct GNUNET_NETWORK_FDSet *rset; - rs = &ctx->sockets[GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, + rs = &ctx->sockets[GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, DNS_SOCKET_MAX)]; rs->timeout = GNUNET_TIME_relative_to_absolute (REQUEST_TIMEOUT); switch (af) @@ -223,7 +223,7 @@ get_request_socket (struct GNUNET_DNSSTUB_Context *ctx, break; default: return NULL; - } + } if (GNUNET_SCHEDULER_NO_TASK != rs->read_task) { GNUNET_SCHEDULER_cancel (rs->read_task); @@ -286,7 +286,7 @@ GNUNET_DNSSTUB_resolve (struct GNUNET_DNSSTUB_Context *ctx, rs->addrlen = sa_len; rs->rc = rc; rs->rc_cls = rc_cls; - if (GNUNET_SYSERR == + if (GNUNET_SYSERR == GNUNET_NETWORK_socket_sendto (ret, request, request_len, @@ -351,7 +351,7 @@ GNUNET_DNSSTUB_resolve2 (struct GNUNET_DNSSTUB_Context *ctx, #endif sa = (struct sockaddr *) &v6; af = AF_INET6; - } + } else { GNUNET_break (0); @@ -384,7 +384,7 @@ GNUNET_DNSSTUB_resolve2 (struct GNUNET_DNSSTUB_Context *ctx, _("Failed to send DNS request to %s\n"), GNUNET_a2s (sa, salen)); rs->timeout = GNUNET_TIME_relative_to_absolute (REQUEST_TIMEOUT); - + return rs; } @@ -420,13 +420,13 @@ do_dns_read (struct GNUNET_DNSSTUB_RequestSocket *rs, #endif GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving %d byte DNS reply\n", - len); + len); { unsigned char buf[len] GNUNET_ALIGN; addrlen = sizeof (addr); - memset (&addr, 0, sizeof (addr)); - r = GNUNET_NETWORK_socket_recvfrom (dnsout, + memset (&addr, 0, sizeof (addr)); + r = GNUNET_NETWORK_socket_recvfrom (dnsout, buf, sizeof (buf), (struct sockaddr*) &addr, &addrlen); if (-1 == r) @@ -437,7 +437,7 @@ do_dns_read (struct GNUNET_DNSSTUB_RequestSocket *rs, } if (sizeof (struct GNUNET_TUN_DnsHeader) > r) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Received DNS response that is too small (%u bytes)"), r); return GNUNET_NO; @@ -446,11 +446,11 @@ do_dns_read (struct GNUNET_DNSSTUB_RequestSocket *rs, if ( (addrlen != rs->addrlen) || (0 != memcmp (&rs->addr, &addr, - addrlen)) || + addrlen)) || (0 == GNUNET_TIME_absolute_get_remaining (rs->timeout).rel_value_us) ) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Request timeout or invalid sender address; ignoring reply\n"); + "Request timeout or invalid sender address; ignoring reply\n"); return GNUNET_NO; } if (NULL != rs->rc) @@ -458,7 +458,7 @@ do_dns_read (struct GNUNET_DNSSTUB_RequestSocket *rs, rs, dns, r); - } + } return GNUNET_OK; } @@ -530,7 +530,7 @@ struct GNUNET_DNSSTUB_Context * GNUNET_DNSSTUB_start (const char *dns_ip) { struct GNUNET_DNSSTUB_Context *ctx; - + ctx = GNUNET_malloc (sizeof (struct GNUNET_DNSSTUB_Context)); if (NULL != dns_ip) 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) const char *format; char buf[INET6_ADDRSTRLEN]; char *tmp; - + tmp = NULL; switch (record->type) { @@ -164,7 +164,7 @@ display_record (const struct GNUNET_DNSPARSER_Record *record) (unsigned int) record->data.soa->refresh, (unsigned int) record->data.soa->retry, (unsigned int) record->data.soa->expire, - (unsigned int) record->data.soa->minimum_ttl); + (unsigned int) record->data.soa->minimum_ttl); format = tmp; } break; @@ -242,7 +242,7 @@ display_record (const struct GNUNET_DNSPARSER_Record *record) * @param request_length number of bytes in request * @param request udp payload of the DNS request */ -static void +static void display_request (void *cls, struct GNUNET_DNS_RequestHandle *rh, size_t request_length, @@ -284,13 +284,13 @@ display_request (void *cls, p->flags.authenticated_data ? "AD " : "", p->flags.recursion_available ? "RA " : "", return_codes[p->flags.return_code & 15], - op_codes[p->flags.opcode & 15]); + op_codes[p->flags.opcode & 15]); if (p->num_queries > 0) fprintf (stdout, "\tQueries:\n"); for (i=0;inum_queries;i++) display_query (&p->queries[i]); - + if (p->num_answers > 0) fprintf (stdout, "\tAnswers:\n"); @@ -338,7 +338,7 @@ run (void *cls, char *const *args, const char *cfgfile, if (outbound_only) flags |= GNUNET_DNS_FLAG_RESPONSE_MONITOR; handle = - GNUNET_DNS_connect (cfg, + GNUNET_DNS_connect (cfg, flags, &display_request, 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) switch (record->type) { - case GNUNET_DNSPARSER_TYPE_A: + case GNUNET_DNSPARSER_TYPE_A: if (record->data.raw.data_len != sizeof (struct in_addr)) return; if (NULL != n4) { if (verbosity > 1) - fprintf (stderr, + fprintf (stderr, "Changing A record from `%s' to `%s'\n", inet_ntop (AF_INET, record->data.raw.data, buf, sizeof (buf)), n4); @@ -86,7 +86,7 @@ modify_record (const struct GNUNET_DNSPARSER_Record *record) if (NULL != n6) { if (verbosity > 1) - fprintf (stderr, + fprintf (stderr, "Changing AAAA record from `%s' to `%s'\n", inet_ntop (AF_INET6, record->data.raw.data, buf, sizeof (buf)), n6); @@ -129,7 +129,7 @@ modify_record (const struct GNUNET_DNSPARSER_Record *record) * @param request_length number of bytes in request * @param request udp payload of the DNS request */ -static void +static void modify_request (void *cls, struct GNUNET_DNS_RequestHandle *rh, size_t request_length, @@ -156,7 +156,7 @@ modify_request (void *cls, if (GNUNET_OK != ret) { if (GNUNET_NO == ret) - fprintf (stderr, + fprintf (stderr, "Modified DNS response did not fit, keeping old response\n"); else GNUNET_break (0); /* our modifications should have been sane! */ @@ -169,7 +169,7 @@ modify_request (void *cls, "Injecting modified DNS response\n"); GNUNET_DNS_request_answer (rh, len, buf); } - GNUNET_free_non_null (buf); + GNUNET_free_non_null (buf); } @@ -219,7 +219,7 @@ run (void *cls, char *const *args, const char *cfgfile, } handle = - GNUNET_DNS_connect (cfg, + GNUNET_DNS_connect (cfg, GNUNET_DNS_FLAG_POST_RESOLUTION, &modify_request, 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 @@ * @brief helper to install firewall rules to hijack all DNS traffic * and send it to our virtual interface (except for DNS traffic * that originates on the specified port). We then - * allow interacting with our virtual interface via stdin/stdout. + * allow interacting with our virtual interface via stdin/stdout. * @author Philipp Tölke * @author Christian Grothoff * @@ -55,13 +55,13 @@ * Naturally, neither of these problems can be helped as this is the * fundamental purpose of the binary. Certifying that this code is * "safe" thus only means that it doesn't allow anything else (such - * as local priv. escalation, etc.). + * as local priv. escalation, etc.). * * The following list of people have reviewed this code and considered * it safe (within specifications) since the last modification (if you * reviewed it, please have your name added to the list): * - * - Christian Grothoff + * - Christian Grothoff */ #include "platform.h" @@ -174,7 +174,7 @@ open_dev_null (int target_fd, if (fd == target_fd) return; if (-1 == dup2 (fd, target_fd)) - { + { (void) close (fd); abort (); } @@ -184,13 +184,13 @@ open_dev_null (int target_fd, /** * Run the given command and wait for it to complete. - * + * * @param file name of the binary to run * @param cmd command line arguments (as given to 'execv') * @return 0 on success, 1 on any error */ static int -fork_and_exec (const char *file, +fork_and_exec (const char *file, char *const cmd[]) { int status; @@ -200,8 +200,8 @@ fork_and_exec (const char *file, pid = fork (); if (-1 == pid) { - fprintf (stderr, - "fork failed: %s\n", + fprintf (stderr, + "fork failed: %s\n", strerror (errno)); return 1; } @@ -210,25 +210,25 @@ fork_and_exec (const char *file, /* we are the child process */ /* close stdin/stdout to not cause interference with the helper's main protocol! */ - (void) close (0); + (void) close (0); open_dev_null (0, O_RDONLY); - (void) close (1); + (void) close (1); open_dev_null (1, O_WRONLY); (void) execv (file, cmd); /* can only get here on error */ - fprintf (stderr, - "exec `%s' failed: %s\n", + fprintf (stderr, + "exec `%s' failed: %s\n", file, strerror (errno)); _exit (1); } /* keep running waitpid as long as the only error we get is 'EINTR' */ while ( (-1 == (ret = waitpid (pid, &status, 0))) && - (errno == EINTR) ); + (errno == EINTR) ); if (-1 == ret) { - fprintf (stderr, - "waitpid failed: %s\n", + fprintf (stderr, + "waitpid failed: %s\n", strerror (errno)); return 1; } @@ -312,8 +312,8 @@ set_address6 (const char *dev, const char *address, unsigned long prefix_len) sa6.sin6_family = AF_INET6; if (1 != inet_pton (AF_INET6, address, sa6.sin6_addr.s6_addr)) { - fprintf (stderr, - "Failed to parse IPv6 address `%s': %s\n", + fprintf (stderr, + "Failed to parse IPv6 address `%s': %s\n", address, strerror (errno)); exit (1); @@ -321,11 +321,11 @@ set_address6 (const char *dev, const char *address, unsigned long prefix_len) if (-1 == (fd = socket (PF_INET6, SOCK_DGRAM, 0))) { - fprintf (stderr, - "Error creating IPv6 socket: %s (ignored)\n", + fprintf (stderr, + "Error creating IPv6 socket: %s (ignored)\n", strerror (errno)); /* ignore error, maybe only IPv4 works on this system! */ - return; + return; } memset (&ifr, 0, sizeof (struct ifreq)); @@ -410,8 +410,8 @@ set_address4 (const char *dev, const char *address, const char *mask) */ if (1 != inet_pton (AF_INET, address, &addr->sin_addr.s_addr)) { - fprintf (stderr, - "Failed to parse IPv4 address `%s': %s\n", + fprintf (stderr, + "Failed to parse IPv4 address `%s': %s\n", address, strerror (errno)); exit (1); @@ -420,7 +420,7 @@ set_address4 (const char *dev, const char *address, const char *mask) if (-1 == (fd = socket (PF_INET, SOCK_DGRAM, 0))) { fprintf (stderr, - "Error creating IPv4 socket: %s\n", + "Error creating IPv4 socket: %s\n", strerror (errno)); exit (1); } @@ -619,7 +619,7 @@ run (int fd_tun) return; } buftun_size -= written; - buftun_read += written; + buftun_read += written; } if (FD_ISSET (0, &fds_r)) @@ -749,7 +749,7 @@ main (int argc, char *const*argv) return 254; } #else - if (0 != seteuid (0)) + if (0 != seteuid (0)) { fprintf (stderr, "Failed to seteuid back to root: %s\n", strerror (errno)); return 254; @@ -763,7 +763,7 @@ main (int argc, char *const*argv) sbin_iptables = "/usr/sbin/iptables"; else { - fprintf (stderr, + fprintf (stderr, "Fatal: executable iptables not found in approved directories: %s\n", strerror (errno)); return 3; @@ -805,7 +805,7 @@ main (int argc, char *const*argv) /* setup pipe to shutdown nicely on SIGINT */ if (0 != pipe (cpipe)) { - fprintf (stderr, + fprintf (stderr, "Fatal: could not setup control pipe: %s\n", strerror (errno)); return 6; @@ -839,14 +839,14 @@ main (int argc, char *const*argv) } if ( (SIG_ERR == signal (SIGTERM, &signal_handler)) || (SIG_ERR == signal (SIGINT, &signal_handler)) || - (SIG_ERR == signal (SIGHUP, &signal_handler)) ) - { - fprintf (stderr, + (SIG_ERR == signal (SIGHUP, &signal_handler)) ) + { + fprintf (stderr, "Fatal: could not initialize signal handler: %s\n", strerror (errno)); (void) close (cpipe[0]); (void) close (cpipe[1]); - return 7; + return 7; } @@ -868,8 +868,8 @@ main (int argc, char *const*argv) return 5; } } - - + + /* now open virtual interface (first part that requires root) */ if (-1 == (fd_tun = init_tun (dev))) { @@ -907,14 +907,14 @@ main (int argc, char *const*argv) set_address4 (dev, address, mask); } - + /* update routing tables -- next part why we need SUID! */ /* Forward everything from our EGID (which should only be held by the 'gnunet-service-dns') and with destination to port 53 on UDP, without hijacking */ r = 8; /* failed to fully setup routing table */ { - char *const mangle_args[] = + char *const mangle_args[] = { "iptables", "-m", "owner", "-t", "mangle", "-I", "OUTPUT", "1", "-p", "udp", "--gid-owner", mygid, "--dport", DNS_PORT, "-j", @@ -922,7 +922,7 @@ main (int argc, char *const*argv) }; if (0 != fork_and_exec (sbin_iptables, mangle_args)) goto cleanup_rest; - } + } /* Mark all of the other DNS traffic using our mark DNS_MARK */ { char *const mark_args[] = @@ -965,7 +965,7 @@ main (int argc, char *const*argv) } #else /* Note: no 'setuid' here as we must keep our saved UID as root */ - if (0 != seteuid (uid)) + if (0 != seteuid (uid)) { fprintf (stderr, "Failed to seteuid: %s\n", strerror (errno)); r = 24; @@ -977,7 +977,7 @@ main (int argc, char *const*argv) /* now forward until we hit a problem */ run (fd_tun); - + /* now need to regain privs so we can remove the firewall rules we added! */ #ifdef HAVE_SETRESUID if (0 != setresuid (uid, 0, 0)) @@ -987,19 +987,19 @@ main (int argc, char *const*argv) goto cleanup_route_4; } #else - if (0 != seteuid (0)) + if (0 != seteuid (0)) { fprintf (stderr, "Failed to seteuid back to root: %s\n", strerror (errno)); r = 40; goto cleanup_route_4; } #endif - + /* update routing tables again -- this is why we could not fully drop privs */ /* now undo updating of routing tables; normal exit or clean-up-on-error case */ cleanup_route_4: { - char *const route_clean_args[] = + char *const route_clean_args[] = { "ip", "route", "del", "default", "dev", dev, "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 @@ * each request will be given one of 128 random source ports, and the * 128 random source ports will also change "often" (less often if the * system is very busy, each time if we are mostly idle). At the same - * time, the system will never use more than 256 UDP sockets. + * time, the system will never use more than 256 UDP sockets. */ #include "platform.h" #include "gnunet_util_lib.h" @@ -88,7 +88,7 @@ enum RequestPhase * Global Internet query is now pending. */ RP_INTERNET_DNS, - + /** * Client (or global DNS request) has resulted in a response. * Forward to all POST-RESOLUTION clients. If client list is empty, @@ -111,22 +111,22 @@ enum RequestPhase /** * Entry we keep for each client. - */ + */ struct ClientRecord { /** * Kept in doubly-linked list. - */ + */ struct ClientRecord *next; /** * Kept in doubly-linked list. - */ + */ struct ClientRecord *prev; /** * Handle to the client. - */ + */ struct GNUNET_SERVER_Client *client; /** @@ -139,7 +139,7 @@ struct ClientRecord /** * Entry we keep for each active request. - */ + */ struct RequestRecord { @@ -180,7 +180,7 @@ struct RequestRecord /** * Number of bytes in payload. - */ + */ size_t payload_length; /** @@ -317,7 +317,7 @@ request_done (struct RequestRecord *rr) GNUNET_array_grow (rr->client_wait_list, rr->client_wait_list_length, - 0); + 0); if (RP_RESPONSE_MONITOR != rr->phase) { /* no response, drop */ @@ -330,7 +330,7 @@ request_done (struct RequestRecord *rr) LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting response for request %llu\n", - (unsigned long long) rr->request_id); + (unsigned long long) rr->request_id); /* send response via hijacker */ reply_len = sizeof (struct GNUNET_MessageHeader); reply_len += sizeof (struct GNUNET_TUN_Layer2PacketHeader); @@ -345,7 +345,7 @@ request_done (struct RequestRecord *rr) default: GNUNET_break (0); cleanup_rr (rr); - return; + return; } reply_len += sizeof (struct GNUNET_TUN_UdpHeader); reply_len += rr->payload_length; @@ -354,7 +354,7 @@ request_done (struct RequestRecord *rr) /* response too big, drop */ GNUNET_break (0); /* how can this be? */ cleanup_rr(rr); - return; + return; } { char buf[reply_len] GNUNET_ALIGN; @@ -374,7 +374,7 @@ request_done (struct RequestRecord *rr) tun.flags = htons (0); if (rr->src_addr.ss_family == AF_INET) - tun.proto = htons (ETH_P_IPV4); + tun.proto = htons (ETH_P_IPV4); else tun.proto = htons (ETH_P_IPV6); memcpy (&buf[off], &tun, sizeof (struct GNUNET_TUN_Layer2PacketHeader)); @@ -483,14 +483,14 @@ send_request_to_client (struct RequestRecord *rr, } LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending information about request %llu to local client\n", - (unsigned long long) rr->request_id); + (unsigned long long) rr->request_id); req = (struct GNUNET_DNS_Request*) buf; req->header.type = htons (GNUNET_MESSAGE_TYPE_DNS_CLIENT_REQUEST); req->header.size = htons (sizeof (buf)); req->reserved = htonl (0); req->request_id = rr->request_id; memcpy (&req[1], rr->payload, rr->payload_length); - GNUNET_SERVER_notification_context_unicast (nc, + GNUNET_SERVER_notification_context_unicast (nc, client, &req->header, GNUNET_NO); @@ -541,8 +541,8 @@ next_phase (struct RequestRecord *rr) nz = (int) j; break; } - } - if (-1 != nz) + } + if (-1 != nz) { send_request_to_client (rr, rr->client_wait_list[nz]->client); return; @@ -551,7 +551,7 @@ next_phase (struct RequestRecord *rr) LOG (GNUNET_ERROR_TYPE_DEBUG, "Request %llu now in phase %d\n", rr->request_id, - rr->phase); + rr->phase); switch (rr->phase) { case RP_INIT: @@ -647,7 +647,7 @@ next_phase (struct RequestRecord *rr) * * @param cls unused * @param client handle of client that disconnected - */ + */ static void client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) { @@ -674,7 +674,7 @@ client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) if (rr->client_wait_list[j] == cr) { rr->client_wait_list[j] = NULL; - next_phase (rr); + next_phase (rr); } } } @@ -714,8 +714,8 @@ process_dns_result (void *cls, gettext_noop ("# External DNS response discarded (no matching request)"), 1, GNUNET_NO); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Received DNS reply that does not match any pending request. Dropping.\n"); - return; + "Received DNS reply that does not match any pending request. Dropping.\n"); + return; } LOG (GNUNET_ERROR_TYPE_DEBUG, "Got a response from the stub resolver for DNS request %llu intercepted locally!\n", @@ -736,7 +736,7 @@ process_dns_result (void *cls, * @param message the init message (unused) */ static void -handle_client_init (void *cls GNUNET_UNUSED, +handle_client_init (void *cls GNUNET_UNUSED, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { @@ -745,7 +745,7 @@ handle_client_init (void *cls GNUNET_UNUSED, cr = GNUNET_malloc (sizeof (struct ClientRecord)); cr->client = client; - cr->flags = (enum GNUNET_DNS_Flags) ntohl (reg->flags); + cr->flags = (enum GNUNET_DNS_Flags) ntohl (reg->flags); GNUNET_SERVER_client_keep (client); GNUNET_CONTAINER_DLL_insert (clients_head, clients_tail, @@ -763,7 +763,7 @@ handle_client_init (void *cls GNUNET_UNUSED, * @param message the response */ static void -handle_client_response (void *cls GNUNET_UNUSED, +handle_client_response (void *cls GNUNET_UNUSED, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { @@ -816,7 +816,7 @@ handle_client_response (void *cls GNUNET_UNUSED, { GNUNET_break (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); - next_phase (rr); + next_phase (rr); return; } GNUNET_free_non_null (rr->payload); @@ -844,9 +844,9 @@ handle_client_response (void *cls GNUNET_UNUSED, } break; } - next_phase (rr); + next_phase (rr); GNUNET_SERVER_receive_done (client, GNUNET_OK); - return; + return; } /* odd, client was not on our list for the request, that ought to be an error */ @@ -936,7 +936,7 @@ process_helper_messages (void *cls GNUNET_UNUSED, void *client, } if ( (msize <= sizeof (struct GNUNET_TUN_UdpHeader) + sizeof (struct GNUNET_TUN_DnsHeader)) || (DNS_PORT != ntohs (udp->destination_port)) ) - { + { /* non-DNS packet received on TUN, ignore */ GNUNET_STATISTICS_update (stats, gettext_noop ("# Non-DNS UDP packet received via TUN interface"), @@ -1025,7 +1025,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, { static const struct GNUNET_SERVER_MessageHandler handlers[] = { /* callback, cls, type, size */ - {&handle_client_init, NULL, GNUNET_MESSAGE_TYPE_DNS_CLIENT_INIT, + {&handle_client_init, NULL, GNUNET_MESSAGE_TYPE_DNS_CLIENT_INIT, sizeof (struct GNUNET_DNS_Register)}, {&handle_client_response, NULL, GNUNET_MESSAGE_TYPE_DNS_CLIENT_RESPONSE, 0}, {NULL, NULL, 0, 0} @@ -1059,7 +1059,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, cls); dns_exit = NULL; if ( ( (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (cfg, "dns", + GNUNET_CONFIGURATION_get_value_string (cfg, "dns", "DNS_EXIT", &dns_exit)) || ( (1 != inet_pton (AF_INET, dns_exit, &dns_exit4)) && @@ -1157,7 +1157,7 @@ main (int argc, char *const *argv) strerror (errno)); } else if (sgid != rgid) - { + { if (-1 == setregid (sgid, sgid)) fprintf (stderr, "setregid failed: %s\n", strerror (errno)); } 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, GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (ad->expiration_time)).rel_value_us) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "DNS advertisement has expired\n"); return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; } if (GNUNET_OK != GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_DNS_RECORD, - &ad->purpose, - &ad->signature, + &ad->purpose, + &ad->signature, &ad->peer.public_key)) { GNUNET_break_op (0); @@ -117,9 +117,9 @@ block_plugin_dns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, * (or if extracting a key from a block of this type does not work) */ static int -block_plugin_dns_get_key (void *cls, +block_plugin_dns_get_key (void *cls, enum GNUNET_BLOCK_Type type, - const void *block, + const void *block, size_t block_size, struct GNUNET_HashCode *key) { 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 /** * Type: GNUNET_MESSAGE_TYPE_DV_SEND_ACK or * GNUNET_MESSAGE_TYPE_DV_SEND_NACK. - */ + */ struct GNUNET_MessageHeader header; /** @@ -166,7 +166,7 @@ struct GNUNET_DV_DistanceUpdateMessage { /** * Type: GNUNET_MESSAGE_TYPE_DV_DISTANCE_CHANGED. - */ + */ struct GNUNET_MessageHeader header; /** 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 * Closure for 'cb'. */ void *cb_cls; - + /** * The actual message (allocated at the end of this struct). */ @@ -78,7 +78,7 @@ struct GNUNET_DV_TransmitHandle * UID of our message, if any. */ uint32_t uid; - + }; @@ -107,7 +107,7 @@ struct GNUNET_DV_ServiceHandle * Closure for the callbacks. */ void *cls; - + /** * Function to call on connect events. */ @@ -221,12 +221,12 @@ start_transmit (struct GNUNET_DV_ServiceHandle *sh) if (NULL != sh->th) return; if (NULL == sh->th_head) - return; + return; sh->th = GNUNET_CLIENT_notify_transmit_ready (sh->client, ntohs (sh->th_head->msg->size), GNUNET_TIME_UNIT_FOREVER_REL, - GNUNET_NO, + GNUNET_NO, &transmit_pending, sh); } @@ -291,7 +291,7 @@ process_ack (void *cls, * @param msg the message that was received */ static void -handle_message_receipt (void *cls, +handle_message_receipt (void *cls, const struct GNUNET_MessageHeader *msg) { struct GNUNET_DV_ServiceHandle *sh = cls; @@ -302,7 +302,7 @@ handle_message_receipt (void *cls, const struct GNUNET_MessageHeader *payload; const struct GNUNET_DV_AckMessage *ack; struct AckContext ctx; - + if (NULL == msg) { /* Connection closed */ @@ -389,7 +389,7 @@ handle_message_receipt (void *cls, reconnect (sh); break; } - GNUNET_CLIENT_receive (sh->client, + GNUNET_CLIENT_receive (sh->client, &handle_message_receipt, sh, GNUNET_TIME_UNIT_FOREVER_REL); } @@ -402,7 +402,7 @@ handle_message_receipt (void *cls, * @param size number of bytes available in buf * @param buf where to copy the message * @return number of bytes written to buf - */ + */ static size_t transmit_start (void *cls, size_t size, @@ -464,7 +464,7 @@ cleanup_send_cb (void *cls, */ static void reconnect (struct GNUNET_DV_ServiceHandle *sh) -{ +{ if (NULL != sh->th) { GNUNET_CLIENT_notify_transmit_ready_cancel (sh->th); @@ -538,7 +538,7 @@ void GNUNET_DV_service_disconnect (struct GNUNET_DV_ServiceHandle *sh) { struct GNUNET_DV_TransmitHandle *pos; - + if (NULL == sh) return; if (NULL != sh->th) @@ -553,7 +553,7 @@ GNUNET_DV_service_disconnect (struct GNUNET_DV_ServiceHandle *sh) pos); GNUNET_free (pos); } - if (NULL != sh->client) + if (NULL != sh->client) { GNUNET_CLIENT_disconnect (sh->client); sh->client = NULL; @@ -607,7 +607,7 @@ GNUNET_DV_send (struct GNUNET_DV_ServiceHandle *sh, th->msg = (const struct GNUNET_MessageHeader *) &th[1]; sm = (struct GNUNET_DV_SendMessage *) &th[1]; sm->header.type = htons (GNUNET_MESSAGE_TYPE_DV_SEND); - sm->header.size = htons (sizeof (struct GNUNET_DV_SendMessage) + + sm->header.size = htons (sizeof (struct GNUNET_DV_SendMessage) + ntohs (msg->size)); if (0 == sh->uid_gen) 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; * @param peer newly connected peer * @param distance distance to the peer */ -static void +static void connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer, uint32_t distance) @@ -62,7 +62,7 @@ connect_cb (void *cls, * @param peer connected peer * @param distance new distance to the peer */ -static void +static void change_cb (void *cls, const struct GNUNET_PeerIdentity *peer, uint32_t distance) @@ -79,7 +79,7 @@ change_cb (void *cls, * @param cls closure * @param peer peer that disconnected */ -static void +static void disconnect_cb (void *cls, const struct GNUNET_PeerIdentity *peer) { @@ -96,7 +96,7 @@ disconnect_cb (void *cls, * @param distance how far did the message travel * @param msg actual message payload */ -static void +static void message_cb (void *cls, const struct GNUNET_PeerIdentity *sender, uint32_t distance, @@ -171,7 +171,7 @@ main (int argc, char *const *argv) return 2; res = GNUNET_PROGRAM_run (argc, argv, "gnunet-dv", - gettext_noop ("Print information about DV state"), + gettext_noop ("Print information about DV state"), options, &run, NULL); 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 /** * Message exchanged between DV services (via core), requesting a - * message to be routed. + * message to be routed. */ struct RouteMessage { @@ -176,7 +176,7 @@ struct DirectNeighbor * with other applications. */ struct GNUNET_HashCode real_session_id; - + /** * Head of linked list of messages to send to this peer. */ @@ -197,7 +197,7 @@ struct DirectNeighbor * Keys are peer identities, values are 'struct Target' entries. * Note that the distances in the targets are from the point-of-view * of the peer, not from us! - */ + */ struct GNUNET_CONTAINER_MultiPeerMap *neighbor_table; /** @@ -206,7 +206,7 @@ struct DirectNeighbor * Keys are peer identities, values are 'struct Target' entries. * Note that the distances in the targets are from the point-of-view * of the peer, not from us! - */ + */ struct GNUNET_CONTAINER_MultiPeerMap *neighbor_table_consensus; /** @@ -318,13 +318,13 @@ struct ConsensusSet /** * Peermap of all of our neighbors; processing these usually requires - * first checking to see if the peer is core-connected and if the + * first checking to see if the peer is core-connected and if the * distance is 1, in which case they are direct neighbors. */ static struct GNUNET_CONTAINER_MultiPeerMap *direct_neighbors; /** - * Hashmap with all routes that we currently support; contains + * Hashmap with all routes that we currently support; contains * routing information for all peers from distance 2 * up to distance DEFAULT_FISHEYE_DEPTH. */ @@ -367,7 +367,7 @@ static struct GNUNET_STATISTICS_Handle *stats; * Handle to ATS service. */ static struct GNUNET_ATS_PerformanceHandle *ats; - + /** * Start creating a new DV set union by initiating the connection. @@ -375,7 +375,7 @@ static struct GNUNET_ATS_PerformanceHandle *ats; * @param cls the 'struct DirectNeighbor' of the peer we're building * a routing consensus with * @param tc scheduler context - */ + */ static void initiate_set_union (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); @@ -396,7 +396,7 @@ initiate_set_union (void *cls, * necessary to specify the set we want to do the operation with, * whith sometimes can be derived from the context message. * Also necessary to specify the timeout. - */ + */ static void listen_set_union (void *cls, const struct GNUNET_PeerIdentity *other_peer, @@ -412,7 +412,7 @@ listen_set_union (void *cls, * @param distance distance to the original sender of the message */ static void -send_data_to_plugin (const struct GNUNET_MessageHeader *message, +send_data_to_plugin (const struct GNUNET_MessageHeader *message, const struct GNUNET_PeerIdentity *origin, uint32_t distance) { @@ -422,10 +422,10 @@ send_data_to_plugin (const struct GNUNET_MessageHeader *message, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Delivering message from peer `%s'\n", GNUNET_i2s (origin)); - size = sizeof (struct GNUNET_DV_ReceivedMessage) + + size = sizeof (struct GNUNET_DV_ReceivedMessage) + ntohs (message->size); if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) - { + { GNUNET_break (0); /* too big */ return; } @@ -435,7 +435,7 @@ send_data_to_plugin (const struct GNUNET_MessageHeader *message, received_msg->distance = htonl (distance); received_msg->sender = *origin; memcpy (&received_msg[1], message, ntohs (message->size)); - GNUNET_SERVER_notification_context_broadcast (nc, + GNUNET_SERVER_notification_context_broadcast (nc, &received_msg->header, GNUNET_YES); GNUNET_free (received_msg); @@ -450,7 +450,7 @@ send_data_to_plugin (const struct GNUNET_MessageHeader *message, static void send_control_to_plugin (const struct GNUNET_MessageHeader *message) { - GNUNET_SERVER_notification_context_broadcast (nc, + GNUNET_SERVER_notification_context_broadcast (nc, message, GNUNET_NO); } @@ -464,7 +464,7 @@ send_control_to_plugin (const struct GNUNET_MessageHeader *message) * @param nack GNUNET_NO to send ACK, GNUNET_YES to send NACK */ static void -send_ack_to_plugin (const struct GNUNET_PeerIdentity *target, +send_ack_to_plugin (const struct GNUNET_PeerIdentity *target, uint32_t uid, int nack) { @@ -474,7 +474,7 @@ send_ack_to_plugin (const struct GNUNET_PeerIdentity *target, "Delivering ACK for message to peer `%s'\n", GNUNET_i2s (target)); ack_msg.header.size = htons (sizeof (ack_msg)); - ack_msg.header.type = htons ((GNUNET_YES == nack) + ack_msg.header.type = htons ((GNUNET_YES == nack) ? GNUNET_MESSAGE_TYPE_DV_SEND_NACK : GNUNET_MESSAGE_TYPE_DV_SEND_ACK); ack_msg.uid = htonl (uid); @@ -490,7 +490,7 @@ send_ack_to_plugin (const struct GNUNET_PeerIdentity *target, * @param distance new distance to the peer */ static void -send_distance_change_to_plugin (const struct GNUNET_PeerIdentity *peer, +send_distance_change_to_plugin (const struct GNUNET_PeerIdentity *peer, uint32_t distance) { struct GNUNET_DV_DistanceUpdateMessage du_msg; @@ -513,7 +513,7 @@ send_distance_change_to_plugin (const struct GNUNET_PeerIdentity *peer, * @param distance distance to the target */ static void -send_connect_to_plugin (const struct GNUNET_PeerIdentity *target, +send_connect_to_plugin (const struct GNUNET_PeerIdentity *target, uint32_t distance) { struct GNUNET_DV_ConnectMessage cm; @@ -585,7 +585,7 @@ core_transmit_notify (void *cls, size_t size, void *buf) dn->pm_tail, pending); memcpy (&cbuf[off], pending->msg, msize); - if (0 != pending->uid) + if (0 != pending->uid) send_ack_to_plugin (&pending->ultimate_target, pending->uid, GNUNET_NO); @@ -599,7 +599,7 @@ core_transmit_notify (void *cls, size_t size, void *buf) 0 /* priority */, GNUNET_TIME_UNIT_FOREVER_REL, &dn->peer, - msize, + msize, &core_transmit_notify, dn); return off; } @@ -662,7 +662,7 @@ forward_payload (struct DirectNeighbor *target, 0 /* priority */, GNUNET_TIME_UNIT_FOREVER_REL, &target->peer, - msize, + msize, &core_transmit_notify, target); } @@ -738,7 +738,7 @@ move_route (struct Route *route, release_route (route); i = get_consensus_slot (new_distance); route->set_offset = i; - consensi[new_distance].targets[i] = route; + consensi[new_distance].targets[i] = route; route->target.distance = htonl (new_distance); } @@ -785,13 +785,13 @@ build_set (void *cls) while ( (DEFAULT_FISHEYE_DEPTH - 1 > neighbor->consensus_insertion_distance) && (consensi[neighbor->consensus_insertion_distance].array_length < neighbor->consensus_insertion_offset) && (NULL == consensi[neighbor->consensus_insertion_distance].targets[neighbor->consensus_insertion_offset]) ) - neighbor->consensus_insertion_offset++; + neighbor->consensus_insertion_offset++; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding element to SET\n"); GNUNET_SET_add_element (neighbor->my_set, &element, &build_set, neighbor); - + } @@ -814,9 +814,9 @@ handle_direct_connect (struct DirectNeighbor *neighbor) GNUNET_STATISTICS_update (stats, "# peers connected (1-hop)", 1, GNUNET_NO); - route = GNUNET_CONTAINER_multipeermap_get (all_routes, + route = GNUNET_CONTAINER_multipeermap_get (all_routes, &neighbor->peer); - if (NULL != route) + if (NULL != route) { send_disconnect_to_plugin (&neighbor->peer); release_route (route); @@ -839,7 +839,7 @@ handle_direct_connect (struct DirectNeighbor *neighbor) sizeof (struct GNUNET_PeerIdentity))) { neighbor->initiate_task = GNUNET_SCHEDULER_add_now (&initiate_set_union, - neighbor); + neighbor); } else { @@ -861,16 +861,16 @@ handle_direct_connect (struct DirectNeighbor *neighbor) * @param peer peer identity this notification is about */ static void -handle_core_connect (void *cls, +handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer) { struct DirectNeighbor *neighbor; - + /* Check for connect to self message */ if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity))) return; /* check if entry exists */ - neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors, + neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors, peer); if (NULL != neighbor) { @@ -929,14 +929,14 @@ free_targets (void *cls, * @return GNUNET_YES to continue iteration, GNUNET_NO to stop */ static int -check_possible_route (void *cls, - const struct GNUNET_PeerIdentity *key, +check_possible_route (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { struct DirectNeighbor *neighbor = cls; struct Target *target = value; struct Route *route; - + route = GNUNET_CONTAINER_multipeermap_get (all_routes, key); if (NULL != route) @@ -975,15 +975,15 @@ check_possible_route (void *cls, * @return GNUNET_YES to continue iteration */ static int -refresh_routes (void *cls, - const struct GNUNET_PeerIdentity *key, +refresh_routes (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { struct DirectNeighbor *neighbor = value; if ( (GNUNET_YES != neighbor->connected) || (DIRECT_NEIGHBOR_COST != neighbor->distance) ) - return GNUNET_YES; + return GNUNET_YES; if (NULL != neighbor->neighbor_table) GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table, &check_possible_route, @@ -1024,8 +1024,8 @@ get_atsi_distance (const struct GNUNET_ATS_Information *atsi, * @return GNUNET_YES to continue iteration, GNUNET_NO to stop */ static int -cull_routes (void *cls, - const struct GNUNET_PeerIdentity *key, +cull_routes (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { struct DirectNeighbor *neighbor = cls; @@ -1047,7 +1047,7 @@ cull_routes (void *cls, * disrupted. Remove all routes via that peer and * stop the consensus with it. * - * @param neighbor peer that was disconnected (or at least is no + * @param neighbor peer that was disconnected (or at least is no * longer at distance 1) */ static void @@ -1118,7 +1118,7 @@ handle_ats_update (void *cls, int active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, - const struct GNUNET_ATS_Information *ats, + const struct GNUNET_ATS_Information *ats, uint32_t ats_count) { struct DirectNeighbor *neighbor; @@ -1126,25 +1126,25 @@ handle_ats_update (void *cls, if (GNUNET_NO == active) return; - distance = get_atsi_distance (ats, ats_count); + distance = get_atsi_distance (ats, ats_count); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS says distance to %s is %u\n", GNUNET_i2s (&address->peer), (unsigned int) distance); /* check if entry exists */ - neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors, + neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors, &address->peer); if (NULL != neighbor) - { + { if ( (DIRECT_NEIGHBOR_COST == neighbor->distance) && (DIRECT_NEIGHBOR_COST == distance) ) return; /* no change */ - if (DIRECT_NEIGHBOR_COST == neighbor->distance) + if (DIRECT_NEIGHBOR_COST == neighbor->distance) { neighbor->distance = distance; GNUNET_STATISTICS_update (stats, "# peers connected (1-hop)", - -1, GNUNET_NO); + -1, GNUNET_NO); handle_direct_disconnect (neighbor); GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors, &refresh_routes, @@ -1153,7 +1153,7 @@ handle_ats_update (void *cls, } neighbor->distance = distance; if (DIRECT_NEIGHBOR_COST != neighbor->distance) - return; + return; if (GNUNET_YES != neighbor->connected) return; handle_direct_connect (neighbor); @@ -1167,7 +1167,7 @@ handle_ats_update (void *cls, neighbor, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); neighbor->connected = GNUNET_NO; /* not yet */ - neighbor->distance = distance; + neighbor->distance = distance; } @@ -1357,7 +1357,7 @@ handle_set_union_result (void *cls, /* check if we got an alternative for the removed routes */ GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors, &refresh_routes, - NULL); + NULL); } /* add targets that appeared (and check for improved routes) */ GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table_consensus, @@ -1406,7 +1406,7 @@ handle_set_union_result (void *cls, * necessary to specify the set we want to do the operation with, * whith sometimes can be derived from the context message. * Also necessary to specify the timeout. - */ + */ static void listen_set_union (void *cls, const struct GNUNET_PeerIdentity *other_peer, @@ -1446,7 +1446,7 @@ listen_set_union (void *cls, * @param cls the 'struct DirectNeighbor' of the peer we're building * a routing consensus with * @param tc scheduler context - */ + */ static void initiate_set_union (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) @@ -1550,7 +1550,7 @@ handle_dv_route_message (void *cls, const struct GNUNET_PeerIdentity *peer, &rm->target, &rm->sender, payload); - return GNUNET_OK; + return GNUNET_OK; } @@ -1627,12 +1627,12 @@ cleanup_neighbor (struct DirectNeighbor *neighbor) neighbor->pm_queue_size--; GNUNET_CONTAINER_DLL_remove (neighbor->pm_head, neighbor->pm_tail, - pending); + pending); GNUNET_free (pending); } handle_direct_disconnect (neighbor); GNUNET_assert (GNUNET_YES == - GNUNET_CONTAINER_multipeermap_remove (direct_neighbors, + GNUNET_CONTAINER_multipeermap_remove (direct_neighbors, &neighbor->peer, neighbor)); GNUNET_free (neighbor); @@ -1669,7 +1669,7 @@ handle_core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) { GNUNET_STATISTICS_update (stats, "# peers connected (1-hop)", - -1, GNUNET_NO); + -1, GNUNET_NO); } cleanup_neighbor (neighbor); GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors, @@ -1770,13 +1770,13 @@ add_route (void *cls, struct GNUNET_SERVER_Client *client = cls; struct Route *route = value; struct GNUNET_DV_ConnectMessage cm; - + cm.header.size = htons (sizeof (cm)); cm.header.type = htons (GNUNET_MESSAGE_TYPE_DV_CONNECT); cm.distance = htonl (route->target.distance); cm.peer = route->target.peer; - GNUNET_SERVER_notification_context_unicast (nc, + GNUNET_SERVER_notification_context_unicast (nc, client, &cm.header, GNUNET_NO); @@ -1796,7 +1796,7 @@ static void handle_start (void *cls, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { - GNUNET_SERVER_notification_context_add (nc, client); + GNUNET_SERVER_notification_context_add (nc, client); GNUNET_SERVER_receive_done (client, GNUNET_OK); GNUNET_CONTAINER_multipeermap_iterate (all_routes, &add_route, @@ -1837,11 +1837,11 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, {NULL, 0, 0} }; static struct GNUNET_SERVER_MessageHandler plugin_handlers[] = { - {&handle_start, NULL, - GNUNET_MESSAGE_TYPE_DV_START, + {&handle_start, NULL, + GNUNET_MESSAGE_TYPE_DV_START, sizeof (struct GNUNET_MessageHeader) }, - { &handle_dv_send_message, NULL, - GNUNET_MESSAGE_TYPE_DV_SEND, + { &handle_dv_send_message, NULL, + GNUNET_MESSAGE_TYPE_DV_SEND, 0}, {NULL, NULL, 0, 0} }; @@ -1850,11 +1850,11 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, direct_neighbors = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); all_routes = GNUNET_CONTAINER_multipeermap_create (65536, GNUNET_NO); core_api = GNUNET_CORE_connect (cfg, NULL, - &core_init, + &core_init, &handle_core_connect, &handle_core_disconnect, - NULL, GNUNET_NO, - NULL, GNUNET_NO, + NULL, GNUNET_NO, + NULL, GNUNET_NO, core_handlers); 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 /** * Tokenizer for boxed messages. */ - struct GNUNET_SERVER_MessageStreamTokenizer *mst; + struct GNUNET_SERVER_MessageStreamTokenizer *mst; }; @@ -202,11 +202,11 @@ unbox_cb (void *cls, struct Plugin *plugin = cls; struct Session *session = client; struct GNUNET_ATS_Information ats; - + ats.type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); ats.value = htonl (session->distance); session->active = GNUNET_YES; - plugin->env->receive (plugin->env->cls, + plugin->env->receive (plugin->env->cls, &session->sender, message, session, "", 0); @@ -222,7 +222,7 @@ unbox_cb (void *cls, * @param cls closure with the plugin * @param sender sender of the message * @param distance how far did the message travel - * @param msg actual message payload + * @param msg actual message payload */ static void handle_dv_message_received (void *cls, @@ -236,7 +236,7 @@ handle_dv_message_received (void *cls, session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, sender); - if (NULL == session) + if (NULL == session) { GNUNET_break (0); return; @@ -244,7 +244,7 @@ handle_dv_message_received (void *cls, if (GNUNET_MESSAGE_TYPE_DV_BOX == ntohs (msg->type)) { /* need to unbox using MST */ - GNUNET_SERVER_mst_receive (plugin->mst, + GNUNET_SERVER_mst_receive (plugin->mst, session, (const char *) &msg[1], ntohs (msg->size) - sizeof (struct GNUNET_MessageHeader), @@ -270,7 +270,7 @@ handle_dv_message_received (void *cls, * @param peer newly connected peer * @param distance distance to the peer */ -static void +static void handle_dv_connect (void *cls, const struct GNUNET_PeerIdentity *peer, uint32_t distance) @@ -280,13 +280,13 @@ handle_dv_connect (void *cls, session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, peer); - if (NULL != session) + if (NULL != session) { GNUNET_break (0); session->distance = distance; if (GNUNET_YES == session->active) notify_distance_change (session); - return; /* nothing to do */ + return; /* nothing to do */ } session = GNUNET_new (struct Session); session->sender = *peer; @@ -306,7 +306,7 @@ handle_dv_connect (void *cls, * @param peer connected peer * @param distance new distance to the peer */ -static void +static void handle_dv_distance_changed (void *cls, const struct GNUNET_PeerIdentity *peer, uint32_t distance) @@ -316,7 +316,7 @@ handle_dv_distance_changed (void *cls, session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, peer); - if (NULL == session) + if (NULL == session) { GNUNET_break (0); handle_dv_connect (plugin, peer, distance); @@ -370,7 +370,7 @@ free_session (struct Session *session) * @param cls closure with 'struct Plugin' * @param peer peer that disconnected */ -static void +static void handle_dv_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) { @@ -379,7 +379,7 @@ handle_dv_disconnect (void *cls, session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, peer); - if (NULL == session) + if (NULL == session) return; /* nothing to do */ free_session (session); } @@ -431,10 +431,10 @@ send_finished (void *cls, * and does NOT mean that the message was not transmitted (DV) */ static ssize_t -dv_plugin_send (void *cls, +dv_plugin_send (void *cls, struct Session *session, const char *msgbuf, size_t msgbuf_size, unsigned int priority, - struct GNUNET_TIME_Relative timeout, + struct GNUNET_TIME_Relative timeout, GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) { struct PendingRequest *pr; @@ -486,8 +486,8 @@ dv_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target) session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, target); - if (NULL == session) - return; /* nothing to do */ + if (NULL == session) + return; /* nothing to do */ while (NULL != (pr = session->pr_head)) { GNUNET_CONTAINER_DLL_remove (session->pr_head, @@ -548,7 +548,7 @@ dv_plugin_address_to_string (void *cls, const void *addr, size_t addrlen) if (0 != addrlen) { GNUNET_break (0); /* malformed */ - return NULL; + return NULL; } return "dv"; } @@ -588,7 +588,7 @@ dv_plugin_check_address (void *cls, const void *addr, size_t addrlen) * @param address the address * @return the session if the address is valid, NULL otherwise */ -static struct Session * +static struct Session * dv_get_session (void *cls, const struct GNUNET_HELLO_Address *address) { @@ -618,7 +618,7 @@ dv_get_session (void *cls, * @param added length of created address * @return GNUNET_OK on success, GNUNET_SYSERR on failure */ -static int +static int dv_plugin_string_to_address (void *cls, const char *addr, uint16_t addrlen, @@ -646,7 +646,7 @@ dv_plugin_string_to_address (void *cls, * @param session the session * @return the network type */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_ATS_Network_Type dv_get_network (void *cls, struct Session *session) { @@ -682,7 +682,7 @@ libgnunet_plugin_transport_dv_init (void *cls) if (NULL == plugin->dvh) { GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions); - GNUNET_SERVER_mst_destroy (plugin->mst); + GNUNET_SERVER_mst_destroy (plugin->mst); GNUNET_free (plugin); return NULL; } @@ -737,7 +737,7 @@ libgnunet_plugin_transport_dv_done (void *cls) &free_session_iterator, NULL); GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions); - GNUNET_SERVER_mst_destroy (plugin->mst); + GNUNET_SERVER_mst_destroy (plugin->mst); GNUNET_free (plugin); GNUNET_free (api); 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, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Links successful %u / %u failed\n", links_succeeded, links_failed); if ( (4 == num_peers) && (0 == links_failed) ) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Testbed connect peers despite blacklist!\n"); ok = 1; } 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 @@ * Boston, MA 02111-1307, USA. */ -/** +/** * @file env/env.c * @brief Library providing operations for the @e environment of * PSYC and Social messages, and for (de)serializing variable values. @@ -29,7 +29,7 @@ #include "gnunet_util_lib.h" #include "gnunet_env_lib.h" -/** +/** * Environment for a message. * * Contains modifiers. @@ -42,9 +42,9 @@ struct GNUNET_ENV_Environment }; -/** +/** * Create an environment. - * + * * @return A newly allocated environment. */ struct GNUNET_ENV_Environment * @@ -54,7 +54,7 @@ GNUNET_ENV_environment_create () } -/** +/** * Add a modifier to the environment. * * @param env The environment. @@ -78,7 +78,7 @@ GNUNET_ENV_environment_add_mod (struct GNUNET_ENV_Environment *env, } -/** +/** * Iterate through all modifiers in the environment. * * @param env The environment. @@ -95,7 +95,7 @@ GNUNET_ENV_environment_iterate (const struct GNUNET_ENV_Environment *env, } -/** +/** * Get the number of modifiers in the environment. * * @param env The environment. @@ -109,7 +109,7 @@ GNUNET_ENV_environment_get_mod_count (const struct GNUNET_ENV_Environment *env) } -/** +/** * Destroy an environment. * * @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 @@ * Boston, MA 02111-1307, USA. */ -/** +/** * @file env/test_env.c * @brief Tests for the environment library. * @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 /** - * Message send via mesh between VPN and entry and an exit daemon to + * Message send via mesh between VPN and entry and an exit daemon to * transmit TCP data between the VPN entry and an exit session. This * format is used for both Internet-exits and service-exits and * in both directions (VPN to exit and exit to VPN). @@ -136,7 +136,7 @@ struct GNUNET_EXIT_UdpServiceMessage /** * Destination port to use for the UDP request. In NBO. - */ + */ uint16_t destination_port GNUNET_PACKED; /** @@ -171,7 +171,7 @@ struct GNUNET_EXIT_UdpInternetMessage /** * Destination port to use for the UDP request. In NBO. - */ + */ uint16_t destination_port GNUNET_PACKED; /* followed by IP address of the destination; either @@ -201,7 +201,7 @@ struct GNUNET_EXIT_UdpReplyMessage /** * Destination port to use for the UDP reply (0 to use the same * port as for the original request). In NBO. - */ + */ uint16_t destination_port GNUNET_PACKED; /* 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 @@ * - which code should advertise services? the service model is right * now a bit odd, especially as this code DOES the exit and knows * the DNS "name", but OTOH this is clearly NOT the place to advertise - * the service's existence; maybe the daemon should turn into a + * the service's existence; maybe the daemon should turn into a * service with an API to add local-exit services dynamically? */ #include "platform.h" @@ -111,7 +111,7 @@ struct SocketAddress */ struct in6_addr ipv6; } address; - + /** * IPPROTO_TCP or IPPROTO_UDP; */ @@ -155,7 +155,7 @@ struct LocalService * IP-version, protocol, source-IP, destination-IP, source-port and * destinatin-port. */ -struct RedirectInformation +struct RedirectInformation { /** @@ -171,10 +171,10 @@ struct RedirectInformation */ struct SocketAddress local_address; - /* + /* Note 1: additional information might be added here in the future to support protocols that require special handling, - such as ftp/tftp + such as ftp/tftp Note 2: we might also sometimes not match on all components of the tuple, to support protocols where things do not always @@ -235,42 +235,42 @@ struct TunnelState struct GNUNET_MESH_TransmitHandle *th; /** - * #GNUNET_NO if this is a tunnel for TCP/UDP, + * #GNUNET_NO if this is a tunnel for TCP/UDP, * #GNUNET_YES if this is a tunnel for DNS, * #GNUNET_SYSERR if the tunnel is not yet initialized. */ int is_dns; - union + union { - struct + struct { /** * Heap node for this state in the connections_heap. */ struct GNUNET_CONTAINER_HeapNode *heap_node; - + /** * Key this state has in the connections_map. */ struct GNUNET_HashCode state_key; - + /** * Associated service record, or NULL for no service. */ struct LocalService *serv; - + /** * Head of DLL of messages for this tunnel. */ struct TunnelMessageQueue *head; - + /** * Tail of DLL of messages for this tunnel. */ struct TunnelMessageQueue *tail; - + /** * Primary redirection information for this connection. */ @@ -284,28 +284,28 @@ struct TunnelState * DNS reply ready for transmission. */ char *reply; - + /** * Socket we are using to transmit this request (must match if we receive * a response). */ struct GNUNET_DNSSTUB_RequestSocket *rs; - + /** * Number of bytes in 'reply'. */ size_t reply_length; - + /** * Original DNS request ID as used by the client. */ uint16_t original_id; - + /** * DNS request ID that we used for forwarding. */ uint16_t my_id; - + } dns; } specifics; @@ -411,7 +411,7 @@ static struct GNUNET_DNSSTUB_Context *dnsstub; /** * Handle for ongoing DHT PUT operations to advertise exit service. - */ + */ static struct GNUNET_DHT_PutHandle *dht_put; /** @@ -487,7 +487,7 @@ transmit_reply_to_mesh (void *cls, GNUNET_assert (ts->specifics.dns.reply != NULL); if (size == 0) return 0; - ret = sizeof (struct GNUNET_MessageHeader) + ts->specifics.dns.reply_length; + ret = sizeof (struct GNUNET_MessageHeader) + ts->specifics.dns.reply_length; GNUNET_assert (ret <= size); hdr.size = htons (ret); hdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET); @@ -502,7 +502,7 @@ transmit_reply_to_mesh (void *cls, off += ts->specifics.dns.reply_length - sizeof (dns); GNUNET_free (ts->specifics.dns.reply); ts->specifics.dns.reply = NULL; - ts->specifics.dns.reply_length = 0; + ts->specifics.dns.reply_length = 0; GNUNET_assert (ret == off); return ret; } @@ -558,7 +558,7 @@ process_dns_result (void *cls, * @param tunnel connection to the other end * @param tunnel_ctx pointer to our `struct TunnelState *` * @param message the actual message - * + * * @return #GNUNET_OK to keep the connection open, * #GNUNET_SYSERR to close it (signal serious error) */ @@ -595,7 +595,7 @@ receive_dns_request (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, ts->specifics.dns.original_id = dns->id; if (tunnels[ts->specifics.dns.my_id] == ts) tunnels[ts->specifics.dns.my_id] = NULL; - ts->specifics.dns.my_id = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, + ts->specifics.dns.my_id = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT16_MAX + 1); tunnels[ts->specifics.dns.my_id] = ts; memcpy (buf, dns, dlen); @@ -619,7 +619,7 @@ receive_dns_request (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, * @param ri information about the connection */ static void -hash_redirect_info (struct GNUNET_HashCode *hash, +hash_redirect_info (struct GNUNET_HashCode *hash, const struct RedirectInformation *ri) { char *off; @@ -678,7 +678,7 @@ hash_redirect_info (struct GNUNET_HashCode *hash, */ static struct TunnelState * get_redirect_state (int af, - int protocol, + int protocol, const void *destination_ip, uint16_t destination_port, const void *local_ip, @@ -718,7 +718,7 @@ get_redirect_state (int af, return NULL; /* Mark this connection as freshly used */ if (NULL == state_key) - GNUNET_CONTAINER_heap_update_cost (connections_heap, + GNUNET_CONTAINER_heap_update_cost (connections_heap, state->specifics.tcp_udp.heap_node, GNUNET_TIME_absolute_get ().abs_value_us); return state; @@ -774,7 +774,7 @@ free_service_record (void *cls, * respective service entry. * * @param service_map map of services (TCP or UDP) - * @param name name of the service + * @param name name of the service * @param destination_port destination port * @param service service information record to store (service->name will be set). */ @@ -827,8 +827,8 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf) return 0; if (0 == size) { - s->th = GNUNET_MESH_notify_transmit_ready (tunnel, - GNUNET_NO /* corking */, + s->th = GNUNET_MESH_notify_transmit_ready (tunnel, + GNUNET_NO /* corking */, GNUNET_TIME_UNIT_FOREVER_REL, tnq->len, &send_to_peer_notify_callback, @@ -838,13 +838,13 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf) GNUNET_assert (size >= tnq->len); memcpy (buf, tnq->payload, tnq->len); size = tnq->len; - GNUNET_CONTAINER_DLL_remove (s->specifics.tcp_udp.head, + GNUNET_CONTAINER_DLL_remove (s->specifics.tcp_udp.head, s->specifics.tcp_udp.tail, - tnq); + tnq); GNUNET_free (tnq); if (NULL != (tnq = s->specifics.tcp_udp.head)) - s->th = GNUNET_MESH_notify_transmit_ready (tunnel, - GNUNET_NO /* corking */, + s->th = GNUNET_MESH_notify_transmit_ready (tunnel, + GNUNET_NO /* corking */, GNUNET_TIME_UNIT_FOREVER_REL, tnq->len, &send_to_peer_notify_callback, @@ -887,16 +887,16 @@ send_packet_to_mesh_tunnel (struct TunnelState *s, * @param icmp A pointer to the Packet * @param pktlen number of bytes in 'icmp' * @param af address family (AFINET or AF_INET6) - * @param destination_ip destination IP-address of the IP packet (should + * @param destination_ip destination IP-address of the IP packet (should * be our local address) * @param source_ip original source IP-address of the IP packet (should * be the original destination address) */ static void -icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp, +icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp, size_t pktlen, int af, - const void *destination_ip, + const void *destination_ip, const void *source_ip) { struct TunnelState *state; @@ -920,7 +920,7 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp, sbuf, sizeof (sbuf)), inet_ntop (af, destination_ip, - dbuf, sizeof (dbuf))); + dbuf, sizeof (dbuf))); } if (pktlen < sizeof (struct GNUNET_TUN_IcmpHeader)) { @@ -946,7 +946,7 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp, case GNUNET_TUN_ICMPTYPE_DESTINATION_UNREACHABLE: case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH: case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED: - if (pktlen < + if (pktlen < sizeof (struct GNUNET_TUN_IcmpHeader) + sizeof (struct GNUNET_TUN_IPv4Header) + 8) { @@ -980,7 +980,7 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp, case GNUNET_TUN_ICMPTYPE6_PACKET_TOO_BIG: case GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED: case GNUNET_TUN_ICMPTYPE6_PARAMETER_PROBLEM: - if (pktlen < + if (pktlen < sizeof (struct GNUNET_TUN_IcmpHeader) + sizeof (struct GNUNET_TUN_IPv6Header) + 8) { @@ -1055,7 +1055,7 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp, return; } mlen = sizeof (struct GNUNET_EXIT_IcmpToVPNMessage) + pktlen - sizeof (struct GNUNET_TUN_IcmpHeader); - tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueue) + mlen); + tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueue) + mlen); tnq->payload = &tnq[1]; tnq->len = mlen; i2v = (struct GNUNET_EXIT_IcmpToVPNMessage *) &tnq[1]; @@ -1075,16 +1075,16 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp, * @param udp A pointer to the Packet * @param pktlen number of bytes in 'udp' * @param af address family (AFINET or AF_INET6) - * @param destination_ip destination IP-address of the IP packet (should + * @param destination_ip destination IP-address of the IP packet (should * be our local address) * @param source_ip original source IP-address of the IP packet (should * be the original destination address) */ static void -udp_from_helper (const struct GNUNET_TUN_UdpHeader *udp, +udp_from_helper (const struct GNUNET_TUN_UdpHeader *udp, size_t pktlen, int af, - const void *destination_ip, + const void *destination_ip, const void *source_ip) { struct TunnelState *state; @@ -1131,7 +1131,7 @@ udp_from_helper (const struct GNUNET_TUN_UdpHeader *udp, return; } mlen = sizeof (struct GNUNET_EXIT_UdpReplyMessage) + pktlen - sizeof (struct GNUNET_TUN_UdpHeader); - tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueue) + mlen); + tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueue) + mlen); tnq->payload = &tnq[1]; tnq->len = mlen; urm = (struct GNUNET_EXIT_UdpReplyMessage *) &tnq[1]; @@ -1152,13 +1152,13 @@ udp_from_helper (const struct GNUNET_TUN_UdpHeader *udp, * @param tcp A pointer to the Packet * @param pktlen the length of the packet, including its TCP header * @param af address family (AFINET or AF_INET6) - * @param destination_ip destination IP-address of the IP packet (should + * @param destination_ip destination IP-address of the IP packet (should * be our local address) * @param source_ip original source IP-address of the IP packet (should * be the original destination address) */ static void -tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp, +tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp, size_t pktlen, int af, const void *destination_ip, @@ -1193,7 +1193,7 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp, return; } state = get_redirect_state (af, IPPROTO_TCP, - source_ip, + source_ip, ntohs (tcp->source_port), destination_ip, ntohs (tcp->destination_port), @@ -1202,12 +1202,12 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp, { GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("TCP Packet dropped, have no matching connection information\n")); - + return; } /* mug port numbers and crc to avoid information leakage; sender will need to lookup the correct values anyway */ - memcpy (buf, tcp, pktlen); + memcpy (buf, tcp, pktlen); mtcp = (struct GNUNET_TUN_TcpHeader *) buf; mtcp->source_port = 0; mtcp->destination_port = 0; @@ -1228,7 +1228,7 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp, tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN); tdm->reserved = htonl (0); memcpy (&tdm->tcp_header, - buf, + buf, pktlen); send_packet_to_mesh_tunnel (state, tnq); } @@ -1296,26 +1296,26 @@ message_token (void *cls GNUNET_UNUSED, void *client GNUNET_UNUSED, _("IPv4 packet options received. Ignored.\n")); return GNUNET_OK; } - + size -= sizeof (struct GNUNET_TUN_IPv4Header); switch (pkt4->protocol) { case IPPROTO_UDP: udp_from_helper ((const struct GNUNET_TUN_UdpHeader *) &pkt4[1], size, AF_INET, - &pkt4->destination_address, + &pkt4->destination_address, &pkt4->source_address); break; case IPPROTO_TCP: tcp_from_helper ((const struct GNUNET_TUN_TcpHeader *) &pkt4[1], size, AF_INET, - &pkt4->destination_address, + &pkt4->destination_address, &pkt4->source_address); break; case IPPROTO_ICMP: icmp_from_helper ((const struct GNUNET_TUN_IcmpHeader *) &pkt4[1], size, AF_INET, - &pkt4->destination_address, + &pkt4->destination_address, &pkt4->source_address); break; default: @@ -1349,19 +1349,19 @@ message_token (void *cls GNUNET_UNUSED, void *client GNUNET_UNUSED, case IPPROTO_UDP: udp_from_helper ((const struct GNUNET_TUN_UdpHeader *) &pkt6[1], size, AF_INET6, - &pkt6->destination_address, + &pkt6->destination_address, &pkt6->source_address); break; case IPPROTO_TCP: tcp_from_helper ((const struct GNUNET_TUN_TcpHeader *) &pkt6[1], size, AF_INET6, - &pkt6->destination_address, + &pkt6->destination_address, &pkt6->source_address); break; case IPPROTO_ICMPV6: icmp_from_helper ((const struct GNUNET_TUN_IcmpHeader *) &pkt6[1], size, AF_INET6, - &pkt6->destination_address, + &pkt6->destination_address, &pkt6->source_address); break; default: @@ -1398,14 +1398,14 @@ setup_fresh_address (int af, local_address->af = af; local_address->proto = (uint8_t) proto; /* default "local" port range is often 32768--61000, - so we pick a random value in that range */ + so we pick a random value in that range */ if ( ( (af == AF_INET) && (proto == IPPROTO_ICMP) ) || ( (af == AF_INET6) && (proto == IPPROTO_ICMPV6) ) ) local_address->port = 0; else - local_address->port - = (uint16_t) 32768 + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, - 28232); + local_address->port + = (uint16_t) 32768 + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, + 28232); switch (af) { case AF_INET: @@ -1422,13 +1422,13 @@ setup_fresh_address (int af, local_address->address.ipv4 = addr; return; } - /* Given 192.168.0.1/255.255.0.0, we want a mask + /* Given 192.168.0.1/255.255.0.0, we want a mask of '192.168.255.255', thus: */ mask.s_addr = addr.s_addr | ~mask.s_addr; /* Pick random IPv4 address within the subnet, except 'addr' or 'mask' itself */ do { - rnd.s_addr = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, + rnd.s_addr = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX); local_address->address.ipv4.s_addr = (addr.s_addr | rnd.s_addr) & mask.s_addr; } @@ -1442,7 +1442,7 @@ setup_fresh_address (int af, struct in6_addr mask; struct in6_addr rnd; int i; - + addr = exit_ipv6addr; GNUNET_assert (ipv6prefix < 128); if (ipv6prefix == 127) @@ -1456,13 +1456,13 @@ setup_fresh_address (int af, mask = addr; for (i=127;i>=ipv6prefix;i--) mask.s6_addr[i / 8] |= (1 << (i % 8)); - + /* Pick random IPv6 address within the subnet, except 'addr' or 'mask' itself */ do { for (i=0;i<16;i++) { - rnd.s6_addr[i] = (unsigned char) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, + rnd.s6_addr[i] = (unsigned char) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256); local_address->address.ipv6.s6_addr[i] = (addr.s6_addr[i] | rnd.s6_addr[i]) & mask.s6_addr[i]; @@ -1478,7 +1478,7 @@ setup_fresh_address (int af, break; default: GNUNET_assert (0); - } + } } @@ -1531,19 +1531,19 @@ setup_state_record (struct TunnelState *state) char buf[INET6_ADDRSTRLEN]; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Picked local address %s:%u for new connection\n", - inet_ntop (state->specifics.tcp_udp.ri.local_address.af, + inet_ntop (state->specifics.tcp_udp.ri.local_address.af, &state->specifics.tcp_udp.ri.local_address.address, buf, sizeof (buf)), (unsigned int) state->specifics.tcp_udp.ri.local_address.port); } state->specifics.tcp_udp.state_key = key; GNUNET_assert (GNUNET_OK == - GNUNET_CONTAINER_multihashmap_put (connections_map, + GNUNET_CONTAINER_multihashmap_put (connections_map, &key, state, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); state->specifics.tcp_udp.heap_node = GNUNET_CONTAINER_heap_insert (connections_heap, state, - GNUNET_TIME_absolute_get ().abs_value_us); + GNUNET_TIME_absolute_get ().abs_value_us); while (GNUNET_CONTAINER_heap_get_size (connections_heap) > max_connections) { s = GNUNET_CONTAINER_heap_remove_root (connections_heap); @@ -1552,7 +1552,7 @@ setup_state_record (struct TunnelState *state) GNUNET_MESH_tunnel_destroy (s->tunnel); GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_remove (connections_map, - &s->specifics.tcp_udp.state_key, + &s->specifics.tcp_udp.state_key, s)); GNUNET_free (s); } @@ -1630,7 +1630,7 @@ prepare_ipv4_packet (const void *payload, size_t payload_length, case IPPROTO_TCP: { struct GNUNET_TUN_TcpHeader *pkt4_tcp = (struct GNUNET_TUN_TcpHeader *) &pkt4[1]; - + *pkt4_tcp = *tcp_header; pkt4_tcp->source_port = htons (src_address->port); pkt4_tcp->destination_port = htons (dst_address->port); @@ -1696,7 +1696,7 @@ prepare_ipv6_packet (const void *payload, size_t payload_length, GNUNET_TUN_initialize_ipv6_header (pkt6, protocol, - len, + len, &src_address->address.ipv6, &dst_address->address.ipv6); @@ -1785,7 +1785,7 @@ send_tcp_packet_via_tun (const struct SocketAddress *destination_address, char buf[len] GNUNET_ALIGN; struct GNUNET_MessageHeader *hdr; struct GNUNET_TUN_Layer2PacketHeader *tun; - + hdr = (struct GNUNET_MessageHeader *) buf; hdr->type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER); hdr->size = htons (len); @@ -1800,7 +1800,7 @@ send_tcp_packet_via_tun (const struct SocketAddress *destination_address, tun->proto = htons (ETH_P_IPV4); prepare_ipv4_packet (payload, payload_length, IPPROTO_TCP, - tcp_header, + tcp_header, source_address, destination_address, ipv4); @@ -1811,9 +1811,9 @@ send_tcp_packet_via_tun (const struct SocketAddress *destination_address, struct GNUNET_TUN_IPv6Header * ipv6 = (struct GNUNET_TUN_IPv6Header*) &tun[1]; tun->proto = htons (ETH_P_IPV6); - prepare_ipv6_packet (payload, payload_length, + prepare_ipv6_packet (payload, payload_length, IPPROTO_TCP, - tcp_header, + tcp_header, source_address, destination_address, ipv6); @@ -1840,7 +1840,7 @@ send_tcp_packet_via_tun (const struct SocketAddress *destination_address, * @param tunnel connection to the other end * @param tunnel_ctx pointer to our 'struct TunnelState *' * @param message the actual message - * + * * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ @@ -1853,7 +1853,7 @@ receive_tcp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, const struct GNUNET_EXIT_TcpServiceStartMessage *start; uint16_t pkt_len = ntohs (message->size); - if (NULL == state) + if (NULL == state) { GNUNET_break_op (0); return GNUNET_SYSERR; @@ -1899,11 +1899,11 @@ receive_tcp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, "Received data from %s for forwarding to TCP service %s on port %u\n", GNUNET_i2s (&state->peer), GNUNET_h2s (&start->service_descriptor), - (unsigned int) ntohs (start->tcp_header.destination_port)); - if (NULL == (state->specifics.tcp_udp.serv = find_service (tcp_services, &start->service_descriptor, + (unsigned int) ntohs (start->tcp_header.destination_port)); + if (NULL == (state->specifics.tcp_udp.serv = find_service (tcp_services, &start->service_descriptor, ntohs (start->tcp_header.destination_port)))) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("No service found for %s on port %d!\n"), "TCP", ntohs (start->tcp_header.destination_port)); @@ -1912,7 +1912,7 @@ receive_tcp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, 1, GNUNET_NO); return GNUNET_SYSERR; } - state->specifics.tcp_udp.ri.remote_address = state->specifics.tcp_udp.serv->address; + state->specifics.tcp_udp.ri.remote_address = state->specifics.tcp_udp.serv->address; setup_state_record (state); send_tcp_packet_via_tun (&state->specifics.tcp_udp.ri.remote_address, &state->specifics.tcp_udp.ri.local_address, @@ -1929,7 +1929,7 @@ receive_tcp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, * @param tunnel connection to the other end * @param tunnel_ctx pointer to our 'struct TunnelState *' * @param message the actual message - * + * * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ @@ -1946,7 +1946,7 @@ receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, const void *payload; int af; - if (NULL == state) + if (NULL == state) { GNUNET_break_op (0); return GNUNET_SYSERR; @@ -1973,7 +1973,7 @@ receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, return GNUNET_SYSERR; } start = (const struct GNUNET_EXIT_TcpInternetStartMessage*) message; - pkt_len -= sizeof (struct GNUNET_EXIT_TcpInternetStartMessage); + pkt_len -= sizeof (struct GNUNET_EXIT_TcpInternetStartMessage); if ( (NULL != state->specifics.tcp_udp.serv) || (NULL != state->specifics.tcp_udp.heap_node) ) { @@ -2030,10 +2030,10 @@ receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received data from %s for starting TCP stream to %s:%u\n", GNUNET_i2s (&state->peer), - inet_ntop (af, + inet_ntop (af, &state->specifics.tcp_udp.ri.remote_address.address, buf, sizeof (buf)), - (unsigned int) ntohs (start->tcp_header.destination_port)); + (unsigned int) ntohs (start->tcp_header.destination_port)); } state->specifics.tcp_udp.ri.remote_address.proto = IPPROTO_TCP; 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, /** - * Process a request to forward TCP data on an established + * Process a request to forward TCP data on an established * connection via this peer. * * @param cls closure, NULL * @param tunnel connection to the other end * @param tunnel_ctx pointer to our 'struct TunnelState *' * @param message the actual message - * + * * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ @@ -2089,7 +2089,7 @@ receive_tcp_data (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, return GNUNET_SYSERR; } data = (const struct GNUNET_EXIT_TcpDataMessage*) message; - pkt_len -= sizeof (struct GNUNET_EXIT_TcpDataMessage); + pkt_len -= sizeof (struct GNUNET_EXIT_TcpDataMessage); if ( (NULL == state) || (NULL == state->specifics.tcp_udp.heap_node) ) { @@ -2112,7 +2112,7 @@ receive_tcp_data (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, "Received additional %u bytes of data from %s for TCP stream to %s:%u\n", pkt_len, GNUNET_i2s (&state->peer), - inet_ntop (state->specifics.tcp_udp.ri.remote_address.af, + inet_ntop (state->specifics.tcp_udp.ri.remote_address.af, &state->specifics.tcp_udp.ri.remote_address.address, buf, sizeof (buf)), (unsigned int) state->specifics.tcp_udp.ri.remote_address.port); @@ -2174,7 +2174,7 @@ send_icmp_packet_via_tun (const struct SocketAddress *destination_address, char buf[len] GNUNET_ALIGN; struct GNUNET_MessageHeader *hdr; struct GNUNET_TUN_Layer2PacketHeader *tun; - + hdr= (struct GNUNET_MessageHeader *) buf; hdr->type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER); hdr->size = htons (len); @@ -2287,7 +2287,7 @@ make_up_icmpv6_payload (struct TunnelState *state, * @param tunnel connection to the other end * @param tunnel_ctx pointer to our 'struct TunnelState *' * @param message the actual message - * + * * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ @@ -2300,7 +2300,7 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, const struct GNUNET_EXIT_IcmpInternetMessage *msg; uint16_t pkt_len = ntohs (message->size); const struct in_addr *v4; - const struct in6_addr *v6; + const struct in6_addr *v6; const void *payload; char buf[sizeof (struct GNUNET_TUN_IPv6Header) + 8] GNUNET_ALIGN; int af; @@ -2327,7 +2327,7 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, return GNUNET_SYSERR; } msg = (const struct GNUNET_EXIT_IcmpInternetMessage*) message; - pkt_len -= sizeof (struct GNUNET_EXIT_IcmpInternetMessage); + pkt_len -= sizeof (struct GNUNET_EXIT_IcmpInternetMessage); af = (int) ntohl (msg->af); if ( (NULL != state->specifics.tcp_udp.heap_node) && @@ -2361,7 +2361,7 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, state->specifics.tcp_udp.ri.remote_address.proto = IPPROTO_ICMP; setup_state_record (state); } - /* check that ICMP type is something we want to support + /* check that ICMP type is something we want to support and possibly make up payload! */ switch (msg->icmp_header.type) { @@ -2383,7 +2383,7 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, GNUNET_assert (8 == sizeof (struct GNUNET_TUN_UdpHeader)); pkt_len = sizeof (struct GNUNET_TUN_IPv4Header) + 8; - make_up_icmpv4_payload (state, + make_up_icmpv4_payload (state, ipp, udp); payload = ipp; @@ -2394,7 +2394,7 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, GNUNET_STATISTICS_update (stats, gettext_noop ("# ICMPv4 packets dropped (type not allowed)"), 1, GNUNET_NO); - return GNUNET_SYSERR; + return GNUNET_SYSERR; } /* end AF_INET */ break; @@ -2419,7 +2419,7 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, state->specifics.tcp_udp.ri.remote_address.proto = IPPROTO_ICMPV6; setup_state_record (state); } - /* check that ICMP type is something we want to support + /* check that ICMP type is something we want to support and possibly make up payload! */ switch (msg->icmp_header.type) { @@ -2442,7 +2442,7 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, GNUNET_assert (8 == sizeof (struct GNUNET_TUN_UdpHeader)); pkt_len = sizeof (struct GNUNET_TUN_IPv6Header) + 8; - make_up_icmpv6_payload (state, + make_up_icmpv6_payload (state, ipp, udp); payload = ipp; @@ -2453,22 +2453,22 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, GNUNET_STATISTICS_update (stats, gettext_noop ("# ICMPv6 packets dropped (type not allowed)"), 1, GNUNET_NO); - return GNUNET_SYSERR; + return GNUNET_SYSERR; } /* end AF_INET6 */ - break; + break; default: /* bad AF */ GNUNET_break_op (0); return GNUNET_SYSERR; } - + { char buf[INET6_ADDRSTRLEN]; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ICMP data from %s for forwarding to %s\n", GNUNET_i2s (&state->peer), - inet_ntop (af, + inet_ntop (af, &state->specifics.tcp_udp.ri.remote_address.address, buf, sizeof (buf))); } @@ -2499,7 +2499,7 @@ make_up_icmp_service_payload (struct TunnelState *state, { struct GNUNET_TUN_IPv4Header *ipv4; struct GNUNET_TUN_UdpHeader *udp; - + ipv4 = (struct GNUNET_TUN_IPv4Header *)buf; udp = (struct GNUNET_TUN_UdpHeader *) &ipv4[1]; make_up_icmpv4_payload (state, @@ -2520,7 +2520,7 @@ make_up_icmp_service_payload (struct TunnelState *state, ipv6, udp); GNUNET_assert (8 == sizeof (struct GNUNET_TUN_UdpHeader)); - return sizeof (struct GNUNET_TUN_IPv6Header) + 8; + return sizeof (struct GNUNET_TUN_IPv6Header) + 8; } break; default: @@ -2538,7 +2538,7 @@ make_up_icmp_service_payload (struct TunnelState *state, * @param tunnel connection to the other end * @param tunnel_ctx pointer to our 'struct TunnelState *' * @param message the actual message - * + * * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ @@ -2590,7 +2590,7 @@ receive_icmp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel } icmp = msg->icmp_header; payload = &msg[1]; - state->specifics.tcp_udp.ri.remote_address = state->specifics.tcp_udp.serv->address; + state->specifics.tcp_udp.ri.remote_address = state->specifics.tcp_udp.serv->address; setup_state_record (state); /* check that ICMP type is something we want to support, @@ -2772,7 +2772,7 @@ send_udp_packet_via_tun (const struct SocketAddress *destination_address, char buf[len] GNUNET_ALIGN; struct GNUNET_MessageHeader *hdr; struct GNUNET_TUN_Layer2PacketHeader *tun; - + hdr= (struct GNUNET_MessageHeader *) buf; hdr->type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER); hdr->size = htons (len); @@ -2798,7 +2798,7 @@ send_udp_packet_via_tun (const struct SocketAddress *destination_address, struct GNUNET_TUN_IPv6Header * ipv6 = (struct GNUNET_TUN_IPv6Header*) &tun[1]; tun->proto = htons (ETH_P_IPV6); - prepare_ipv6_packet (payload, payload_length, + prepare_ipv6_packet (payload, payload_length, IPPROTO_UDP, NULL, source_address, @@ -2826,7 +2826,7 @@ send_udp_packet_via_tun (const struct SocketAddress *destination_address, * @param tunnel connection to the other end * @param tunnel_ctx pointer to our 'struct TunnelState *' * @param message the actual message - * + * * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ @@ -2865,7 +2865,7 @@ receive_udp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, return GNUNET_SYSERR; } msg = (const struct GNUNET_EXIT_UdpInternetMessage*) message; - pkt_len -= sizeof (struct GNUNET_EXIT_UdpInternetMessage); + pkt_len -= sizeof (struct GNUNET_EXIT_UdpInternetMessage); af = (int) ntohl (msg->af); state->specifics.tcp_udp.ri.remote_address.af = af; switch (af) @@ -2911,10 +2911,10 @@ receive_udp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received data from %s for forwarding to UDP %s:%u\n", GNUNET_i2s (&state->peer), - inet_ntop (af, + inet_ntop (af, &state->specifics.tcp_udp.ri.remote_address.address, buf, sizeof (buf)), - (unsigned int) ntohs (msg->destination_port)); + (unsigned int) ntohs (msg->destination_port)); } state->specifics.tcp_udp.ri.remote_address.proto = IPPROTO_UDP; 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, * @param tunnel connection to the other end * @param tunnel_ctx pointer to our 'struct TunnelState *' * @param message the actual message - * + * * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ @@ -2978,11 +2978,11 @@ receive_udp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, "Received data from %s for forwarding to UDP service %s on port %u\n", GNUNET_i2s (&state->peer), GNUNET_h2s (&msg->service_descriptor), - (unsigned int) ntohs (msg->destination_port)); - if (NULL == (state->specifics.tcp_udp.serv = find_service (udp_services, &msg->service_descriptor, + (unsigned int) ntohs (msg->destination_port)); + if (NULL == (state->specifics.tcp_udp.serv = find_service (udp_services, &msg->service_descriptor, ntohs (msg->destination_port)))) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("No service found for %s on port %d!\n"), "UDP", ntohs (msg->destination_port)); @@ -2991,7 +2991,7 @@ receive_udp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, 1, GNUNET_NO); return GNUNET_SYSERR; } - state->specifics.tcp_udp.ri.remote_address = state->specifics.tcp_udp.serv->address; + state->specifics.tcp_udp.ri.remote_address = state->specifics.tcp_udp.serv->address; setup_state_record (state); if (0 != ntohs (msg->source_port)) 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, { if (tunnels[s->specifics.dns.my_id] == s) tunnels[s->specifics.dns.my_id] = NULL; - GNUNET_free_non_null (s->specifics.dns.reply); + GNUNET_free_non_null (s->specifics.dns.reply); } else { @@ -3233,10 +3233,10 @@ add_services (int proto, } hostport[0] = '\0'; hostport++; - + int local_port = atoi (redirect); int remote_port = atoi (hostport); - + if (!((local_port > 0) && (local_port < 65536))) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, @@ -3260,7 +3260,7 @@ add_services (int proto, { const char *ip4addr = exit_argv[5]; - serv->address.af = AF_INET; + serv->address.af = AF_INET; GNUNET_assert (1 == inet_pton (AF_INET, ip4addr, &serv->address.address.ipv4)); } else if (0 == strcmp ("localhost6", hostname)) @@ -3272,10 +3272,10 @@ add_services (int proto, } else { - struct addrinfo *res; + struct addrinfo *res; int ret; - ret = getaddrinfo (hostname, NULL, NULL, &res); + ret = getaddrinfo (hostname, NULL, NULL, &res); if ( (ret != 0) || (res == NULL) ) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, @@ -3285,7 +3285,7 @@ add_services (int proto, GNUNET_free (serv); continue; } - + serv->address.af = res->ai_family; switch (res->ai_family) { @@ -3388,7 +3388,7 @@ dht_put_cont (void *cls, { dht_put = NULL; dht_task = GNUNET_SCHEDULER_add_delayed (DHT_PUT_FREQUENCY, - &do_dht_put, + &do_dht_put, NULL); } @@ -3408,7 +3408,7 @@ do_dht_put (void *cls, dht_task = GNUNET_SCHEDULER_NO_TASK; expiration = GNUNET_TIME_absolute_ntoh (dns_advertisement.expiration_time); - if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us < + if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us < GNUNET_TIME_UNIT_HOURS.rel_value_us) { /* refresh advertisement */ @@ -3424,7 +3424,7 @@ do_dht_put (void *cls, 1 /* replication */, GNUNET_DHT_RO_NONE, GNUNET_BLOCK_TYPE_DNS, - sizeof (struct GNUNET_DNS_Advertisement), + sizeof (struct GNUNET_DNS_Advertisement), &dns_advertisement, expiration, GNUNET_TIME_UNIT_FOREVER_REL, @@ -3480,9 +3480,9 @@ run (void *cls, char *const *args GNUNET_UNUSED, cfg = cfg_; ipv4_exit = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "EXIT_IPV4"); - ipv6_exit = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "EXIT_IPV6"); + ipv6_exit = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "EXIT_IPV6"); ipv4_enabled = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "ENABLE_IPV4"); - ipv6_enabled = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "ENABLE_IPV6"); + ipv6_enabled = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "ENABLE_IPV6"); if ( (ipv4_exit) || (ipv6_exit) ) { binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-exit"); @@ -3540,13 +3540,13 @@ run (void *cls, char *const *args GNUNET_UNUSED, if ( (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg_, "exit", "ENABLE_DNS")) && ( (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (cfg, "exit", + GNUNET_CONFIGURATION_get_value_string (cfg, "exit", "DNS_RESOLVER", &dns_exit)) || ( (1 != inet_pton (AF_INET, dns_exit, &dns_exit4)) && (1 != inet_pton (AF_INET6, dns_exit, &dns_exit6)) ) ) ) { - GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "dns", "DNS_RESOLVER", _("need a valid IPv4 or IPv6 address\n")); GNUNET_free_non_null (dns_exit); @@ -3575,13 +3575,13 @@ run (void *cls, char *const *args GNUNET_UNUSED, peer_key = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg); GNUNET_CRYPTO_ecc_key_get_public_for_signature (peer_key, &dns_advertisement.peer.public_key); - dns_advertisement.purpose.size = htonl (sizeof (struct GNUNET_DNS_Advertisement) - + dns_advertisement.purpose.size = htonl (sizeof (struct GNUNET_DNS_Advertisement) - sizeof (struct GNUNET_CRYPTO_EccSignature)); dns_advertisement.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_DNS_RECORD); - GNUNET_CRYPTO_hash ("dns", + GNUNET_CRYPTO_hash ("dns", strlen ("dns"), &dht_put_key); - dht_task = GNUNET_SCHEDULER_add_now (&do_dht_put, + dht_task = GNUNET_SCHEDULER_add_now (&do_dht_put, NULL); apptypes[app_idx] = GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER; app_idx++; @@ -3617,7 +3617,7 @@ run (void *cls, char *const *args GNUNET_UNUSED, { exit_argv[2] = GNUNET_strdup ("-"); } - + if (GNUNET_YES == ipv6_enabled) { @@ -3651,7 +3651,7 @@ run (void *cls, char *const *args GNUNET_UNUSED, GNUNET_SCHEDULER_shutdown (); return; } - } + } else { /* IPv6 explicitly disabled */ @@ -3695,9 +3695,9 @@ run (void *cls, char *const *args GNUNET_UNUSED, connections_map = GNUNET_CONTAINER_multihashmap_create (65536, GNUNET_NO); connections_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); - mesh_handle - = GNUNET_MESH_connect (cfg, NULL, - &new_tunnel, + mesh_handle + = GNUNET_MESH_connect (cfg, NULL, + &new_tunnel, &clean_tunnel, handlers, apptypes); // FIXME use ports if (NULL == mesh_handle) @@ -3724,12 +3724,12 @@ run (void *cls, char *const *args GNUNET_UNUSED, (void) GNUNET_asprintf (&prefixed_regex, "%s%s%s", GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, "4", regex); - regex4 = GNUNET_REGEX_announce (cfg, + regex4 = GNUNET_REGEX_announce (cfg, prefixed_regex, REGEX_REFRESH_FREQUENCY, REGEX_MAX_PATH_LEN_IPV4); GNUNET_free (regex); - GNUNET_free (prefixed_regex); + GNUNET_free (prefixed_regex); } } @@ -3744,7 +3744,7 @@ run (void *cls, char *const *args GNUNET_UNUSED, regex = NULL; else regex = GNUNET_TUN_ipv6policy2regex (policy); - GNUNET_free_non_null (policy); + GNUNET_free_non_null (policy); if (NULL != regex) { (void) GNUNET_asprintf (&prefixed_regex, "%s%s%s", @@ -3760,7 +3760,7 @@ run (void *cls, char *const *args GNUNET_UNUSED, } if ((ipv4_exit) || (ipv6_exit)) helper_handle = GNUNET_HELPER_start (GNUNET_NO, - "gnunet-helper-exit", + "gnunet-helper-exit", exit_argv, &message_token, 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 @@ */ /** * @file exit/gnunet-helper-exit-windows.c - * @brief the helper for the EXIT service in win32 builds. - * Opens a virtual network-interface, sends data received on the if to stdout, + * @brief the helper for the EXIT service in win32 builds. + * Opens a virtual network-interface, sends data received on the if to stdout, * sends data received on stdin to the interface * @author Christian M. Fuchs * @@ -68,7 +68,7 @@ #endif /** - * Will this binary be run in permissions testing mode? + * Will this binary be run in permissions testing mode? */ static boolean privilege_testing = FALSE; @@ -90,7 +90,7 @@ static boolean privilege_testing = FALSE; #define INF_FILE64 "share/gnunet/openvpn-tap32/tapw64/OemWin2k.inf" /** - * Hardware ID used in the inf-file. + * Hardware ID used in the inf-file. * This might change over time, as openvpn advances their driver */ #define HARDWARE_ID "tap0901" @@ -101,7 +101,7 @@ static boolean privilege_testing = FALSE; #define TAP_WIN_MIN_MAJOR 9 /** - * Minimum minor-id of the driver version we can work with. + * Minimum minor-id of the driver version we can work with. * v <= 7 has buggy IPv6. * v == 8 is broken for small IPv4 Packets */ @@ -109,7 +109,7 @@ static boolean privilege_testing = FALSE; /** * Time in seconds to wait for our virtual device to go up after telling it to do so. - * + * * openvpn doesn't specify a value, 4 seems sane for testing, even for openwrt * (in fact, 4 was chosen by a fair dice roll...) */ @@ -121,7 +121,7 @@ static boolean privilege_testing = FALSE; #define INTERFACE_REGISTRY_LOCATION "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}" /** - * Our local process' PID. Used for creating a sufficiently unique additional + * Our local process' PID. Used for creating a sufficiently unique additional * hardware ID for our device. */ static char secondary_hwid[LINE_LEN / 2]; @@ -132,13 +132,13 @@ static char secondary_hwid[LINE_LEN / 2]; */ static char device_visible_name[256]; -/** +/** * This is our own local instance of a virtual network interface * It is (somewhat) equivalent to using tun/tap in unixoid systems - * + * * Upon initialization, we create such an device node. * Upon termination, we remove it again. - * + * * If we crash this device might stay around. */ static HDEVINFO DeviceInfo = INVALID_HANDLE_VALUE; @@ -149,7 +149,7 @@ static HDEVINFO DeviceInfo = INVALID_HANDLE_VALUE; static SP_DEVINFO_DATA DeviceNode; /** - * GUID of our virtual device in the form of + * GUID of our virtual device in the form of * {12345678-1234-1234-1234-123456789abc} - in hex */ static char device_guid[256]; @@ -161,36 +161,36 @@ static char device_guid[256]; enum IO_State { - /** - * overlapped I/O is ready for work + /** + * overlapped I/O is ready for work */ IOSTATE_READY = 0, - /** - * overlapped I/O has been queued + /** + * overlapped I/O has been queued */ IOSTATE_QUEUED, - /** - * overlapped I/O has finished, but is waiting for it's write-partner + /** + * overlapped I/O has finished, but is waiting for it's write-partner */ - IOSTATE_WAITING, - - /** + IOSTATE_WAITING, + + /** * there is a full buffer waiting */ IOSTATE_RESUME, - /** + /** * Operlapped IO states for facility objects - * overlapped I/O has failed, stop processing + * overlapped I/O has failed, stop processing */ - IOSTATE_FAILED + IOSTATE_FAILED }; -/** +/** * A IO Object + read/writebuffer + buffer-size for windows asynchronous IO handling */ struct io_facility @@ -229,7 +229,7 @@ struct io_facility * Amount of data actually written or read by readfile/writefile. */ DWORD buffer_size_processed; - + /** * How much of this buffer we have written in total */ @@ -248,32 +248,32 @@ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); /** * Determines if the host OS is win32 or win64 - * - * @return true if + * + * @return true if */ BOOL is_win64 () { #if defined(_WIN64) - //this is a win64 binary, - return TRUE; + //this is a win64 binary, + return TRUE; #elif defined(_WIN32) //this is a 32bit binary, and we need to check if we are running in WOW64 BOOL success = FALSE; BOOL on_wow64 = FALSE; LPFN_ISWOW64PROCESS IsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress (GetModuleHandle ("kernel32"), "IsWow64Process"); - + if (NULL != IsWow64Process) success = IsWow64Process (GetCurrentProcess (), &on_wow64); - + return success && on_wow64; #endif } /** * Wrapper for executing a shellcommand in windows. - * + * * @param command - the command + parameters to execute - * @return * exitcode of the program executed, + * @return * exitcode of the program executed, * * EINVAL (cmd/file not found) * * EPIPE (could not read STDOUT) */ @@ -393,7 +393,7 @@ set_address4 (const char *address, const char *mask) strerror (errno)); return -1; } - // Set Device to Subnet-Mode? + // Set Device to Subnet-Mode? // do we really need tun.c:2925 ? /* @@ -445,8 +445,8 @@ remove_address4 (const char *address) /** - * Setup a new virtual interface to use for tunneling. - * + * Setup a new virtual interface to use for tunneling. + * * @return: TRUE if setup was successful, else FALSE */ static BOOL @@ -454,7 +454,7 @@ setup_interface () { /* * where to find our inf-file. (+ the "full" path, after windows found") - * + * * We do not directly input all the props here, because openvpn will update * these details over time. */ @@ -465,22 +465,22 @@ setup_interface () GUID class_guid; int str_length = 0; - /** + /** * Set the device's hardware ID and add it to a list. - * This information will later on identify this device in registry. + * This information will later on identify this device in registry. */ strncpy (hwidlist, HARDWARE_ID, LINE_LEN); /** - * this is kind of over-complicated, but allows keeps things independent of - * how the openvpn-hwid is actually stored. - * + * this is kind of over-complicated, but allows keeps things independent of + * how the openvpn-hwid is actually stored. + * * A HWID list is double-\0 terminated and \0 separated */ str_length = strlen (hwidlist) + 1; strncpy (&hwidlist[str_length], secondary_hwid, LINE_LEN); str_length += strlen (&hwidlist[str_length]) + 1; - - /** + + /** * Locate the inf-file, we need to store it somewhere where the system can * find it. We need to pick the correct driver for win32/win64. */ @@ -490,7 +490,7 @@ setup_interface () GetFullPathNameA (INF_FILE, MAX_PATH, inf_file_path, &temp_inf_filename); fprintf (stderr, "INFO: Located our driver's .inf file at %s\n", inf_file_path); - /** + /** * Bootstrap our device info using the drivers inf-file */ if ( ! SetupDiGetINFClassA (inf_file_path, @@ -499,9 +499,9 @@ setup_interface () NULL)) return FALSE; - /** - * Collect all the other needed information... - * let the system fill our this form + /** + * Collect all the other needed information... + * let the system fill our this form */ DeviceInfo = SetupDiCreateDeviceInfoList (&class_guid, NULL); if (DeviceInfo == INVALID_HANDLE_VALUE) @@ -546,9 +546,9 @@ setup_interface () /** - * Remove our new virtual interface to use for tunneling. + * Remove our new virtual interface to use for tunneling. * This function must be called AFTER setup_interface! - * + * * @return: TRUE if destruction was successful, else FALSE */ static BOOL @@ -564,7 +564,7 @@ remove_interface () remove.Scope = DI_REMOVEDEVICE_GLOBAL; remove.ClassInstallHeader.InstallFunction = DIF_REMOVE; /* - * 1. Prepare our existing device information set, and place the + * 1. Prepare our existing device information set, and place the * uninstall related information into the structure */ if ( ! SetupDiSetClassInstallParamsA (DeviceInfo, @@ -581,7 +581,7 @@ remove_interface () return FALSE; SetupDiDestroyDeviceInfoList (DeviceInfo); - + fprintf (stderr, "DEBUG: removed interface successfully\n"); return TRUE; @@ -590,8 +590,8 @@ remove_interface () /** * Do all the lookup necessary to retrieve the inteface's actual name - * off the registry. - * + * off the registry. + * * @return: TRUE if we were able to lookup the interface's name, else FALSE */ static BOOL @@ -615,7 +615,7 @@ resolve_interface_name () 0, //must be 0 NULL)) //hMachine, we are local return FALSE; - + fprintf (stderr, "DEBUG: Resolving interface name for network device %s\n",pnp_instance_id); /* Registry is incredibly slow, retry for up to 30 seconds to allow registry to refresh */ @@ -633,7 +633,7 @@ resolve_interface_name () &adapter_key_handle)) return FALSE; - /* Of course there is a multitude of entries here, with arbitrary names, + /* Of course there is a multitude of entries here, with arbitrary names, * thus we need to iterate through there. */ while (!retval) @@ -658,7 +658,7 @@ resolve_interface_name () NULL, NULL); - /* this may fail due to one of two reasons: + /* this may fail due to one of two reasons: * we are at the end of the list*/ if (ERROR_NO_MORE_ITEMS == status) break; @@ -709,8 +709,8 @@ resolve_interface_name () if (status != ERROR_SUCCESS || data_type != REG_SZ) goto cleanup; - /* - * we have successfully found OUR instance, + /* + * we have successfully found OUR instance, * save the device GUID before exiting */ @@ -732,7 +732,7 @@ cleanup: /** * Determines the version of the installed TAP32 driver and checks if it's sufficiently new for GNUNET - * + * * @param handle the handle to our tap device * @return TRUE if the version is sufficient, else FALSE */ @@ -758,7 +758,7 @@ check_tapw32_version (HANDLE handle) TAP_WIN_MIN_MINOR); return FALSE; } - + return TRUE; } @@ -824,8 +824,8 @@ init_tun () /** * Brings a TAP device up and sets it to connected state. - * - * @param handle the handle to our TAP device + * + * @param handle the handle to our TAP device * @return True if the operation succeeded, else false */ static BOOL @@ -851,25 +851,25 @@ tun_up (HANDLE handle) /** * Attempts to read off an input facility (tap or named pipe) in overlapped mode. - * - * 1. + * + * 1. * If the input facility is in IOSTATE_READY, it will issue a new read operation to the - * input handle. Then it goes into IOSTATE_QUEUED state. + * input handle. Then it goes into IOSTATE_QUEUED state. * In case the read succeeded instantly the input facility enters 3. - * - * 2. + * + * 2. * If the input facility is in IOSTATE_QUEUED state, it will check if the queued read has finished already. * If it has finished, go to state 3. * If it has failed, set IOSTATE_FAILED - * + * * 3. * If the output facility is in state IOSTATE_READY, the read-buffer is copied to the output buffer. * The input facility enters state IOSTATE_READY * The output facility enters state IOSTATE_READY * If the output facility is in state IOSTATE_QUEUED, the input facility enters IOSTATE_WAITING - * + * * IOSTATE_WAITING is reset by the output facility, once it has completed. - * + * * @param input_facility input named pipe or file to work with. * @param output_facility output pipe or file to hand over data to. * @return false if an event reset was impossible (OS error), else true @@ -880,11 +880,11 @@ attempt_read_tap (struct io_facility * input_facility, { struct GNUNET_MessageHeader * hdr; unsigned short size; - + switch (input_facility->facility_state) { case IOSTATE_READY: - { + { if (! ResetEvent (input_facility->overlapped.hEvent)) { return FALSE; @@ -903,9 +903,9 @@ attempt_read_tap (struct io_facility * input_facility, /* reset event manually*/ if (! SetEvent (input_facility->overlapped.hEvent)) return FALSE; - + fprintf (stderr, "DEBUG: tap read succeeded immediately\n"); - + /* we successfully read something from the TAP and now need to * send it our via STDOUT. Is that possible at the moment? */ if ((IOSTATE_READY == output_facility->facility_state || @@ -914,7 +914,7 @@ attempt_read_tap (struct io_facility * input_facility, { /* hand over this buffers content and apply message header for gnunet */ hdr = (struct GNUNET_MessageHeader *) output_facility->buffer; size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader); - + memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader), input_facility->buffer, input_facility->buffer_size); @@ -961,7 +961,7 @@ attempt_read_tap (struct io_facility * input_facility, return FALSE; fprintf (stderr, "DEBUG: tap read succeeded delayed\n"); - + /* we successfully read something from the TAP and now need to * send it our via STDOUT. Is that possible at the moment? */ if ((IOSTATE_READY == output_facility->facility_state || @@ -970,7 +970,7 @@ attempt_read_tap (struct io_facility * input_facility, { /* hand over this buffers content and apply message header for gnunet */ hdr = (struct GNUNET_MessageHeader *) output_facility->buffer; size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader); - + memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader), input_facility->buffer, input_facility->buffer_size); @@ -1023,26 +1023,26 @@ attempt_read_tap (struct io_facility * input_facility, /** * Attempts to read off an input facility (tap or named pipe) in overlapped mode. - * - * 1. + * + * 1. * If the input facility is in IOSTATE_READY, it will issue a new read operation to the - * input handle. Then it goes into IOSTATE_QUEUED state. + * input handle. Then it goes into IOSTATE_QUEUED state. * In case the read succeeded instantly the input facility enters 3. - * - * 2. + * + * 2. * If the input facility is in IOSTATE_QUEUED state, it will check if the queued read has finished already. * If it has finished, go to state 3. * If it has failed, set IOSTATE_FAILED - * + * * 3. * If the facility is finished with ready * The read-buffer is copied to the output buffer, except for the GNUNET_MessageHeader. * The input facility enters state IOSTATE_READY * The output facility enters state IOSTATE_READY * If the output facility is in state IOSTATE_QUEUED, the input facility enters IOSTATE_WAITING - * + * * IOSTATE_WAITING is reset by the output facility, once it has completed. - * + * * @param input_facility input named pipe or file to work with. * @param output_facility output pipe or file to hand over data to. * @return false if an event reset was impossible (OS error), else true @@ -1052,17 +1052,17 @@ attempt_read_stdin (struct io_facility * input_facility, struct io_facility * output_facility) { struct GNUNET_MessageHeader * hdr; - + switch (input_facility->facility_state) { case IOSTATE_READY: { input_facility->buffer_size = 0; - + partial_read_iostate_ready: if (! ResetEvent (input_facility->overlapped.hEvent)) return FALSE; - + /* Check how the task is handled */ if (ReadFile (input_facility->handle, input_facility->buffer + input_facility->buffer_size, @@ -1110,7 +1110,7 @@ partial_read_iostate_ready: input_facility->facility_state = IOSTATE_WAITING; else /* we read nothing */ input_facility->facility_state = IOSTATE_READY; - } + } else /* operation was either queued or failed*/ { int err = GetLastError (); @@ -1138,13 +1138,13 @@ partial_read_iostate_ready: FALSE)) {/* successful return for a queued operation */ hdr = (struct GNUNET_MessageHeader *) input_facility->buffer; - + if (! ResetEvent (input_facility->overlapped.hEvent)) return FALSE; - + fprintf (stderr, "DEBUG: stdin read succeeded delayed\n"); input_facility->buffer_size += input_facility->buffer_size_processed; - + if ((ntohs (hdr->type) != GNUNET_MESSAGE_TYPE_VPN_HELPER) || (ntohs (hdr->size) > sizeof (input_facility->buffer))) { @@ -1206,7 +1206,7 @@ partial_read_iostate_ready: * Attempts to write to an output facility (tap or named pipe) in overlapped mode. * * TODO: high level description - * + * * @param output_facility output pipe or file to hand over data to. * @param input_facility input named pipe or file to work with. * @return false if an event reset was impossible (OS error), else true @@ -1219,7 +1219,7 @@ attempt_write (struct io_facility * output_facility, { case IOSTATE_READY: output_facility->buffer_size_written = 0; - + continue_partial_write: if (! ResetEvent (output_facility->overlapped.hEvent)) return FALSE; @@ -1234,7 +1234,7 @@ continue_partial_write: fprintf (stderr, "DEBUG: write succeeded immediately\n"); output_facility->buffer_size_written += output_facility->buffer_size_processed; - + /* reset event manually*/ if (! SetEvent (output_facility->overlapped.hEvent)) return FALSE; @@ -1242,7 +1242,7 @@ continue_partial_write: /* partial write */ if (output_facility->buffer_size_written < output_facility->buffer_size) goto continue_partial_write; - + /* we are now waiting for our buffer to be filled*/ output_facility->facility_state = IOSTATE_WAITING; @@ -1269,7 +1269,7 @@ continue_partial_write: return TRUE; case IOSTATE_QUEUED: // there was an operation going on already, check if that has completed now. - + if (GetOverlappedResult (output_facility->handle, &output_facility->overlapped, &output_facility->buffer_size_processed, @@ -1277,17 +1277,17 @@ continue_partial_write: {/* successful return for a queued operation */ if (! ResetEvent (output_facility->overlapped.hEvent)) return FALSE; - + fprintf (stderr, "DEBUG: write succeeded delayed\n"); output_facility->buffer_size_written += output_facility->buffer_size_processed; - + /* partial write */ if (output_facility->buffer_size_written < output_facility->buffer_size) goto continue_partial_write; - + /* we are now waiting for our buffer to be filled*/ output_facility->facility_state = IOSTATE_WAITING; - + /* we successfully wrote something and now need to reset our reader */ if (IOSTATE_WAITING == input_facility->facility_state) input_facility->facility_state = IOSTATE_RESUME; @@ -1304,7 +1304,7 @@ continue_partial_write: fprintf (stderr, "FATAL: Write to handle failed, exiting\n"); } } - default: + default: return TRUE; } } @@ -1312,7 +1312,7 @@ continue_partial_write: /** * Initialize a overlapped structure - * + * * @param elem the element to initilize * @param initial_state the initial state for this instance * @param signaled if the hEvent created should default to signaled or not @@ -1358,13 +1358,13 @@ run (HANDLE tap_handle) /* tun up: */ /* we do this HERE and not beforehand (in init_tun()), in contrast to openvpn * to remove the need to flush the arp cache, handle DHCP and wrong IPs. - * + * * DHCP and such are all features we will never use in gnunet afaik. * But for openvpn those are essential. */ if ((privilege_testing) || (! tun_up (tap_handle) )) goto teardown_final; - + /* Initialize our overlapped IO structures*/ if (! (initialize_io_facility (&tap_read, IOSTATE_READY, FALSE) && initialize_io_facility (&tap_write, IOSTATE_WAITING, TRUE) @@ -1380,12 +1380,12 @@ run (HANDLE tap_handle) /* Debug output to console STDIN/STDOUT*/ std_in.handle = parent_std_in_handle; std_out.handle = parent_std_out_handle; - + #else fprintf (stderr, "DEBUG: reopening stdin/out for overlapped IO\n"); - /* - * Find out the types of our handles. - * This part is a problem, because in windows we need to handle files, + /* + * Find out the types of our handles. + * This part is a problem, because in windows we need to handle files, * pipes and the console differently. */ if ((FILE_TYPE_PIPE != GetFileType (parent_std_in_handle)) || @@ -1417,9 +1417,9 @@ run (HANDLE tap_handle) goto teardown; } #endif - + fprintf (stderr, "DEBUG: mainloop has begun\n"); - + while (std_out.path_open || tap_write.path_open) { /* perform READ from stdin if possible */ @@ -1439,15 +1439,15 @@ run (HANDLE tap_handle) break; } fprintf (stderr, "DEBUG: teardown initiated\n"); - + teardown: - + CancelIo (tap_handle); CancelIo (std_in.handle); CancelIo (std_out.handle); teardown_final: - + CloseHandle (tap_handle); } @@ -1474,7 +1474,7 @@ main (int argc, char **argv) BOOL have_ip4 = FALSE; BOOL have_ip6 = FALSE; BOOL have_nat44 = FALSE; - + if ( (1 < argc) && (0 != strcmp (argv[1], "-d"))){ privilege_testing = TRUE; fprintf (stderr, @@ -1483,10 +1483,10 @@ main (int argc, char **argv) argv++; argc--; } - + if (6 != argc) { - fprintf (stderr, + fprintf (stderr, "%s", "FATAL: must supply 6 arguments\nUsage:\ngnunet-helper-exit [-d] \n"); return 1; @@ -1495,9 +1495,9 @@ main (int argc, char **argv) strncpy (hwid, argv[1], LINE_LEN); hwid[LINE_LEN - 1] = '\0'; - /* - * We use our PID for finding/resolving the control-panel name of our virtual - * device. PIDs are (of course) unique at runtime, thus we can safely use it + /* + * We use our PID for finding/resolving the control-panel name of our virtual + * device. PIDs are (of course) unique at runtime, thus we can safely use it * as additional hardware-id for our device. */ snprintf (secondary_hwid, LINE_LEN / 2, "%s-%d", @@ -1558,7 +1558,7 @@ main (int argc, char **argv) fprintf (stderr, "FATAL: Could not enable forwarding via netsh: %s\n", strerror (local_ret)); goto cleanup; } - /* we can keep IPv6 forwarding around, as all interfaces have + /* we can keep IPv6 forwarding around, as all interfaces have * their forwarding mode reset to false at bootup. */ } @@ -1574,11 +1574,11 @@ main (int argc, char **argv) // setup NAPT, if possible /* MS has REMOVED the routing/nat capabilities from Vista+, thus * we can not setup NAT like in XP or on the server. Actually the - * the only feasible solution seems to be to use + * the only feasible solution seems to be to use * Internet Connection Sharing, which introduces a horde of problems * such as sending out rogue-RAs on the external interface in an ipv6 * network. - * Thus, below stuff ONLY works on + * Thus, below stuff ONLY works on * WinXP SP3 * Win Server 2003 SP1+ * Win Server 2008 @@ -1637,7 +1637,7 @@ cleanup: if (0 != local_ret) 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)); } - + fprintf(stderr, "DEBUG: Removing IP4 address\n"); remove_address4 (address); } 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 @@ */ /** - * @file exit/gnunet-helper-exit.c + * @file exit/gnunet-helper-exit.c * * @brief the helper for exit nodes. Opens a virtual * network-interface, sends data received on the if to stdout, sends @@ -109,7 +109,7 @@ open_dev_null (int target_fd, if (fd == target_fd) return; if (-1 == dup2 (fd, target_fd)) - { + { (void) close (fd); abort (); } @@ -119,13 +119,13 @@ open_dev_null (int target_fd, /** * Run the given command and wait for it to complete. - * + * * @param file name of the binary to run * @param cmd command line arguments (as given to 'execv') * @return 0 on success, 1 on any error */ static int -fork_and_exec (const char *file, +fork_and_exec (const char *file, char *const cmd[]) { int status; @@ -135,8 +135,8 @@ fork_and_exec (const char *file, pid = fork (); if (-1 == pid) { - fprintf (stderr, - "fork failed: %s\n", + fprintf (stderr, + "fork failed: %s\n", strerror (errno)); return 1; } @@ -145,25 +145,25 @@ fork_and_exec (const char *file, /* we are the child process */ /* close stdin/stdout to not cause interference with the helper's main protocol! */ - (void) close (0); + (void) close (0); open_dev_null (0, O_RDONLY); - (void) close (1); + (void) close (1); open_dev_null (1, O_WRONLY); (void) execv (file, cmd); /* can only get here on error */ - fprintf (stderr, - "exec `%s' failed: %s\n", + fprintf (stderr, + "exec `%s' failed: %s\n", file, strerror (errno)); _exit (1); } /* keep running waitpid as long as the only error we get is 'EINTR' */ while ( (-1 == (ret = waitpid (pid, &status, 0))) && - (errno == EINTR) ); + (errno == EINTR) ); if (-1 == ret) { - fprintf (stderr, - "waitpid failed: %s\n", + fprintf (stderr, + "waitpid failed: %s\n", strerror (errno)); return 1; } @@ -215,7 +215,7 @@ init_tun (char *dev) if (-1 == ioctl (fd, TUNSETIFF, (void *) &ifr)) { - fprintf (stderr, + fprintf (stderr, "Error with ioctl on `%s': %s\n", "/dev/net/tun", strerror (errno)); (void) close (fd); @@ -255,7 +255,7 @@ set_address6 (const char *dev, const char *address, unsigned long prefix_len) if (-1 == (fd = socket (PF_INET6, SOCK_DGRAM, 0))) { - fprintf (stderr, "Error creating socket: %s\n", strerror (errno)); + fprintf (stderr, "Error creating socket: %s\n", strerror (errno)); exit (1); } @@ -669,7 +669,7 @@ main (int argc, char **argv) sbin_iptables = "/usr/sbin/iptables"; else { - fprintf (stderr, + fprintf (stderr, "Fatal: executable iptables not found in approved directories: %s\n", strerror (errno)); return 1; @@ -691,7 +691,7 @@ main (int argc, char **argv) if (-1 == (fd_tun = init_tun (dev))) { - fprintf (stderr, + fprintf (stderr, "Fatal: could not initialize tun-interface `%s' with IPv6 %s/%s and IPv4 %s/%s\n", dev, argv[3], @@ -706,13 +706,13 @@ main (int argc, char **argv) { const char *address = argv[3]; long prefix_len = atol (argv[4]); - + if ((prefix_len < 1) || (prefix_len > 127)) { fprintf (stderr, "Fatal: prefix_len out of range\n"); return 1; - } - set_address6 (dev, address, prefix_len); + } + set_address6 (dev, address, prefix_len); } { char *const sysctl_args[] = @@ -724,7 +724,7 @@ main (int argc, char **argv) { fprintf (stderr, "Failed to enable IPv6 forwarding. Will continue anyway.\n"); - } + } } } @@ -733,7 +733,7 @@ main (int argc, char **argv) { const char *address = argv[5]; const char *mask = argv[6]; - + set_address4 (dev, address, mask); } { @@ -746,7 +746,7 @@ main (int argc, char **argv) { fprintf (stderr, "Failed to enable IPv4 forwarding. Will continue anyway.\n"); - } + } } if (0 != strcmp (argv[2], "-")) { @@ -759,10 +759,10 @@ main (int argc, char **argv) { fprintf (stderr, "Failed to enable IPv4 masquerading (NAT). Will continue anyway.\n"); - } + } } } - + uid_t uid = getuid (); #ifdef HAVE_SETRESUID 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 /* Header */ /* ----------------- */ char *name; - + /** - * Experiment issuer + * Experiment issuer */ struct GNUNET_CRYPTO_EccPublicSignKey issuer; - + /** - * Experiment version as timestamp of creation + * Experiment version as timestamp of creation */ struct GNUNET_TIME_Absolute version; - + /** - * Description + * Description */ char *description; - + /** - * Required capabilities + * Required capabilities */ uint32_t required_capabilities; - + /* Experiment timing */ /* ----------------- */ - + /** - * When to start experiment + * When to start experiment */ struct GNUNET_TIME_Absolute start; - + /** - * When to end experiment + * When to end experiment */ struct GNUNET_TIME_Absolute stop; - + /** - * How often to run experiment + * How often to run experiment */ struct GNUNET_TIME_Relative frequency; - + /** - * How long to run each execution + * How long to run each execution */ struct GNUNET_TIME_Relative duration; - - + + /* Experiment itself */ /* ----------------- */ - + /* TBD */ }; @@ -150,34 +150,34 @@ struct Node * Peer id */ struct GNUNET_PeerIdentity id; - + /** * Task for response timeout */ GNUNET_SCHEDULER_TaskIdentifier timeout_task; - + /** * Core transmission handle */ struct GNUNET_CORE_TransmitHandle *cth; - + /** * Node capabilities */ uint32_t capabilities; - + /** - * Experiment version as timestamp of creation + * Experiment version as timestamp of creation */ struct GNUNET_TIME_Absolute version; - + struct NodeComCtx *e_req_head; struct NodeComCtx *e_req_tail; /** * Array of issuers accepted by this neighbor. - */ + */ struct GNUNET_CRYPTO_EccPublicSignKey *issuer_id; unsigned int issuer_count; @@ -198,9 +198,9 @@ GNUNET_NETWORK_STRUCT_BEGIN struct Experimentation_Request { struct GNUNET_MessageHeader msg; - + uint32_t capabilities GNUNET_PACKED; - + uint32_t issuer_count GNUNET_PACKED; }; @@ -215,9 +215,9 @@ struct Experimentation_Request struct Experimentation_Response { struct GNUNET_MessageHeader msg; - + uint32_t capabilities GNUNET_PACKED; - + uint32_t issuer_count GNUNET_PACKED; }; @@ -233,7 +233,7 @@ struct Issuer /** * Hashmap containing valid experiment issuers - * (the key is the hash of the respective public key, + * (the key is the hash of the respective public key, * the values are of type `struct Issuer'). */ struct GNUNET_CONTAINER_MultiHashMap *valid_issuers; @@ -246,19 +246,19 @@ struct GNUNET_CONTAINER_MultiHashMap *valid_issuers; struct GED_start_message { struct GNUNET_MessageHeader header; - + /** * String length of experiment name following the struct */ uint32_t len_name GNUNET_PACKED; - + /** - * Experiment issuer + * Experiment issuer */ struct GNUNET_CRYPTO_EccPublicSignKey issuer; - + /** - * Experiment version as timestamp of creation + * Experiment version as timestamp of creation */ struct GNUNET_TIME_AbsoluteNBO version_nbo; }; @@ -267,19 +267,19 @@ struct GED_start_message struct GED_start_ack_message { struct GNUNET_MessageHeader header; - + /** * String length of experiment name following the struct */ uint32_t len_name GNUNET_PACKED; - + /** - * Experiment issuer + * Experiment issuer */ struct GNUNET_CRYPTO_EccPublicSignKey issuer; /** - * Experiment version as timestamp of creation + * Experiment version as timestamp of creation */ struct GNUNET_TIME_AbsoluteNBO version_nbo; }; @@ -288,19 +288,19 @@ struct GED_start_ack_message struct GED_stop_message { struct GNUNET_MessageHeader header; - + /** * String length of experiment name following the struct */ uint32_t len_name GNUNET_PACKED; - + /** - * Experiment issuer + * Experiment issuer */ struct GNUNET_CRYPTO_EccPublicSignKey issuer; - + /** - * Experiment version as timestamp of creation + * Experiment version as timestamp of creation */ struct GNUNET_TIME_AbsoluteNBO version_nbo; }; @@ -396,7 +396,7 @@ GED_experiments_find (const struct GNUNET_CRYPTO_EccPublicSignKey *issuer, const struct GNUNET_TIME_Absolute version); -typedef void (*GNUNET_EXPERIMENTATION_experiments_get_cb) (struct Node *n, +typedef void (*GNUNET_EXPERIMENTATION_experiments_get_cb) (struct Node *n, struct Experiment *e); @@ -461,7 +461,7 @@ GED_scheduler_handle_stop (struct Node *n, struct Experiment *e); */ void GED_scheduler_add (struct Node *n, - struct Experiment *e, + struct Experiment *e, int outbound); 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) { GNUNET_assert (NULL != i); GNUNET_assert (NULL != e); - + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Verification: to be implemented\n"); return GNUNET_OK; } -static int +static int free_experiment (void *cls, const struct GNUNET_HashCode * key, void *value) @@ -84,15 +84,15 @@ free_experiment (void *cls, * @param value the issuer element to free * @return GNUNET_OK to continue */ -static int +static int free_issuer (void *cls, const struct GNUNET_HashCode * key, void *value) { struct Issuer *i = value; - GNUNET_break (0 == GNUNET_CONTAINER_multihashmap_remove (valid_issuers, - key, + GNUNET_break (0 == GNUNET_CONTAINER_multihashmap_remove (valid_issuers, + key, i)); GNUNET_free (i); return GNUNET_OK; @@ -149,8 +149,8 @@ GED_experiments_find (const struct GNUNET_CRYPTO_EccPublicSignKey *issuer, const struct GNUNET_TIME_Absolute version) { struct GNUNET_HashCode hc; - - get_experiment_key (issuer, + + get_experiment_key (issuer, name, version, &hc); @@ -180,7 +180,7 @@ get_it (void *cls, if (0 == memcmp (&e->issuer, get_ctx->issuer, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))) - get_ctx->get_cb (get_ctx->n, e); + get_ctx->get_cb (get_ctx->n, e); return GNUNET_OK; } @@ -222,7 +222,7 @@ GNUNET_EXPERIMENTATION_experiments_add (struct Issuer *i, struct Experiment *e; struct GNUNET_HashCode hc; - e = GNUNET_new (struct Experiment); + e = GNUNET_new (struct Experiment); e->name = GNUNET_strdup (name); e->issuer = *issuer_id; e->version = version; @@ -233,20 +233,20 @@ GNUNET_EXPERIMENTATION_experiments_add (struct Issuer *i, e->frequency = frequency; e->duration = duration; e->stop = stop; - + /* verify experiment */ if (GNUNET_SYSERR == experiment_verify (i, e)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _("Experiment `%s': Experiment signature is invalid\n"), + _("Experiment `%s': Experiment signature is invalid\n"), name); GNUNET_free (e); GNUNET_free_non_null (e->name); GNUNET_free_non_null (e->description); return GNUNET_SYSERR; } - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + + GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Adding experiment `%s' running from `%s' to `%s' every %llu sec. for %llu sec. \n"), e->name, GNUNET_STRINGS_absolute_time_to_string (start), @@ -259,12 +259,12 @@ GNUNET_EXPERIMENTATION_experiments_add (struct Issuer *i, &hc); GNUNET_CONTAINER_multihashmap_put (experiments, &hc, - e, + e, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); - GNUNET_STATISTICS_set (GED_stats, - "# experiments", + GNUNET_STATISTICS_set (GED_stats, + "# experiments", GNUNET_CONTAINER_multihashmap_size (experiments), GNUNET_NO); - + return GNUNET_OK; } @@ -293,9 +293,9 @@ exp_file_iterator (void *cls, struct GNUNET_TIME_Relative frequency; struct GNUNET_TIME_Relative duration; struct GNUNET_HashCode phash; - + /* Mandatory fields */ - + /* Issuer */ if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (exp, name, "ISSUER", &val)) { @@ -303,8 +303,8 @@ exp_file_iterator (void *cls, _("Experiment `%s': Issuer missing\n"), name); return; } - if (GNUNET_SYSERR == - GNUNET_CRYPTO_ecc_public_sign_key_from_string (val, + if (GNUNET_SYSERR == + GNUNET_CRYPTO_ecc_public_sign_key_from_string (val, strlen (val), &issuer)) { @@ -322,20 +322,20 @@ exp_file_iterator (void *cls, return; } GNUNET_free (val); - + /* Version */ if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "VERSION", &number)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Experiment `%s': Version missing or invalid \n"), name); return; } version.abs_value_us = number; // FIXME: what is this supposed to be? Version != TIME!??? - + /* Required capabilities */ if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "CAPABILITIES", &number)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Experiment `%s': Required capabilities missing \n"), name); return; } @@ -346,23 +346,23 @@ exp_file_iterator (void *cls, return; } required_capabilities = number; - + /* Optional fields */ - + /* Description */ if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (exp, name, "DESCRIPTION", &description)) description = NULL; - + if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "START", (long long unsigned int *) &start.abs_value_us)) start = GNUNET_TIME_UNIT_ZERO_ABS; - + if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (exp, name, "FREQUENCY", &frequency)) frequency = EXP_DEFAULT_EXP_FREQ; if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (exp, name, "DURATION", &duration)) duration = EXP_DEFAULT_EXP_DUR; if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "STOP", (long long unsigned int *)&stop.abs_value_us)) stop = GNUNET_TIME_UNIT_FOREVER_ABS; - + GNUNET_EXPERIMENTATION_experiments_add (i, name, &issuer, version, description, required_capabilities, start, frequency, duration, stop); @@ -382,12 +382,12 @@ load_file (const char * file) if (NULL == exp) return; - + if (GNUNET_SYSERR == GNUNET_CONFIGURATION_parse (exp, file)) { GNUNET_CONFIGURATION_destroy (exp); GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _("Failed to parse file `%s'\n"), + _("Failed to parse file `%s'\n"), file); return; } @@ -408,28 +408,28 @@ GED_experiments_start () char *pos; struct GNUNET_CRYPTO_EccPublicSignKey issuer_ID; struct GNUNET_HashCode hash; - + /* Load valid issuer */ - if (GNUNET_SYSERR == - GNUNET_CONFIGURATION_get_value_string (GED_cfg, - "EXPERIMENTATION", + if (GNUNET_SYSERR == + GNUNET_CONFIGURATION_get_value_string (GED_cfg, + "EXPERIMENTATION", "ISSUERS", &issuers)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("No valid experiment issuers configured! Set value to public keys of issuers! Exiting.\n")); GED_experiments_stop (); return GNUNET_SYSERR; } - + valid_issuers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); for (pos = strtok (issuers, " "); pos != NULL; pos = strtok (NULL, " ")) - { + { if (GNUNET_SYSERR == GNUNET_CRYPTO_ecc_public_sign_key_from_string (pos, strlen (pos), &issuer_ID)) { - GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "EXPERIMENTATION", "ISSUERS", _("Invalid value for public key\n")); @@ -439,33 +439,33 @@ GED_experiments_start () i = GNUNET_new (struct Issuer); i->pubkey = issuer_ID; GNUNET_CRYPTO_hash( &issuer_ID, sizeof (issuer_ID), &hash); - GNUNET_CONTAINER_multihashmap_put (valid_issuers, + GNUNET_CONTAINER_multihashmap_put (valid_issuers, &hash, i, - GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); + GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); } GNUNET_free (issuers); if (0 == GNUNET_CONTAINER_multihashmap_size (valid_issuers)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("No valid experiment issuers configured! Set value to public keys of issuers! Exiting.\n")); GED_experiments_stop (); return GNUNET_SYSERR; } GNUNET_STATISTICS_set (GED_stats, - "# issuer", - GNUNET_CONTAINER_multihashmap_size (valid_issuers), + "# issuer", + GNUNET_CONTAINER_multihashmap_size (valid_issuers), GNUNET_NO); - + experiments = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); /* Load experiments from file */ if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (GED_cfg, - "EXPERIMENTATION", + "EXPERIMENTATION", "EXPERIMENTS", &file)) return GNUNET_OK; - + if (GNUNET_YES != GNUNET_DISK_file_test (file)) { 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 { struct NodeComCtx *prev; struct NodeComCtx *next; - + struct Node *n; struct Experiment *e; - + size_t size; GNUNET_CONNECTION_TransmitReadyNotify notify; void *notify_cls; @@ -79,7 +79,7 @@ struct NodeComCtx * * @param m peermap to update values from */ -static void +static void update_stats (struct GNUNET_CONTAINER_MultiPeerMap *m) { GNUNET_assert (NULL != m); @@ -122,14 +122,14 @@ cleanup_node (void *cls, struct NodeComCtx *e_cur; struct NodeComCtx *e_next; struct GNUNET_CONTAINER_MultiPeerMap *cur = cls; - + n = value; if (GNUNET_SCHEDULER_NO_TASK != n->timeout_task) { GNUNET_SCHEDULER_cancel (n->timeout_task); n->timeout_task = GNUNET_SCHEDULER_NO_TASK; } - + if (NULL != n->cth) { GNUNET_CORE_notify_transmit_ready_cancel (n->cth); @@ -154,7 +154,7 @@ cleanup_node (void *cls, * @param id the id to check * @return GNUNET_YES or GNUNET_NO */ -static int +static int is_me (const struct GNUNET_PeerIdentity *id) { if (0 == memcmp (&me, id, sizeof (me))) @@ -187,14 +187,14 @@ transmit_read_wrapper (void *cls, size_t bufsize, void *buf) { struct NodeComCtx *e_ctx = cls; struct NodeComCtx *next; - + size_t res = e_ctx->notify (e_ctx->notify_cls, bufsize, buf); e_ctx->n->cth = NULL; - + GNUNET_CONTAINER_DLL_remove (e_ctx->n->e_req_head, e_ctx->n->e_req_tail, e_ctx); next = e_ctx->n->e_req_head; GNUNET_free (e_ctx); - + if (NULL != next) { /* Schedule next message */ @@ -209,9 +209,9 @@ schedule_transmisson (struct NodeComCtx *e_ctx) { if (NULL != e_ctx->n->cth) return; - + e_ctx->n->cth = GNUNET_CORE_notify_transmit_ready (ch, GNUNET_NO, 0, FAST_TIMEOUT, - &e_ctx->n->id, e_ctx->size, + &e_ctx->n->id, e_ctx->size, transmit_read_wrapper, e_ctx); if (NULL == e_ctx->n->cth) { @@ -219,7 +219,7 @@ schedule_transmisson (struct NodeComCtx *e_ctx) _("Cannot send message to peer `%s' for experiment `%s'\n"), GNUNET_i2s(&e_ctx->n->id), e_ctx->e->name); GNUNET_free (e_ctx); - } + } } @@ -233,10 +233,10 @@ static void remove_request (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct Node *n = cls; - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing request for peer %s due to timeout\n", - GNUNET_i2s (&n->id)); + GNUNET_i2s (&n->id)); if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_requested, &n->id)) { GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_requested, &n->id, n)); @@ -271,7 +271,7 @@ append_public_key (void *cls, * @param buf the buffer to copy to * @return bytes passed */ -static size_t +static size_t send_experimentation_request_cb (void *cls, size_t bufsize, void *buf) { struct Node *n = cls; @@ -315,22 +315,22 @@ send_experimentation_request_cb (void *cls, size_t bufsize, void *buf) * * @param peer the peer to send to */ -static void +static void send_experimentation_request (const struct GNUNET_PeerIdentity *peer) { struct Node *n; struct NodeComCtx *e_ctx; size_t size; size_t c_issuers; - - c_issuers = GNUNET_CONTAINER_multihashmap_size (valid_issuers); + + c_issuers = GNUNET_CONTAINER_multihashmap_size (valid_issuers); size = sizeof (struct Experimentation_Request) + c_issuers * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); n = GNUNET_new (struct Node); n->id = *peer; n->timeout_task = GNUNET_SCHEDULER_add_delayed (EXP_RESPONSE_TIMEOUT, &remove_request, n); n->capabilities = NONE; - + e_ctx = GNUNET_new (struct NodeComCtx); e_ctx->n = n; e_ctx->e = NULL; @@ -339,10 +339,10 @@ send_experimentation_request (const struct GNUNET_PeerIdentity *peer) e_ctx->notify_cls = n; GNUNET_CONTAINER_DLL_insert_tail(n->e_req_head, n->e_req_tail, e_ctx); schedule_transmisson (e_ctx); - - GNUNET_assert (GNUNET_OK == + + GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multipeermap_put (nodes_requested, - peer, n, + peer, n, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); update_stats (nodes_requested); } @@ -361,17 +361,17 @@ send_response_cb (void *cls, size_t bufsize, void *buf) { struct Node *n = cls; struct Experimentation_Response msg; - size_t c_issuers = GNUNET_CONTAINER_multihashmap_size (valid_issuers); + size_t c_issuers = GNUNET_CONTAINER_multihashmap_size (valid_issuers); size_t ri_size = c_issuers * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); size_t msg_size = sizeof (msg); size_t total_size = msg_size + ri_size; struct GNUNET_CRYPTO_EccPublicSignKey *issuers; - + n->cth = NULL; if (buf == NULL) { /* client disconnected */ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client disconnected\n"); return 0; } @@ -399,7 +399,7 @@ get_experiments_cb (struct Node *n, struct Experiment *e) static int counter = 0; if (NULL == e) return; /* Done */ - + /* Tell the scheduler to add a node with an experiment */ GED_scheduler_add (n, e, GNUNET_YES); counter ++; @@ -417,19 +417,19 @@ get_node (const struct GNUNET_PeerIdentity *id) tmp = GNUNET_CONTAINER_multipeermap_get (nodes_active, id); if (res == NULL) res = tmp; - + tmp = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, id); if (res == NULL) res = tmp; else GNUNET_break (0); /* Multiple instances */ - + tmp = GNUNET_CONTAINER_multipeermap_get (nodes_requested, id); if (res == NULL) res = tmp; else GNUNET_break (0); /* Multiple instances */ - + return res; } @@ -439,7 +439,7 @@ get_node (const struct GNUNET_PeerIdentity *id) * * @param n the node */ -static void +static void node_make_active (struct Node *n) { int c1; @@ -452,7 +452,7 @@ node_make_active (struct Node *n) GNUNET_i2s (&n->id)); /* Request experiments for this node to start them */ for (c1 = 0; c1 < n->issuer_count; c1++) - { + { GED_experiments_get (n, &n->issuer_id[c1], &get_experiments_cb); } } @@ -478,20 +478,20 @@ handle_request (const struct GNUNET_PeerIdentity *peer, uint32_t ic; uint32_t ic_accepted; int make_active; - + if (ntohs (message->size) < sizeof (struct Experimentation_Request)) { GNUNET_break (0); return; } ic = ntohl (rm->issuer_count); - if (ntohs (message->size) != + if (ntohs (message->size) != sizeof (struct Experimentation_Request) + ic * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) { GNUNET_break (0); return; } - + make_active = GNUNET_NO; if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer))) { @@ -522,10 +522,10 @@ handle_request (const struct GNUNET_PeerIdentity *peer, n->capabilities = NONE; make_active = GNUNET_YES; } - + /* Update node */ n->capabilities = ntohl (rm->capabilities); - + /* Filter accepted issuer */ ic_accepted = 0; for (c1 = 0; c1 < ic; c1++) @@ -533,7 +533,7 @@ handle_request (const struct GNUNET_PeerIdentity *peer, if (GNUNET_YES == GED_experiments_issuer_accepted(&rmi[c1])) ic_accepted ++; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Request from peer `%s' with %u issuers, we accepted %u issuer \n", GNUNET_i2s (peer), ic, ic_accepted); GNUNET_free_non_null (n->issuer_id); @@ -548,19 +548,19 @@ handle_request (const struct GNUNET_PeerIdentity *peer, } } n->issuer_count = ic_accepted; - + if (GNUNET_YES == make_active) node_make_active (n); - + /* Send response */ e_ctx = GNUNET_new (struct NodeComCtx); e_ctx->n = n; e_ctx->e = NULL; - e_ctx->size = sizeof (struct Experimentation_Response) + + e_ctx->size = sizeof (struct Experimentation_Response) + my_issuer_count * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); e_ctx->notify = &send_response_cb; e_ctx->notify_cls = n; - + GNUNET_CONTAINER_DLL_insert_tail(n->e_req_head, n->e_req_tail, e_ctx); schedule_transmisson (e_ctx); } @@ -583,7 +583,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, int make_active; unsigned int c1; unsigned int c2; - + if (ntohs (message->size) < sizeof (struct Experimentation_Response)) { GNUNET_break (0); @@ -595,7 +595,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, GNUNET_break (0); return; } - + make_active = GNUNET_NO; if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer))) { @@ -618,7 +618,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, } else if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, peer))) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %s from peer `%s'\n", "RESPONSE", "inactive", GNUNET_i2s (peer)); GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_inactive, peer, n)); @@ -631,10 +631,10 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, "RESPONSE", "unknown", GNUNET_i2s (peer)); return; } - + /* Update */ n->capabilities = ntohl (rm->capabilities); - + /* Filter accepted issuer */ ic_accepted = 0; for (c1 = 0; c1 < ic; c1++) @@ -657,7 +657,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, } } n->issuer_count = ic_accepted; - + if (GNUNET_YES == make_active) node_make_active (n); } @@ -669,7 +669,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, * @param peer the source * @param message the message */ -static void +static void handle_start (const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message) { @@ -679,7 +679,7 @@ handle_start (const struct GNUNET_PeerIdentity *peer, const char *name; struct Node *n; struct Experiment *e; - + if (NULL == peer) { GNUNET_break (0); @@ -690,7 +690,7 @@ handle_start (const struct GNUNET_PeerIdentity *peer, GNUNET_break (0); return; } - + size = ntohs (message->size); if (size < sizeof (struct GED_start_message)) { @@ -704,7 +704,7 @@ handle_start (const struct GNUNET_PeerIdentity *peer, GNUNET_break (0); return; } - + n = get_node (peer); if (NULL == n) { @@ -716,18 +716,18 @@ handle_start (const struct GNUNET_PeerIdentity *peer, { GNUNET_break (0); return; - } + } if (name_len != strlen (name) + 1) { GNUNET_break (0); return; - } + } e = GED_experiments_find (&msg->issuer, name, GNUNET_TIME_absolute_ntoh(msg->version_nbo)); if (NULL == e) { GNUNET_break (0); return; - } + } GED_scheduler_handle_start (n, e); } @@ -748,7 +748,7 @@ handle_start_ack (const struct GNUNET_PeerIdentity *peer, const char *name; struct Node *n; struct Experiment *e; - + if (NULL == peer) { GNUNET_break (0); @@ -759,7 +759,7 @@ handle_start_ack (const struct GNUNET_PeerIdentity *peer, GNUNET_break (0); return; } - + size = ntohs (message->size); if (size < sizeof (struct GED_start_ack_message)) { @@ -773,7 +773,7 @@ handle_start_ack (const struct GNUNET_PeerIdentity *peer, GNUNET_break (0); return; } - + n = get_node (peer); if (NULL == n) { @@ -791,7 +791,7 @@ handle_start_ack (const struct GNUNET_PeerIdentity *peer, GNUNET_break (0); return; } - + e = GED_experiments_find (&msg->issuer, name, GNUNET_TIME_absolute_ntoh(msg->version_nbo)); if (NULL == e) { @@ -885,19 +885,19 @@ core_connect_handler (void *cls, { if (GNUNET_YES == is_me(peer)) return; - + GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connected to peer %s\n"), GNUNET_i2s (peer)); - + if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_requested, peer)) return; /* We already sent a request */ - + if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_active, peer)) return; /* This peer is known as active */ - + if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_inactive, peer)) return; /* This peer is known as inactive */ - + send_experimentation_request (peer); } 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) GNUNET_break_op (0); return; } - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %s message from peer %s for experiment `%s'\n", "START", GNUNET_i2s (&n->id), e->name); 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) * failed */ static void -test_master (void *cls, +test_master (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, 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, for (mc = dc->head; NULL != mc; mc = mc->next) if (mc->fragment_id > fid) last++; - + mc = dc->head; while ((NULL != mc) && (fid != mc->fragment_id)) mc = mc->next; @@ -538,13 +538,13 @@ GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc, } /* send ACK */ if (mc->frag_times_write_offset - mc->frag_times_start_offset > 1) - { + { dc->latency = estimate_latency (mc); } delay = GNUNET_TIME_relative_multiply (dc->latency, bc + 1); if ( (last + fid == num_fragments) || - (0 == mc->bits) || - (GNUNET_YES == duplicate)) + (0 == mc->bits) || + (GNUNET_YES == duplicate)) { /* message complete or duplicate or last missing fragment in 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) fc->num_rounds++; delay = GNUNET_TIME_relative_multiply (fc->ack_delay, 2); /* never use zero, need some time for ACK always */ - delay = GNUNET_TIME_relative_max (MIN_ACK_DELAY, delay); + delay = GNUNET_TIME_relative_max (MIN_ACK_DELAY, delay); fc->wack = GNUNET_YES; fc->last_round = GNUNET_TIME_absolute_get (); GNUNET_STATISTICS_update (fc->stats, _("# fragments wrap arounds"), 1, @@ -277,7 +277,7 @@ GNUNET_FRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats, struct GNUNET_FRAGMENT_Context *fc; size_t size; uint64_t bits; - + GNUNET_STATISTICS_update (stats, _("# messages fragmented"), 1, GNUNET_NO); GNUNET_assert (mtu >= 1024 + sizeof (struct FragmentHeader)); size = ntohs (msg->size); @@ -368,7 +368,7 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc, fc->wack = GNUNET_NO; ndelay = GNUNET_TIME_absolute_get_duration (fc->last_round); fc->ack_delay.rel_value_us = - (ndelay.rel_value_us / fc->num_transmissions + 3 * fc->ack_delay.rel_value_us) / 4; + (ndelay.rel_value_us / fc->num_transmissions + 3 * fc->ack_delay.rel_value_us) / 4; fc->num_transmissions = 0; /* calculate ratio msg sent vs. msg acked */ ack_cnt = 0; @@ -385,8 +385,8 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc, if (0 == ack_cnt) { /* complete loss */ - fc->msg_delay = GNUNET_TIME_relative_multiply (fc->msg_delay, - snd_cnt); + fc->msg_delay = GNUNET_TIME_relative_multiply (fc->msg_delay, + snd_cnt); } else if (snd_cnt > ack_cnt) { 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, htons (sizeof (struct GNUNET_MessageHeader) + (17 * i) % (32 * 1024)); frags[i] = GNUNET_FRAGMENT_context_create (NULL /* no stats */ , MTU, &trackers[i], - GNUNET_TIME_UNIT_MILLISECONDS, - GNUNET_TIME_UNIT_SECONDS, + GNUNET_TIME_UNIT_MILLISECONDS, + GNUNET_TIME_UNIT_SECONDS, msg, &proc_frac, &frags[i]); } 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) /* stop probes if possible */ num_probes_change = - num_probes_active; num_downloads_change = h->max_parallel_requests - h->active_downloads; - } - else + } + else { /* start all downloads */ num_downloads_change = num_downloads_waiting; @@ -220,7 +220,7 @@ process_job_queue (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) num_probes_change = GNUNET_MIN (num_probes_waiting, h->max_parallel_requests - (h->active_downloads + num_downloads_waiting)); } - + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Changing %d probes and %d downloads\n", num_probes_change, @@ -232,7 +232,7 @@ process_job_queue (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) next = qe->next; if (GNUNET_FS_QUEUE_PRIORITY_PROBE != qe->priority) continue; - if (num_probes_change < 0) + if (num_probes_change < 0) { stop_job (qe); num_probes_change++; @@ -266,7 +266,7 @@ process_job_queue (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) ( (qe->blocks + h->active_blocks <= h->max_parallel_requests) || ( (qe->blocks > h->max_parallel_requests) && (0 == h->active_downloads) ) ) ) - { + { start_job (qe); num_downloads_change--; } @@ -284,7 +284,7 @@ process_job_queue (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "AD: %u, MP: %u; %d probes and %d downloads to start, will run again in %s\n", h->active_downloads, - h->max_parallel_requests, + h->max_parallel_requests, num_probes_change, num_downloads_change, 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, return 0; } } - if ( (GNUNET_SYSERR == + if ( (GNUNET_SYSERR == GNUNET_DISK_file_seek (fi->fd, offset, GNUNET_DISK_SEEK_SET)) || (-1 == (ret = GNUNET_DISK_file_read (fi->fd, buf, max))) ) { @@ -1398,7 +1398,7 @@ cleanup: * @return NULL if srch was not found in this subtree */ static struct GNUNET_FS_FileInformation * -find_file_position (struct GNUNET_FS_FileInformation *pos, +find_file_position (struct GNUNET_FS_FileInformation *pos, const char *srch) { struct GNUNET_FS_FileInformation *r; @@ -1409,7 +1409,7 @@ find_file_position (struct GNUNET_FS_FileInformation *pos, return pos; if ( (GNUNET_YES == pos->is_directory) && (NULL != (r = find_file_position (pos->data.dir.entries, srch))) ) - return r; + return r; pos = pos->next; } return NULL; @@ -1556,7 +1556,7 @@ deserialize_publish_file (void *cls, const char *filename) GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pc->upload_task); pc->upload_task = GNUNET_SCHEDULER_add_with_priority - (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, + (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, &GNUNET_FS_publish_main_, pc); } if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg)) @@ -2031,8 +2031,8 @@ cleanup: if (NULL != wh) (void) GNUNET_BIO_write_close (wh); remove_sync_file_in_dir (sr->h, - (NULL == sr->sc->psearch_result) - ? GNUNET_FS_SYNC_PATH_MASTER_SEARCH + (NULL == sr->sc->psearch_result) + ? GNUNET_FS_SYNC_PATH_MASTER_SEARCH : GNUNET_FS_SYNC_PATH_CHILD_SEARCH, sr->sc->serialization, sr->serialization); GNUNET_free (sr->serialization); @@ -2057,8 +2057,8 @@ GNUNET_FS_search_sync_ (struct GNUNET_FS_SearchContext *sc) const char *category; category = - (NULL == sc->psearch_result) - ? GNUNET_FS_SYNC_PATH_MASTER_SEARCH + (NULL == sc->psearch_result) + ? GNUNET_FS_SYNC_PATH_MASTER_SEARCH : GNUNET_FS_SYNC_PATH_CHILD_SEARCH; if (NULL == sc->serialization) sc->serialization = make_serialization_file_name (sc->h, category); @@ -2163,7 +2163,7 @@ deserialize_unindex_file (void *cls, const char *filename) { GNUNET_break (0); goto cleanup; - } + } uc->state = (enum UnindexState) state; switch (state) { @@ -2316,8 +2316,8 @@ deserialize_search_result (void *cls, const char *filename) if (NULL != ser) { remove_sync_file_in_dir (sc->h, - (NULL == sc->psearch_result) - ? GNUNET_FS_SYNC_PATH_MASTER_SEARCH + (NULL == sc->psearch_result) + ? GNUNET_FS_SYNC_PATH_MASTER_SEARCH : GNUNET_FS_SYNC_PATH_CHILD_SEARCH, sc->serialization, ser); 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); /** * Priorities for the queue. - */ + */ enum GNUNET_FS_QueuePriority { /** @@ -1259,7 +1259,7 @@ struct GNUNET_FS_PublishContext * Set to GNUNET_YES if all processing has completed. */ int all_done; - + /** * Flag set to GNUNET_YES if the next callback from * GNUNET_FS_file_information_inspect should be skipped because it @@ -1284,7 +1284,7 @@ enum UnindexState * the respective DBlocks and IBlocks. */ UNINDEX_STATE_DS_REMOVE = 1, - + /** * Find out which keywords apply. */ @@ -1300,12 +1300,12 @@ enum UnindexState * the unindexing. */ UNINDEX_STATE_FS_NOTIFY = 4, - + /** * We're done. */ UNINDEX_STATE_COMPLETE = 5, - + /** * We've encountered a fatal error. */ @@ -1323,7 +1323,7 @@ struct GNUNET_FS_UnindexContext * The content hash key of the last block we processed, will in the * end be set to the CHK from the URI. Used to remove the KBlocks. */ - struct ContentHashKey chk; + struct ContentHashKey chk; /** * Global FS context. @@ -1460,7 +1460,7 @@ struct SearchRequestEntry /** * Derived public key, hashes to 'uquery'. - */ + */ struct GNUNET_CRYPTO_EccPublicSignKey dpub; /** 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 * Second argument to helper process. */ char *ex_arg; - + /** * The function that will be called every time there's a progress * message. */ GNUNET_FS_DirScannerProgressCallback progress_callback; - + /** * A closure for progress_callback. */ @@ -68,7 +68,7 @@ struct GNUNET_FS_DirScanner /** * After the scan is finished, it will contain a pointer to the * top-level directory entry in the directory tree built by the - * scanner. + * scanner. */ struct GNUNET_FS_ShareTreeItem *toplevel; @@ -103,7 +103,7 @@ GNUNET_FS_directory_scan_abort (struct GNUNET_FS_DirScanner *ds) /* terminate helper */ if (NULL != ds->helper) GNUNET_HELPER_stop (ds->helper, GNUNET_NO); - + /* free resources */ if (NULL != ds->toplevel) GNUNET_FS_share_tree_free (ds->toplevel); @@ -132,7 +132,7 @@ GNUNET_FS_directory_scan_get_result (struct GNUNET_FS_DirScanner *ds) GNUNET_assert (NULL == ds->helper); /* preserve result */ result = ds->toplevel; - ds->toplevel = NULL; + ds->toplevel = NULL; GNUNET_FS_directory_scan_abort (ds); return result; } @@ -149,7 +149,7 @@ static struct GNUNET_FS_ShareTreeItem * advance (struct GNUNET_FS_ShareTreeItem *pos) { int moved; - + GNUNET_assert (NULL != pos); moved = 0; /* must not terminate, even on file, otherwise "normal" */ while ( (pos->is_directory == GNUNET_YES) || @@ -214,7 +214,7 @@ expand_tree (struct GNUNET_FS_ShareTreeItem *parent, if (NULL != parent) GNUNET_CONTAINER_DLL_insert (parent->children_head, parent->children_tail, - chld); + chld); return chld; } @@ -237,9 +237,9 @@ finish_scan (void *cls, GNUNET_HELPER_stop (ds->helper, GNUNET_NO); ds->helper = NULL; } - ds->progress_callback (ds->progress_callback_cls, + ds->progress_callback (ds->progress_callback_cls, NULL, GNUNET_SYSERR, - GNUNET_FS_DIRSCANNER_FINISHED); + GNUNET_FS_DIRSCANNER_FINISHED); } @@ -252,7 +252,7 @@ finish_scan (void *cls, * @param msg message from the helper process */ static int -process_helper_msgs (void *cls, +process_helper_msgs (void *cls, void *client, const struct GNUNET_MessageHeader *msg) { @@ -275,7 +275,7 @@ process_helper_msgs (void *cls, GNUNET_break (0); break; } - ds->progress_callback (ds->progress_callback_cls, + ds->progress_callback (ds->progress_callback_cls, filename, GNUNET_NO, GNUNET_FS_DIRSCANNER_FILE_START); if (NULL == ds->toplevel) @@ -301,7 +301,7 @@ process_helper_msgs (void *cls, ds->pos = ds->pos->parent; return GNUNET_OK; } - ds->progress_callback (ds->progress_callback_cls, + ds->progress_callback (ds->progress_callback_cls, filename, GNUNET_YES, GNUNET_FS_DIRSCANNER_FILE_START); ds->pos = expand_tree (ds->pos, @@ -314,7 +314,7 @@ process_helper_msgs (void *cls, case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_SKIP_FILE: if ('\0' != filename[left-1]) break; - ds->progress_callback (ds->progress_callback_cls, + ds->progress_callback (ds->progress_callback_cls, filename, GNUNET_SYSERR, GNUNET_FS_DIRSCANNER_FILE_IGNORED); return GNUNET_OK; @@ -329,7 +329,7 @@ process_helper_msgs (void *cls, GNUNET_break (0); break; } - ds->progress_callback (ds->progress_callback_cls, + ds->progress_callback (ds->progress_callback_cls, NULL, GNUNET_SYSERR, GNUNET_FS_DIRSCANNER_ALL_COUNTED); ds->pos = ds->toplevel; @@ -340,7 +340,7 @@ process_helper_msgs (void *cls, { size_t nlen; const char *end; - + if (NULL == ds->pos) { GNUNET_break (0); @@ -361,7 +361,7 @@ process_helper_msgs (void *cls, GNUNET_break (0); break; } - ds->progress_callback (ds->progress_callback_cls, + ds->progress_callback (ds->progress_callback_cls, filename, GNUNET_YES, GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED); if (0 < left) @@ -373,18 +373,18 @@ process_helper_msgs (void *cls, break; } /* having full filenames is too dangerous; always make sure we clean them up */ - GNUNET_CONTAINER_meta_data_delete (ds->pos->meta, + GNUNET_CONTAINER_meta_data_delete (ds->pos->meta, EXTRACTOR_METATYPE_FILENAME, NULL, 0); /* instead, put in our 'safer' original filename */ GNUNET_CONTAINER_meta_data_insert (ds->pos->meta, "", EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME, EXTRACTOR_METAFORMAT_UTF8, "text/plain", - ds->pos->short_filename, + ds->pos->short_filename, strlen (ds->pos->short_filename) + 1); } ds->pos->ksk_uri = GNUNET_FS_uri_ksk_create_from_meta_data (ds->pos->meta); - ds->pos = advance (ds->pos); + ds->pos = advance (ds->pos); return GNUNET_OK; } case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_FINISHED: @@ -397,7 +397,7 @@ process_helper_msgs (void *cls, { GNUNET_break (0); break; - } + } if (NULL == ds->toplevel) { GNUNET_break (0); @@ -410,7 +410,7 @@ process_helper_msgs (void *cls, GNUNET_break (0); break; } - ds->progress_callback (ds->progress_callback_cls, + ds->progress_callback (ds->progress_callback_cls, NULL, GNUNET_SYSERR, GNUNET_FS_DIRSCANNER_INTERNAL_ERROR); return GNUNET_OK; @@ -430,9 +430,9 @@ helper_died_cb (void *cls) ds->helper = NULL; if (GNUNET_SCHEDULER_NO_TASK != ds->stop_task) return; /* normal death, was finished */ - ds->progress_callback (ds->progress_callback_cls, + ds->progress_callback (ds->progress_callback_cls, NULL, GNUNET_SYSERR, - GNUNET_FS_DIRSCANNER_INTERNAL_ERROR); + GNUNET_FS_DIRSCANNER_INTERNAL_ERROR); } @@ -449,7 +449,7 @@ helper_died_cb (void *cls) struct GNUNET_FS_DirScanner * GNUNET_FS_directory_scan_start (const char *filename, int disable_extractor, const char *ex, - GNUNET_FS_DirScannerProgressCallback cb, + GNUNET_FS_DirScannerProgressCallback cb, void *cb_cls) { struct stat sbuf; @@ -468,9 +468,9 @@ GNUNET_FS_directory_scan_start (const char *filename, ds->progress_callback = cb; ds->progress_callback_cls = cb_cls; ds->filename_expanded = filename_expanded; - if (disable_extractor) + if (disable_extractor) ds->ex_arg = GNUNET_strdup ("-"); - else + else ds->ex_arg = (NULL != ex) ? GNUNET_strdup (ex) : NULL; ds->args[0] = "gnunet-helper-fs-publish"; 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, drc = dr->children[i]; GNUNET_assert (drc->offset >= dr->offset); child_block_size = GNUNET_FS_tree_compute_tree_size (drc->depth); - GNUNET_assert (0 == (drc->offset - dr->offset) % child_block_size); + GNUNET_assert (0 == (drc->offset - dr->offset) % child_block_size); if (BRS_INIT == drc->state) { drc->state = BRS_CHK_SET; @@ -1083,7 +1083,7 @@ process_result_with_request (void *cls, const struct GNUNET_HashCode * key, pi.value.download.specifics.progress.respect_offered = prc->respect_offered; pi.value.download.specifics.progress.num_transmissions = prc->num_transmissions; if (prc->last_transmission.abs_value_us != GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) - pi.value.download.specifics.progress.block_download_duration + pi.value.download.specifics.progress.block_download_duration = GNUNET_TIME_absolute_get_duration (prc->last_transmission); else pi.value.download.specifics.progress.block_download_duration @@ -1445,7 +1445,7 @@ try_reconnect (struct GNUNET_FS_DownloadContext *dc) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Will try to reconnect in %s\n", GNUNET_STRINGS_relative_time_to_string (dc->reconnect_backoff, GNUNET_YES)); dc->task = - GNUNET_SCHEDULER_add_delayed (dc->reconnect_backoff, + GNUNET_SCHEDULER_add_delayed (dc->reconnect_backoff, &do_reconnect, dc); } @@ -1539,7 +1539,7 @@ deactivate_fs_download (void *cls) * the specified depth */ static struct DownloadRequest * -create_download_request (struct DownloadRequest *parent, +create_download_request (struct DownloadRequest *parent, unsigned int chk_idx, unsigned int depth, uint64_t dr_offset, uint64_t file_start_offset, @@ -1558,7 +1558,7 @@ create_download_request (struct DownloadRequest *parent, if (0 == depth) return dr; child_block_size = GNUNET_FS_tree_compute_tree_size (depth - 1); - + /* calculate how many blocks at this level are not interesting * from the start (rounded down), either because of the requested * file offset or because this IBlock is further along */ @@ -1570,7 +1570,7 @@ create_download_request (struct DownloadRequest *parent, { head_skip = 0; } - + /* calculate index of last block at this level that is interesting (rounded up) */ dr->num_children = (file_start_offset + desired_length - dr_offset) / child_block_size; if (dr->num_children * child_block_size < @@ -1585,12 +1585,12 @@ create_download_request (struct DownloadRequest *parent, (unsigned long long) dr_offset, depth, dr->num_children); - + /* now we can get the total number of *interesting* children for this block */ /* why else would we have gotten here to begin with? (that'd be a bad logic error) */ GNUNET_assert (dr->num_children > 0); - + dr->children = GNUNET_malloc (dr->num_children * sizeof (struct DownloadRequest *)); for (i = 0; i < dr->num_children; i++) @@ -1616,7 +1616,7 @@ reconstruct_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_FS_DownloadContext *dc = cls; - /* clean up state from tree encoder */ + /* clean up state from tree encoder */ if (dc->task != GNUNET_SCHEDULER_NO_TASK) { GNUNET_SCHEDULER_cancel (dc->task); @@ -1965,7 +1965,7 @@ GNUNET_FS_download_start_task_ (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying bottom-up reconstruction of file `%s'\n", dc->filename); dc->te = - GNUNET_FS_tree_encoder_create (dc->h, + GNUNET_FS_tree_encoder_create (dc->h, GNUNET_FS_uri_chk_get_file_size (dc->uri), dc, &fh_reader, &reconstruct_cb, NULL, @@ -2116,7 +2116,7 @@ create_download_context (struct GNUNET_FS_Handle *h, else dc->temp_filename = GNUNET_DISK_mktemp ("gnunet-directory-download-tmp"); } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting download `%s' of %llu bytes with tree depth %u\n", filename, (unsigned long long) length, @@ -2267,7 +2267,7 @@ GNUNET_FS_download_start_downloading_ (struct GNUNET_FS_DownloadContext *dc) GNUNET_FS_queue_ (dc->h, &activate_fs_download, &deactivate_fs_download, dc, (dc->length + DBLOCK_SIZE - 1) / DBLOCK_SIZE, (0 == (dc->options & GNUNET_FS_DOWNLOAD_IS_PROBE)) - ? GNUNET_FS_QUEUE_PRIORITY_NORMAL + ? GNUNET_FS_QUEUE_PRIORITY_NORMAL : GNUNET_FS_QUEUE_PRIORITY_PROBE); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "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, GNUNET_CRYPTO_hash (&pub, sizeof (pub), &hc); GNUNET_CRYPTO_hash_to_enc (&hc, &enc); - GNUNET_asprintf (&ret, "%s%s%s", - dn, - DIR_SEPARATOR_STR, + GNUNET_asprintf (&ret, "%s%s%s", + dn, + DIR_SEPARATOR_STR, (const char *) enc.encoding); GNUNET_free (dn); return ret; @@ -158,7 +158,7 @@ get_update_information_directory (struct GNUNET_FS_Handle *h, /** * Release memory occupied by UIG datastructure. - * + * * @param uig data structure to free */ static void @@ -317,7 +317,7 @@ read_update_information_graph (struct GNUNET_FS_Handle *h, END: if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to read `%s': %s\n"), + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to read `%s': %s\n"), fn, emsg); GNUNET_free (emsg); } @@ -383,7 +383,7 @@ struct GNUNET_FS_PublishSksContext * @param msg error message (or NULL) */ static void -sks_publish_cont (void *cls, +sks_publish_cont (void *cls, const char *msg) { struct GNUNET_FS_PublishSksContext *psc = cls; @@ -405,7 +405,7 @@ sks_publish_cont (void *cls, uig = read_update_information_graph (psc->h, &psc->ns); GNUNET_array_append (uig->update_nodes, - uig->update_node_count, + uig->update_node_count, psc->nsn); psc->nsn = NULL; write_update_information_graph (uig); @@ -549,16 +549,16 @@ struct ProcessUpdateClosure * GNUNET_NO if not. */ static int -process_update_node (void *cls, - const struct GNUNET_HashCode *key, +process_update_node (void *cls, + const struct GNUNET_HashCode *key, void *value) { struct ProcessUpdateClosure *pc = cls; struct NamespaceUpdateNode *nsn = value; pc->ip (pc->ip_cls, - nsn->id, - nsn->uri, + nsn->id, + nsn->uri, nsn->md, nsn->update); return GNUNET_YES; @@ -619,7 +619,7 @@ struct FindTreeClosure */ static int find_trees (void *cls, - const struct GNUNET_HashCode *key, + const struct GNUNET_HashCode *key, void *value) { struct FindTreeClosure *fc = cls; @@ -780,7 +780,7 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Handle *h, fc.tree_array[fc.id] = nsn; nsn->tree_id = fc.id; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TREE of node `%s' is %u\n", nsn->id, fc.id); } 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) * @param msg error message (or NULL) */ static void -ds_put_cont (void *cls, int success, +ds_put_cont (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg) { @@ -206,14 +206,14 @@ signal_publish_error (struct GNUNET_FS_FileInformation *p, * @param msg error message (typically NULL, not used) */ static void -finish_release_reserve (void *cls, int success, +finish_release_reserve (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg) { struct GNUNET_FS_PublishContext *pc = cls; pc->qre = NULL; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Releasing reserve done!\n"); signal_publish_completion (pc->fi, pc); pc->all_done = GNUNET_YES; @@ -268,8 +268,8 @@ publish_sblock (struct GNUNET_FS_PublishContext *pc) { if (NULL != pc->ns) pc->sks_pc = GNUNET_FS_publish_sks (pc->h, - pc->ns, - pc->nid, + pc->ns, + pc->nid, pc->nuid, pc->fi->meta, pc->fi->chk_uri, @@ -300,7 +300,7 @@ publish_kblocks_cont (void *cls, const struct GNUNET_FS_Uri *uri, pc->ksk_pc = NULL; if (NULL != emsg) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Error uploading KSK blocks: %s\n", emsg); signal_publish_error (p, pc, emsg); @@ -359,7 +359,7 @@ block_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg) } else { - if (UINT64_MAX == offset) + if (UINT64_MAX == offset) { if (&GNUNET_FS_data_reader_file_ == p->data.file.reader) { @@ -408,10 +408,10 @@ encode_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (NULL != emsg) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Error during tree walk: %s\n", + "Error during tree walk: %s\n", emsg); GNUNET_asprintf (&p->emsg, - _("Publishing failed: %s"), + _("Publishing failed: %s"), emsg); GNUNET_free (emsg); pi.status = GNUNET_FS_STATUS_PUBLISH_ERROR; @@ -603,7 +603,7 @@ publish_content (struct GNUNET_FS_PublishContext *pc) GNUNET_FS_file_information_sync_ (p); } size = (GNUNET_YES == p->is_directory) ? p->data.dir.dir_size : p->data.file.file_size; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating tree encoder\n"); p->te = GNUNET_FS_tree_encoder_create (pc->h, size, pc, &block_reader, @@ -625,7 +625,7 @@ publish_content (struct GNUNET_FS_PublishContext *pc) * @param msg the response we got */ static void -process_index_start_response (void *cls, +process_index_start_response (void *cls, const struct GNUNET_MessageHeader *msg) { struct GNUNET_FS_PublishContext *pc = cls; @@ -696,7 +696,7 @@ hash_for_index_cb (void *cls, { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Can not index file `%s': %s. Will try to insert instead.\n"), - p->filename, + p->filename, _("failed to compute hash")); p->data.file.do_index = GNUNET_NO; GNUNET_FS_file_information_sync_ (p); @@ -741,7 +741,7 @@ hash_for_index_cb (void *cls, { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Can not index file `%s': %s. Will try to insert instead.\n"), - p->filename, + p->filename, _("could not connect to `fs' service")); p->data.file.do_index = GNUNET_NO; publish_content (pc); @@ -810,8 +810,8 @@ GNUNET_FS_publish_main_ (void *cls, return; } /* find starting position */ - while ( (GNUNET_YES == p->is_directory) && - (NULL != p->data.dir.entries) && + while ( (GNUNET_YES == p->is_directory) && + (NULL != p->data.dir.entries) && (NULL == p->emsg) && (NULL == p->data.dir.entries->chk_uri) ) { @@ -822,8 +822,8 @@ GNUNET_FS_publish_main_ (void *cls, /* abort on error */ if (NULL != p->emsg) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Error uploading: %s\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Error uploading: %s\n", p->emsg); /* error with current file, abort all * related files as well! */ @@ -928,9 +928,9 @@ fip_signal_start (void *cls, struct GNUNET_FS_FileInformation *fi, uint64_t length, struct GNUNET_CONTAINER_MetaData *meta, - struct GNUNET_FS_Uri **uri, + struct GNUNET_FS_Uri **uri, struct GNUNET_FS_BlockOptions *bo, - int *do_index, + int *do_index, void **client_info) { struct GNUNET_FS_PublishContext *pc = cls; @@ -1013,7 +1013,7 @@ suspend_operation (struct GNUNET_FS_FileInformation *fi, GNUNET_FS_publish_sks_cancel (pc->sks_pc); pc->sks_pc = NULL; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Suspending publish operation\n"); GNUNET_free_non_null (fi->serialization); fi->serialization = NULL; @@ -1051,10 +1051,10 @@ suspend_operation (struct GNUNET_FS_FileInformation *fi, static int fip_signal_suspend (void *cls, struct GNUNET_FS_FileInformation *fi, - uint64_t length, + uint64_t length, struct GNUNET_CONTAINER_MetaData *meta, struct GNUNET_FS_Uri **uri, - struct GNUNET_FS_BlockOptions *bo, + struct GNUNET_FS_BlockOptions *bo, int *do_index, void **client_info) { @@ -1112,7 +1112,7 @@ GNUNET_FS_publish_signal_suspend_ (void *cls) * @param msg error message on error, otherwise NULL */ static void -finish_reserve (void *cls, int success, +finish_reserve (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg) { @@ -1122,7 +1122,7 @@ finish_reserve (void *cls, int success, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Reservation complete (%d)!\n", success); if ((msg != NULL) || (success <= 0)) { - GNUNET_asprintf (&pc->fi->emsg, + GNUNET_asprintf (&pc->fi->emsg, _("Insufficient space for publishing: %s"), msg); 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 @@ /** * @file fs/fs_publish_ksk.c * @brief publish a URI under a keyword in GNUnet - * @see https://gnunet.org/encoding and #2564 + * @see https://gnunet.org/encoding and #2564 * @author Krista Bennett * @author Christian Grothoff */ @@ -93,7 +93,7 @@ struct GNUNET_FS_PublishKskContext /** * Options to use. - */ + */ enum GNUNET_FS_PublishOptions options; /** @@ -113,7 +113,7 @@ struct GNUNET_FS_PublishKskContext * @param tc unused */ static void -publish_ksk_cont (void *cls, +publish_ksk_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); @@ -133,7 +133,7 @@ kb_put_cont (void *cls, pkc->uc = NULL; if (NULL != msg) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "KBlock PUT operation failed: %s\n", msg); pkc->cont (pkc->cont_cls, NULL, msg); 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 @@ /** * @file fs/fs_publish_ublock.c * @brief publish a UBLOCK in GNUnet - * @see https://gnunet.org/encoding and #2564 + * @see https://gnunet.org/encoding and #2564 * @author Krista Bennett * @author Christian Grothoff */ @@ -41,7 +41,7 @@ * @param iv where to store the IV * @param label label to use for key derivation * @param pub public key to use for key derivation - */ + */ static void derive_ublock_encryption_key (struct GNUNET_CRYPTO_SymmetricSessionKey *skey, struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, @@ -69,7 +69,7 @@ derive_ublock_encryption_key (struct GNUNET_CRYPTO_SymmetricSessionKey *skey, * @param ns public key under which the UBlock was stored * @param label label under which the UBlock was stored * @param output where to write the result, has input_len bytes - */ + */ void GNUNET_FS_ublock_decrypt_ (const void *input, size_t input_len, @@ -124,7 +124,7 @@ struct GNUNET_FS_PublishUblockContext * @param msg NULL on success, otherwise an error message */ static void -ublock_put_cont (void *cls, +ublock_put_cont (void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiration, const char *msg) @@ -221,7 +221,7 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h, } size = sizeof (struct UBlock) + slen + mdsize + ulen; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Publishing under identifier `%s'\n", label); /* get public key of the namespace */ @@ -232,11 +232,11 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h, /* encrypt ublock */ ub_enc = GNUNET_malloc (size); - GNUNET_CRYPTO_symmetric_encrypt (&ub_plain[1], + GNUNET_CRYPTO_symmetric_encrypt (&ub_plain[1], ulen + slen + mdsize, &skey, &iv, &ub_enc[1]); - ub_enc->purpose.size = htonl (ulen + slen + mdsize + + ub_enc->purpose.size = htonl (ulen + slen + mdsize + sizeof (struct UBlock) - sizeof (struct GNUNET_CRYPTO_EccSignature)); 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 @@ /** * @file fs/fs_publish_ublock.h * @brief publish a UBLOCK in GNUnet - * @see https://gnunet.org/encoding and #2564 + * @see https://gnunet.org/encoding and #2564 * @author Krista Bennett * @author Christian Grothoff */ @@ -42,7 +42,7 @@ * @param ns public key under which the UBlock was stored * @param label label under which the UBlock was stored * @param output where to write the result, has input_len bytes - */ + */ void GNUNET_FS_ublock_decrypt_ (const void *input, size_t input_len, 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, pi->value.search.sc = sc; pi->value.search.cctx = (NULL != sc) ? sc->client_info : NULL; pi->value.search.pctx = - ((NULL == sc) || (NULL == sc->psearch_result)) - ? NULL + ((NULL == sc) || (NULL == sc->psearch_result)) + ? NULL : sc->psearch_result->client_info; pi->value.search.query = (NULL != sc) ? sc->uri : NULL; - pi->value.search.duration = (NULL != sc) + pi->value.search.duration = (NULL != sc) ? GNUNET_TIME_absolute_get_duration (sc->start_time) : GNUNET_TIME_UNIT_ZERO; pi->value.search.anonymity = (NULL != sc) ? sc->anonymity : 0; @@ -125,7 +125,7 @@ notify_client_chk_update (struct GNUNET_FS_SearchContext *sc, struct GNUNET_FS_SearchResult *sr) { struct GNUNET_FS_ProgressInfo pi; - + pi.status = GNUNET_FS_STATUS_SEARCH_UPDATE; pi.value.search.specifics.update.cctx = sr->client_info; pi.value.search.specifics.update.meta = sr->meta; @@ -135,7 +135,7 @@ notify_client_chk_update (struct GNUNET_FS_SearchContext *sc, pi.value.search.specifics.update.availability_certainty = sr->availability_trials; pi.value.search.specifics.update.applicability_rank = sr->optional_support; - pi.value.search.specifics.update.current_probe_time + pi.value.search.specifics.update.current_probe_time = GNUNET_TIME_absolute_get_duration (sr->probe_active_time); sr->client_info = GNUNET_FS_search_make_status_ (&pi, sc->h, sc); } @@ -194,12 +194,12 @@ signal_probe_result (struct GNUNET_FS_SearchResult *sr) pi.value.search.specifics.update.cctx = sr->client_info; pi.value.search.specifics.update.meta = sr->meta; pi.value.search.specifics.update.uri = sr->uri; - pi.value.search.specifics.update.availability_rank + pi.value.search.specifics.update.availability_rank = 2 * sr->availability_success - sr->availability_trials; - pi.value.search.specifics.update.availability_certainty + pi.value.search.specifics.update.availability_certainty = sr->availability_trials; pi.value.search.specifics.update.applicability_rank = sr->optional_support; - pi.value.search.specifics.update.current_probe_time + pi.value.search.specifics.update.current_probe_time = GNUNET_TIME_absolute_get_duration (sr->probe_active_time); sr->client_info = GNUNET_FS_search_make_status_ (&pi, sr->h, sr->sc); GNUNET_FS_search_start_probe_ (sr); @@ -380,7 +380,7 @@ probe_ping_task (void *cls, struct GNUNET_FS_SearchResult *sr = cls; signal_probe_result (sr); - sr->probe_ping_task + sr->probe_ping_task = GNUNET_SCHEDULER_add_delayed (GNUNET_FS_PROBE_UPDATE_FREQUENCY, &probe_ping_task, sr); @@ -434,7 +434,7 @@ GNUNET_FS_search_start_probe_ (struct GNUNET_FS_SearchResult *sr) len, sr->anonymity, GNUNET_FS_DOWNLOAD_NO_TEMPORARIES | GNUNET_FS_DOWNLOAD_IS_PROBE, sr, NULL); - sr->probe_ping_task + sr->probe_ping_task = GNUNET_SCHEDULER_add_now (&probe_ping_task, sr); } @@ -465,7 +465,7 @@ GNUNET_FS_probe (struct GNUNET_FS_Handle *h, sr->uri = GNUNET_FS_uri_dup (uri); sr->meta = GNUNET_CONTAINER_meta_data_duplicate (meta); sr->client_info = client_info; - sr->anonymity = anonymity; + sr->anonymity = anonymity; GNUNET_FS_search_start_probe_ (sr); return sr; } @@ -473,8 +473,8 @@ GNUNET_FS_probe (struct GNUNET_FS_Handle *h, /** * Stop probing activity associated with a search result. - * - * @param sr search result + * + * @param sr search result */ static void GNUNET_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, * @param edata encrypted data * @param edata_size number of bytes in @a edata (and @a data) * @param data where to store the plaintext - * @return keyword index on success, #GNUNET_SYSERR on error (no such + * @return keyword index on success, #GNUNET_SYSERR on error (no such * keyword, internal error) */ static int @@ -683,7 +683,7 @@ decrypt_block_with_keyword (const struct GNUNET_FS_SearchContext *sc, const void *edata, size_t edata_size, char *data) -{ +{ const struct GNUNET_CRYPTO_EccPrivateKey *anon; struct GNUNET_CRYPTO_EccPublicSignKey anon_pub; unsigned int i; @@ -721,7 +721,7 @@ decrypt_block_with_keyword (const struct GNUNET_FS_SearchContext *sc, * @param size size of nb */ static void -process_kblock (struct GNUNET_FS_SearchContext *sc, +process_kblock (struct GNUNET_FS_SearchContext *sc, const struct UBlock *ub, size_t size) { @@ -749,7 +749,7 @@ process_kblock (struct GNUNET_FS_SearchContext *sc, if (NULL == (uri = GNUNET_FS_uri_parse (&pt[1], &emsg))) { GNUNET_break_op (0); /* ublock malformed */ - GNUNET_free_non_null (emsg); + GNUNET_free_non_null (emsg); return; } j = eos - pt + 1; @@ -781,7 +781,7 @@ process_kblock (struct GNUNET_FS_SearchContext *sc, * @param size size of sb */ static void -process_sblock (struct GNUNET_FS_SearchContext *sc, +process_sblock (struct GNUNET_FS_SearchContext *sc, const struct UBlock *ub, size_t size) { @@ -811,8 +811,8 @@ process_sblock (struct GNUNET_FS_SearchContext *sc, } if (NULL == (uri = GNUNET_FS_uri_parse (uris, &emsg))) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _("Failed to parse URI `%s': %s\n"), + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Failed to parse URI `%s': %s\n"), uris, emsg); GNUNET_break_op (0); /* ublock malformed */ GNUNET_free_non_null (emsg); @@ -837,9 +837,9 @@ process_sblock (struct GNUNET_FS_SearchContext *sc, * @param size size of data */ static void -process_result (struct GNUNET_FS_SearchContext *sc, +process_result (struct GNUNET_FS_SearchContext *sc, enum GNUNET_BLOCK_Type type, - struct GNUNET_TIME_Absolute expiration, + struct GNUNET_TIME_Absolute expiration, const void *data, size_t size) { @@ -1108,7 +1108,7 @@ transmit_search_request (void *cls, size_t size, void *buf) &dpub); GNUNET_CRYPTO_hash (&dpub, sizeof (dpub), - &sm->query); + &sm->query); mbc.put_cnt = (size - msize) / sizeof (struct GNUNET_HashCode); sqms = GNUNET_CONTAINER_multihashmap_size (sc->master_result_map); mbc.put_cnt = GNUNET_MIN (mbc.put_cnt, sqms - mbc.skip_cnt); @@ -1206,7 +1206,7 @@ try_reconnect (struct GNUNET_FS_SearchContext *sc) } sc->reconnect_backoff = GNUNET_TIME_STD_BACKOFF (sc->reconnect_backoff); sc->task = - GNUNET_SCHEDULER_add_delayed (sc->reconnect_backoff, + GNUNET_SCHEDULER_add_delayed (sc->reconnect_backoff, &do_reconnect, sc); } @@ -1293,8 +1293,8 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc) keyword, "fs-ublock", &sre->dpub); - GNUNET_CRYPTO_hash (&sre->dpub, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + GNUNET_CRYPTO_hash (&sre->dpub, + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), &sre->uquery); sre->mandatory = (sc->uri->data.ksk.keywords[i][0] == '+'); 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) cnt->value = (const char *) &cnt[1]; memcpy (&cnt[1], keyword, klen); GNUNET_assert (GNUNET_OK == - GNUNET_CONTAINER_multihashmap_put (mcm, + GNUNET_CONTAINER_multihashmap_put (mcm, &hc, cnt, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); } @@ -313,7 +313,7 @@ migrate_and_drop_metadata (void *cls, const struct GNUNET_HashCode * key, void * counter->type, counter->format, counter->data_mime_type, counter->data, - counter->data_size); + counter->data_size); } GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (tc->metacounter, @@ -350,7 +350,7 @@ share_tree_trim (struct TrimContext *tc, if (tree->is_directory == GNUNET_YES) { const char *user = getenv ("USER"); - if ( (user == NULL) || + if ( (user == NULL) || (0 != strncasecmp (user, tree->short_filename, strlen(user)))) { /* only use filename if it doesn't match $USER */ @@ -366,12 +366,12 @@ share_tree_trim (struct TrimContext *tc, if (1 >= num_children) return; /* nothing to trim */ - + /* now, count keywords and meta data in children */ for (pos = tree->children_head; NULL != pos; pos = pos->next) { if (NULL != pos->meta) - GNUNET_CONTAINER_meta_data_iterate (pos->meta, &add_to_meta_counter, tc->metacounter); + GNUNET_CONTAINER_meta_data_iterate (pos->meta, &add_to_meta_counter, tc->metacounter); if (NULL != pos->ksk_uri) GNUNET_FS_uri_ksk_get_keywords (pos->ksk_uri, &add_to_keyword_counter, tc->keywordcounter); } @@ -393,10 +393,10 @@ share_tree_trim (struct TrimContext *tc, /* add high-frequency meta data and keywords to parent */ tc->pos = tree; - GNUNET_CONTAINER_multihashmap_iterate (tc->keywordcounter, + GNUNET_CONTAINER_multihashmap_iterate (tc->keywordcounter, &migrate_and_drop_keywords, tc); - GNUNET_CONTAINER_multihashmap_iterate (tc->metacounter, + GNUNET_CONTAINER_multihashmap_iterate (tc->metacounter, &migrate_and_drop_metadata, tc); } @@ -414,7 +414,7 @@ GNUNET_FS_share_tree_trim (struct GNUNET_FS_ShareTreeItem *toplevel) struct TrimContext tc; if (toplevel == NULL) - return; + return; tc.keywordcounter = GNUNET_CONTAINER_multihashmap_create (1024, GNUNET_NO); tc.metacounter = GNUNET_CONTAINER_multihashmap_create (1024, GNUNET_NO); 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 * @param tc scheduler context (unused) */ static void -report_uri (void *cls, +report_uri (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct TestPublishOperation *po = cls; GNUNET_FS_publish_stop (po->publish_context); GNUNET_TESTBED_operation_done (po->fs_op); - po->publish_cont (po->publish_cont_cls, + po->publish_cont (po->publish_cont_cls, po->publish_uri, - (GNUNET_YES == po->do_index) + (GNUNET_YES == po->do_index) ? po->publish_tmp_file : NULL); GNUNET_FS_uri_destroy (po->publish_uri); @@ -272,15 +272,15 @@ publish_progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) * @param cls pointer to uint32_t with publishing seed * @param offset offset to generate data for * @param max maximum number of bytes to generate - * @param buf where to write generated data + * @param buf where to write generated data * @param emsg where to store error message (unused) * @return number of bytes written to buf */ static size_t -file_generator (void *cls, +file_generator (void *cls, uint64_t offset, - size_t max, - void *buf, + size_t max, + void *buf, char **emsg) { uint32_t *publish_seed = cls; @@ -307,7 +307,7 @@ file_generator (void *cls, /** * Connect adapter for publishing operation. - * + * * @param cls the 'struct TestPublishOperation' * @param cfg configuration of the peer to connect to; will be available until * GNUNET_TESTBED_operation_done() is called on the operation returned @@ -319,7 +319,7 @@ publish_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) { struct TestPublishOperation *po = cls; - + return GNUNET_FS_start (cfg, "fs-test-publish", &publish_progress_cb, po, @@ -330,11 +330,11 @@ publish_connect_adapter (void *cls, /** * Adapter function called to destroy connection to file-sharing service. - * + * * @param cls the 'struct GNUNET_FS_Handle' * @param op_result unused (different for publish/download!) */ -static void +static void fs_disconnect_adapter (void *cls, void *op_result) { @@ -412,8 +412,8 @@ publish_fs_connect_complete_cb (void *cls, else { fi = GNUNET_FS_file_information_create_from_reader (po->fs, po, - po->size, - &file_generator, &po->publish_seed, + po->size, + &file_generator, &po->publish_seed, NULL, NULL, po->do_index, &bo); } @@ -557,7 +557,7 @@ download_progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) /** * Connect adapter for download operation. - * + * * @param cls the 'struct TestDownloadOperation' * @param cfg configuration of the peer to connect to; will be available until * GNUNET_TESTBED_operation_done() is called on the operation returned @@ -569,7 +569,7 @@ download_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) { struct TestPublishOperation *po = cls; - + return GNUNET_FS_start (cfg, "fs-test-download", &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) * @param reason kind of progress we are making */ static void -unindex_directory_scan_cb (void *cls, - const char *filename, +unindex_directory_scan_cb (void *cls, + const char *filename, int is_directory, enum GNUNET_FS_DirScannerProgressUpdateReason reason) { @@ -381,7 +381,7 @@ GNUNET_FS_unindex_do_extract_keywords_ (struct GNUNET_FS_UnindexContext *uc) ex = NULL; uc->dscan = GNUNET_FS_directory_scan_start (uc->filename, GNUNET_NO, ex, - &unindex_directory_scan_cb, + &unindex_directory_scan_cb, uc); GNUNET_free_non_null (ex); } @@ -391,7 +391,7 @@ GNUNET_FS_unindex_do_extract_keywords_ (struct GNUNET_FS_UnindexContext *uc) * Continuation called to notify client about result of the remove * operation for the UBlock. * - * @param cls the 'struct GNUNET_FS_UnindexContext *' + * @param cls the 'struct GNUNET_FS_UnindexContext *' * @param success GNUNET_SYSERR on failure (including timeout/queue drop) * GNUNET_NO if content was already there * GNUNET_YES (or other positive value) on success @@ -409,10 +409,10 @@ continue_after_remove (void *cls, struct GNUNET_FS_UnindexContext *uc = cls; uc->dqe = NULL; - if (success != GNUNET_YES) + if (success != GNUNET_YES) GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Failed to remove UBlock: %s\n"), - msg); + msg); uc->ksk_offset++; GNUNET_FS_unindex_do_remove_kblocks_ (uc); } @@ -464,14 +464,14 @@ process_kblock_for_unindex (void *cls, if (0 == uc->first_uid) { /* remember UID of first result to detect cycles */ - uc->first_uid = uid; + uc->first_uid = uid; } else if (uid == uc->first_uid) { /* no more additional results */ uc->ksk_offset++; GNUNET_FS_unindex_do_remove_kblocks_ (uc); - return; + return; } GNUNET_assert (GNUNET_BLOCK_TYPE_FS_UBLOCK == type); if (size < sizeof (struct UBlock)) @@ -489,10 +489,10 @@ process_kblock_for_unindex (void *cls, goto get_next; } { - char pt[size - sizeof (struct UBlock)]; + char pt[size - sizeof (struct UBlock)]; struct GNUNET_CRYPTO_EccPublicSignKey anon_pub; const char *keyword; - + GNUNET_CRYPTO_ecc_key_get_public_for_signature (GNUNET_CRYPTO_ecc_key_get_anonymous (), &anon_pub); keyword = &uc->ksk_uri->data.ksk.keywords[uc->ksk_offset][1]; @@ -757,7 +757,7 @@ GNUNET_FS_unindex_signal_suspend_ (void *cls) * @return NULL on error, otherwise handle */ struct GNUNET_FS_UnindexContext * -GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, +GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, const char *filename, void *cctx) { 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 @@ * @param key where to store the unique key */ void -GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, +GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, struct GNUNET_HashCode *key) { switch (uri->type) @@ -368,7 +368,7 @@ uri_sks_parse (const char *s, char **emsg) end = strchr (&s[pos], '/'); if ( (NULL == end) || (GNUNET_OK != - GNUNET_STRINGS_string_to_data (&s[pos], + GNUNET_STRINGS_string_to_data (&s[pos], end - &s[pos], &ns, sizeof (ns))) ) @@ -526,12 +526,12 @@ struct LocUriAssembly /** * File being offered. - */ + */ struct FileIdentifier fi; /** * Peer offering the file. - */ + */ struct GNUNET_PeerIdentity peer; }; @@ -947,7 +947,7 @@ GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *baseUri, * @return an FS URI for the given namespace and identifier */ struct GNUNET_FS_Uri * -GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EccPublicSignKey *ns, +GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EccPublicSignKey *ns, const char *id) { struct GNUNET_FS_Uri *ns_uri; @@ -1424,7 +1424,7 @@ GNUNET_FS_uri_test_loc (const struct GNUNET_FS_Uri *uri) * Add a keyword as non-mandatory (with ' '-prefix) to the * given keyword list at offset 'index'. The array is * guaranteed to be long enough. - * + * * @param s keyword to add * @param array array to add the keyword to * @param index offset where to add the keyword @@ -1439,14 +1439,14 @@ insert_non_mandatory_keyword (const char *s, char **array, int index) /** - * Test if the given keyword 's' is already present in the + * Test if the given keyword 's' is already present in the * given array, ignoring the '+'-mandatory prefix in the array. * * @param s keyword to test * @param array keywords to test against, with ' ' or '+' prefix to ignore * @param array_length length of the array * @return GNUNET_YES if the keyword exists, GNUNET_NO if not - */ + */ static int find_duplicate (const char *s, const char **array, int array_length) { @@ -1535,7 +1535,7 @@ u8_strcount (const uint8_t *s) * to it are used to check for duplicates). ignored if array == NULL. * @return number of tokens counted (including duplicates), or number of * tokens extracted (excluding duplicates). 0 if there are no - * matching parens in the string (when counting), or when all tokens + * matching parens in the string (when counting), or when all tokens * were duplicates (when extracting). */ static int @@ -1612,7 +1612,7 @@ get_keywords_from_parens (const char *s, char **array, int index) else count++; close_paren[0] = tmp; - } + } } GNUNET_free (ss); return count; @@ -1900,7 +1900,7 @@ uri_sks_to_string (const struct GNUNET_FS_Uri *uri) GNUNET_assert (NULL != ret); ret[0] = '\0'; GNUNET_asprintf (&ret, "%s%s%s/%s", GNUNET_FS_URI_PREFIX, - GNUNET_FS_URI_SKS_INFIX, buf, + GNUNET_FS_URI_SKS_INFIX, buf, uri->data.sks.identifier); return ret; } @@ -2003,7 +2003,7 @@ uri_loc_to_string (const struct GNUNET_FS_Uri *uri) peerSig = bin2enc (&uri->data.loc.contentSignature, sizeof (struct GNUNET_CRYPTO_EccSignature)); - GNUNET_asprintf (&ret, + GNUNET_asprintf (&ret, "%s%s%s.%s.%llu.%s.%s.%llu", GNUNET_FS_URI_PREFIX, GNUNET_FS_URI_LOC_INFIX, (const char *) &keyhash, (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 @@ * @file fs/gnunet-auto-share.c * @brief automatically publish files on GNUnet * @author Christian Grothoff - * + * * TODO: * - support loading meta data / keywords from resource file * - add stability timer (a la buildbot) @@ -204,7 +204,7 @@ load_state () while (n-- > 0) { if ( (GNUNET_OK != - GNUNET_BIO_read_string (rh, "filename", &fn, 1024)) || + GNUNET_BIO_read_string (rh, "filename", &fn, 1024)) || (GNUNET_OK != GNUNET_BIO_read (rh, "id", &id, sizeof (struct GNUNET_HashCode))) ) goto error; @@ -224,7 +224,7 @@ load_state () wi, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); } - if (GNUNET_OK == + if (GNUNET_OK == GNUNET_BIO_read_close (rh, &emsg)) return; rh = NULL; @@ -259,7 +259,7 @@ write_item (void *cls, "Saving serialization ID of file `%s' with value `%s'\n", wi->filename, GNUNET_h2s (&wi->id)); - if ( (GNUNET_OK != + if ( (GNUNET_OK != GNUNET_BIO_write_string (wh, wi->filename)) || (GNUNET_OK != GNUNET_BIO_write (wh, @@ -381,7 +381,7 @@ maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_break (0); GNUNET_OS_process_kill (publish_proc, SIGKILL); - type = GNUNET_OS_PROCESS_SIGNALED; + type = GNUNET_OS_PROCESS_SIGNALED; } GNUNET_OS_process_destroy (publish_proc); publish_proc = NULL; @@ -415,7 +415,7 @@ maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) wi); } save_state (); - schedule_next_task (); + schedule_next_task (); } @@ -452,7 +452,7 @@ work (void *cls, static char content_prio[20]; static char repl_level[20]; struct WorkItem *wi; - const struct GNUNET_DISK_FileHandle *pr; + const struct GNUNET_DISK_FileHandle *pr; int argc; run_task = GNUNET_SCHEDULER_NO_TASK; @@ -553,7 +553,7 @@ determine_id (void *cls, /* use hash here to make hierarchical structure distinct from all files on the same level */ GNUNET_CRYPTO_hash (fx, sizeof (fx), &ft); - /* use XOR here so that order of the files in the directory + /* use XOR here so that order of the files in the directory does not matter! */ GNUNET_CRYPTO_hash_xor (&ft, id, id); return GNUNET_OK; @@ -613,7 +613,7 @@ add_file (void *cls, work_tail, wi); if (GNUNET_YES == do_shutdown) - return GNUNET_SYSERR; + return GNUNET_SYSERR; return GNUNET_OK; } @@ -645,7 +645,7 @@ schedule_next_task () struct GNUNET_TIME_Relative delay; if (GNUNET_YES == do_shutdown) - return; + return; if (NULL == work_head) { /* 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, load_state (); run_task = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE, &scan, NULL); - + kill_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_stop_task, NULL); @@ -707,7 +707,7 @@ run (void *cls, char *const *args, const char *cfgfile, * @param cls NULL (unused) * @param key key of the item in the map (unused) * @param value the 'struct WorkItem' to free - * @return GNUNET_OK to continue to iterate + * @return GNUNET_OK to continue to iterate */ static int free_item (void *cls, @@ -731,7 +731,7 @@ free_item (void *cls, */ int main (int argc, char *const *argv) -{ +{ static const struct GNUNET_GETOPT_CommandLineOption options[] = { {'a', "anonymity", "LEVEL", 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; /** - * Parse a pattern string and store the corresponding + * Parse a pattern string and store the corresponding * 'struct Pattern' in the given head/tail. * * @param head where to store the head @@ -243,7 +243,7 @@ make_file (uint64_t length, return NULL; /* initialize data with 'unique' data only depending on 'kval' and 'size', making sure that blocks do not repeat */ - for (i=0;ivalue.publish.cctx; GNUNET_STATISTICS_update (stats_handle, - "# publishing time (ms)", - (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL, + "# publishing time (ms)", + (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL, GNUNET_NO); p->task = GNUNET_SCHEDULER_add_now (&publish_stop_task, p); return p; @@ -424,9 +424,9 @@ progress_cb (void *cls, case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: p = info->value.download.cctx; GNUNET_STATISTICS_update (stats_handle, - "# download time (ms)", - (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL, - GNUNET_NO); + "# download time (ms)", + (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL, + GNUNET_NO); p->task = GNUNET_SCHEDULER_add_now (&download_stop_task, p); return p; case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: @@ -450,12 +450,12 @@ progress_cb (void *cls, if (p->y != GNUNET_FS_uri_chk_get_file_size (uri)) return NULL; /* not what we want */ GNUNET_STATISTICS_update (stats_handle, - "# search time (ms)", - (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL, + "# search time (ms)", + (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL, GNUNET_NO); p->start_time = GNUNET_TIME_absolute_get (); p->ctx = GNUNET_FS_download_start (fs_handle, uri, - NULL, NULL, NULL, + NULL, NULL, NULL, 0, GNUNET_FS_uri_chk_get_file_size (uri), anonymity_level, GNUNET_FS_DOWNLOAD_NO_TEMPORARIES, @@ -483,7 +483,7 @@ progress_cb (void *cls, GNUNET_free (p); } return NULL; - default: + default: /* unexpected event during profiling */ GNUNET_break (0); return NULL; @@ -497,7 +497,7 @@ progress_cb (void *cls, * @param cls the 'struct Pattern' specifying the operation to perform * @param tc scheduler context */ -static void +static void start_publish (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { @@ -522,7 +522,7 @@ start_publish (void *cls, * @param cls the 'struct Pattern' specifying the operation to perform * @param tc scheduler context */ -static void +static void start_download (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { @@ -563,7 +563,7 @@ run (void *cls, char *const *args GNUNET_UNUSED, NULL); if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_number (cfg, + GNUNET_CONFIGURATION_get_value_number (cfg, "TESTBED", "PEERID", &my_peerid)) { @@ -574,28 +574,28 @@ run (void *cls, char *const *args GNUNET_UNUSED, return; } if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_number (cfg, + GNUNET_CONFIGURATION_get_value_number (cfg, "FSPROFILER", "ANONYMITY_LEVEL", &anonymity_level)) anonymity_level = 1; if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_number (cfg, + GNUNET_CONFIGURATION_get_value_number (cfg, "FSPROFILER", "REPLICATION_LEVEL", - &replication_level)) + &replication_level)) replication_level = 1; GNUNET_snprintf (myoptname, sizeof (myoptname), "DOWNLOAD-PATTERN-%u", my_peerid); if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (cfg, + GNUNET_CONFIGURATION_get_value_string (cfg, "FSPROFILER", myoptname, - &download_pattern)) + &download_pattern)) download_pattern = GNUNET_strdup (""); GNUNET_snprintf (myoptname, sizeof (myoptname), "PUBLISH-PATTERN-%u", my_peerid); if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (cfg, + GNUNET_CONFIGURATION_get_value_string (cfg, "FSPROFILER", myoptname, - &publish_pattern)) + &publish_pattern)) publish_pattern = GNUNET_strdup (""); if ( (GNUNET_OK != 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) * @param n total size of the download * @param w desired number of steps in the progress bar */ -static void -display_bar (unsigned long long x, - unsigned long long n, +static void +display_bar (unsigned long long x, + unsigned long long n, unsigned int w) { char buf[w + 20]; @@ -142,7 +142,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) { s = GNUNET_strdup (GNUNET_STRINGS_relative_time_to_string (info->value.download.eta, GNUNET_YES)); - if (info->value.download.specifics.progress.block_download_duration.rel_value_us + if (info->value.download.specifics.progress.block_download_duration.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) s2 = _(""); 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 @@ /** * @file fs/gnunet-fs-profiler.c - * @brief tool to benchmark/profile file-sharing + * @brief tool to benchmark/profile file-sharing * @author Christian Grothoff */ #include "platform.h" @@ -137,7 +137,7 @@ terminate_task (void *cls, * failed */ static void -test_master (void *cls, +test_master (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, @@ -152,7 +152,7 @@ test_master (void *cls, terminate_taskid = GNUNET_SCHEDULER_add_delayed (timeout, &terminate_task, NULL); else - terminate_taskid = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, + terminate_taskid = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &terminate_task, NULL); } 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, memcpy (zdata, data, data_len); zdata[data_len] = '\0'; (void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name, type, format, - data_mime_type, zdata, data_len + 1); - } + data_mime_type, zdata, data_len + 1); + } else { (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, * * @param tree tree to free */ -static void +static void free_tree (struct ScanTreeNode *tree) { struct ScanTreeNode *pos; @@ -151,7 +151,7 @@ free_tree (struct ScanTreeNode *tree) if (NULL != tree->parent) GNUNET_CONTAINER_DLL_remove (tree->parent->children_head, tree->parent->children_tail, - tree); + tree); GNUNET_free (tree->filename); GNUNET_free (tree); } @@ -205,7 +205,7 @@ write_message (uint16_t message_type, struct GNUNET_MessageHeader hdr; #if 0 - fprintf (stderr, + fprintf (stderr, "Helper sends %u-byte message of type %u\n", (unsigned int) (sizeof (struct GNUNET_MessageHeader) + data_length), (unsigned int) message_type); @@ -295,7 +295,7 @@ scan_callback (void *cls, * * @param filename file or directory to scan * @param dst where to store the resulting share tree item; - * NULL is stored in @a dst upon recoverable errors (#GNUNET_OK is returned) + * NULL is stored in @a dst upon recoverable errors (#GNUNET_OK is returned) * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ static int @@ -323,7 +323,7 @@ preprocess_file (const char *filename, /* Report the progress */ if (GNUNET_OK != - write_message (S_ISDIR (sbuf.st_mode) + write_message (S_ISDIR (sbuf.st_mode) ? GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_DIRECTORY : GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_FILE, filename, strlen (filename) + 1)) @@ -338,9 +338,9 @@ preprocess_file (const char *filename, rc.parent = item; rc.stop = GNUNET_NO; - GNUNET_DISK_directory_scan (filename, - &scan_callback, - &rc); + GNUNET_DISK_directory_scan (filename, + &scan_callback, + &rc); if ( (GNUNET_YES == rc.stop) || (GNUNET_OK != write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_DIRECTORY, @@ -363,7 +363,7 @@ preprocess_file (const char *filename, */ static int extract_files (struct ScanTreeNode *item) -{ +{ struct GNUNET_CONTAINER_MetaData *meta; ssize_t size; size_t slen; @@ -380,7 +380,7 @@ extract_files (struct ScanTreeNode *item) return GNUNET_SYSERR; return GNUNET_OK; } - + /* this is the expensive operation, *afterwards* we'll check for aborts */ meta = GNUNET_CONTAINER_meta_data_create (); EXTRACTOR_extract (plugins, item->filename, NULL, 0, &add_to_md, meta); @@ -393,7 +393,7 @@ extract_files (struct ScanTreeNode *item) if (GNUNET_OK != write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_META_DATA, item->filename, slen)) - return GNUNET_SYSERR; + return GNUNET_SYSERR; return GNUNET_OK; } else if (size > (UINT16_MAX - sizeof (struct GNUNET_MessageHeader) - slen)) @@ -404,7 +404,7 @@ extract_files (struct ScanTreeNode *item) { char buf[size + slen]; char *dst = &buf[slen]; - + memcpy (buf, item->filename, slen); size = GNUNET_CONTAINER_meta_data_serialize (meta, &dst, size, @@ -417,7 +417,7 @@ extract_files (struct ScanTreeNode *item) GNUNET_CONTAINER_meta_data_destroy (meta); if (GNUNET_OK != write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_META_DATA, - buf, + buf, slen + size)) return GNUNET_SYSERR; } @@ -456,7 +456,7 @@ ignore_sigpipe () * @param flags flags to use (O_RDONLY or O_WRONLY) */ static void -make_dev_zero (int fd, +make_dev_zero (int fd, int flags) { int z; @@ -483,7 +483,7 @@ make_dev_zero (int fd, * otherwise custom plugins to load from LE * @return 0 on success */ -int +int main (int argc, char *const *argv) { @@ -502,7 +502,7 @@ main (int argc, output_stream = 1; /* stdout */ #else ignore_sigpipe (); - /* move stdout to some other FD for IPC, bind + /* move stdout to some other FD for IPC, bind stdout/stderr to /dev/null */ output_stream = dup (1); make_dev_zero (1, O_WRONLY); @@ -512,7 +512,7 @@ main (int argc, /* parse command line */ if ( (3 != argc) && (2 != argc) ) { - FPRINTF (stderr, + FPRINTF (stderr, "%s", "gnunet-helper-fs-publish needs exactly one or two arguments\n"); #if WINDOWS @@ -532,7 +532,7 @@ main (int argc, } /* scan tree to find out how much work there is to be done */ - if (GNUNET_OK != preprocess_file (filename_expanded, + if (GNUNET_OK != preprocess_file (filename_expanded, &root)) { (void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_ERROR, NULL, 0); @@ -542,7 +542,7 @@ main (int argc, #endif return 2; } - /* signal that we're done counting files, so that a percentage of + /* signal that we're done counting files, so that a percentage of progress can now be calculated */ if (GNUNET_OK != write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_COUNTING_DONE, NULL, 0)) @@ -551,7 +551,7 @@ main (int argc, #if WINDOWS GNUNET_free ((void*) argv); #endif - return 3; + return 3; } if (NULL != root) { @@ -572,7 +572,7 @@ main (int argc, (void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_FINISHED, NULL, 0); EXTRACTOR_plugin_remove_all (plugins); #if WINDOWS - GNUNET_free ((void*) argv); + GNUNET_free ((void*) argv); #endif return 0; } 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) { GNUNET_CONTAINER_meta_data_destroy (meta); meta = NULL; - } + } } @@ -187,7 +187,7 @@ stop_scanner_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_FS_directory_scan_abort (ds); ds = NULL; - } + } if (NULL != identity) { GNUNET_IDENTITY_disconnect (identity); @@ -477,7 +477,7 @@ get_file_information (struct GNUNET_FS_ShareTreeItem *item) if (GNUNET_YES == item->is_directory) { GNUNET_CONTAINER_meta_data_delete (item->meta, - EXTRACTOR_METATYPE_MIMETYPE, + EXTRACTOR_METATYPE_MIMETYPE, NULL, 0); GNUNET_FS_meta_data_make_directory (item->meta); if (NULL == item->ksk_uri) @@ -488,9 +488,9 @@ get_file_information (struct GNUNET_FS_ShareTreeItem *item) else GNUNET_FS_uri_ksk_add_keyword (item->ksk_uri, GNUNET_FS_DIRECTORY_MIME, GNUNET_NO); - fi = GNUNET_FS_file_information_create_empty_directory (ctx, NULL, + fi = GNUNET_FS_file_information_create_empty_directory (ctx, NULL, item->ksk_uri, - item->meta, + item->meta, &bo, item->filename); for (child = item->children_head; child; child = child->next) { @@ -500,9 +500,9 @@ get_file_information (struct GNUNET_FS_ShareTreeItem *item) } else { - fi = GNUNET_FS_file_information_create_from_file (ctx, NULL, + fi = GNUNET_FS_file_information_create_from_file (ctx, NULL, item->filename, - item->ksk_uri, item->meta, + item->ksk_uri, item->meta, !do_insert, &bo); } @@ -542,7 +542,7 @@ directory_trim_complete (struct GNUNET_FS_ShareTreeItem *directory_scan_result) priv = NULL; else priv = GNUNET_IDENTITY_ego_get_private_key (namespace); - pc = GNUNET_FS_publish_start (ctx, fi, + pc = GNUNET_FS_publish_start (ctx, fi, priv, this_id, next_id, (do_simulate) ? GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY : @@ -569,8 +569,8 @@ directory_trim_complete (struct GNUNET_FS_ShareTreeItem *directory_scan_result) * @param reason kind of progress we are making */ static void -directory_scan_cb (void *cls, - const char *filename, +directory_scan_cb (void *cls, + const char *filename, int is_directory, enum GNUNET_FS_DirScannerProgressUpdateReason reason) { @@ -584,21 +584,21 @@ directory_scan_cb (void *cls, if (is_directory == GNUNET_YES) FPRINTF (stdout, _("Scanning directory `%s'.\n"), filename); else - FPRINTF (stdout, _("Scanning file `%s'.\n"), filename); + FPRINTF (stdout, _("Scanning file `%s'.\n"), filename); } break; case GNUNET_FS_DIRSCANNER_FILE_IGNORED: - FPRINTF (stderr, + FPRINTF (stderr, _("There was trouble processing file `%s', skipping it.\n"), filename); break; case GNUNET_FS_DIRSCANNER_ALL_COUNTED: if (verbose) - FPRINTF (stdout, "%s", _("Preprocessing complete.\n")); + FPRINTF (stdout, "%s", _("Preprocessing complete.\n")); break; case GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED: if (verbose > 2) - FPRINTF (stdout, _("Extracting meta data from file `%s' complete.\n"), filename); + FPRINTF (stdout, _("Extracting meta data from file `%s' complete.\n"), filename); break; case GNUNET_FS_DIRSCANNER_FINISHED: if (verbose > 1) @@ -630,7 +630,7 @@ directory_scan_cb (void *cls, * has been initialized. * * @param args0 filename to publish - */ + */ static void identity_continuation (const char *args0) { @@ -673,8 +673,8 @@ identity_continuation (const char *args0) return; } ds = GNUNET_FS_directory_scan_start (args0, - disable_extractor, - ex, + disable_extractor, + ex, &directory_scan_cb, NULL); if (NULL == ds) { @@ -706,7 +706,7 @@ identity_cb (void *cls, { const char *args0 = cls; - if (NULL == ego) + if (NULL == ego) { identity_continuation (args0); 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, int active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, - const struct GNUNET_ATS_Information *ats, + const struct GNUNET_ATS_Information *ats, uint32_t ats_count) { unsigned int i; @@ -270,7 +270,7 @@ update_latencies (void *cls, gettext_noop ("# running average P2P latency (ms)"), GSF_avg_latency.rel_value_us / 1000LL, GNUNET_NO); - break; + break; } } @@ -416,7 +416,7 @@ start_p2p_processing (void *cls, struct GSF_PendingRequest *pr, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Considering mesh-based download for block\n"); GSF_mesh_lookup_ (pr); - break; + break; case GNUNET_BLOCK_TYPE_FS_UBLOCK: /* the above block types are in the DHT */ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -625,7 +625,7 @@ main_init (struct GNUNET_SERVER_Handle *server, anon_p2p_off = (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (GSF_cfg, "fs", - "DISABLE_ANON_TRANSFER")); + "DISABLE_ANON_TRANSFER")); GSF_core = GNUNET_CORE_connect (GSF_cfg, NULL, &peer_init_handler, &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) { char *fn; - GNUNET_asprintf (&fn, - "%s%s%s", - respectDirectory, + GNUNET_asprintf (&fn, + "%s%s%s", + respectDirectory, DIR_SEPARATOR_STR, GNUNET_i2s_full (id)); return fn; @@ -542,7 +542,7 @@ ats_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Reserved %d bytes / need to wait %s for reservation\n", - (int) amount, + (int) amount, GNUNET_STRINGS_relative_time_to_string (res_delay, GNUNET_YES)); cp->rc = NULL; if (0 == amount) @@ -597,7 +597,7 @@ GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer) GNUNET_free (fn); cp->request_map = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); GNUNET_break (GNUNET_OK == - GNUNET_CONTAINER_multipeermap_put (cp_map, + GNUNET_CONTAINER_multipeermap_put (cp_map, GSF_connected_peer_get_identity2_ (cp), cp, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); @@ -682,7 +682,7 @@ GSF_handle_p2p_migration_stop_ (void *cls, bt = GNUNET_TIME_relative_ntoh (msm->duration); GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Migration of content to peer `%s' blocked for %s\n"), - GNUNET_i2s (other), + GNUNET_i2s (other), GNUNET_STRINGS_relative_time_to_string (bt, GNUNET_YES)); cp->ppd.migration_blocked_until = GNUNET_TIME_relative_to_absolute (bt); if (GNUNET_SCHEDULER_NO_TASK == cp->mig_revive_task) @@ -1254,7 +1254,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, { pr = peerreq->pr; prd = GSF_pending_request_get_data_ (pr); - if (prd->type == type) + if (prd->type == type) { if (prd->ttl.abs_value_us >= GNUNET_TIME_absolute_get ().abs_value_us + ttl * 1000LL) { @@ -1278,7 +1278,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, peerreq = GNUNET_new (struct PeerRequest); peerreq->cp = cp; - pr = GSF_pending_request_create_ (options, type, &gm->query, + pr = GSF_pending_request_create_ (options, type, &gm->query, target, (bfsize > 0) ? (const char *) &opt[bits] : NULL, @@ -1813,8 +1813,8 @@ GSF_connected_peer_init_ () * @return #GNUNET_YES (we should continue to iterate) */ static int -clean_peer (void *cls, - const struct GNUNET_PeerIdentity *key, +clean_peer (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { GSF_peer_disconnect_handler_ (NULL, key); @@ -1846,8 +1846,8 @@ GSF_connected_peer_done_ () * @return #GNUNET_YES (we should continue to iterate) */ static int -clean_local_client (void *cls, - const struct GNUNET_PeerIdentity *key, +clean_local_client (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { 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) _ ("Index request received for file `%s' is already indexed as `%s'. Permitting anyway.\n"), ii->filename, - ir->filename); + ir->filename); GNUNET_SERVER_transmit_context_append_data (ii->tc, NULL, 0, GNUNET_MESSAGE_TYPE_FS_INDEX_START_OK); 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, * @param msg error message */ static void -remove_cont (void *cls, int success, +remove_cont (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg) { 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, if (0 != (SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY & ntohl (sm->options))) options |= GSF_PRO_LOCAL_ONLY; cr->pr = GSF_pending_request_create_ (options, type, - &sm->query, + &sm->query, (0 != memcmp (&sm->target, &all_zeros, 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; /** * Function called with a reply from the mesh. - * + * * @param cls closure * @param type type of the block, ANY on error * @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 @@ #define CLIENT_RETRY_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) -/** +/** * Handle for a mesh to another peer. */ struct MeshHandle; @@ -99,7 +99,7 @@ struct GSF_MeshRequest }; -/** +/** * Handle for a mesh to another peer. */ struct MeshHandle @@ -127,12 +127,12 @@ struct MeshHandle /** * Handle for active write operation, or NULL. - */ + */ struct GNUNET_MESH_TransmitHandle *wh; /** * Which peer does this mesh go to? - */ + */ struct GNUNET_PeerIdentity target; /** @@ -177,7 +177,7 @@ transmit_pending (struct MeshHandle *mh); /** - * Iterator called on each entry in a waiting map to + * Iterator called on each entry in a waiting map to * move it back to the pending list. * * @param cls the 'struct MeshHandle' @@ -192,7 +192,7 @@ move_to_pending (void *cls, { struct MeshHandle *mh = cls; struct GSF_MeshRequest *sr = value; - + GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (mh->waiting_map, key, @@ -342,7 +342,7 @@ transmit_sqm (void *cls, transmit_pending (mh); return sizeof (sqm); } - + /** * Transmit pending requests via the mesh. @@ -371,7 +371,7 @@ struct HandleReplyClosure /** * Reply payload. - */ + */ const void *data; /** @@ -384,11 +384,11 @@ struct HandleReplyClosure */ size_t data_size; - /** + /** * Type of the block. */ enum GNUNET_BLOCK_Type type; - + /** * Did we have a matching query? */ @@ -397,7 +397,7 @@ struct HandleReplyClosure /** - * Iterator called on each entry in a waiting map to + * Iterator called on each entry in a waiting map to * process a result. * * @param cls the 'struct HandleReplyClosure' @@ -412,7 +412,7 @@ handle_reply (void *cls, { struct HandleReplyClosure *hrc = cls; struct GSF_MeshRequest *sr = value; - + sr->proc (sr->proc_cls, hrc->type, hrc->expiration, @@ -462,7 +462,7 @@ reply_cb (void *cls, type, &srm[1], msize, &query)) { - GNUNET_break_op (0); + GNUNET_break_op (0); reset_mesh_async (mh); return GNUNET_SYSERR; } @@ -611,7 +611,7 @@ GSF_mesh_query_cancel (struct GSF_MeshRequest *sr) /** - * Iterator called on each entry in a waiting map to + * Iterator called on each entry in a waiting map to * call the 'proc' continuation and release associated * resources. * @@ -641,7 +641,7 @@ free_waiting_entry (void *cls, * * @param cls NULL * @param tunnel tunnel of the disconnecting client - * @param tunnel_ctx our 'struct MeshClient' + * @param tunnel_ctx our 'struct MeshClient' */ static void cleaner_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 { /** * DLL - */ + */ struct MeshClient *next; /** * DLL - */ + */ struct MeshClient *prev; /** * Tunnel for communication. - */ + */ struct GNUNET_MESH_Tunnel *tunnel; /** * Handle for active write operation, or NULL. - */ + */ struct GNUNET_MESH_TransmitHandle *wh; /** @@ -99,7 +99,7 @@ struct MeshClient * Tail of write queue. */ struct WriteQueueItem *wqi_tail; - + /** * Current active request to the datastore, if we have one pending. */ @@ -117,7 +117,7 @@ struct MeshClient /** * Size of the last write that was initiated. - */ + */ size_t reply_size; }; @@ -130,12 +130,12 @@ static struct GNUNET_MESH_Handle *listen_tunnel; /** * Head of DLL of mesh clients. - */ + */ static struct MeshClient *sc_head; /** * Tail of DLL of mesh clients. - */ + */ static struct MeshClient *sc_tail; /** @@ -155,7 +155,7 @@ static unsigned long long sc_count_max; * * @param cls the 'struct MeshClient' * @param tc scheduler context - */ + */ static void timeout_mesh_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) @@ -182,7 +182,7 @@ static void refresh_timeout_task (struct MeshClient *sc) { if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task) - GNUNET_SCHEDULER_cancel (sc->timeout_task); + GNUNET_SCHEDULER_cancel (sc->timeout_task); sc->timeout_task = GNUNET_SCHEDULER_add_delayed (IDLE_TIMEOUT, &timeout_mesh_task, sc); @@ -291,7 +291,7 @@ continue_writing (struct MeshClient *sc) } sc->wh = GNUNET_MESH_notify_transmit_ready (sc->tunnel, GNUNET_NO, GNUNET_TIME_UNIT_FOREVER_REL, - wqi->msize, + wqi->msize, &write_continuation, sc); if (NULL == sc->wh) @@ -320,7 +320,7 @@ continue_writing (struct MeshClient *sc) * @param uid unique identifier for the datum; * maybe 0 if no unique identifier is available */ -static void +static void handle_datastore_reply (void *cls, const struct GNUNET_HashCode *key, size_t size, const void *data, @@ -416,7 +416,7 @@ request_cb (void *cls, 0, &sqm->query, ntohl (sqm->type), - 0 /* priority */, + 0 /* priority */, GSF_datastore_queue_size, GNUNET_TIME_UNIT_FOREVER_REL, &handle_datastore_reply, sc); @@ -481,7 +481,7 @@ accept_cb (void *cls, * * @param cls NULL * @param tunnel tunnel of the disconnecting client - * @param tunnel_ctx our 'struct MeshClient' + * @param tunnel_ctx our 'struct MeshClient' */ static void cleaner_cb (void *cls, @@ -501,9 +501,9 @@ cleaner_cb (void *cls, gettext_noop ("# mesh connections active"), -1, GNUNET_NO); if (GNUNET_SCHEDULER_NO_TASK != sc->terminate_task) - GNUNET_SCHEDULER_cancel (sc->terminate_task); + GNUNET_SCHEDULER_cancel (sc->terminate_task); if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task) - GNUNET_SCHEDULER_cancel (sc->timeout_task); + GNUNET_SCHEDULER_cancel (sc->timeout_task); if (NULL != sc->wh) GNUNET_MESH_notify_transmit_ready_cancel (sc->wh); 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; * are stored in a 'struct GSF_RequestPlan'. (We need * to be able to lookup all pending requests corresponding * to a given plan entry.) - * + * * Similarly head and tail of the "PR" MDLL are stored * with the 'struct GSF_PendingRequest'. (We need * to be able to lookup all plan entries corresponding @@ -360,7 +360,7 @@ get_latest (const struct GSF_RequestPlan *rp) if (NULL == bi) return NULL; /* should never happen */ ret = bi->pr; - bi = bi->next_PE; + bi = bi->next_PE; while (NULL != bi) { 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) pp->delay_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); pp->cp = cp; - GNUNET_CONTAINER_multipeermap_put (plans, + GNUNET_CONTAINER_multipeermap_put (plans, id, pp, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); } 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); * @return GNUNET_YES if 'result' was changed, GNUNET_NO otherwise. */ int -GSF_request_plan_reference_get_last_transmission_ (struct GSF_PendingRequestPlanBijection *pr_head, +GSF_request_plan_reference_get_last_transmission_ (struct GSF_PendingRequestPlanBijection *pr_head, struct GSF_ConnectedPeer *sender, struct GNUNET_TIME_Absolute *result); 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, { refresh_bloomfilter (pr); } - GNUNET_CONTAINER_multihashmap_put (pr_map, + GNUNET_CONTAINER_multihashmap_put (pr_map, &pr->public_data.query, pr, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); if (0 == (options & GSF_PRO_REQUEST_NEVER_EXPIRES)) @@ -482,7 +482,7 @@ GSF_pending_request_update_ (struct GSF_PendingRequest *pr, } } } - if (NULL != pr->gh) + if (NULL != pr->gh) GNUNET_DHT_get_filter_known_results (pr->gh, replies_seen_count, replies_seen); @@ -828,8 +828,8 @@ process_reply (void *cls, const struct GNUNET_HashCode * key, void *value) GNUNET_TIME_absolute_get_duration (pr-> public_data.start_time).rel_value_us); if (GNUNET_YES != - GSF_request_plan_reference_get_last_transmission_ (pr->public_data.pr_head, - prq->sender, + GSF_request_plan_reference_get_last_transmission_ (pr->public_data.pr_head, + prq->sender, &last_transmission)) last_transmission.abs_value_us = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; /* pass on to other peers / local clients */ @@ -890,10 +890,10 @@ process_reply (void *cls, const struct GNUNET_HashCode * key, void *value) prq->request_found = GNUNET_YES; /* finally, pass on to other peer / local client */ if (! GSF_request_plan_reference_get_last_transmission_ (pr->public_data.pr_head, - prq->sender, + prq->sender, &last_transmission)) last_transmission.abs_value_us = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; - pr->rh (pr->rh_cls, prq->eval, pr, + pr->rh (pr->rh_cls, prq->eval, pr, prq->anonymity_level, prq->expiration, last_transmission, prq->type, prq->data, prq->size); return GNUNET_YES; @@ -934,7 +934,7 @@ struct PutMigrationContext * @param msg NULL on success, otherwise an error message */ static void -put_migration_continuation (void *cls, int success, +put_migration_continuation (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg) { @@ -947,13 +947,13 @@ put_migration_continuation (void *cls, int success, { if (GNUNET_SYSERR != success) { - GNUNET_LOAD_update (datastore_put_load, + GNUNET_LOAD_update (datastore_put_load, GNUNET_TIME_absolute_get_duration (pmc->start).rel_value_us); } else { /* on queue failure / timeout, increase the put load dramatically */ - GNUNET_LOAD_update (datastore_put_load, + GNUNET_LOAD_update (datastore_put_load, GNUNET_TIME_UNIT_MINUTES.rel_value_us); } } @@ -968,17 +968,17 @@ put_migration_continuation (void *cls, int success, GNUNET_free (pmc); return; } - if ( (GNUNET_NO == success) && - (GNUNET_NO == pmc->requested) && + if ( (GNUNET_NO == success) && + (GNUNET_NO == pmc->requested) && (NULL != cp) ) { ppd = GSF_get_peer_performance_data_ (cp); if (min_expiration.abs_value_us > 0) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking to stop migration for %s because datastore is full\n", GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (min_expiration), GNUNET_YES)); - GSF_block_peer_migration_ (cp, min_expiration); + GSF_block_peer_migration_ (cp, min_expiration); } else { @@ -989,7 +989,7 @@ put_migration_continuation (void *cls, int success, mig_pause.rel_value_us = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, ppd->migration_delay.rel_value_us); ppd->migration_delay = GNUNET_TIME_relative_multiply (ppd->migration_delay, 2); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Replicated content already exists locally, asking to stop migration for %s\n", GNUNET_STRINGS_relative_time_to_string (mig_pause, GNUNET_YES)); GSF_block_peer_migration_ (cp, GNUNET_TIME_relative_to_absolute (mig_pause)); @@ -1123,12 +1123,12 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr) xquery_size += sizeof (struct GNUNET_PeerIdentity); } pr->gh = - GNUNET_DHT_get_start (GSF_dht, + GNUNET_DHT_get_start (GSF_dht, pr->public_data.type, &pr->public_data.query, DHT_GET_REPLICATION, GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, xquery, xquery_size, &handle_dht_reply, pr); - if ( (NULL != pr->gh) && + if ( (NULL != pr->gh) && (0 != pr->replies_seen_count) ) GNUNET_DHT_get_filter_known_results (pr->gh, pr->replies_seen_count, @@ -1138,7 +1138,7 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr) /** * Function called with a reply from the mesh. - * + * * @param cls the pending request struct * @param type type of the block, ANY on error * @param expiration expiration time for the block @@ -1698,7 +1698,7 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp, test_put_load_too_high (prq.priority)); } putl = GNUNET_LOAD_get_load (datastore_put_load); - if ( (NULL != cp) && + if ( (NULL != cp) && (GNUNET_NO == prq.request_found) && ( (GNUNET_YES != active_to_migration) || (putl > 2.5 * (1 + prq.priority)) ) ) @@ -1711,7 +1711,7 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp, GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, (unsigned int) (60000 * putl * putl))); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking to stop migration for %s because of load %f and events %d/%d\n", GNUNET_STRINGS_relative_time_to_string (block_time, 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) * maybe 0 if no unique identifier is available */ static void -process_dht_put_content (void *cls, - const struct GNUNET_HashCode * key, +process_dht_put_content (void *cls, + const struct GNUNET_HashCode * key, size_t size, - const void *data, + const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, uint32_t anonymity, 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, * Function that gathers stats from all daemons. */ static void -stat_run (void *cls, +stat_run (void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg); @@ -147,7 +147,7 @@ get_done (void *cls, int success) /** * Adapter function called to establish a connection to * statistics service. - * + * * @param cls closure * @param cfg configuration of the peer to connect to; will be available until * GNUNET_TESTBED_operation_done() is called on the operation returned @@ -166,11 +166,11 @@ statistics_connect_adapter (void *cls, /** * Adapter function called to destroy a connection to * statistics service. - * + * * @param cls closure * @param op_result service handle returned from the connect adapter */ -static void +static void statistics_disconnect_adapter (void *cls, void *op_result) { @@ -182,7 +182,7 @@ statistics_disconnect_adapter (void *cls, * Function that gathers stats from all daemons. */ static void -stat_run (void *cls, +stat_run (void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg) @@ -244,12 +244,12 @@ do_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_DISK_directory_remove (fn); GNUNET_free (fn); } - if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) + if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout during download, shutting down with error\n"); ok = 1; - GNUNET_SCHEDULER_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } @@ -276,7 +276,7 @@ do_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -do_download (void *cls, +do_download (void *cls, const struct GNUNET_FS_Uri *uri, const char *fn) { @@ -298,7 +298,7 @@ do_download (void *cls, else anonymity = 1; GNUNET_FS_TEST_download (daemons[0], TIMEOUT, anonymity, SEED, uri, VERBOSE, - &do_report, + &do_report, (NULL == fn) ? NULL : GNUNET_strdup (fn)); } @@ -314,7 +314,7 @@ do_publish (void *cls, unsigned int i; int do_index; int anonymity; - + GNUNET_assert (NUM_DAEMONS == num_peers); for (i=0;ivalue.publish.specifics. completed.chk_uri, NULL, fn, NULL, 0, - FILESIZE, anonymity_level, + FILESIZE, anonymity_level, GNUNET_FS_DOWNLOAD_OPTION_NONE, "download", NULL); GNUNET_assert (download != NULL); @@ -173,8 +173,8 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event) GNUNET_TIME_absolute_get_duration (start).rel_value_us) / 1024LL)); GAUGER ("FS", - (GNUNET_YES == indexed) - ? "Local download speed (indexed)" + (GNUNET_YES == indexed) + ? "Local download speed (indexed)" : "Local download speed (inserted)", (unsigned long long) (FILESIZE * 1000000LL / (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) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_TESTING_Peer *peer) { 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 () bo.expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES); sks_uri = GNUNET_FS_uri_sks_create (&nsid, "root"); - GNUNET_FS_publish_ksk (fs, - ksk_uri, meta, sks_uri, + GNUNET_FS_publish_ksk (fs, + ksk_uri, meta, sks_uri, &bo, GNUNET_FS_PUBLISH_OPTION_NONE, &adv_cont, NULL); GNUNET_FS_uri_destroy (sks_uri); @@ -296,7 +296,7 @@ testNamespace () static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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 () static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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) { rtask = GNUNET_SCHEDULER_NO_TASK; GNUNET_FS_stop (fs); - fs = GNUNET_FS_start (cfg, "test-fs-publish-persistence", + fs = GNUNET_FS_start (cfg, "test-fs-publish-persistence", &progress_cb, NULL, GNUNET_FS_FLAGS_PERSISTENCE, GNUNET_FS_OPTIONS_END); @@ -223,7 +223,7 @@ progress_cb (void *cls, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_TESTING_Peer *peer) { 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; static void abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) -{ +{ if (NULL != publish) { 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, size_t i; fs = GNUNET_FS_start (cfg, "test-fs-search", &progress_cb, NULL, - GNUNET_FS_FLAGS_DO_PROBES, + GNUNET_FS_FLAGS_DO_PROBES, GNUNET_FS_OPTIONS_END); GNUNET_assert (NULL != fs); 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) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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, static void -do_publish (void *cls, +do_publish (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg) { @@ -113,7 +113,7 @@ do_publish (void *cls, /** * Actual main function for the test. - * + * * @param cls closure * @param h the run handle * @param num_peers number of peers in 'peers' @@ -124,7 +124,7 @@ do_publish (void *cls, * failed */ static void -run (void *cls, +run (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, @@ -132,7 +132,7 @@ run (void *cls, unsigned int links_failed) { unsigned int i; - + GNUNET_assert (NUM_DAEMONS == num_peers); for (i=0;itransmitted = GNUNET_NO; GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail, - p); + p); } handle->reconnect_backoff = GNUNET_TIME_STD_BACKOFF (handle->reconnect_backoff); handle->reconnect_task = GNUNET_SCHEDULER_add_delayed (handle->reconnect_backoff, @@ -279,17 +279,17 @@ process_pending_messages (struct GNUNET_GNS_Handle *handle) struct PendingMessage *p = handle->pending_head; if (NULL == handle->client) - return; /* wait for reconnect */ + return; /* wait for reconnect */ if (NULL != handle->th) - return; /* transmission request already pending */ + return; /* transmission request already pending */ while ((NULL != p) && (p->transmitted == GNUNET_YES)) p = p->next; if (NULL == p) return; /* no messages pending */ - + LOG (GNUNET_ERROR_TYPE_DEBUG, - "Trying to transmit %u bytes\n", + "Trying to transmit %u bytes\n", (unsigned int) p->size); handle->th = GNUNET_CLIENT_notify_transmit_ready (handle->client, @@ -324,7 +324,7 @@ transmit_pending (void *cls, size_t size, void *buf) "Transmission to GNS service failed!\n"); force_reconnect (handle); return 0; - } + } if (NULL == (p = handle->pending_head)) return 0; @@ -388,7 +388,7 @@ process_lookup_reply (struct GNUNET_GNS_LookupRequest *qe, qe->lookup_proc (qe->proc_cls, 0, NULL); } else - { + { LOG (GNUNET_ERROR_TYPE_DEBUG, "Received lookup reply from GNS service (%u records)\n", (unsigned int) rd_count); @@ -412,7 +412,7 @@ process_message (void *cls, const struct GNUNET_MessageHeader *msg) struct GNUNET_GNS_LookupRequest *lr; const struct GNUNET_GNS_ClientLookupResultMessage *lookup_msg; uint32_t r_id; - + if (NULL == msg) { force_reconnect (handle); @@ -430,11 +430,11 @@ process_message (void *cls, const struct GNUNET_MessageHeader *msg) return; } lookup_msg = (const struct GNUNET_GNS_ClientLookupResultMessage *) msg; - r_id = ntohl (lookup_msg->id); - for (lr = handle->lookup_head; NULL != lr; lr = lr->next) + r_id = ntohl (lookup_msg->id); + for (lr = handle->lookup_head; NULL != lr; lr = lr->next) if (lr->r_id == r_id) { - process_lookup_reply(lr, lookup_msg); + process_lookup_reply(lr, lookup_msg); break; } break; @@ -499,7 +499,7 @@ GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr) { struct PendingMessage *p = (struct PendingMessage*) &lr[1]; - GNUNET_assert (NULL != lr->gns_handle); + GNUNET_assert (NULL != lr->gns_handle); if (GNUNET_NO == p->transmitted) GNUNET_CONTAINER_DLL_remove (lr->gns_handle->pending_head, lr->gns_handle->pending_tail, @@ -544,9 +544,9 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, { GNUNET_break (0); return NULL; - } + } LOG (GNUNET_ERROR_TYPE_DEBUG, - "Trying to lookup `%s' in GNS\n", + "Trying to lookup `%s' in GNS\n", name); msize = sizeof (struct GNUNET_GNS_ClientLookupMessage) + 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 * converted to the DNS response. */ struct GNUNET_DNSPARSER_Packet *packet; - + /** * Our GNS request handle. */ @@ -84,7 +84,7 @@ struct Request /** * Number of bytes in 'addr'. - */ + */ size_t addr_len; }; @@ -217,7 +217,7 @@ send_response (struct Request *request) { char *buf; size_t size; - + if (GNUNET_SYSERR == GNUNET_DNSPARSER_pack (request->packet, UINT16_MAX /* is this not too much? */, @@ -377,7 +377,7 @@ result_processor (void *cls, * @param addr address to use for sending the reply * @param addr_len number of bytes in @a addr * @param udp_msg DNS request payload - * @param udp_msg_size number of bytes in @a udp_msg + * @param udp_msg_size number of bytes in @a udp_msg */ static void handle_request (struct GNUNET_NETWORK_Handle *lsock, @@ -408,7 +408,7 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock, (int) packet->num_answers, (int) packet->num_authority_records, (int) packet->num_additional_records); - if ( (0 != packet->flags.query_or_response) || + if ( (0 != packet->flags.query_or_response) || (0 != packet->num_answers) || (0 != packet->num_authority_records)) { @@ -439,7 +439,7 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock, name_len = strlen (name); use_gns = GNUNET_NO; - + if ( (name_len > strlen (fcfs_suffix)) && (0 == strcasecmp (fcfs_suffix, &name[name_len - strlen (fcfs_suffix)])) ) @@ -481,7 +481,7 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock, else { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Using DNS resolver IP `%s' to resolve `%s'\n", + "Using DNS resolver IP `%s' to resolve `%s'\n", dns_ip, name); GNUNET_DNSPARSER_free_packet (request->packet); @@ -501,7 +501,7 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock, * * @param cls the 'listen_socket4' * @param tc scheduler context - */ + */ static void read_dns4 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) @@ -525,9 +525,9 @@ read_dns4 (void *cls, } { char buf[size]; - + addrlen = sizeof (v4); - GNUNET_break (size == + GNUNET_break (size == GNUNET_NETWORK_socket_recvfrom (listen_socket4, buf, size, @@ -544,7 +544,7 @@ read_dns4 (void *cls, * * @param cls the 'listen_socket6' * @param tc scheduler context - */ + */ static void read_dns6 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) @@ -568,9 +568,9 @@ read_dns6 (void *cls, } { char buf[size]; - + addrlen = sizeof (v6); - GNUNET_break (size == + GNUNET_break (size == GNUNET_NETWORK_socket_recvfrom (listen_socket6, buf, size, @@ -601,7 +601,7 @@ run_dnsd () return; } listen_socket4 = GNUNET_NETWORK_socket_create (PF_INET, - SOCK_DGRAM, + SOCK_DGRAM, IPPROTO_UDP); if (NULL != listen_socket4) { @@ -625,7 +625,7 @@ run_dnsd () } } listen_socket6 = GNUNET_NETWORK_socket_create (PF_INET6, - SOCK_DGRAM, + SOCK_DGRAM, IPPROTO_UDP); if (NULL != listen_socket6) { @@ -671,7 +671,7 @@ run_dnsd () } -/** +/** * Method called to inform about the egos of this peer. * * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get, @@ -679,7 +679,7 @@ run_dnsd () * @a ego does indicate an error (i.e. name is taken or no default * value is known). If @a ego is non-NULL and if '*ctx' * is set in those callbacks, the value WILL be passed to a subsequent - * call to the identity callback of #GNUNET_IDENTITY_connect (if + * call to the identity callback of #GNUNET_IDENTITY_connect (if * that one was not NULL). * * @param cls closure, NULL @@ -747,7 +747,7 @@ run (void *cls, char *const *args, const char *cfgfile, strlen (gns_zone_str), &my_zone)) ) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("No valid GNS zone specified!\n")); GNUNET_SCHEDULER_shutdown (); return; @@ -764,7 +764,7 @@ run (void *cls, char *const *args, const char *cfgfile, * @return 0 ok, 1 on error */ int -main (int argc, +main (int argc, char *const *argv) { static const struct GNUNET_GETOPT_CommandLineOption options[] = { @@ -794,7 +794,7 @@ main (int argc, ret = (GNUNET_OK == GNUNET_PROGRAM_run (argc, argv, "gnunet-dns2gns", - _("GNUnet DNS-to-GNS proxy (a DNS server)"), + _("GNUnet DNS-to-GNS proxy (a DNS server)"), options, &run, NULL)) ? 0 : 1; 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) * @param msg message to transmit, will be freed! */ static void -transmit (struct GNUNET_SERVER_Client *client, +transmit (struct GNUNET_SERVER_Client *client, struct GNUNET_MessageHeader *msg) { struct TransmitCallbackContext *tcc; @@ -188,7 +188,7 @@ transmit (struct GNUNET_SERVER_Client *client, tcc->msg = msg; if (NULL == (tcc->th = - GNUNET_SERVER_notify_transmit_ready (client, + GNUNET_SERVER_notify_transmit_ready (client, ntohs (msg->size), GNUNET_TIME_UNIT_FOREVER_REL, &transmit_callback, tcc))) @@ -242,7 +242,7 @@ MarshallWSAQUERYSETW (WSAQUERYSETW *qs, GUID *sc) static void -process_ip_lookup_result (void* cls, +process_ip_lookup_result (void* cls, uint32_t rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) { @@ -547,7 +547,7 @@ get_ip_from_hostname (struct GNUNET_SERVER_Client *client, namelen = 0; if (namelen > 0) hostname = (char *) u16_to_u8 (name, namelen + 1, NULL, &strl); - + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "W32 DNS resolver asked to look up %s for `%s'.\n", af == AF_INET ? "IPv4" : af == AF_INET6 ? "IPv6" : "anything", @@ -631,7 +631,7 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client, sc.Data1, sc.Data2, sc.Data3, data4); for (i = 0; i < 8; i++) sc.Data4[i] = 0xFF & (data4 >> ((7 - i) * 8)); - + hostname = (const wchar_t *) &msg[1]; if (hostname[size - 1] != L'\0') { 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 @@ /** * Default Socks5 listen port. - */ + */ #define GNUNET_GNS_PROXY_PORT 7777 /** @@ -119,7 +119,7 @@ /** * Commands in Socks5. - */ + */ enum Socks5Commands { /** @@ -141,7 +141,7 @@ enum Socks5Commands /** * Address types in Socks5. - */ + */ enum Socks5AddressType { /** @@ -242,7 +242,7 @@ struct Socks5ClientRequestMessage */ uint8_t addr_type; - /* + /* * Followed by either an ip4/ipv6 address or a domain name with a * length field (uint8_t) in front (depending on @e addr_type). * followed by port number in network byte order (uint16_t). @@ -275,7 +275,7 @@ struct Socks5ServerResponseMessage */ uint8_t addr_type; - /* + /* * Followed by either an ip4/ipv6 address or a domain name with a * length field (uint8_t) in front (depending on @e addr_type). * followed by port number in network byte order (uint16_t). @@ -293,12 +293,12 @@ struct Socks5ServerResponseMessage struct ProxyCA { /** - * The certificate + * The certificate */ gnutls_x509_crt_t cert; /** - * The private key + * The private key */ gnutls_x509_privkey_t key; }; @@ -310,12 +310,12 @@ struct ProxyCA struct ProxyGNSCertificate { /** - * The certificate as PEM + * The certificate as PEM */ char cert[MAX_PEM_SIZE]; /** - * The private key as PEM + * The private key as PEM */ char key[MAX_PEM_SIZE]; }; @@ -328,22 +328,22 @@ struct ProxyGNSCertificate struct MhdHttpList { /** - * DLL for httpds + * DLL for httpds */ struct MhdHttpList *prev; /** - * DLL for httpds + * DLL for httpds */ struct MhdHttpList *next; /** - * the domain name to server (only important for SSL) + * the domain name to server (only important for SSL) */ char *domain; /** - * The daemon handle + * The daemon handle */ struct MHD_Daemon *daemon; @@ -353,12 +353,12 @@ struct MhdHttpList struct ProxyGNSCertificate *proxy_cert; /** - * The task ID + * The task ID */ GNUNET_SCHEDULER_TaskIdentifier httpd_task; /** - * is this an ssl daemon? + * is this an ssl daemon? */ int is_ssl; @@ -369,7 +369,7 @@ struct MhdHttpList /** - * The socks phases. + * The socks phases. */ enum SocksPhase { @@ -443,7 +443,7 @@ struct Socks5Request struct Socks5Request *prev; /** - * The client socket + * The client socket */ struct GNUNET_NETWORK_Handle *sock; @@ -453,27 +453,27 @@ struct Socks5Request struct GNUNET_GNS_LookupRequest *gns_lookup; /** - * Client socket read task + * Client socket read task */ GNUNET_SCHEDULER_TaskIdentifier rtask; /** - * Client socket write task + * Client socket write task */ GNUNET_SCHEDULER_TaskIdentifier wtask; /** - * Timeout task + * Timeout task */ GNUNET_SCHEDULER_TaskIdentifier timeout_task; /** - * Read buffer + * Read buffer */ char rbuf[SOCKS_BUFFERSIZE]; /** - * Write buffer + * Write buffer */ char wbuf[SOCKS_BUFFERSIZE]; @@ -493,7 +493,7 @@ struct Socks5Request struct MHD_Response *response; /** - * the domain name to server (only important for SSL) + * the domain name to server (only important for SSL) */ char *domain; @@ -503,12 +503,12 @@ struct Socks5Request char *leho; /** - * The URL to fetch + * The URL to fetch */ char *url; /** - * Handle to cURL + * Handle to cURL */ CURL *curl; @@ -516,22 +516,22 @@ struct Socks5Request * HTTP request headers for the curl request. */ struct curl_slist *headers; - + /** * HTTP response code to give to MHD for the response. */ unsigned int response_code; /** - * Number of bytes already in read buffer + * Number of bytes already in read buffer */ size_t rbuf_len; /** - * Number of bytes already in write buffer + * Number of bytes already in write buffer */ size_t wbuf_len; - + /** * Number of bytes already in the IO buffer. */ @@ -543,7 +543,7 @@ struct Socks5Request struct sockaddr_storage destination_address; /** - * The socks state + * The socks state */ enum SocksPhase state; @@ -560,22 +560,22 @@ struct Socks5Request /** - * The port the proxy is running on (default 7777) + * The port the proxy is running on (default 7777) */ static unsigned long port = GNUNET_GNS_PROXY_PORT; /** - * The CA file (pem) to use for the proxy CA + * The CA file (pem) to use for the proxy CA */ static char *cafile_opt; /** - * The listen socket of the proxy + * The listen socket of the proxy */ static struct GNUNET_NETWORK_Handle *lsock; /** - * The listen task ID + * The listen task ID */ static GNUNET_SCHEDULER_TaskIdentifier ltask; @@ -585,22 +585,22 @@ static GNUNET_SCHEDULER_TaskIdentifier ltask; static GNUNET_SCHEDULER_TaskIdentifier curl_download_task; /** - * The cURL multi handle + * The cURL multi handle */ static CURLM *curl_multi; /** - * Handle to the GNS service + * Handle to the GNS service */ static struct GNUNET_GNS_Handle *gns_handle; /** - * DLL for http/https daemons + * DLL for http/https daemons */ static struct MhdHttpList *mhd_httpd_head; /** - * DLL for http/https daemons + * DLL for http/https daemons */ static struct MhdHttpList *mhd_httpd_tail; @@ -621,12 +621,12 @@ static struct Socks5Request *s5r_head; static struct Socks5Request *s5r_tail; /** - * The users local GNS master zone + * The users local GNS master zone */ static struct GNUNET_CRYPTO_EccPublicSignKey local_gns_zone; /** - * The users local shorten zone + * The users local shorten zone */ static struct GNUNET_CRYPTO_EccPrivateKey local_shorten_zone; @@ -636,7 +636,7 @@ static struct GNUNET_CRYPTO_EccPrivateKey local_shorten_zone; static int do_shorten; /** - * The CA for SSL certificate generation + * The CA for SSL certificate generation */ static struct ProxyCA proxy_ca; @@ -682,11 +682,11 @@ static void cleanup_s5r (struct Socks5Request *s5r) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Cleaning up socks request\n"); + "Cleaning up socks request\n"); if (NULL != s5r->curl) - { + { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Cleaning up cURL handle\n"); + "Cleaning up cURL handle\n"); curl_multi_remove_handle (curl_multi, s5r->curl); curl_easy_cleanup (s5r->curl); s5r->curl = NULL; @@ -703,7 +703,7 @@ cleanup_s5r (struct Socks5Request *s5r) GNUNET_SCHEDULER_cancel (s5r->wtask); if (NULL != s5r->gns_lookup) GNUNET_GNS_lookup_cancel (s5r->gns_lookup); - if (NULL != s5r->sock) + if (NULL != s5r->sock) { if (SOCKS5_SOCKET_WITH_MHD <= s5r->state) GNUNET_NETWORK_socket_free_memory_only_ (s5r->sock); @@ -796,13 +796,13 @@ check_ssl_certificate (struct Socks5Request *s5r) gnutls_session_t session; struct curl_slist * to_slist; } gptr; - unsigned int cert_list_size; + unsigned int cert_list_size; const gnutls_datum_t *chainp; - gptr.to_slist = NULL; - if (CURLE_OK != - curl_easy_getinfo (s5r->curl, - CURLINFO_GNUTLS_SESSION, + gptr.to_slist = NULL; + if (CURLE_OK != + curl_easy_getinfo (s5r->curl, + CURLINFO_GNUTLS_SESSION, &gptr)) return GNUNET_SYSERR; @@ -832,7 +832,7 @@ check_ssl_certificate (struct Socks5Request *s5r) return GNUNET_OK; } - + /** * We're getting an HTTP response header from cURL. Convert it to the * 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) (GNUNET_OK != check_ssl_certificate (s5r)) ) return 0; - GNUNET_break (CURLE_OK == + GNUNET_break (CURLE_OK == curl_easy_getinfo (s5r->curl, CURLINFO_RESPONSE_CODE, &resp_code)); @@ -885,27 +885,27 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls) if (NULL != s5r->leho) { char *cors_hdr; - - GNUNET_asprintf (&cors_hdr, + + GNUNET_asprintf (&cors_hdr, (HTTPS_PORT == s5r->port) ? "https://%s" : "http://%s", s5r->leho); - - GNUNET_break (MHD_YES == + + GNUNET_break (MHD_YES == MHD_add_response_header (s5r->response, MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, cors_hdr)); GNUNET_free (cors_hdr); } - /* force connection to be closed after each request, as we + /* force connection to be closed after each request, as we do not support HTTP pipelining */ - GNUNET_break (MHD_YES == + GNUNET_break (MHD_YES == MHD_add_response_header (s5r->response, MHD_HTTP_HEADER_CONNECTION, "close")); } - + ndup = GNUNET_strndup (buffer, bytes); hdr_type = strtok (ndup, ":"); if (NULL == hdr_type) @@ -927,9 +927,9 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls) if ( (NULL != s5r->leho) && (0 == strcasecmp (hdr_type, MHD_HTTP_HEADER_SET_COOKIE)) ) - + { - new_cookie_hdr = GNUNET_malloc (strlen (hdr_val) + + new_cookie_hdr = GNUNET_malloc (strlen (hdr_val) + strlen (s5r->domain) + 1); offset = 0; 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) if (0 == strcasecmp (cookie_domain, s5r->leho + delta_cdomain)) { offset += sprintf (new_cookie_hdr + offset, - " domain=%s;", + " domain=%s;", s5r->domain); continue; } @@ -954,9 +954,9 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls) else if (0 == strcmp (cookie_domain, s5r->leho)) { offset += sprintf (new_cookie_hdr + offset, - " domain=%s;", + " domain=%s;", s5r->domain); - continue; + continue; } GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("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) if (0 == strcasecmp (MHD_HTTP_HEADER_LOCATION, hdr_type)) { char *leho_host; - + GNUNET_asprintf (&leho_host, (HTTPS_PORT != s5r->port) ? "http://%s" : "https://%s", s5r->leho); - if (0 == strncmp (leho_host, - hdr_val, + if (0 == strncmp (leho_host, + hdr_val, strlen (leho_host))) { GNUNET_asprintf (&new_location, @@ -1051,12 +1051,12 @@ curl_download_cb (void *ptr, size_t size, size_t nmemb, void* ctx) "Pausing CURL download, not enough space\n"); return CURL_WRITEFUNC_PAUSE; /* not enough space */ } - memcpy (&s5r->io_buf[s5r->io_len], + memcpy (&s5r->io_buf[s5r->io_len], ptr, total); s5r->io_len += total; if (s5r->io_len == total) - run_mhd_now (s5r->hd); + run_mhd_now (s5r->hd); return total; } @@ -1178,7 +1178,7 @@ curl_download_prepare () GNUNET_NETWORK_fdset_destroy (gws); GNUNET_NETWORK_fdset_destroy (grs); } - else + else { curl_download_task = GNUNET_SCHEDULER_add_delayed (rtime, &curl_task_download, @@ -1194,7 +1194,7 @@ curl_download_prepare () * @param tc task context */ static void -curl_task_download (void *cls, +curl_task_download (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { int running; @@ -1206,7 +1206,7 @@ curl_task_download (void *cls, curl_download_task = GNUNET_SCHEDULER_NO_TASK; do { - running = 0; + running = 0; mret = curl_multi_perform (curl_multi, &running); while (NULL != (msg = curl_multi_info_read (curl_multi, &msgnum))) { @@ -1232,7 +1232,7 @@ curl_task_download (void *cls, case CURLE_GOT_NOTHING: GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CURL download completed.\n"); - s5r->state = SOCKS5_SOCKET_DOWNLOAD_DONE; + s5r->state = SOCKS5_SOCKET_DOWNLOAD_DONE; run_mhd_now (s5r->hd); break; default: @@ -1241,7 +1241,7 @@ curl_task_download (void *cls, curl_easy_strerror (msg->data.result)); /* FIXME: indicate error somehow? close MHD connection badly as well? */ s5r->state = SOCKS5_SOCKET_DOWNLOAD_DONE; - run_mhd_now (s5r->hd); + run_mhd_now (s5r->hd); break; } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -1262,12 +1262,12 @@ curl_task_download (void *cls, break; } }; - } while (mret == CURLM_CALL_MULTI_PERFORM); + } while (mret == CURLM_CALL_MULTI_PERFORM); if (CURLM_OK != mret) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s failed at %s:%d: `%s'\n", "curl_multi_perform", __FILE__, __LINE__, - curl_multi_strerror (mret)); + curl_multi_strerror (mret)); if (0 == running) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -1418,7 +1418,7 @@ create_response (void *cls, if (NULL == s5r->curl) return MHD_queue_response (con, MHD_HTTP_INTERNAL_SERVER_ERROR, - curl_failure_response); + curl_failure_response); curl_easy_setopt (s5r->curl, CURLOPT_HEADERFUNCTION, &curl_check_hdr); curl_easy_setopt (s5r->curl, CURLOPT_HEADERDATA, s5r); curl_easy_setopt (s5r->curl, CURLOPT_FOLLOWLOCATION, 0); @@ -1436,11 +1436,11 @@ create_response (void *cls, ? "http://%s:%d%s" : "https://%s:%d%s", ipaddr, - port, - s5r->url); + port, + s5r->url); curl_easy_setopt (s5r->curl, - CURLOPT_URL, - curlurl); + CURLOPT_URL, + curlurl); GNUNET_free (curlurl); if (0 == strcasecmp (meth, MHD_HTTP_METHOD_PUT)) @@ -1451,10 +1451,10 @@ create_response (void *cls, curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r); curl_easy_setopt (s5r->curl, CURLOPT_READFUNCTION, &curl_upload_cb); curl_easy_setopt (s5r->curl, CURLOPT_READDATA, s5r); - } + } else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_POST)) { - s5r->state = SOCKS5_SOCKET_UPLOAD_STARTED; + s5r->state = SOCKS5_SOCKET_UPLOAD_STARTED; curl_easy_setopt (s5r->curl, CURLOPT_POST, 1); curl_easy_setopt (s5r->curl, CURLOPT_WRITEFUNCTION, &curl_download_cb); curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r); @@ -1463,12 +1463,12 @@ create_response (void *cls, } else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_HEAD)) { - s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED; + s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED; curl_easy_setopt (s5r->curl, CURLOPT_NOBODY, 1); } else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_GET)) { - s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED; + s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED; curl_easy_setopt (s5r->curl, CURLOPT_HTTPGET, 1); curl_easy_setopt (s5r->curl, CURLOPT_WRITEFUNCTION, &curl_download_cb); curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r); @@ -1479,10 +1479,10 @@ create_response (void *cls, _("Unsupported HTTP method `%s'\n"), meth); curl_easy_cleanup (s5r->curl); - s5r->curl = NULL; + s5r->curl = NULL; return MHD_NO; } - + if (0 == strcasecmp (ver, MHD_HTTP_VERSION_1_0)) { curl_easy_setopt (s5r->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); @@ -1495,26 +1495,26 @@ create_response (void *cls, { curl_easy_setopt (s5r->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_NONE); } - + if (HTTPS_PORT == s5r->port) { curl_easy_setopt (s5r->curl, CURLOPT_USE_SSL, CURLUSESSL_ALL); curl_easy_setopt (s5r->curl, CURLOPT_SSL_VERIFYPEER, 1L); /* Disable cURL checking the hostname, as we will check ourselves as only we have the domain name or the LEHO or the DANE record */ - curl_easy_setopt (s5r->curl, CURLOPT_SSL_VERIFYHOST, 0L); + curl_easy_setopt (s5r->curl, CURLOPT_SSL_VERIFYHOST, 0L); } else { - curl_easy_setopt (s5r->curl, CURLOPT_USE_SSL, CURLUSESSL_NONE); + curl_easy_setopt (s5r->curl, CURLOPT_USE_SSL, CURLUSESSL_NONE); } if (CURLM_OK != curl_multi_add_handle (curl_multi, s5r->curl)) { GNUNET_break (0); curl_easy_cleanup (s5r->curl); - s5r->curl = NULL; - return MHD_NO; + s5r->curl = NULL; + return MHD_NO; } MHD_get_connection_values (con, MHD_HEADER_KIND, @@ -1522,18 +1522,18 @@ create_response (void *cls, curl_easy_setopt (s5r->curl, CURLOPT_HTTPHEADER, s5r->headers); curl_download_prepare (); return MHD_YES; - } + } /* continuing to process request */ if (0 != *upload_data_size) { left = GNUNET_MIN (*upload_data_size, sizeof (s5r->io_buf) - s5r->io_len); - memcpy (&s5r->io_buf[s5r->io_len], + memcpy (&s5r->io_buf[s5r->io_len], upload_data, left); s5r->io_len += left; - *upload_data_size -= left; + *upload_data_size -= left; GNUNET_assert (NULL != s5r->curl); curl_easy_pause (s5r->curl, CURLPAUSE_CONT); curl_download_prepare (); @@ -1545,12 +1545,12 @@ create_response (void *cls, "Finished processing UPLOAD\n"); s5r->state = SOCKS5_SOCKET_UPLOAD_DONE; } - if (NULL == s5r->response) + if (NULL == s5r->response) return MHD_YES; /* too early to queue response, did not yet get headers from cURL */ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Queueing response with MHD\n"); return MHD_queue_response (con, - s5r->response_code, + s5r->response_code, s5r->response); } @@ -1582,7 +1582,7 @@ mhd_completed_cb (void *cls, "MHD encountered error handling request: %d\n", toe); cleanup_s5r (s5r); - *con_cls = NULL; + *con_cls = NULL; } @@ -1590,7 +1590,7 @@ mhd_completed_cb (void *cls, * Function called when MHD first processes an incoming connection. * Gives us the respective URI information. * - * We use this to associate the `struct MHD_Connection` with our + * We use this to associate the `struct MHD_Connection` with our * internal `struct Socks5Request` data structure (by checking * for matching sockets). * @@ -1600,7 +1600,7 @@ mhd_completed_cb (void *cls, * @return the `struct Socks5Request` that this @a connection is for */ static void * -mhd_log_callback (void *cls, +mhd_log_callback (void *cls, const char *url, struct MHD_Connection *connection) { @@ -1610,7 +1610,7 @@ mhd_log_callback (void *cls, ci = MHD_get_connection_info (connection, MHD_CONNECTION_INFO_CONNECTION_FD); - if (NULL == ci) + if (NULL == ci) { GNUNET_break (0); return NULL; @@ -1770,8 +1770,8 @@ do_httpd (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct MhdHttpList *hd = cls; - - hd->httpd_task = GNUNET_SCHEDULER_NO_TASK; + + hd->httpd_task = GNUNET_SCHEDULER_NO_TASK; MHD_run (hd->daemon); schedule_httpd (hd); } @@ -1785,10 +1785,10 @@ do_httpd (void *cls, static void run_mhd_now (struct MhdHttpList *hd) { - if (GNUNET_SCHEDULER_NO_TASK != + if (GNUNET_SCHEDULER_NO_TASK != hd->httpd_task) GNUNET_SCHEDULER_cancel (hd->httpd_task); - hd->httpd_task = GNUNET_SCHEDULER_add_now (&do_httpd, + hd->httpd_task = GNUNET_SCHEDULER_add_now (&do_httpd, hd); } @@ -1801,7 +1801,7 @@ run_mhd_now (struct MhdHttpList *hd) * @return NULL on error */ static void* -load_file (const char* filename, +load_file (const char* filename, unsigned int* size) { void *buffer; @@ -1832,7 +1832,7 @@ load_file (const char* filename, * @return #GNUNET_OK on success */ static int -load_key_from_file (gnutls_x509_privkey_t key, +load_key_from_file (gnutls_x509_privkey_t key, const char* keyfile) { gnutls_datum_t key_data; @@ -1860,7 +1860,7 @@ load_key_from_file (gnutls_x509_privkey_t key, * @return #GNUNET_OK on success */ static int -load_cert_from_file (gnutls_x509_crt_t crt, +load_cert_from_file (gnutls_x509_crt_t crt, const char* certfile) { gnutls_datum_t cert_data; @@ -1896,8 +1896,8 @@ generate_gns_certificate (const char *name) struct tm *tm_data; struct ProxyGNSCertificate *pgc; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Generating TLS/SSL certificate for `%s'\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Generating TLS/SSL certificate for `%s'\n", name); GNUNET_break (GNUTLS_E_SUCCESS == gnutls_x509_crt_init (&request)); GNUNET_break (GNUTLS_E_SUCCESS == gnutls_x509_crt_set_key (request, proxy_ca.key)); @@ -1914,15 +1914,15 @@ generate_gns_certificate (const char *name) &serial, sizeof (serial)); etime = time (NULL); - tm_data = localtime (&etime); + tm_data = localtime (&etime); gnutls_x509_crt_set_activation_time (request, etime); tm_data->tm_year++; etime = mktime (tm_data); gnutls_x509_crt_set_expiration_time (request, etime); - gnutls_x509_crt_sign (request, - proxy_ca.cert, + gnutls_x509_crt_sign (request, + proxy_ca.cert, proxy_ca.key); key_buf_size = sizeof (pgc->key); cert_buf_size = sizeof (pgc->cert); @@ -1954,10 +1954,10 @@ lookup_ssl_httpd (const char* domain) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting fresh MHD HTTPS instance for domain `%s'\n", domain); - pgc = generate_gns_certificate (domain); + pgc = generate_gns_certificate (domain); hd = GNUNET_new (struct MhdHttpList); hd->is_ssl = GNUNET_YES; - hd->domain = GNUNET_strdup (domain); + hd->domain = GNUNET_strdup (domain); hd->proxy_cert = pgc; hd->daemon = MHD_start_daemon (MHD_USE_DEBUG | MHD_USE_SSL | MHD_USE_NO_LISTEN_SOCKET, 0, @@ -1975,8 +1975,8 @@ lookup_ssl_httpd (const char* domain) GNUNET_free (hd); return NULL; } - GNUNET_CONTAINER_DLL_insert (mhd_httpd_head, - mhd_httpd_tail, + GNUNET_CONTAINER_DLL_insert (mhd_httpd_head, + mhd_httpd_tail, hd); return hd; } @@ -2003,7 +2003,7 @@ timeout_s5r_handshake (void *cls, /** * We're done with the Socks5 protocol, now we need to pass the - * connection data through to the final destination, either + * connection data through to the final destination, either * direct (if the protocol might not be HTTP), or via MHD * (if the port looks like it should be HTTP). * @@ -2078,7 +2078,7 @@ do_write (void *cls, if (len <= 0) { /* write error: connection closed, shutdown, etc.; just clean up */ - cleanup_s5r (s5r); + cleanup_s5r (s5r); return; } memmove (s5r->wbuf, @@ -2099,10 +2099,10 @@ do_write (void *cls, switch (s5r->state) { - case SOCKS5_INIT: + case SOCKS5_INIT: GNUNET_assert (0); break; - case SOCKS5_REQUEST: + case SOCKS5_REQUEST: GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != s5r->rtask); break; case SOCKS5_DATA_TRANSFER: @@ -2136,7 +2136,7 @@ signal_socks_failure (struct Socks5Request *s5r, s_resp->reply = sc; s5r->state = SOCKS5_WRITE_THEN_CLEANUP; if (GNUNET_SCHEDULER_NO_TASK != s5r->wtask) - s5r->wtask = + s5r->wtask = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, s5r->sock, &do_write, s5r); @@ -2159,16 +2159,16 @@ signal_socks_success (struct Socks5Request *s5r) s_resp->reserved = 0; s_resp->addr_type = SOCKS5_AT_IPV4; /* zero out IPv4 address and port */ - memset (&s_resp[1], - 0, + memset (&s_resp[1], + 0, sizeof (struct in_addr) + sizeof (uint16_t)); s5r->wbuf_len += sizeof (struct Socks5ServerResponseMessage) + - sizeof (struct in_addr) + sizeof (uint16_t); - if (GNUNET_SCHEDULER_NO_TASK == s5r->wtask) + sizeof (struct in_addr) + sizeof (uint16_t); + if (GNUNET_SCHEDULER_NO_TASK == s5r->wtask) s5r->wtask = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, s5r->sock, - &do_write, s5r); + &do_write, s5r); } @@ -2207,7 +2207,7 @@ handle_gns_result (void *cls, } if (GNUNET_YES == got_ip) break; - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_NETWORK_test_pf (PF_INET)) break; got_ip = GNUNET_YES; @@ -2222,7 +2222,7 @@ handle_gns_result (void *cls, #endif } break; - case GNUNET_DNSPARSER_TYPE_AAAA: + case GNUNET_DNSPARSER_TYPE_AAAA: { struct sockaddr_in6 *in; @@ -2232,8 +2232,8 @@ handle_gns_result (void *cls, break; } if (GNUNET_YES == got_ip) - break; - if (GNUNET_OK != + break; + if (GNUNET_OK != GNUNET_NETWORK_test_pf (PF_INET)) break; /* FIXME: allow user to disable IPv6 per configuration option... */ @@ -2248,7 +2248,7 @@ handle_gns_result (void *cls, in->sin6_len = sizeof (*in); #endif } - break; + break; case GNUNET_NAMESTORE_TYPE_VPN: GNUNET_break (0); /* should have been translated within GNS */ break; @@ -2264,14 +2264,14 @@ handle_gns_result (void *cls, } if (GNUNET_YES != got_ip) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name resolution failed to yield useful IP address.\n"); signal_socks_failure (s5r, SOCKS5_STATUS_GENERAL_FAILURE); return; } s5r->state = SOCKS5_DATA_TRANSFER; - signal_socks_success (s5r); + signal_socks_success (s5r); } @@ -2314,12 +2314,12 @@ do_s5r_read (void *cls, if ( (NULL != tc->read_ready) && (GNUNET_NETWORK_fdset_isset (tc->read_ready, s5r->sock)) ) { - rlen = GNUNET_NETWORK_socket_recv (s5r->sock, + rlen = GNUNET_NETWORK_socket_recv (s5r->sock, &s5r->rbuf[s5r->rbuf_len], sizeof (s5r->rbuf) - s5r->rbuf_len); if (rlen <= 0) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "socks5 client disconnected.\n"); cleanup_s5r (s5r); return; @@ -2449,7 +2449,7 @@ do_s5r_read (void *cls, GNUNET_NO /* only cached */, (GNUNET_YES == do_shorten) ? &local_shorten_zone : NULL, &handle_gns_result, - s5r); + s5r); break; } default: @@ -2469,7 +2469,7 @@ do_s5r_read (void *cls, GNUNET_break_op (0); signal_socks_failure (s5r, SOCKS5_STATUS_GENERAL_FAILURE); - return; + return; } if (SOCKS5_DATA_TRANSFER == s5r->state) { @@ -2478,7 +2478,7 @@ do_s5r_read (void *cls, } /* We are done reading right now */ GNUNET_SCHEDULER_cancel (s5r->rtask); - s5r->rtask = GNUNET_SCHEDULER_NO_TASK; + s5r->rtask = GNUNET_SCHEDULER_NO_TASK; return; case SOCKS5_RESOLVING: GNUNET_assert (0); @@ -2500,7 +2500,7 @@ do_s5r_read (void *cls, * @param tc the scheduler context */ static void -do_accept (void *cls, +do_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_NETWORK_Handle *s; @@ -2595,8 +2595,8 @@ do_shutdown (void *cls, /** * Continue initialization after we have our zone information. */ -static void -run_cont () +static void +run_cont () { struct MhdHttpList *hd; struct sockaddr_in sa; @@ -2612,7 +2612,7 @@ run_cont () lsock = GNUNET_NETWORK_socket_create (AF_INET, SOCK_STREAM, 0); - if (NULL == lsock) + if (NULL == lsock) { GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket"); GNUNET_SCHEDULER_shutdown (); @@ -2666,7 +2666,7 @@ run_cont () } -/** +/** * Method called to inform about the egos of the shorten zone of this peer. * * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get, @@ -2674,7 +2674,7 @@ run_cont () * @a ego does indicate an error (i.e. name is taken or no default * value is known). If @a ego is non-NULL and if '*ctx' * is set in those callbacks, the value WILL be passed to a subsequent - * call to the identity callback of #GNUNET_IDENTITY_connect (if + * call to the identity callback of #GNUNET_IDENTITY_connect (if * that one was not NULL). * * @param cls closure, NULL @@ -2706,7 +2706,7 @@ identity_shorten_cb (void *cls, } -/** +/** * Method called to inform about the egos of the master zone of this peer. * * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get, @@ -2714,7 +2714,7 @@ identity_shorten_cb (void *cls, * @a ego does indicate an error (i.e. name is taken or no default * value is known). If @a ego is non-NULL and if '*ctx' * is set in those callbacks, the value WILL be passed to a subsequent - * call to the identity callback of #GNUNET_IDENTITY_connect (if + * call to the identity callback of #GNUNET_IDENTITY_connect (if * that one was not NULL). * * @param cls closure, NULL @@ -2770,7 +2770,7 @@ run (void *cls, char *const *args, const char *cfgfile, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to create cURL multi handle!\n"); return; - } + } cafile = cafile_opt; if (NULL == cafile) { @@ -2787,11 +2787,11 @@ run (void *cls, char *const *args, const char *cfgfile, } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using %s as CA\n", cafile); - + gnutls_global_init (); gnutls_x509_crt_init (&proxy_ca.cert); gnutls_x509_privkey_init (&proxy_ca.key); - + if ( (GNUNET_OK != load_cert_from_file (proxy_ca.cert, cafile)) || (GNUNET_OK != load_key_from_file (proxy_ca.key, cafile)) ) { @@ -2801,7 +2801,7 @@ run (void *cls, char *const *args, const char *cfgfile, gnutls_x509_crt_deinit (proxy_ca.cert); gnutls_x509_privkey_deinit (proxy_ca.key); gnutls_global_deinit (); - GNUNET_free_non_null (cafile_cfg); + GNUNET_free_non_null (cafile_cfg); return; } GNUNET_free_non_null (cafile_cfg); @@ -2815,11 +2815,11 @@ run (void *cls, char *const *args, const char *cfgfile, return; } identity = GNUNET_IDENTITY_connect (cfg, - NULL, NULL); + NULL, NULL); id_op = GNUNET_IDENTITY_get (identity, "gns-proxy", &identity_master_cb, - NULL); + NULL); GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_shutdown, NULL); } @@ -2844,7 +2844,7 @@ main (int argc, char *const *argv) &GNUNET_GETOPT_set_string, &cafile_opt}, GNUNET_GETOPT_OPTION_END }; - static const char* page = + static const char* page = "gnunet-gns-proxy" "cURL fail"; 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; static int rtype; /** - * Handle to lookup request + * Handle to lookup request */ static struct GNUNET_GNS_LookupRequest *lookup_request; @@ -144,13 +144,13 @@ process_lookup_result (void *cls, uint32_t rd_count, const char *typename; char* string_val; - lookup_request = NULL; - if (!raw) + lookup_request = NULL; + if (!raw) { if (0 == rd_count) printf ("No results.\n"); else - printf ("%s:\n", + printf ("%s:\n", name); } for (i=0; iclient, NULL); @@ -266,7 +266,7 @@ publish_zone_dht_next (void *cls, * @param tc task context */ static void -publish_zone_dht_start (void *cls, +publish_zone_dht_start (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); @@ -280,10 +280,10 @@ static void dht_put_continuation (void *cls, int success) { - struct GNUNET_TIME_Relative next_put_interval; + struct GNUNET_TIME_Relative next_put_interval; active_put = NULL; - num_public_records++; + num_public_records++; if ( (num_public_records > last_num_public_records) && (GNUNET_NO == first_zone_iteration) ) { @@ -300,7 +300,7 @@ dht_put_continuation (void *cls, GNUNET_STATISTICS_set (statistics, "Current zone iteration interval (ms)", next_put_interval.rel_value_us / 1000LL, - GNUNET_NO); + GNUNET_NO); zone_publish_task = GNUNET_SCHEDULER_add_delayed (next_put_interval, &publish_zone_dht_next, NULL); @@ -322,10 +322,10 @@ put_gns_record (void *cls, const char *name, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) -{ +{ struct GNUNET_NAMESTORE_Block *block; struct GNUNET_HashCode query; - struct GNUNET_TIME_Absolute expire; + struct GNUNET_TIME_Absolute expire; struct GNUNET_TIME_Absolute now; size_t block_size; struct GNUNET_NAMESTORE_RecordData rd_public[rd_count]; @@ -365,8 +365,8 @@ put_gns_record (void *cls, put_interval.rel_value_us / 1000LL, GNUNET_NO); GNUNET_STATISTICS_update (statistics, - "Number of zone iterations", - 1, + "Number of zone iterations", + 1, GNUNET_NO); GNUNET_STATISTICS_set (statistics, "Number of public records in DHT", @@ -377,7 +377,7 @@ put_gns_record (void *cls, &publish_zone_dht_start, NULL); else - zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, + zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, NULL); return; } @@ -413,8 +413,8 @@ put_gns_record (void *cls, name, rd_public, rd_public_count); - block_size = ntohl (block->purpose.size) - + sizeof (struct GNUNET_CRYPTO_EccSignature) + block_size = ntohl (block->purpose.size) + + sizeof (struct GNUNET_CRYPTO_EccSignature) + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); GNUNET_NAMESTORE_query_from_private_key (key, name, @@ -429,7 +429,7 @@ put_gns_record (void *cls, expire, DHT_OPERATION_TIMEOUT, &dht_put_continuation, - NULL); + NULL); if (NULL == active_put) { GNUNET_break (0); @@ -446,13 +446,13 @@ put_gns_record (void *cls, * @param tc task context */ static void -publish_zone_dht_start (void *cls, +publish_zone_dht_start (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { zone_publish_task = GNUNET_SCHEDULER_NO_TASK; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Scheduling DHT zone update!\n"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Scheduling DHT zone update!\n"); /* start counting again */ num_public_records = 0; namestore_iter = GNUNET_NAMESTORE_zone_iteration_start (namestore_handle, @@ -480,21 +480,21 @@ send_lookup_response (void* cls, struct ClientLookupHandle *clh = cls; struct GNUNET_GNS_ClientLookupResultMessage *rmsg; size_t len; - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message with %d results\n", - "LOOKUP_RESULT", + "LOOKUP_RESULT", rd_count); - + len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); - rmsg = GNUNET_malloc (len + sizeof (struct GNUNET_GNS_ClientLookupResultMessage)); + rmsg = GNUNET_malloc (len + sizeof (struct GNUNET_GNS_ClientLookupResultMessage)); rmsg->header.type = htons (GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT); rmsg->header.size = htons (len + sizeof(struct GNUNET_GNS_ClientLookupResultMessage)); rmsg->id = clh->request_id; - rmsg->rd_count = htonl (rd_count); - GNUNET_NAMESTORE_records_serialize (rd_count, rd, len, + rmsg->rd_count = htonl (rd_count); + GNUNET_NAMESTORE_records_serialize (rd_count, rd, len, (char*) &rmsg[1]); - GNUNET_SERVER_notification_context_unicast (nc, + GNUNET_SERVER_notification_context_unicast (nc, clh->client, &rmsg->header, GNUNET_NO); @@ -503,11 +503,11 @@ send_lookup_response (void* cls, GNUNET_SERVER_client_set_user_context (clh->client, NULL); GNUNET_free (clh); GNUNET_STATISTICS_update (statistics, - "Completed lookups", 1, + "Completed lookups", 1, GNUNET_NO); GNUNET_STATISTICS_update (statistics, - "Records resolved", - rd_count, + "Records resolved", + rd_count, GNUNET_NO); } @@ -531,9 +531,9 @@ handle_lookup (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *key; uint16_t msg_size; const struct GNUNET_GNS_ClientLookupMessage *sh_msg; - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Received `%s' message\n", + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Received `%s' message\n", "LOOKUP"); msg_size = ntohs (message->size); if (msg_size < sizeof (struct GNUNET_GNS_ClientLookupMessage)) @@ -557,8 +557,8 @@ handle_lookup (void *cls, return; } GNUNET_STRINGS_utf8_tolower (utf_in, &nameptr); - GNUNET_SERVER_receive_done (client, GNUNET_OK); - + GNUNET_SERVER_receive_done (client, GNUNET_OK); + clh = GNUNET_new (struct ClientLookupHandle); GNUNET_SERVER_client_set_user_context (client, clh); GNUNET_CONTAINER_DLL_insert (clh_head, clh_tail, clh); @@ -571,7 +571,7 @@ handle_lookup (void *cls, "LOOKUP: Query for A record but AF_INET not supported!"); send_lookup_response (clh, 0, NULL); return; - } + } if ( (GNUNET_DNSPARSER_TYPE_AAAA == ntohl (sh_msg->type)) && (GNUNET_OK != v6_enabled) ) { @@ -580,14 +580,14 @@ handle_lookup (void *cls, send_lookup_response (clh, 0, NULL); return; } - clh->lookup = GNS_resolver_lookup (&sh_msg->zone, + clh->lookup = GNS_resolver_lookup (&sh_msg->zone, ntohl (sh_msg->type), name, key, ntohl (sh_msg->only_cached), &send_lookup_response, clh); GNUNET_STATISTICS_update (statistics, - "Lookup attempts", + "Lookup attempts", 1, GNUNET_NO); } @@ -645,7 +645,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, GNUNET_SCHEDULER_shutdown (); return; } - + put_interval = INITIAL_PUT_INTERVAL; zone_publish_time_window = DEFAULT_ZONE_PUBLISH_TIME_WINDOW; @@ -677,7 +677,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); return; } - + if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (c, "gns", "DNS_ROOT", &dns_root_name)) @@ -688,7 +688,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, &dns_root)) { GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, - "gns", "DNS_ROOT", + "gns", "DNS_ROOT", _("valid public key required")); GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); GNUNET_free (dns_root_name); @@ -697,7 +697,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "DNS hijacking with root `%s' enabled. Connecting to DNS service.\n", dns_root_name); - GNUNET_free (dns_root_name); + GNUNET_free (dns_root_name); if (GNUNET_SYSERR == GNS_interceptor_init (&dns_root, c)) { @@ -705,21 +705,21 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, return; } } - GNS_resolver_init (namestore_handle, dht_handle, + GNS_resolver_init (namestore_handle, dht_handle, c, max_parallel_bg_queries); GNS_shorten_init (namestore_handle, dht_handle); GNUNET_SERVER_disconnect_notify (server, ¬ify_client_disconnect, NULL); - /* Schedule periodic put for our records. */ + /* Schedule periodic put for our records. */ first_zone_iteration = GNUNET_YES; GNUNET_SERVER_add_handlers (server, handlers); statistics = GNUNET_STATISTICS_create ("gns", c); nc = GNUNET_SERVER_notification_context_create (server, 1); - zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, + zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, NULL); - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, NULL); } 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 struct InterceptLookupHandle *prev; /** - * the request handle to reply to + * the request handle to reply to */ struct GNUNET_DNS_RequestHandle *request_handle; - + /** - * the dns parser packet received + * the dns parser packet received */ struct GNUNET_DNSPARSER_Packet *packet; @@ -102,7 +102,7 @@ reply_to_dns (void *cls, uint32_t rd_count, struct InterceptLookupHandle *ilh = cls; struct GNUNET_DNSPARSER_Packet *packet = ilh->packet; struct GNUNET_DNSPARSER_Query *query = &packet->queries[0]; - uint32_t i; + uint32_t i; size_t len; int ret; char *buf; @@ -110,7 +110,7 @@ reply_to_dns (void *cls, uint32_t rd_count, unsigned int skip_answers; unsigned int skip_additional; size_t off; - + /* Put records in the DNS packet */ num_answers = 0; for (i=0; i < rd_count; i++) @@ -151,7 +151,7 @@ reply_to_dns (void *cls, uint32_t rd_count, } break; case GNUNET_DNSPARSER_TYPE_SOA: - answer_records[i - skip_answers].data.soa + answer_records[i - skip_answers].data.soa = GNUNET_DNSPARSER_parse_soa (rd[i].data, rd[i].data_size, &off); @@ -167,7 +167,7 @@ reply_to_dns (void *cls, uint32_t rd_count, skip_answers++; break; case GNUNET_DNSPARSER_TYPE_MX: - answer_records[i - skip_answers].data.mx + answer_records[i - skip_answers].data.mx = GNUNET_DNSPARSER_parse_mx (rd[i].data, rd[i].data_size, &off); @@ -196,7 +196,7 @@ reply_to_dns (void *cls, uint32_t rd_count, case GNUNET_DNSPARSER_TYPE_NS: case GNUNET_DNSPARSER_TYPE_CNAME: case GNUNET_DNSPARSER_TYPE_PTR: - additional_records[i - skip_additional].data.hostname + additional_records[i - skip_additional].data.hostname = GNUNET_DNSPARSER_parse_name (rd[i].data, rd[i].data_size, &off); @@ -208,7 +208,7 @@ reply_to_dns (void *cls, uint32_t rd_count, } break; case GNUNET_DNSPARSER_TYPE_SOA: - additional_records[i - skip_additional].data.soa + additional_records[i - skip_additional].data.soa = GNUNET_DNSPARSER_parse_soa (rd[i].data, rd[i].data_size, &off); @@ -220,7 +220,7 @@ reply_to_dns (void *cls, uint32_t rd_count, } break; case GNUNET_DNSPARSER_TYPE_MX: - additional_records[i - skip_additional].data.mx + additional_records[i - skip_additional].data.mx = GNUNET_DNSPARSER_parse_mx (rd[i].data, rd[i].data_size, &off); @@ -242,7 +242,7 @@ reply_to_dns (void *cls, uint32_t rd_count, } GNUNET_break (0 == (rd[i - skip_additional].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); additional_records[i - skip_additional].expiration_time.abs_value_us = rd[i].expiration_time; - additional_records[i - skip_additional].dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET; + additional_records[i - skip_additional].dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET; } } packet->num_answers = num_answers - skip_answers; @@ -261,14 +261,14 @@ reply_to_dns (void *cls, uint32_t rd_count, { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Error converting GNS response to DNS response!\n")); - } + } else { GNUNET_DNS_request_answer (ilh->request_handle, len, buf); GNUNET_free (buf); - } + } packet->num_answers = 0; packet->answers = NULL; packet->num_additional_records = 0; @@ -297,7 +297,7 @@ handle_dns_request (void *cls, struct GNUNET_DNSPARSER_Packet *p; struct InterceptLookupHandle *ilh; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Hijacked a DNS request. Processing.\n"); if (NULL == (p = GNUNET_DNSPARSER_parse (request, request_length))) { @@ -307,7 +307,7 @@ handle_dns_request (void *cls, GNUNET_DNSPARSER_free_packet (p); return; } - + /* Check TLD and decide if we or legacy dns is responsible */ if (1 != p->num_queries) { @@ -318,7 +318,7 @@ handle_dns_request (void *cls, return; } - /* Check for GNS TLDs. */ + /* Check for GNS TLDs. */ if ( (GNUNET_YES == is_gnu_tld (p->queries[0].name)) || (GNUNET_YES == is_zkey_tld (p->queries[0].name)) || (0 == strcmp (p->queries[0].name, GNUNET_GNS_TLD)) ) @@ -328,8 +328,8 @@ handle_dns_request (void *cls, GNUNET_CONTAINER_DLL_insert (ilh_head, ilh_tail, ilh); ilh->packet = p; ilh->request_handle = rh; - ilh->lookup = GNS_resolver_lookup (&zone, - p->queries[0].type, + ilh->lookup = GNS_resolver_lookup (&zone, + p->queries[0].type, p->queries[0].name, NULL /* FIXME: enable shorten for DNS intercepts? */, GNUNET_NO, @@ -338,7 +338,7 @@ handle_dns_request (void *cls, } /* This request does not concern us. Forward to real DNS. */ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Request for `%s' is forwarded to DNS untouched.\n", + "Request for `%s' is forwarded to DNS untouched.\n", p->queries[0].name); GNUNET_DNS_request_forward (rh); 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 struct GNS_ResolverHandle *rh; /** - * label/name corresponding to the authority + * label/name corresponding to the authority */ char *label; - + /** * #GNUNET_YES if the authority was a GNS authority, * #GNUNET_NO if the authority was a DNS authority. @@ -110,7 +110,7 @@ struct AuthorityChain { /** - * The zone of the GNS authority + * The zone of the GNS authority */ struct GNUNET_CRYPTO_EccPublicSignKey gns_authority; @@ -133,7 +133,7 @@ struct AuthorityChain } dns_authority; } authority_info; - + }; @@ -180,10 +180,10 @@ struct DnsResult /** * Closure for #vpn_allocation_cb. */ -struct VpnContext +struct VpnContext { - /** + /** * Which resolution process are we processing. */ struct GNS_ResolverHandle *rh; @@ -197,12 +197,12 @@ struct VpnContext * Number of records serialized in 'rd_data'. */ unsigned int rd_count; - + /** * Serialized records. */ char *rd_data; - + /** * Number of bytes in 'rd_data'. */ @@ -212,38 +212,38 @@ struct VpnContext /** * Handle to a currenty pending resolution. On result (positive or - * negative) the #GNS_ResultProcessor is called. + * negative) the #GNS_ResultProcessor is called. */ struct GNS_ResolverHandle { /** - * DLL + * DLL */ struct GNS_ResolverHandle *next; /** - * DLL + * DLL */ struct GNS_ResolverHandle *prev; /** - * The top-level GNS authoritative zone to query + * The top-level GNS authoritative zone to query */ struct GNUNET_CRYPTO_EccPublicSignKey authority_zone; /** - * called when resolution phase finishes + * called when resolution phase finishes */ GNS_ResultProcessor proc; - + /** - * closure passed to proc + * closure passed to proc */ void* proc_cls; /** - * Handle for DHT lookups. should be NULL if no lookups are in progress + * Handle for DHT lookups. should be NULL if no lookups are in progress */ struct GNUNET_DHT_GetHandle *get_handle; @@ -274,12 +274,12 @@ struct GNS_ResolverHandle struct GNUNET_CONTAINER_HeapNode *dht_heap_node; /** - * DLL to store the authority chain + * DLL to store the authority chain */ struct AuthorityChain *ac_head; /** - * DLL to store the authority chain + * DLL to store the authority chain */ struct AuthorityChain *ac_tail; @@ -294,7 +294,7 @@ struct GNS_ResolverHandle GNUNET_SCHEDULER_TaskIdentifier task_id; /** - * The name to resolve + * The name to resolve */ char *name; @@ -314,7 +314,7 @@ struct GNS_ResolverHandle size_t name_resolution_pos; /** - * Use only cache + * Use only cache */ int only_cached; @@ -325,7 +325,7 @@ struct GNS_ResolverHandle /** * We increment the loop limiter for each step in a recursive - * resolution. If it passes our threshold (i.e. due to + * resolution. If it passes our threshold (i.e. due to * self-recursion in the resolution, i.e CNAME fun), we stop. */ unsigned int loop_limiter; @@ -470,7 +470,7 @@ is_canonical (const char *name) if ('_' != name[0]) return GNUNET_NO; pos = &name[1]; - while (NULL != (dot = strchr (pos, '.'))) + while (NULL != (dot = strchr (pos, '.'))) if ('_' != dot[1]) return GNUNET_NO; else @@ -530,8 +530,8 @@ fail_resolution (void *cls, /* Don't have this on W32, here's a naive implementation * Was somehow removed on OS X ... */ void * -memrchr (const void *s, - int c, +memrchr (const void *s, + int c, size_t n) { const unsigned char *ucs = s; @@ -567,7 +567,7 @@ resolver_lookup_get_next_label (struct GNS_ResolverHandle *rh) /* done, this was the last one */ len = rh->name_resolution_pos; rp = rh->name; - rh->name_resolution_pos = 0; + rh->name_resolution_pos = 0; } else { @@ -575,8 +575,8 @@ resolver_lookup_get_next_label (struct GNS_ResolverHandle *rh) len = rh->name_resolution_pos - (dot - rh->name) - 1; rp = dot + 1; rh->name_resolution_pos = dot - rh->name; - } - return GNUNET_strndup (rp, len); + } + return GNUNET_strndup (rp, len); } @@ -617,7 +617,7 @@ transmit_lookup_dns_result (struct GNS_ResolverHandle *rh) i++; } GNUNET_assert (i == n); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting standard DNS result with %u records\n", n); rh->proc (rh->proc_cls, @@ -754,7 +754,7 @@ dns_result_parser (void *cls, rh->dns_request = NULL; GNUNET_SCHEDULER_cancel (rh->task_id); rh->task_id = GNUNET_SCHEDULER_NO_TASK; - p = GNUNET_DNSPARSER_parse ((const char *) dns, + p = GNUNET_DNSPARSER_parse ((const char *) dns, dns_len); if (NULL == p) { @@ -776,7 +776,7 @@ dns_result_parser (void *cls, rh->name = GNUNET_strdup (p->answers[0].data.hostname); start_resolver_lookup (rh); GNUNET_DNSPARSER_free_packet (p); - return; + return; } /* FIXME: add DNAME support */ @@ -798,7 +798,7 @@ dns_result_parser (void *cls, rec = &p->answers[i]; else if (i < p->num_answers + p->num_authority_records) rec = &p->authority_records[i - p->num_answers]; - else + else rec = &p->authority_records[i - p->num_answers - p->num_authority_records]; /* As we copied the full DNS name to 'rh->ac_tail->label', this should be the correct check to see if this record is actually @@ -909,7 +909,7 @@ dns_result_parser (void *cls, } rh->proc (rh->proc_cls, rd_count - skip, rd); GNS_resolver_lookup_cancel (rh); - } + } GNUNET_DNSPARSER_free_packet (p); } @@ -963,7 +963,7 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh) UINT16_MAX); p->flags.opcode = GNUNET_TUN_DNS_OPCODE_QUERY; p->flags.recursion_desired = 1; - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_DNSPARSER_pack (p, 1024, &dns_request, &dns_request_length)) { GNUNET_break (0); @@ -993,7 +993,7 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh) * Merge it into our chain. * * @param rh resolution we are performing - * @param cname value of the cname record we got for the current + * @param cname value of the cname record we got for the current * authority chain tail */ static void @@ -1030,13 +1030,13 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh, ac = GNUNET_new (struct AuthorityChain); ac->rh = rh; ac->gns_authority = GNUNET_YES; - ac->authority_info.gns_authority = rh->ac_tail->authority_info.gns_authority; + ac->authority_info.gns_authority = rh->ac_tail->authority_info.gns_authority; ac->label = resolver_lookup_get_next_label (rh); /* tigger shortening */ - if (NULL != rh->shorten_key) + if (NULL != rh->shorten_key) GNS_shorten_start (rh->ac_tail->label, &ac->authority_info.gns_authority, - rh->shorten_key); + rh->shorten_key); /* add AC to tail */ GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, rh->ac_tail, @@ -1076,7 +1076,7 @@ handle_gns_resolution_result (void *cls, * will match 'result_af' from the request * @param address IP address (struct in_addr or struct in_addr6, depending on 'af') * that the VPN allocated for the redirection; - * traffic to this IP will now be redirected to the + * traffic to this IP will now be redirected to the * specified target peer; NULL on error */ static void @@ -1102,7 +1102,7 @@ vpn_allocation_cb (void *cls, { switch (af) { - case AF_INET: + case AF_INET: rd[i].record_type = GNUNET_DNSPARSER_TYPE_A; rd[i].data_size = sizeof (struct in_addr); rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (VPN_TIMEOUT).abs_value_us; @@ -1118,12 +1118,12 @@ vpn_allocation_cb (void *cls, break; default: GNUNET_assert (0); - } + } break; } } GNUNET_assert (i < vpn_ctx->rd_count); - handle_gns_resolution_result (rh, + handle_gns_resolution_result (rh, vpn_ctx->rd_count, rd); GNUNET_free (vpn_ctx->rd_data); @@ -1168,7 +1168,7 @@ handle_gns_resolution_result (void *cls, "Resolution succeeded for `%s' in zone %s, got %u records\n", rh->ac_tail->label, GNUNET_NAMESTORE_z2s (&rh->ac_tail->authority_info.gns_authority), - rd_count); + rd_count); if (0 == rh->name_resolution_pos) { /* top-level match, are we done yet? */ @@ -1188,10 +1188,10 @@ handle_gns_resolution_result (void *cls, GNS_resolver_lookup_cancel (rh); return; } - handle_gns_cname_result (rh, + handle_gns_cname_result (rh, cname); GNUNET_free (cname); - return; + return; } /* If A/AAAA was requested, but we got a VPN record, we convert it to A/AAAA using GNUnet VPN */ @@ -1211,7 +1211,7 @@ handle_gns_resolution_result (void *cls, GNUNET_break_op (0); rh->proc (rh->proc_cls, 0, NULL); GNS_resolver_lookup_cancel (rh); - return; + return; } vpn = (const struct GNUNET_TUN_GnsVpnRecord *) rd[i].data; vname = (const char *) &vpn[1]; @@ -1300,7 +1300,7 @@ handle_gns_resolution_result (void *cls, rd_off++; } } - GNUNET_free_non_null (cname); + GNUNET_free_non_null (cname); } break; case GNUNET_DNSPARSER_TYPE_SOA: @@ -1337,7 +1337,7 @@ handle_gns_resolution_result (void *cls, } } if (NULL != soa) - GNUNET_DNSPARSER_free_soa (soa); + GNUNET_DNSPARSER_free_soa (soa); } break; case GNUNET_DNSPARSER_TYPE_MX: @@ -1373,7 +1373,7 @@ handle_gns_resolution_result (void *cls, } } if (NULL != mx) - GNUNET_DNSPARSER_free_mx (mx); + GNUNET_DNSPARSER_free_mx (mx); } break; case GNUNET_DNSPARSER_TYPE_SRV: @@ -1381,7 +1381,7 @@ handle_gns_resolution_result (void *cls, struct GNUNET_DNSPARSER_SrvRecord *srv; off = 0; - /* FIXME: passing rh->name here is is not necessarily what we want + /* FIXME: passing rh->name here is is not necessarily what we want (SRV support not finished) */ srv = GNUNET_DNSPARSER_parse_srv (rh->name, rd[i].data, @@ -1413,7 +1413,7 @@ handle_gns_resolution_result (void *cls, } } if (NULL != srv) - GNUNET_DNSPARSER_free_srv (srv); + GNUNET_DNSPARSER_free_srv (srv); } break; case GNUNET_NAMESTORE_TYPE_PKEY: @@ -1421,7 +1421,7 @@ handle_gns_resolution_result (void *cls, if (NULL != rh->shorten_key) { struct GNUNET_CRYPTO_EccPublicSignKey pub; - + if (rd[i].data_size != sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) { GNUNET_break_op (0); @@ -1439,11 +1439,11 @@ handle_gns_resolution_result (void *cls, break; } } - + /* yes, we are done, return result */ rh->proc (rh->proc_cls, rd_off, rd_new); GNS_resolver_lookup_cancel (rh); - return; + return; } do_recurse: /* need to recurse, check if we can */ @@ -1459,7 +1459,7 @@ handle_gns_resolution_result (void *cls, GNUNET_break_op (0); rh->proc (rh->proc_cls, 0, NULL); GNS_resolver_lookup_cancel (rh); - return; + return; } /* expand authority chain */ ac = GNUNET_new (struct AuthorityChain); @@ -1470,10 +1470,10 @@ handle_gns_resolution_result (void *cls, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)); ac->label = resolver_lookup_get_next_label (rh); /* tigger shortening */ - if (NULL != rh->shorten_key) + if (NULL != rh->shorten_key) GNS_shorten_start (rh->ac_tail->label, &ac->authority_info.gns_authority, - rh->shorten_key); + rh->shorten_key); /* add AC to tail */ GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, rh->ac_tail, @@ -1491,7 +1491,7 @@ handle_gns_resolution_result (void *cls, GNUNET_break_op (0); rh->proc (rh->proc_cls, 0, NULL); GNS_resolver_lookup_cancel (rh); - return; + return; } /* find associated A/AAAA record */ sa = NULL; @@ -1506,7 +1506,7 @@ handle_gns_resolution_result (void *cls, GNUNET_break_op (0); rh->proc (rh->proc_cls, 0, NULL); GNS_resolver_lookup_cancel (rh); - return; + return; } /* FIXME: might want to check if we support IPv4 here, and otherwise skip this one and hope we find another */ @@ -1528,7 +1528,7 @@ handle_gns_resolution_result (void *cls, GNUNET_break_op (0); rh->proc (rh->proc_cls, 0, NULL); GNS_resolver_lookup_cancel (rh); - return; + return; } /* FIXME: might want to check if we support IPv6 here, and otherwise skip this one and hope we find another */ @@ -1620,7 +1620,7 @@ handle_gns_resolution_result (void *cls, GNS_resolver_lookup_cancel (rh); return; } - handle_gns_cname_result (rh, + handle_gns_cname_result (rh, cname); GNUNET_free (cname); return; @@ -1688,7 +1688,7 @@ handle_dht_response (void *cls, const struct GNUNET_HashCode *key, const struct GNUNET_PeerIdentity *get_path, unsigned int get_path_length, - const struct GNUNET_PeerIdentity *put_path, + const struct GNUNET_PeerIdentity *put_path, unsigned int put_path_length, enum GNUNET_BLOCK_Type type, size_t size, const void *data) @@ -1697,11 +1697,11 @@ handle_dht_response (void *cls, struct AuthorityChain *ac = rh->ac_tail; const struct GNUNET_NAMESTORE_Block *block; struct CacheOps *co; - + GNUNET_DHT_get_stop (rh->get_handle); rh->get_handle = NULL; GNUNET_CONTAINER_heap_remove_node (rh->dht_heap_node); - rh->dht_heap_node = NULL; + rh->dht_heap_node = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Handling response from the DHT\n"); if (size < sizeof (struct GNUNET_NAMESTORE_Block)) @@ -1710,11 +1710,11 @@ handle_dht_response (void *cls, GNUNET_break (0); rh->proc (rh->proc_cls, 0, NULL); GNS_resolver_lookup_cancel (rh); - return; + return; } - block = data; + block = data; if (size != - ntohl (block->purpose.size) + + ntohl (block->purpose.size) + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + sizeof (struct GNUNET_CRYPTO_EccSignature)) { @@ -1722,7 +1722,7 @@ handle_dht_response (void *cls, GNUNET_break (0); rh->proc (rh->proc_cls, 0, NULL); GNS_resolver_lookup_cancel (rh); - return; + return; } if (GNUNET_OK != GNUNET_NAMESTORE_block_decrypt (block, @@ -1756,7 +1756,7 @@ handle_dht_response (void *cls, * @param cls closure with the `struct GNS_ResolverHandle` * @param block block that was stored in the namestore */ -static void +static void handle_namestore_block_response (void *cls, const struct GNUNET_NAMESTORE_Block *block) { @@ -1879,10 +1879,10 @@ recursive_resolution (void *cls, GNS_resolver_lookup_cancel (rh); return; } - if (GNUNET_YES == rh->ac_tail->gns_authority) - recursive_gns_resolution_namestore (rh); - else - recursive_dns_resolution (rh); + if (GNUNET_YES == rh->ac_tail->gns_authority) + recursive_gns_resolution_namestore (rh); + else + recursive_dns_resolution (rh); } @@ -1919,11 +1919,11 @@ start_resolver_lookup (struct GNS_ResolverHandle *rh) default: af = AF_UNSPEC; break; - } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Doing standard DNS lookup for `%s'\n", rh->name); - rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name, + rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name, af, DNS_LOOKUP_TIMEOUT, &handle_dns_result, @@ -2002,7 +2002,7 @@ GNS_resolver_lookup (const struct GNUNET_CRYPTO_EccPublicSignKey *zone, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, (NULL == shorten_key) - ? "Starting lookup for `%s' with shortening disabled\n" + ? "Starting lookup for `%s' with shortening disabled\n" : "Starting lookup for `%s' with shortening enabled\n", name); rh = GNUNET_new (struct GNS_ResolverHandle); @@ -2153,7 +2153,7 @@ GNS_resolver_done () while (NULL != (rh = rlh_head)) { rh->proc (rh->proc_cls, 0, NULL); - GNS_resolver_lookup_cancel (rh); + GNS_resolver_lookup_cancel (rh); } while (NULL != (co = co_head)) { 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); * @return #GNUNET_YES or #GNUNET_NO */ int -is_tld (const char *name, +is_tld (const char *name, const char *tld); 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 struct GNUNET_CRYPTO_EccPublicSignKey target_zone; /** - * Handle for DHT lookups. Should be NULL if no lookups are in progress + * Handle for DHT lookups. Should be NULL if no lookups are in progress */ struct GNUNET_DHT_GetHandle *get_handle; /** - * Handle to namestore request + * Handle to namestore request */ struct GNUNET_NAMESTORE_QueueEntry *namestore_task; @@ -158,8 +158,8 @@ free_get_pseu_authority_handle (struct GetPseuAuthorityHandle *gph) * @param emsg unused */ static void -create_pkey_cont (void* cls, - int32_t success, +create_pkey_cont (void* cls, + int32_t success, const char *emsg) { struct GetPseuAuthorityHandle* gph = cls; @@ -205,7 +205,7 @@ process_pseu_block_ns (void *cls, } GNUNET_CRYPTO_ecc_key_get_public_for_signature (&gph->shorten_zone_key, &pub); - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_NAMESTORE_block_decrypt (block, &pub, gph->current_label, @@ -225,10 +225,10 @@ process_pseu_block_ns (void *cls, * @param gph the handle to our shorten operation * @param label the label to lookup */ -static void +static void perform_pseu_lookup (struct GetPseuAuthorityHandle *gph, const char *label) -{ +{ struct GNUNET_CRYPTO_EccPublicSignKey pub; struct GNUNET_HashCode query; @@ -266,7 +266,7 @@ process_pseu_lookup_ns (void *cls, if (rd_count > 0) { GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, - "Name `%s' already taken, cannot shorten.\n", + "Name `%s' already taken, cannot shorten.\n", gph->current_label); /* if this was not yet the original label, try one more time, this time not using PSEU but the original label */ @@ -283,7 +283,7 @@ process_pseu_lookup_ns (void *cls, } /* name is available */ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Shortening `%s' to `%s'\n", + "Shortening `%s' to `%s'\n", GNUNET_NAMESTORE_z2s (&gph->target_zone), gph->current_label); new_pkey.expiration_time = UINT64_MAX; @@ -293,7 +293,7 @@ process_pseu_lookup_ns (void *cls, new_pkey.flags = GNUNET_NAMESTORE_RF_NONE | GNUNET_NAMESTORE_RF_PRIVATE | GNUNET_NAMESTORE_RF_PENDING; - gph->namestore_task + gph->namestore_task = GNUNET_NAMESTORE_records_store (namestore_handle, &gph->shorten_zone_key, gph->current_label, @@ -309,7 +309,7 @@ process_pseu_lookup_ns (void *cls, * @param pseu the pseu result or NULL */ static void -process_pseu_result (struct GetPseuAuthorityHandle* gph, +process_pseu_result (struct GetPseuAuthorityHandle* gph, const char *pseu) { if (NULL == pseu) @@ -320,7 +320,7 @@ process_pseu_result (struct GetPseuAuthorityHandle* gph, gph->label); perform_pseu_lookup (gph, gph->label); return; - } + } /* check if 'pseu' is taken */ perform_pseu_lookup (gph, pseu); } @@ -373,7 +373,7 @@ process_auth_records (void *cls, rd[i].data, rd[i].data_size); pseu[rd[i].data_size] = '\0'; - process_pseu_result (gph, + process_pseu_result (gph, pseu); return; } @@ -432,18 +432,18 @@ process_auth_discovery_dht_result (void* cls, /* how did this pass DHT block validation!? */ GNUNET_break (0); process_pseu_result (gph, NULL); - return; + return; } block = data; if (size != - ntohl (block->purpose.size) + + ntohl (block->purpose.size) + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + sizeof (struct GNUNET_CRYPTO_EccSignature)) { /* how did this pass DHT block validation!? */ GNUNET_break (0); process_pseu_result (gph, NULL); - return; + return; } if (GNUNET_OK != GNUNET_NAMESTORE_block_decrypt (block, @@ -455,7 +455,7 @@ process_auth_discovery_dht_result (void* cls, /* other peer encrypted invalid block, complain */ GNUNET_break_op (0); process_pseu_result (gph, NULL); - return; + return; } } @@ -479,7 +479,7 @@ process_zone_to_name_discover (void *cls, { struct GetPseuAuthorityHandle* gph = cls; struct GNUNET_HashCode lookup_key; - + gph->namestore_task = NULL; if (0 != rd_len) { @@ -492,10 +492,10 @@ process_zone_to_name_discover (void *cls, } /* record does not yet exist, go into DHT to find PSEU record */ GNUNET_NAMESTORE_query_from_public_key (&gph->target_zone, - GNUNET_GNS_TLD_PLUS, + GNUNET_GNS_TLD_PLUS, &lookup_key); gph->timeout_task = GNUNET_SCHEDULER_add_delayed (DHT_LOOKUP_TIMEOUT, - &handle_auth_discovery_timeout, + &handle_auth_discovery_timeout, gph); gph->get_handle = GNUNET_DHT_get_start (dht_handle, 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 @@ -#if !defined(GNUENT_W32NSP_LIB_H) -#define GNUENT_W32NSP_LIB_H - -#include - -/* E0D24085-622C-4A93-9A0018-034469DE28DA */ -DEFINE_GUID (GNUNET_NAMESPACE_PROVIDER_DNS, 0xE0D24085L, 0x622C, 0x4A93, 0x9A, 0x18, 0x03, 0x44, 0x69, 0xDE, 0x28, 0xDA); - +#if !defined(GNUENT_W32NSP_LIB_H) +#define GNUENT_W32NSP_LIB_H + +#include + +/* E0D24085-622C-4A93-9A0018-034469DE28DA */ +DEFINE_GUID (GNUNET_NAMESPACE_PROVIDER_DNS, 0xE0D24085L, 0x622C, 0x4A93, 0x9A, 0x18, 0x03, 0x44, 0x69, 0xDE, 0x28, 0xDA); + #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 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + nss-mdns is distributed in the hope that it will be useful, but1 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with nss-mdns; if not, write to the Free Software 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) { * @return 1 if true */ static int verify_name_allowed (const char *name) { - return ends_with(name, ".gnu") || ends_with(name, ".zkey"); + return ends_with(name, ".gnu") || ends_with(name, ".zkey"); } /** @@ -96,7 +96,7 @@ enum nss_status _nss_gns_gethostbyname2_r( int i; size_t address_length, l, idx, astart; int name_allowed; - + if (af == AF_UNSPEC) #ifdef NSS_IPV6_ONLY af = AF_INET6; @@ -105,13 +105,13 @@ enum nss_status _nss_gns_gethostbyname2_r( #endif #ifdef NSS_IPV4_ONLY - if (af != AF_INET) + if (af != AF_INET) #elif NSS_IPV6_ONLY if (af != AF_INET6) -#else +#else if (af != AF_INET && af != AF_INET6) -#endif - { +#endif + { *errnop = EINVAL; *h_errnop = NO_RECOVERY; @@ -122,19 +122,19 @@ enum nss_status _nss_gns_gethostbyname2_r( if (buflen < sizeof(char*)+ /* alias names */ strlen(name)+1) { /* official name */ - + *errnop = ERANGE; *h_errnop = NO_RECOVERY; status = NSS_STATUS_TRYAGAIN; - + goto finish; } - + u.count = 0; u.data_len = 0; name_allowed = verify_name_allowed(name); - + if (name_allowed) { if (!gns_resolve_name(af, name, &u) == 0) @@ -156,22 +156,22 @@ enum nss_status _nss_gns_gethostbyname2_r( goto finish; } - + /* Alias names */ *((char**) buffer) = NULL; result->h_aliases = (char**) buffer; idx = sizeof(char*); - + /* Official name */ - strcpy(buffer+idx, name); + strcpy(buffer+idx, name); result->h_name = buffer+idx; idx += strlen(name)+1; ALIGN(idx); - + result->h_addrtype = af; result->h_length = address_length; - + /* Check if there's enough space for the addresses */ if (buflen < idx+u.data_len+sizeof(char*)*(u.count+1)) { *errnop = ERANGE; @@ -195,7 +195,7 @@ enum nss_status _nss_gns_gethostbyname2_r( result->h_addr_list = (char**) (buffer+idx); status = NSS_STATUS_SUCCESS; - + finish: return status; } @@ -254,9 +254,9 @@ enum nss_status _nss_gns_gethostbyaddr_r( int *h_errnop) { /* we dont do this */ - + enum nss_status status = NSS_STATUS_UNAVAIL; - + *errnop = EINVAL; *h_errnop = NO_RECOVERY; 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 @@ * @param u the userdata (result struct) * @return -1 on error else 0 */ -int +int gns_resolve_name (int af, - const char *name, + const char *name, struct userdata *u) { FILE *p; @@ -47,15 +47,15 @@ gns_resolve_name (int af, if (AF_INET6 == af) { - if (-1 == asprintf (&cmd, - "%s -t AAAA -u %s\n", + if (-1 == asprintf (&cmd, + "%s -t AAAA -u %s\n", "gnunet-gns -r", name)) return -1; } else { - if (-1 == asprintf (&cmd, - "%s %s\n", + if (-1 == asprintf (&cmd, + "%s %s\n", "gnunet-gns -r -u", name)) return -1; } 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, } return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; } - + /* this is a reply */ if (reply_block_size < sizeof (struct GNUNET_NAMESTORE_Block)) { @@ -99,7 +99,7 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, GNUNET_break_op (0); return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; } - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_NAMESTORE_block_verify (block)) { 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 () } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download complete, shutting down!\n"); do_shutdown (); - return; + return; } - GNUNET_assert (CURLM_OK == curl_multi_fdset (multi, &rs, &ws, &es, &max)); + GNUNET_assert (CURLM_OK == curl_multi_fdset (multi, &rs, &ws, &es, &max)); if ( (CURLM_OK != curl_multi_timeout (multi, &timeout)) || (-1 == timeout) ) delay = GNUNET_TIME_UNIT_SECONDS; @@ -239,13 +239,13 @@ curl_main () &nrs, &nws, &curl_task, - NULL); + NULL); } static void start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - GNUNET_asprintf (&url, + GNUNET_asprintf (&url, "http://%s:%d/hello_world", TEST_DOMAIN, PORT); curl = curl_easy_init (); @@ -280,7 +280,7 @@ disco_ns (void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * will match 'result_af' from the request * @param address IP address (struct in_addr or struct in_addr6, depending on 'af') * that the VPN allocated for the redirection; - * traffic to this IP will now be redirected to the + * traffic to this IP will now be redirected to the * specified target peer; NULL on error */ static void @@ -290,12 +290,12 @@ commence_testing (void *cls, int32_t success, const char *emsg) if ((emsg != NULL) && (GNUNET_YES != success)) { - fprintf (stderr, + fprintf (stderr, "NS failed to create record %s\n", emsg); GNUNET_SCHEDULER_shutdown (); return; } - + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1), start_curl, NULL); } @@ -306,7 +306,7 @@ commence_testing (void *cls, int32_t success, const char *emsg) /** * Function to keep the HTTP server running. */ -static void +static void mhd_main (void); @@ -320,7 +320,7 @@ mhd_task (void *cls, } -static void +static void mhd_main () { struct GNUNET_NETWORK_FDSet nrs; @@ -355,7 +355,7 @@ mhd_main () &nrs, &nws, &mhd_task, - NULL); + NULL); } static void @@ -367,7 +367,7 @@ run (void *cls, struct GNUNET_CRYPTO_EccPrivateKey *host_key; struct GNUNET_NAMESTORE_RecordData rd; char *zone_keyfile; - + namestore = GNUNET_NAMESTORE_connect (cfg); GNUNET_assert (NULL != namestore); flags = MHD_USE_DEBUG; @@ -396,7 +396,7 @@ run (void *cls, do_shutdown (); return; } - + proxy_proc = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL, @@ -412,7 +412,7 @@ run (void *cls, do_shutdown (); return; } - + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", "ZONEKEY", &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 () } -static void +static void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { @@ -186,7 +186,7 @@ on_lookup_result (void *cls, uint32_t rd_count, struct in_addr a; int i; char* addr; - + if (rd_count == 0) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -267,7 +267,7 @@ put_pseu_dht (void *cls, int success) char* nrb_data = NULL; struct GNUNET_CRYPTO_EccSignature *sig; struct GNUNET_NAMESTORE_RecordData rd; - + memset (&rd, 0, sizeof (struct GNUNET_NAMESTORE_RecordData)); rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; rd.data_size = strlen(TEST_PSEU_ALICE)+1; @@ -336,7 +336,7 @@ put_pseu_dht (void *cls, int success) DHT_OPERATION_TIMEOUT, &commence_testing, NULL); - + GNUNET_free(sig); GNUNET_free (nrb); } @@ -357,19 +357,19 @@ put_www_dht (void *cls, int success) struct GNUNET_NAMESTORE_RecordData rd; char* ip = TEST_IP; struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr)); - + rd.expiration_time = UINT64_MAX; GNUNET_assert(1 == inet_pton (AF_INET, ip, web)); rd.data_size = sizeof(struct in_addr); rd.data = web; rd.record_type = GNUNET_DNSPARSER_TYPE_A; rd.flags = GNUNET_NAMESTORE_RF_NONE; - + sig = GNUNET_NAMESTORE_create_signature(alice_key, GNUNET_TIME_UNIT_FOREVER_ABS, TEST_RECORD_NAME, &rd, 1); - + GNUNET_break (GNUNET_OK == GNUNET_NAMESTORE_verify_signature (&alice_pkey, GNUNET_TIME_UNIT_FOREVER_ABS, TEST_RECORD_NAME, @@ -443,13 +443,13 @@ put_pkey_dht (void *cls, int32_t success, const char *emsg) char* nrb_data = NULL; struct GNUNET_CRYPTO_EccSignature *sig; struct GNUNET_NAMESTORE_RecordData rd; - + rd.expiration_time = UINT64_MAX; rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode); rd.data = &alice_hash; rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; rd.flags = GNUNET_NAMESTORE_RF_NONE; - + sig = GNUNET_NAMESTORE_create_signature (bob_key, GNUNET_TIME_UNIT_FOREVER_ABS, TEST_AUTHORITY_ALICE, @@ -474,7 +474,7 @@ put_pkey_dht (void *cls, int32_t success, const char *emsg) { GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n"); ok = 3; - + GNUNET_free (our_key); GNUNET_free (bob_key); GNUNET_free (alice_key); @@ -492,7 +492,7 @@ put_pkey_dht (void *cls, int32_t success, const char *emsg) &zone_hash); GNUNET_CRYPTO_short_hash_double(&zone_hash, &zone_hash_double); GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double); - GNUNET_CRYPTO_hash_xor(&zone_hash_double, &name_hash_double, &xor_hash); + GNUNET_CRYPTO_hash_xor(&zone_hash_double, &name_hash_double, &xor_hash); rd_payload_length += sizeof(struct GNSNameRecordBlock) + strlen(TEST_AUTHORITY_ALICE) + 1; @@ -520,7 +520,7 @@ fin_init_zone (void *cls, int32_t success, const char *emsg) rd.data = &bob_hash; rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; rd.flags = GNUNET_NAMESTORE_RF_NONE; - + GNUNET_NAMESTORE_record_put_by_authority (namestore_handle, our_key, TEST_AUTHORITY_BOB, @@ -560,7 +560,7 @@ do_check (void *cls, char *shorten_keyfile; char *our_keyfile; struct GNUNET_NAMESTORE_RecordData rd; - + cfg = ccfg; die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); @@ -572,7 +572,7 @@ do_check (void *cls, end_badly_now(); return; } - + /* dht */ dht_handle = GNUNET_DHT_connect(cfg, 1); if (NULL == dht_handle) @@ -591,7 +591,7 @@ do_check (void *cls, GNUNET_free (our_keyfile); return; } - + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", "SHORTEN_ZONEKEY", &shorten_keyfile)) @@ -603,7 +603,7 @@ do_check (void *cls, GNUNET_free (shorten_keyfile); return; } - + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", "PRIVATE_ZONEKEY", &private_keyfile)) @@ -621,7 +621,7 @@ do_check (void *cls, short_key = GNUNET_CRYPTO_ecc_key_create_from_file (shorten_keyfile); bob_key = GNUNET_CRYPTO_ecc_key_create (); alice_key = GNUNET_CRYPTO_ecc_key_create (); - + GNUNET_free (our_keyfile); GNUNET_free (shorten_keyfile); GNUNET_free (private_keyfile); @@ -636,7 +636,7 @@ do_check (void *cls, GNUNET_CRYPTO_short_hash (&our_pkey, sizeof(our_pkey), &our_zone); GNUNET_CRYPTO_short_hash (&priv_pkey, sizeof(priv_pkey), &priv_zone); GNUNET_CRYPTO_short_hash (&short_pkey, sizeof(short_pkey), &short_zone); - + rd.expiration_time = UINT64_MAX; rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode); 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 () } -static void +static void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { @@ -109,7 +109,7 @@ on_lookup_result(void *cls, uint32_t rd_count, struct in_addr a; int i; char* addr; - + if (GNUNET_SCHEDULER_NO_TASK != die_task) { GNUNET_SCHEDULER_cancel (die_task); @@ -221,7 +221,7 @@ do_check (void *cls, struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr)); rd.expiration_time = UINT64_MAX; GNUNET_assert(1 == inet_pton (AF_INET, ip, web)); - + GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash); 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) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shorten test succeeded!\n"); ok = 0; } - + GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); } @@ -205,7 +205,7 @@ void do_check (void *cls, end_badly_now (); return; } - + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", "SHORTEN_ZONEKEY", &shorten_keyfile)) @@ -215,7 +215,7 @@ void do_check (void *cls, end_badly_now (); return; } - + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", "PRIVATE_ZONEKEY", &private_keyfile)) @@ -236,7 +236,7 @@ void do_check (void *cls, GNUNET_free(shorten_keyfile); GNUNET_free(private_keyfile); - + GNUNET_CRYPTO_ecc_key_get_public_for_signature (our_key, &our_pkey); GNUNET_CRYPTO_ecc_key_get_public_for_signature (alice_key, &alice_pkey); GNUNET_CRYPTO_ecc_key_get_public_for_signature (bob_key, &bob_pkey); @@ -251,14 +251,14 @@ void do_check (void *cls, struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr)); rd.expiration_time = UINT64_MAX; GNUNET_assert(1 == inet_pton (AF_INET, ip, web)); - + GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash); rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode); rd.data = &bob_hash; rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; rd.flags = GNUNET_NAMESTORE_RF_NONE; - + /* put bob into our zone */ GNUNET_NAMESTORE_record_put_by_authority (namestore_handle, our_key, @@ -267,7 +267,7 @@ void do_check (void *cls, &rd, NULL, NULL); - + /* put alice into bobs zone */ GNUNET_CRYPTO_short_hash(&alice_pkey, sizeof(alice_pkey), &alice_hash); rd.data = &alice_hash; @@ -305,7 +305,7 @@ void do_check (void *cls, sig, NULL, NULL); - + rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode); rd.data = &alice_hash; rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; @@ -336,7 +336,7 @@ main (int argc, char *argv[]) "WARNING", NULL); GNUNET_TESTING_peer_run ("test-gns-simple-shorten", - "test_gns_simple_lookup.conf", + "test_gns_simple_lookup.conf", &do_check, NULL); return ok; } 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, int i; uint16_t *srv_data; char* srv; - + if (GNUNET_SCHEDULER_NO_TASK != die_task) { GNUNET_SCHEDULER_cancel (die_task); @@ -229,7 +229,7 @@ do_check (void *cls, rd.expiration_time = UINT64_MAX; GNUNET_assert(1 == inet_pton (AF_INET, ip, sipserver)); - + GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash); rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode); @@ -262,7 +262,7 @@ do_check (void *cls, NULL, NULL); GNUNET_free (sig); - + rd.data_size = sizeof (struct GNUNET_TUN_DnsSrvRecord)+strlen(TEST_SRV_NAME)+1; srv_data->port = srv_port; 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 () } -static void +static void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { @@ -110,7 +110,7 @@ on_lookup_result(void *cls, uint32_t rd_count, struct in_addr a; int i; char* addr; - + if (GNUNET_SCHEDULER_NO_TASK != die_task) { GNUNET_SCHEDULER_cancel (die_task); @@ -150,7 +150,7 @@ on_lookup_result(void *cls, uint32_t rd_count, } } } - + GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); } @@ -165,7 +165,7 @@ commence_testing (void *cls, int32_t success, const char *emsg) char name[GNUNET_DNSPARSER_MAX_NAME_LENGTH]; char* pos; struct GNUNET_CRYPTO_ShortHashAsciiEncoded hash_str; - + gns_handle = GNUNET_GNS_connect(cfg); if (NULL == gns_handle) { @@ -286,8 +286,8 @@ main (int argc, char *argv[]) GNUNET_log_setup ("test-gns-simple-zkey-lookup", "WARNING", NULL); - GNUNET_TESTING_peer_run ("test-gns-simple-zkey-lookup", - "test_gns_simple_lookup.conf", + GNUNET_TESTING_peer_run ("test-gns-simple-zkey-lookup", + "test_gns_simple_lookup.conf", &do_check, NULL); return ok; } 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 @@ -/* - This file is part of GNUnet. - (C) 2012 Christian Grothoff (and other contributing authors) - - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. - - GNUnet is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ -/** - * @file gns/w32nsp-install.c - * @brief W32 integration installer for GNS - * @author LRN - */ - -#define INITGUID -#include -#include -#include -#include "gnunet_w32nsp_lib.h" -#include - -int -main (int argc, char **argv) -{ - int ret; - int r = 1; - WSADATA wsd; - GUID id = GNUNET_NAMESPACE_PROVIDER_DNS; - wchar_t *cmdl; - int wargc; - wchar_t **wargv; - - if (WSAStartup(MAKEWORD(2,2), &wsd) != 0) - { - fprintf (stderr, "WSAStartup() failed: %lu\n", GetLastError()); - return 5; - } - - cmdl = GetCommandLineW (); - if (cmdl == NULL) - { - WSACleanup(); - return 2; - } - wargv = CommandLineToArgvW (cmdl, &wargc); - if (wargv == NULL) - { - WSACleanup(); - return 3; - } - r = 4; - - if (wargc == 2) - { - ret = WSCInstallNameSpace (L"GNUnet DNS provider", wargv[1], NS_DNS, 1, &id); - if (ret == NO_ERROR) - { - r = 0; - } - else - { - r = 1; - fprintf (stderr, - "WSCInstallNameSpace(L\"GNUnet DNS provider\", \"%S\", %d, 0, %p) failed: %lu\n", - wargv[1], NS_DNS, &id, GetLastError ()); - } - } - WSACleanup(); - return r; -} +/* + This file is part of GNUnet. + (C) 2012 Christian Grothoff (and other contributing authors) + + GNUnet is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNUnet; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +/** + * @file gns/w32nsp-install.c + * @brief W32 integration installer for GNS + * @author LRN + */ + +#define INITGUID +#include +#include +#include +#include "gnunet_w32nsp_lib.h" +#include + +int +main (int argc, char **argv) +{ + int ret; + int r = 1; + WSADATA wsd; + GUID id = GNUNET_NAMESPACE_PROVIDER_DNS; + wchar_t *cmdl; + int wargc; + wchar_t **wargv; + + if (WSAStartup(MAKEWORD(2,2), &wsd) != 0) + { + fprintf (stderr, "WSAStartup() failed: %lu\n", GetLastError()); + return 5; + } + + cmdl = GetCommandLineW (); + if (cmdl == NULL) + { + WSACleanup(); + return 2; + } + wargv = CommandLineToArgvW (cmdl, &wargc); + if (wargv == NULL) + { + WSACleanup(); + return 3; + } + r = 4; + + if (wargc == 2) + { + ret = WSCInstallNameSpace (L"GNUnet DNS provider", wargv[1], NS_DNS, 1, &id); + if (ret == NO_ERROR) + { + r = 0; + } + else + { + r = 1; + fprintf (stderr, + "WSCInstallNameSpace(L\"GNUnet DNS provider\", \"%S\", %d, 0, %p) failed: %lu\n", + wargv[1], NS_DNS, &id, GetLastError ()); + } + } + WSACleanup(); + return r; +} 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 @@ typedef int (WSPAPI *LPNSPSTARTUP) (LPGUID lpProviderId, LPNSP_ROUTINE lpnspRoutines); GUID host = {0x0002a800,0,0,{ 0xC0,0,0,0,0,0,0,0x46 }}; -GUID ip4 = {0x00090035,0,1,{ 0xc0,0,0,0,0,0,0,0x046}}; +GUID ip4 = {0x00090035,0,1,{ 0xc0,0,0,0,0,0,0,0x046}}; GUID ip6 = {0x00090035,0,0x001c, { 0xc0,0,0,0,0,0,0,0x046}}; DEFINE_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 // to convert structures returned as BLOBs. // -VOID +VOID FixList(PCHAR ** List, PCHAR Base) { if(*List) @@ -78,7 +78,7 @@ FixList(PCHAR ** List, PCHAR Base) // Routine to convert a hostent returned in a BLOB to one with // usable pointers. The structure is converted in-place. // -VOID +VOID UnpackHostEnt(struct hostent * hostent) { PCHAR pch; @@ -210,7 +210,7 @@ main (int argc, char **argv) if (wargc == 5) { HMODULE nsp; - + nsp = LoadLibraryW (wargv[3]); if (nsp == NULL) { 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 @@ -#define INITGUID -#include -#include -#include -#include "gnunet_w32nsp_lib.h" -#include - -int -main (int argc, char **argv) -{ - int ret; - GUID id = GNUNET_NAMESPACE_PROVIDER_DNS; - WSADATA wsd; - - if (WSAStartup(MAKEWORD(2,2), &wsd) != 0) - { - fprintf (stderr, "WSAStartup() failed: %lu\n", GetLastError()); - return 5; - } - - ret = WSCUnInstallNameSpace (&id); - if (ret == NO_ERROR) - { - WSACleanup (); - return 0; - } - fprintf (stderr, "WSCUnInstallNameSpace() failed: %lu\n", GetLastError ()); - WSACleanup (); - return 1; +#define INITGUID +#include +#include +#include +#include "gnunet_w32nsp_lib.h" +#include + +int +main (int argc, char **argv) +{ + int ret; + GUID id = GNUNET_NAMESPACE_PROVIDER_DNS; + WSADATA wsd; + + if (WSAStartup(MAKEWORD(2,2), &wsd) != 0) + { + fprintf (stderr, "WSAStartup() failed: %lu\n", GetLastError()); + return 5; + } + + ret = WSCUnInstallNameSpace (&id); + if (ret == NO_ERROR) + { + WSACleanup (); + return 0; + } + fprintf (stderr, "WSCUnInstallNameSpace() failed: %lu\n", GetLastError ()); + WSACleanup (); + return 1; } \ 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 * Where to add. */ char *buf; - + /** * Maximum number of bytes left */ @@ -65,7 +65,7 @@ add_to_buf (void *cls, const struct GNUNET_HELLO_Address *address, struct AddContext *ac = cls; size_t ret; - ret = GNUNET_HELLO_add_address (address, + ret = GNUNET_HELLO_add_address (address, GNUNET_TIME_UNIT_FOREVER_ABS, ac->buf, ac->max); @@ -97,7 +97,7 @@ add_from_hello (void *cls, size_t max, void *buf) ac.max = max; ac.ret = 0; GNUNET_assert (NULL == - GNUNET_HELLO_iterate_addresses (*orig, + GNUNET_HELLO_iterate_addresses (*orig, GNUNET_NO, &add_to_buf, &ac)); *orig = NULL; @@ -145,7 +145,7 @@ main (int argc, char *argv[]) argv[1]); return 1; } - fh = GNUNET_DISK_file_open (argv[1], + fh = GNUNET_DISK_file_open (argv[1], GNUNET_DISK_OPEN_READ, GNUNET_DISK_PERM_USER_READ); if (NULL == fh) @@ -158,8 +158,8 @@ main (int argc, char *argv[]) } { char buf[fsize] GNUNET_ALIGN; - - GNUNET_assert (fsize == + + GNUNET_assert (fsize == GNUNET_DISK_file_read (fh, buf, fsize)); GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh)); orig = (struct GNUNET_HELLO_Message *) buf; @@ -174,7 +174,7 @@ main (int argc, char *argv[]) result = GNUNET_HELLO_create (&pk, &add_from_hello, &orig, GNUNET_HELLO_is_friend_only (orig)); GNUNET_assert (NULL != result); - fh = GNUNET_DISK_file_open (argv[1], + fh = GNUNET_DISK_file_open (argv[1], GNUNET_DISK_OPEN_WRITE, GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); 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, */ static size_t get_hello_address_size (const char *buf, - size_t max, + size_t max, uint16_t *ralen) { const char *pos; @@ -716,9 +716,9 @@ GNUNET_HELLO_get_last_expiration (const struct GNUNET_HELLO_Message *msg) * maybe differenciated into additional subcategories if applicable. * This module only deals with hello identifiers (MODULE = "hello"). *

- * + * * The concrete URI format is: - * + * * "gnunet://hello/PEER[!YYYYMMDDHHMMSS!!

]...". * These URIs can be used to add a peer record to peerinfo service. * 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) * TYPE is a transport type. * ADDRESS is the address, its format depends upon the transport type. * The concrete transport types and corresponding address formats are: - * + * *
  • - * + * * !IPADDRESS * IPVDDRESS is either IPV4 .-delimited address in form of XXX.XXX.XXX.XXX:PPPPP * or IPV6 :-delimited address, but with '(' and ')' instead of '[' and ']' (RFC2396 advises against using square brackets in URIs): * (XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX):PPPPP * PPPPP is the port number. May be 0. - * + * *
  • - * + * * [add SMTP, HTTP and other addresses here] - * + * *
- * + * * The encoding for hexadecimal values is defined in the crypto_hash.c * module in the gnunetutil library and discussed there. - * + * * Examples: - * + * * gnunet://hello/0430205UC7D56PTQK8NV05776671CNN44FK4TL6D0GQ35OMF8MEN4RNMKA5UF6AL3DQO8B1SC5AQF50SQ2MABIRU4HC8H2HAJKJ59JL1JVRJAK308F9GASRFLMGUBB5TQ5AKR94AS5T3MDG8B9O1EMPRKB0HVCG7T6QPP4CDJ913LAEHVJ2DI1TOBB15Q1JIT5ARBOD12U4SIGRFDV3Q7T66G4TBVSJJ90UQF1BG29TGJJKLGEIMSPHHKO544D6EALQ4F2K0416311JC22GVAD48R616I7VK03K7MP7N0RS2MBV1TE9JV8CK1LSQMR7KCDRTLDA6917UGA67DHTGHERIACCGQ54TGSR48RMSGS9BA5HLMOKASFC1I6V4TT09TUGCU8GNDHQF0JF3H7LPV59UL5I38QID040G000!20120302010059!TCP!192.168.0.1:2086!TCP!64.23.8.174:0 * gnunet://hello/0430205UC7D56PTQK8NV05776671CNN44FK4TL6D0GQ35OMF8MEN4RNMKA5UF6AL3DQO8B1SC5AQF50SQ2MABIRU4HC8H2HAJKJ59JL1JVRJAK308F9GASRFLMGUBB5TQ5AKR94AS5T3MDG8B9O1EMPRKB0HVCG7T6QPP4CDJ913LAEHVJ2DI1TOBB15Q1JIT5ARBOD12U4SIGRFDV3Q7T66G4TBVSJJ90UQF1BG29TGJJKLGEIMSPHHKO544D6EALQ4F2K0416311JC22GVAD48R616I7VK03K7MP7N0RS2MBV1TE9JV8CK1LSQMR7KCDRTLDA6917UGA67DHTGHERIACCGQ54TGSR48RMSGS9BA5HLMOKASFC1I6V4TT09TUGCU8GNDHQF0JF3H7LPV59UL5I38QID040G000!20120302010059!TCP!(2001:db8:85a3:8d3:1319:8a2e:370:7348):2086 - * + * *

*/ 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) GNUNET_STATISTICS_set (stats, gettext_noop ("# milliseconds between hostlist downloads"), - hostlist_delay.rel_value_us / 1000LL, + hostlist_delay.rel_value_us / 1000LL, GNUNET_YES); if (0 == once) { 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, else { builder = GNUNET_malloc (sizeof (struct HostSet)); - } - GNUNET_assert (NULL != peerinfo); + } + GNUNET_assert (NULL != peerinfo); builder->pitr = GNUNET_PEERINFO_iterate (peerinfo, GNUNET_NO, NULL, GNUNET_TIME_UNIT_MINUTES, &host_processor, NULL); @@ -601,7 +601,7 @@ GNUNET_HOSTLIST_server_start (const struct GNUNET_CONFIGURATION_Handle *c, GNUNET_CONFIGURATION_get_value_string (cfg, "HOSTLIST", "BINDTOIP", &ip)); } - else + else ip = NULL; if (NULL != ip) { 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, int main (int argcx, char *argvx[]) { - static char *const argv[] = { + static char *const argv[] = { "test-gnunet-daemon-hostlist", "-c", "test_gnunet_daemon_hostlist_data.conf", 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, { GNUNET_IDENTITY_cancel (delete_op); delete_op = NULL; - } + } GNUNET_IDENTITY_disconnect (sh); sh = NULL; } @@ -121,7 +121,7 @@ test_finished () (NULL == set_op) && (NULL == set_ego) && (! list) && - (! monitor) ) + (! monitor) ) GNUNET_SCHEDULER_shutdown (); } @@ -201,11 +201,11 @@ set_done (void *cls, * 'ego' does indicate an error (i.e. name is taken or no default * value is known). If 'ego' is non-NULL and if '*ctx' * is set in those callbacks, the value WILL be passed to a subsequent - * call to the identity callback of 'GNUNET_IDENTITY_connect' (if + * call to the identity callback of 'GNUNET_IDENTITY_connect' (if * that one was not NULL). * * When an identity is renamed, this function is called with the - * (known) ego but the NEW identifier. + * (known) ego but the NEW identifier. * * When an identity is deleted, this function is called with the * (known) ego and "NULL" for the 'identifier'. In this case, @@ -232,7 +232,7 @@ print_ego (void *cls, if ( (NULL != set_ego) && (NULL != ego) && (NULL != identifier) && - (0 == strcmp (identifier, + (0 == strcmp (identifier, set_ego)) ) { set_op = GNUNET_IDENTITY_set (sh, @@ -348,7 +348,7 @@ main (int argc, char *const *argv) return 2; res = GNUNET_PROGRAM_run (argc, argv, "gnunet-identity", - gettext_noop ("Maintain egos"), + gettext_noop ("Maintain egos"), options, &run, NULL); 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 /** * We keep egos in a DLL. - */ + */ struct Ego *next; /** * We keep egos in a DLL. - */ + */ struct Ego *prev; /** @@ -195,7 +195,7 @@ send_result_code (struct GNUNET_SERVER_Client *client, "Sending result %d (%s) to client\n", (int) result_code, emsg); - GNUNET_SERVER_notification_context_unicast (nc, client, &rcm->header, GNUNET_NO); + GNUNET_SERVER_notification_context_unicast (nc, client, &rcm->header, GNUNET_NO); GNUNET_free (rcm); } @@ -211,7 +211,7 @@ create_update_message (struct Ego *ego) { struct GNUNET_IDENTITY_UpdateMessage *um; size_t name_len; - + name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1); um = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_UpdateMessage) + name_len); um->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE); @@ -252,7 +252,7 @@ create_set_default_message (struct Ego *ego, /** * Handler for START message from client, sends information - * about all identities to the client immediately and + * about all identities to the client immediately and * adds the client to the notification context for future * updates. * @@ -268,7 +268,7 @@ handle_start_message (void *cls, struct GNUNET_SERVER_Client *client, struct GNUNET_IDENTITY_UpdateMessage ume; struct Ego *ego; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received START message from client\n"); GNUNET_SERVER_notification_context_add (nc, client); for (ego = ego_head; NULL != ego; ego = ego->next) @@ -282,7 +282,7 @@ handle_start_message (void *cls, struct GNUNET_SERVER_Client *client, ume.header.size = htons (sizeof (struct GNUNET_IDENTITY_UpdateMessage)); ume.end_of_list = htons (GNUNET_YES); ume.name_len = htons (0); - GNUNET_SERVER_notification_context_unicast (nc, client, &ume.header, GNUNET_NO); + GNUNET_SERVER_notification_context_unicast (nc, client, &ume.header, GNUNET_NO); GNUNET_SERVER_receive_done (client, GNUNET_OK); } @@ -325,7 +325,7 @@ handle_get_default_message (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); return; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received GET_DEFAULT for service `%s' from client\n", name); if (GNUNET_OK != @@ -335,7 +335,7 @@ handle_get_default_message (void *cls, struct GNUNET_SERVER_Client *client, &identifier)) { send_result_code (client, 1, gettext_noop ("no default known")); - GNUNET_SERVER_receive_done (client, GNUNET_OK); + GNUNET_SERVER_receive_done (client, GNUNET_OK); return; } for (ego = ego_head; NULL != ego; ego = ego->next) @@ -356,7 +356,7 @@ handle_get_default_message (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to find ego `%s'\n", name); - send_result_code (client, 1, + send_result_code (client, 1, gettext_noop ("default configured, but ego unknown (internal error)")); GNUNET_SERVER_receive_done (client, GNUNET_OK); } @@ -364,7 +364,7 @@ handle_get_default_message (void *cls, struct GNUNET_SERVER_Client *client, /** * Compare the given two private keys for equality. - * + * * @param pk1 one private key * @param pk2 another private key * @return 0 if the keys are equal @@ -405,7 +405,7 @@ handle_set_default_message (void *cls, struct GNUNET_SERVER_Client *client, sdm = (const struct GNUNET_IDENTITY_SetDefaultMessage *) message; name_len = ntohs (sdm->name_len); GNUNET_break (0 == ntohs (sdm->reserved)); - if (name_len + sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) != size) + if (name_len + sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) != size) { GNUNET_break (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); @@ -418,7 +418,7 @@ handle_set_default_message (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); return; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received SET_DEFAULT for service `%s' from client\n", str); for (ego = ego_head; NULL != ego; ego = ego->next) @@ -430,7 +430,7 @@ handle_set_default_message (void *cls, struct GNUNET_SERVER_Client *client, str, "DEFAULT_IDENTIFIER", ego->identifier); - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_CONFIGURATION_write (subsystem_cfg, subsystem_cfg_file)) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -440,7 +440,7 @@ handle_set_default_message (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_SERVER_receive_done (client, GNUNET_OK); return; } - } + } send_result_code (client, 1, _("Unknown ego specified for service (internal error)")); GNUNET_SERVER_receive_done (client, GNUNET_OK); } @@ -481,7 +481,7 @@ handle_create_message (void *cls, struct GNUNET_SERVER_Client *client, const char *str; char *fn; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREATE message from client\n"); size = ntohs (message->size); if (size <= sizeof (struct GNUNET_IDENTITY_CreateRequestMessage)) @@ -493,7 +493,7 @@ handle_create_message (void *cls, struct GNUNET_SERVER_Client *client, crm = (const struct GNUNET_IDENTITY_CreateRequestMessage *) message; name_len = ntohs (crm->name_len); GNUNET_break (0 == ntohs (crm->reserved)); - if (name_len + sizeof (struct GNUNET_IDENTITY_CreateRequestMessage) != size) + if (name_len + sizeof (struct GNUNET_IDENTITY_CreateRequestMessage) != size) { GNUNET_break (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); @@ -528,14 +528,14 @@ handle_create_message (void *cls, struct GNUNET_SERVER_Client *client, (void) GNUNET_DISK_directory_create_for_file (fn); if (sizeof (struct GNUNET_CRYPTO_EccPrivateKey) != GNUNET_DISK_fn_write (fn, - &crm->private_key, + &crm->private_key, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE)) GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", fn); GNUNET_free (fn); - notify_listeners (ego); + notify_listeners (ego); GNUNET_SERVER_receive_done (client, GNUNET_OK); } @@ -543,7 +543,7 @@ handle_create_message (void *cls, struct GNUNET_SERVER_Client *client, /** * Closure for 'handle_ego_rename'. */ -struct RenameContext +struct RenameContext { /** * Old name. @@ -579,14 +579,14 @@ handle_ego_rename (void *cls, return; if (0 != strcmp (id, rc->old_name)) { - GNUNET_free (id); + GNUNET_free (id); return; } GNUNET_CONFIGURATION_set_value_string (subsystem_cfg, section, "DEFAULT_IDENTIFIER", rc->new_name); - GNUNET_free (id); + GNUNET_free (id); } @@ -613,7 +613,7 @@ handle_rename_message (void *cls, struct GNUNET_SERVER_Client *client, char *fn_old; char *fn_new; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received RENAME message from client\n"); size = ntohs (message->size); if (size <= sizeof (struct GNUNET_IDENTITY_RenameMessage)) @@ -643,7 +643,7 @@ handle_rename_message (void *cls, struct GNUNET_SERVER_Client *client, new_name)) { send_result_code (client, 1, gettext_noop ("target name already exists")); - GNUNET_SERVER_receive_done (client, GNUNET_OK); + GNUNET_SERVER_receive_done (client, GNUNET_OK); return; } } @@ -661,14 +661,14 @@ handle_rename_message (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg, &handle_ego_rename, &rename_ctx); - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_CONFIGURATION_write (subsystem_cfg, subsystem_cfg_file)) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to write subsystem default identifier map to `%s'.\n"), subsystem_cfg_file); ego->identifier = GNUNET_strdup (new_name); - fn_new = get_ego_filename (ego); + fn_new = get_ego_filename (ego); if (0 != RENAME (fn_old, fn_new)) GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "rename", fn_old); GNUNET_free (fn_old); @@ -708,14 +708,14 @@ handle_ego_delete (void *cls, return; if (0 != strcmp (id, identifier)) { - GNUNET_free (id); + GNUNET_free (id); return; } GNUNET_CONFIGURATION_set_value_string (subsystem_cfg, section, "DEFAULT_IDENTIFIER", NULL); - GNUNET_free (id); + GNUNET_free (id); } @@ -738,7 +738,7 @@ handle_delete_message (void *cls, struct GNUNET_SERVER_Client *client, const char *name; char *fn; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received DELETE message from client\n"); size = ntohs (message->size); if (size <= sizeof (struct GNUNET_IDENTITY_DeleteMessage)) @@ -769,7 +769,7 @@ handle_delete_message (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg, &handle_ego_delete, ego->identifier); - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_CONFIGURATION_write (subsystem_cfg, subsystem_cfg_file)) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -830,7 +830,7 @@ process_ego_file (void *cls, } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Loaded ego `%s'\n", - fn + 1); + fn + 1); ego->identifier = GNUNET_strdup (fn + 1); GNUNET_CONTAINER_DLL_insert (ego_head, ego_tail, @@ -847,7 +847,7 @@ process_ego_file (void *cls, * @param c configuration to use */ static void -run (void *cls, +run (void *cls, struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c) { @@ -892,7 +892,7 @@ run (void *cls, subsystem_cfg = GNUNET_CONFIGURATION_create (); if ( (GNUNET_YES == GNUNET_DISK_file_test (subsystem_cfg_file)) && - (GNUNET_OK != + (GNUNET_OK != GNUNET_CONFIGURATION_parse (subsystem_cfg, subsystem_cfg_file)) ) { @@ -931,7 +931,7 @@ int main (int argc, char *const *argv) { return (GNUNET_OK == - GNUNET_SERVICE_run (argc, argv, "identity", + GNUNET_SERVICE_run (argc, argv, "identity", GNUNET_SERVICE_OPTION_NONE, &run, NULL)) ? 0 : 1; } 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 uint16_t reserved GNUNET_PACKED; /** - * The private key + * The private key */ struct GNUNET_CRYPTO_EccPrivateKey private_key; @@ -149,7 +149,7 @@ struct GNUNET_IDENTITY_SetDefaultMessage /** * Client requests creation of an identity. Service - * will respond with a result code. + * will respond with a result code. */ struct GNUNET_IDENTITY_CreateRequestMessage { @@ -169,7 +169,7 @@ struct GNUNET_IDENTITY_CreateRequestMessage uint16_t reserved GNUNET_PACKED; /** - * The private key + * The private key */ struct GNUNET_CRYPTO_EccPrivateKey private_key; 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 @@ #define LOG(kind,...) GNUNET_log_from (kind, "identity-api",__VA_ARGS__) -/** +/** * Handle for an ego. */ struct GNUNET_IDENTITY_Ego @@ -59,7 +59,7 @@ struct GNUNET_IDENTITY_Ego }; -/** +/** * Handle for an operation with the identity service. */ struct GNUNET_IDENTITY_Operation @@ -69,7 +69,7 @@ struct GNUNET_IDENTITY_Operation * Main identity handle. */ struct GNUNET_IDENTITY_Handle *h; - + /** * We keep operations in a DLL. */ @@ -139,12 +139,12 @@ struct GNUNET_IDENTITY_Handle /** * Head of active operations. - */ + */ struct GNUNET_IDENTITY_Operation *op_head; /** * Tail of active operations. - */ + */ struct GNUNET_IDENTITY_Operation *op_tail; /** @@ -172,7 +172,7 @@ struct GNUNET_IDENTITY_Handle /** * Obtain the ego representing 'anonymous' users. - * + * * @return handle for the anonymous user, must not be freed */ const struct GNUNET_IDENTITY_Ego * @@ -240,7 +240,7 @@ reschedule_connect (struct GNUNET_IDENTITY_Handle *h) * @param msg message received, NULL on timeout or fatal error */ static void -message_handler (void *cls, +message_handler (void *cls, const struct GNUNET_MessageHeader *msg) { struct GNUNET_IDENTITY_Handle *h = cls; @@ -307,7 +307,7 @@ message_handler (void *cls, } um = (const struct GNUNET_IDENTITY_UpdateMessage *) msg; name_len = ntohs (um->name_len); - + str = (const char *) &um[1]; if ( (size != name_len + sizeof (struct GNUNET_IDENTITY_UpdateMessage)) || ( (0 != name_len) && @@ -369,7 +369,7 @@ message_handler (void *cls, /* ego changed name */ GNUNET_free (ego->name); ego->name = GNUNET_strdup (str); - } + } GNUNET_CLIENT_receive (h->client, &message_handler, h, GNUNET_TIME_UNIT_FOREVER_REL); /* inform application about change */ @@ -456,14 +456,14 @@ transmit_next (struct GNUNET_IDENTITY_Handle *h); * @return number of bytes copied to buf */ static size_t -send_next_message (void *cls, - size_t size, +send_next_message (void *cls, + size_t size, void *buf) { struct GNUNET_IDENTITY_Handle *h = cls; struct GNUNET_IDENTITY_Operation *op = h->op_head; size_t ret; - + h->th = NULL; if (NULL == op) return 0; @@ -472,7 +472,7 @@ send_next_message (void *cls, { reschedule_connect (h); return 0; - } + } LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending message of type %d to identity service\n", ntohs (op->msg->type)); @@ -543,7 +543,7 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if ( (NULL == h->op_head) || (GNUNET_MESSAGE_TYPE_IDENTITY_START != ntohs (h->op_head->msg->type)) ) { - op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) + + op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) + sizeof (struct GNUNET_MessageHeader)); op->h = h; op->msg = (const struct GNUNET_MessageHeader *) &op[1]; @@ -633,7 +633,7 @@ GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *id, struct GNUNET_IDENTITY_GetDefaultMessage *gdm; size_t slen; - slen = strlen (service_name) + 1; + slen = strlen (service_name) + 1; if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_GetDefaultMessage)) { GNUNET_break (0); @@ -641,7 +641,7 @@ GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *id, } op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) + sizeof (struct GNUNET_IDENTITY_GetDefaultMessage) + - slen); + slen); op->h = id; op->cb = cb; op->cls = cb_cls; @@ -691,7 +691,7 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *id, } op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) + sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) + - slen); + slen); op->h = id; op->cont = cont; op->cls = cont_cls; @@ -713,7 +713,7 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *id, } -/** +/** * Create a new identity with the given name. * * @param id identity service to use @@ -744,7 +744,7 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, } op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) + sizeof (struct GNUNET_IDENTITY_CreateRequestMessage) + - slen); + slen); op->h = id; op->cont = cont; op->cls = cont_cls; @@ -767,7 +767,7 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, } -/** +/** * Renames an existing identity. * * @param id identity service to use @@ -824,7 +824,7 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id, } -/** +/** * Delete an existing identity. * * @param id identity service to use @@ -851,7 +851,7 @@ GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *id, } op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) + sizeof (struct GNUNET_IDENTITY_DeleteMessage) + - slen); + slen); op->h = id; op->cont = cb; 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 @@ /** * Handle for ego lookup. - */ + */ struct GNUNET_IDENTITY_EgoLookup { - + /** * Handle to the identity service. */ struct GNUNET_IDENTITY_Handle *identity; - + /** * Name of the ego we are looking up. */ char *name; - + /** * Function to call with the result. */ GNUNET_IDENTITY_EgoCallback cb; - + /** * Closure for @e cb */ @@ -58,7 +58,7 @@ struct GNUNET_IDENTITY_EgoLookup }; -/** +/** * Method called to inform about the egos of this peer. * * When used with #GNUNET_IDENTITY_connect, this function is @@ -81,7 +81,7 @@ struct GNUNET_IDENTITY_EgoLookup * NULL if the user just deleted the ego and it * must thus no longer be used */ -static void +static void identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, @@ -98,7 +98,7 @@ identity_cb (void *cls, GNUNET_IDENTITY_ego_lookup_cancel (el); return; } - if (NULL == ego) + if (NULL == ego) { /* not found */ 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; /** * Handle for task for timeout termination. - */ + */ static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; @@ -105,7 +105,7 @@ end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /** * Finish the testcase (successfully). */ -static void +static void end () { if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) @@ -195,9 +195,9 @@ fail_rename_cont (void *cls, const char *emsg) { GNUNET_assert (NULL != emsg); - op = GNUNET_IDENTITY_delete (h, + op = GNUNET_IDENTITY_delete (h, "test", - &delete_cont, + &delete_cont, NULL); end (); /* yepee */ } @@ -214,10 +214,10 @@ success_rename_cont (void *cls, const char *emsg) { GNUNET_assert (NULL == emsg); - op = GNUNET_IDENTITY_rename (h, + op = GNUNET_IDENTITY_rename (h, "test-id", "test", - &fail_rename_cont, + &fail_rename_cont, NULL); } @@ -231,12 +231,12 @@ success_rename_cont (void *cls, static void create_cb (void *cls, const char *emsg) -{ +{ GNUNET_assert (NULL == emsg); - op = GNUNET_IDENTITY_rename (h, + op = GNUNET_IDENTITY_rename (h, "test-id", "test", - &success_rename_cont, + &success_rename_cont, NULL); } @@ -249,19 +249,19 @@ create_cb (void *cls, * @param peer handle to access more of the peer (not used) */ static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { - endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, - &endbadly, NULL); + endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, + &endbadly, NULL); h = GNUNET_IDENTITY_connect (cfg, ¬ification_cb, NULL); GNUNET_assert (NULL != h); op = GNUNET_IDENTITY_create (h, "test-id", &create_cb, NULL); - + } @@ -270,7 +270,7 @@ main (int argc, char *argv[]) { GNUNET_DISK_directory_remove ("/tmp/test-identity-service"); res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-identity", "identity", "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; /** * Handle for task for timeout termination. - */ + */ static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; @@ -105,7 +105,7 @@ end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /** * Finish the testcase (successfully). */ -static void +static void end () { if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) @@ -149,9 +149,9 @@ get_cb (void *cls, GNUNET_assert (NULL != ego); GNUNET_assert (NULL != identifier); GNUNET_assert (0 == strcmp (identifier, "test-id")); - op = GNUNET_IDENTITY_delete (h, + op = GNUNET_IDENTITY_delete (h, "test-id", - &delete_cont, + &delete_cont, NULL); } @@ -164,12 +164,12 @@ get_cb (void *cls, * @param peer handle to access more of the peer (not used) */ static void -run_get (void *cls, +run_get (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { - endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, - &endbadly, NULL); + endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, + &endbadly, NULL); h = GNUNET_IDENTITY_connect (cfg, NULL, NULL); GNUNET_assert (NULL != h); op = GNUNET_IDENTITY_get (h, @@ -214,10 +214,10 @@ notification_cb (void *cls, { if (NULL == ego) return; /* skip first call */ - op = GNUNET_IDENTITY_set (h, + op = GNUNET_IDENTITY_set (h, "test-service", ego, - &success_set_cont, + &success_set_cont, NULL); } @@ -231,7 +231,7 @@ notification_cb (void *cls, static void create_cb (void *cls, const char *emsg) -{ +{ GNUNET_assert (NULL == emsg); op = NULL; } @@ -245,19 +245,19 @@ create_cb (void *cls, * @param peer handle to access more of the peer (not used) */ static void -run_set (void *cls, +run_set (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { - endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, - &endbadly, NULL); + endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, + &endbadly, NULL); h = GNUNET_IDENTITY_connect (cfg, ¬ification_cb, NULL); GNUNET_assert (NULL != h); op = GNUNET_IDENTITY_create (h, "test-id", &create_cb, NULL); - + } @@ -266,14 +266,14 @@ main (int argc, char *argv[]) { GNUNET_DISK_directory_remove ("/tmp/test-identity-service"); res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-identity-defaults", "identity", "test_identity.conf", &run_set, NULL)) return 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-identity-defaults", "identity", "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 * The key of the state. */ struct GNUNET_HashCode key; - + /** * Public key of the peer signing. */ 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; * @param connected GNUNET_YES if connected, GNUNET_NO if disconnected, * GNUNET_SYSERR if there was an error. */ -typedef void (*GNUNET_ARM_ConnectionStatusCallback) (void *cls, +typedef void (*GNUNET_ARM_ConnectionStatusCallback) (void *cls, int connected); @@ -195,9 +195,9 @@ typedef void (*GNUNET_ARM_ConnectionStatusCallback) (void *cls, * @param service service name * @param result result of the operation */ -typedef void (*GNUNET_ARM_ResultCallback) (void *cls, - enum GNUNET_ARM_RequestStatus rs, - const char *service, +typedef void (*GNUNET_ARM_ResultCallback) (void *cls, + enum GNUNET_ARM_RequestStatus rs, + const char *service, enum GNUNET_ARM_Result result); @@ -212,9 +212,9 @@ typedef void (*GNUNET_ARM_ResultCallback) (void *cls, * @param count number of strings in the list * @param list list of running services */ -typedef void (*GNUNET_ARM_ServiceListCallback) (void *cls, - enum GNUNET_ARM_RequestStatus rs, - unsigned int count, +typedef void (*GNUNET_ARM_ServiceListCallback) (void *cls, + enum GNUNET_ARM_RequestStatus rs, + unsigned int count, const char *const*list); @@ -231,7 +231,7 @@ typedef void (*GNUNET_ARM_ServiceListCallback) (void *cls, */ struct GNUNET_ARM_Handle * GNUNET_ARM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, - GNUNET_ARM_ConnectionStatusCallback conn_status, + GNUNET_ARM_ConnectionStatusCallback conn_status, void *cls); @@ -274,7 +274,7 @@ GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h, */ void GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h, - const char *service_name, + const char *service_name, struct GNUNET_TIME_Relative timeout, GNUNET_ARM_ResultCallback cont, void *cont_cls); @@ -291,9 +291,9 @@ GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h, */ void GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, - const char *service_name, + const char *service_name, enum GNUNET_OS_InheritStdioFlags std_inheritance, - struct GNUNET_TIME_Relative timeout, + struct GNUNET_TIME_Relative timeout, GNUNET_ARM_ResultCallback cont, void *cont_cls); @@ -312,8 +312,8 @@ struct GNUNET_ARM_MonitorHandle; * @param service service name * @param status status of the service */ -typedef void (*GNUNET_ARM_ServiceStatusCallback) (void *cls, - const char *service, +typedef void (*GNUNET_ARM_ServiceStatusCallback) (void *cls, + const char *service, enum GNUNET_ARM_ServiceStatus status); @@ -330,7 +330,7 @@ typedef void (*GNUNET_ARM_ServiceStatusCallback) (void *cls, */ struct GNUNET_ARM_MonitorHandle * GNUNET_ARM_monitor (const struct GNUNET_CONFIGURATION_Handle *cfg, - GNUNET_ARM_ServiceStatusCallback cont, + GNUNET_ARM_ServiceStatusCallback cont, void *cont_cls); 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, * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure */ int -GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, +GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, const char *file, int line, void *result, size_t len); 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 * Block for testing. */ GNUNET_BLOCK_TYPE_TEST = 8, - + /** * Type of a block representing any type of search result * (universal). Implemented in the context of #2564, replaces @@ -132,7 +132,7 @@ enum GNUNET_BLOCK_EvaluationResult * Valid result, and there may be more. */ GNUNET_BLOCK_EVALUATION_OK_MORE = 0, - + /** * Last possible valid result. */ 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 @@ * @param reply_block_size number of bytes in @a reply_block * @return characterization of result */ -typedef enum GNUNET_BLOCK_EvaluationResult +typedef enum GNUNET_BLOCK_EvaluationResult (*GNUNET_BLOCK_EvaluationFunction) (void *cls, enum GNUNET_BLOCK_Type type, 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, size_t size, struct GNUNET_TIME_Relative timeout, int auto_retry, - GNUNET_CONNECTION_TransmitReadyNotify notify, + GNUNET_CONNECTION_TransmitReadyNotify notify, void *notify_cls); 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" /** * Define as empty, GNUNET_PACKED should suffice, but this won't work on W32 */ -#define GNUNET_NETWORK_STRUCT_BEGIN +#define GNUNET_NETWORK_STRUCT_BEGIN /** * Define as empty, GNUNET_PACKED should suffice, but this won't work on W32; @@ -307,9 +307,9 @@ GNUNET_get_log_skip (); #if !defined(GNUNET_CULL_LOGGING) int -GNUNET_get_log_call_status (int caller_level, +GNUNET_get_log_call_status (int caller_level, const char *comp, - const char *file, + const char *file, const char *function, int line); #endif @@ -403,7 +403,7 @@ GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, const char *comp, * @param option name of missing option */ void -GNUNET_log_config_missing (enum GNUNET_ErrorType kind, +GNUNET_log_config_missing (enum GNUNET_ErrorType kind, const char *section, const char *option); @@ -418,7 +418,7 @@ GNUNET_log_config_missing (enum GNUNET_ErrorType kind, * @param required what is required that is invalid about the option */ void -GNUNET_log_config_invalid (enum GNUNET_ErrorType kind, +GNUNET_log_config_invalid (enum GNUNET_ErrorType kind, const char *section, const char *option, const char *required); @@ -651,7 +651,7 @@ GNUNET_htonll (uint64_t n); * @param d the value in network byte order * @return the same value in host byte order */ -double +double GNUNET_hton_double (double d); /** @@ -659,7 +659,7 @@ GNUNET_hton_double (double d); * @param d the value in network byte order * @return the same value in host byte order */ -double +double GNUNET_ntoh_double (double d); /* ************************* 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 @@ * @file include/gnunet_configuration_lib.h * @brief configuration API * @author Christian Grothoff - * @defgroup configuration Configuration management + * @defgroup configuration Configuration management * @{ */ #ifndef GNUNET_CONFIGURATION_LIB_H @@ -324,9 +324,9 @@ GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg, * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ int -GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Handle *cfg, +GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, - const char *option, + const char *option, char **value); 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, * GNUNET_CONSENSUS_destroy instead. * * @param cls - * @param success GNUNET_OK on success, GNUNET_SYSERR if + * @param success GNUNET_OK on success, GNUNET_SYSERR if * the insertion and thus the consensus failed for good */ typedef void (*GNUNET_CONSENSUS_InsertDoneCallback) (void *cls, @@ -111,7 +111,7 @@ typedef void (*GNUNET_CONSENSUS_InsertDoneCallback) (void *cls, * * @param consensus handle for the consensus session * @param element the element to be inserted - * @param idc function called when we are done with this element and it + * @param idc function called when we are done with this element and it * is thus allowed to call GNUNET_CONSENSUS_insert again * @param idc_cls closure for 'idc' */ 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" /** * Largest block that can be stored in the DHT. - */ + */ #define GNUNET_CONSTANTS_MAX_BLOCK_SIZE (62 * 1024) 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, * @param len initial size (map will grow as needed) * @param do_not_copy_keys #GNUNET_NO is always safe and should be used by default; * #GNUNET_YES means that on 'put', the 'key' does not have - * to be copied as the destination of the pointer is + * to be copied as the destination of the pointer is * guaranteed to be life as long as the value is stored in - * the hashmap. This can significantly reduce memory - * consumption, but of course is also a recipie for + * the hashmap. This can significantly reduce memory + * consumption, but of course is also a recipie for * heap corruption if the assumption is not true. Only * use this if (1) memory use is important in this case and * (2) you have triple-checked that the invariant holds @@ -649,7 +649,7 @@ GNUNET_CONTAINER_multihashmap_destroy (struct GNUNET_CONTAINER_MultiHashMap *map * key-value pairs with value NULL */ void * -GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap *map, +GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key); @@ -667,7 +667,7 @@ GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap *m */ int GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map, - const struct GNUNET_HashCode *key, + const struct GNUNET_HashCode *key, const void *value); /** @@ -680,7 +680,7 @@ GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map, * @return number of values removed */ int -GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap *map, +GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key); @@ -711,7 +711,7 @@ GNUNET_CONTAINER_multihashmap_contains (const struct GNUNET_CONTAINER_MultiHashM * #GNUNET_NO if not */ int -GNUNET_CONTAINER_multihashmap_contains_value (const struct GNUNET_CONTAINER_MultiHashMap *map, +GNUNET_CONTAINER_multihashmap_contains_value (const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value); @@ -782,7 +782,7 @@ GNUNET_CONTAINER_multihashmap_iterator_create (const struct GNUNET_CONTAINER_Mul /** - * @ingroup hashmap + * @ingroup hashmap * Retrieve the next element from the hash map at the iterator's * position. If there are no elements left, #GNUNET_NO is returned, * and @a key and @a value are not modified. This operation is only @@ -798,12 +798,12 @@ GNUNET_CONTAINER_multihashmap_iterator_create (const struct GNUNET_CONTAINER_Mul */ int GNUNET_CONTAINER_multihashmap_iterator_next (struct GNUNET_CONTAINER_MultiHashMapIterator *iter, - struct GNUNET_HashCode *key, + struct GNUNET_HashCode *key, const void **value); /** - * @ingroup hashmap + * @ingroup hashmap * Destroy a multihashmap iterator. * * @param iter the iterator to destroy @@ -813,7 +813,7 @@ GNUNET_CONTAINER_multihashmap_iterator_destroy (struct GNUNET_CONTAINER_MultiHas /** - * @ingroup hashmap + * @ingroup hashmap * Iterate over all entries in the map that match a particular key. * * @param map the map @@ -856,10 +856,10 @@ typedef int (*GNUNET_CONTAINER_PeerMapIterator) (void *cls, * @param len initial size (map will grow as needed) * @param do_not_copy_keys #GNUNET_NO is always safe and should be used by default; * #GNUNET_YES means that on 'put', the 'key' does not have - * to be copied as the destination of the pointer is + * to be copied as the destination of the pointer is * guaranteed to be life as long as the value is stored in - * the hashmap. This can significantly reduce memory - * consumption, but of course is also a recipie for + * the hashmap. This can significantly reduce memory + * consumption, but of course is also a recipie for * heap corruption if the assumption is not true. Only * use this if (1) memory use is important in this case and * (2) you have triple-checked that the invariant holds @@ -893,7 +893,7 @@ GNUNET_CONTAINER_multipeermap_destroy (struct GNUNET_CONTAINER_MultiPeerMap *map * key-value pairs with value NULL */ void * -GNUNET_CONTAINER_multipeermap_get (const struct GNUNET_CONTAINER_MultiPeerMap *map, +GNUNET_CONTAINER_multipeermap_get (const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key); @@ -911,7 +911,7 @@ GNUNET_CONTAINER_multipeermap_get (const struct GNUNET_CONTAINER_MultiPeerMap *m */ int GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map, - const struct GNUNET_PeerIdentity * key, + const struct GNUNET_PeerIdentity * key, const void *value); /** @@ -924,7 +924,7 @@ GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map, * @return number of values removed */ int -GNUNET_CONTAINER_multipeermap_remove_all (struct GNUNET_CONTAINER_MultiPeerMap *map, +GNUNET_CONTAINER_multipeermap_remove_all (struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key); @@ -955,7 +955,7 @@ GNUNET_CONTAINER_multipeermap_contains (const struct GNUNET_CONTAINER_MultiPeerM * #GNUNET_NO if not */ int -GNUNET_CONTAINER_multipeermap_contains_value (const struct GNUNET_CONTAINER_MultiPeerMap *map, +GNUNET_CONTAINER_multipeermap_contains_value (const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity * key, const void *value); @@ -975,7 +975,7 @@ GNUNET_CONTAINER_multipeermap_contains_value (const struct GNUNET_CONTAINER_Mult */ int GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map, - const struct GNUNET_PeerIdentity *key, + const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt); @@ -1025,7 +1025,7 @@ GNUNET_CONTAINER_multipeermap_iterator_create (const struct GNUNET_CONTAINER_Mul /** - * @ingroup hashmap + * @ingroup hashmap * Retrieve the next element from the hash map at the iterator's * position. If there are no elements left, #GNUNET_NO is returned, * and @a key and @a value are not modified. This operation is only @@ -1041,12 +1041,12 @@ GNUNET_CONTAINER_multipeermap_iterator_create (const struct GNUNET_CONTAINER_Mul */ int GNUNET_CONTAINER_multipeermap_iterator_next (struct GNUNET_CONTAINER_MultiPeerMapIterator *iter, - struct GNUNET_PeerIdentity *key, + struct GNUNET_PeerIdentity *key, const void **value); /** - * @ingroup hashmap + * @ingroup hashmap * Destroy a multipeermap iterator. * * @param iter the iterator to destroy @@ -1056,7 +1056,7 @@ GNUNET_CONTAINER_multipeermap_iterator_destroy (struct GNUNET_CONTAINER_MultiPee /** - * @ingroup hashmap + * @ingroup hashmap * Iterate over all entries in the map that match a particular key. * * @param map the map @@ -1077,14 +1077,14 @@ GNUNET_CONTAINER_multipeermap_get_multiple (const struct GNUNET_CONTAINER_MultiP /* Version of multihashmap with 32 bit keys */ /** - * @ingroup hashmap + * @ingroup hashmap * Opaque handle for the 32-bit key HashMap. */ struct GNUNET_CONTAINER_MultiHashMap32; /** - * @ingroup hashmap + * @ingroup hashmap * Iterator over hash map entries. * * @param cls closure @@ -1100,7 +1100,7 @@ typedef int (*GNUNET_CONTAINER_HashMapIterator32) (void *cls, /** - * @ingroup hashmap + * @ingroup hashmap * Create a 32-bit key multi hash map. * * @param len initial size (map will grow as needed) @@ -1111,7 +1111,7 @@ GNUNET_CONTAINER_multihashmap32_create (unsigned int len); /** - * @ingroup hashmap + * @ingroup hashmap * Destroy a 32-bit key hash map. Will not free any values * stored in the hash map! * @@ -1123,7 +1123,7 @@ GNUNET_CONTAINER_multihashmap32_destroy (struct GNUNET_CONTAINER_MultiHashMap32 /** - * @ingroup hashmap + * @ingroup hashmap * Get the number of key-value pairs in the map. * * @param map the map @@ -1135,7 +1135,7 @@ GNUNET_CONTAINER_multihashmap32_size (const struct /** - * @ingroup hashmap + * @ingroup hashmap * Given a key find a value in the map matching the key. * * @param map the map @@ -1146,13 +1146,13 @@ GNUNET_CONTAINER_multihashmap32_size (const struct * key-value pairs with value NULL */ void * -GNUNET_CONTAINER_multihashmap32_get (const struct +GNUNET_CONTAINER_multihashmap32_get (const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key); /** - * @ingroup hashmap + * @ingroup hashmap * Iterate over all entries in the map. * * @param map the map @@ -1169,7 +1169,7 @@ GNUNET_CONTAINER_multihashmap32_iterate (const struct /** - * @ingroup hashmap + * @ingroup hashmap * Remove the given key-value pair from the map. Note that if the * key-value pair is in the map multiple times, only one of the pairs * will be removed. @@ -1182,12 +1182,12 @@ GNUNET_CONTAINER_multihashmap32_iterate (const struct */ int GNUNET_CONTAINER_multihashmap32_remove (struct GNUNET_CONTAINER_MultiHashMap32 *map, - uint32_t key, + uint32_t key, const void *value); /** - * @ingroup hashmap + * @ingroup hashmap * Remove all entries for the given key from the map. * Note that the values would not be "freed". * @@ -1201,7 +1201,7 @@ GNUNET_CONTAINER_multihashmap32_remove_all (struct GNUNET_CONTAINER_MultiHashMap /** - * @ingroup hashmap + * @ingroup hashmap * Check if the map contains any value under the given * key (including values that are NULL). * @@ -1216,7 +1216,7 @@ GNUNET_CONTAINER_multihashmap32_contains (const struct GNUNET_CONTAINER_MultiHas /** - * @ingroup hashmap + * @ingroup hashmap * Check if the map contains the given value under the given * key. * @@ -1227,13 +1227,13 @@ GNUNET_CONTAINER_multihashmap32_contains (const struct GNUNET_CONTAINER_MultiHas * #GNUNET_NO if not */ int -GNUNET_CONTAINER_multihashmap32_contains_value (const struct GNUNET_CONTAINER_MultiHashMap32 *map, +GNUNET_CONTAINER_multihashmap32_contains_value (const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, const void *value); /** - * @ingroup hashmap + * @ingroup hashmap * Store a key-value pair in the map. * * @param map the map @@ -1246,14 +1246,14 @@ GNUNET_CONTAINER_multihashmap32_contains_value (const struct GNUNET_CONTAINER_Mu * value already exists */ int -GNUNET_CONTAINER_multihashmap32_put (struct GNUNET_CONTAINER_MultiHashMap32 *map, - uint32_t key, +GNUNET_CONTAINER_multihashmap32_put (struct GNUNET_CONTAINER_MultiHashMap32 *map, + uint32_t key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt); /** - * @ingroup hashmap + * @ingroup hashmap * Iterate over all entries in the map that match a particular key. * * @param map the map @@ -1264,7 +1264,7 @@ GNUNET_CONTAINER_multihashmap32_put (struct GNUNET_CONTAINER_MultiHashMap32 *map * #GNUNET_SYSERR if it aborted iteration */ int -GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_MultiHashMap32 *map, +GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, GNUNET_CONTAINER_HashMapIterator32 it, void *it_cls); @@ -1276,7 +1276,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult /* To avoid mistakes: head->prev == tail->next == NULL */ /** - * @ingroup dll + * @ingroup dll * Insert an element at the head of a DLL. Assumes that head, tail and * element are structs with prev and next fields. * @@ -1297,7 +1297,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult /** - * @ingroup dll + * @ingroup dll * Insert an element at the tail of a DLL. Assumes that head, tail and * element are structs with prev and next fields. * @@ -1318,7 +1318,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult /** - * @ingroup dll + * @ingroup dll * Insert an element into a DLL after the given other element. Insert * at the head if the other element is NULL. * @@ -1348,7 +1348,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult /** - * @ingroup dll + * @ingroup dll * Insert an element into a DLL before the given other element. Insert * at the tail if the other element is NULL. * @@ -1378,7 +1378,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult /** - * @ingroup dll + * @ingroup dll * Remove an element from a DLL. Assumes that head, tail and * element point to structs with prev and next fields. * @@ -1410,7 +1410,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult in multiple lists at the same time *********************** */ /** - * @ingroup dll + * @ingroup dll * Insert an element at the head of a MDLL. Assumes that head, tail and * element are structs with prev and next fields. * @@ -1432,7 +1432,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult /** - * @ingroup dll + * @ingroup dll * Insert an element at the tail of a MDLL. Assumes that head, tail and * element are structs with prev and next fields. * @@ -1454,7 +1454,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult /** - * @ingroup dll + * @ingroup dll * Insert an element into a MDLL after the given other element. Insert * at the head if the other element is NULL. * @@ -1485,7 +1485,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult /** - * @ingroup dll + * @ingroup dll * Insert an element into a MDLL before the given other element. Insert * at the tail if the other element is NULL. * @@ -1516,7 +1516,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult /** - * @ingroup dll + * @ingroup dll * Remove an element from a MDLL. Assumes * that head, tail and element are structs * 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 @@ /* This file is part of GNUnet (C) 2013 Christian Grothoff (and other contributing authors) - + GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. - + GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, @@ -25,7 +25,7 @@ * @author Andreas Fuchs * @author Christian Grothoff * - * + * * NOTE: This API is deliberately deceptively simple; the idea * is that advanced features (such as answering machines) will * be done with a separate service (an answering machine service) @@ -109,17 +109,17 @@ struct GNUNET_CONVERSATION_PhoneRecord enum GNUNET_CONVERSATION_EventCode { /** - * The phone is ringing, caller ID is provided in the varargs as + * The phone is ringing, caller ID is provided in the varargs as * a `const char *`. The caller ID will be a GNS name. */ GNUNET_CONVERSATION_EC_RING, /** - * We are the caller and are now ringing the other party. + * We are the caller and are now ringing the other party. * The varargs will be empty. */ GNUNET_CONVERSATION_EC_RINGING, - + /** * We are ready to talk, metadata about the call may be supplied * as a `const char *` in the varargs. @@ -139,7 +139,7 @@ enum GNUNET_CONVERSATION_EventCode * client must no longer call #GNUNET_CONVERSATION_call_stop. */ GNUNET_CONVERSATION_EC_BUSY, - + /** * The conversation was terminated, a reason may be supplied as a * `const char *` in the varargs. After this invocation, the @@ -147,7 +147,7 @@ enum GNUNET_CONVERSATION_EventCode * client must no longer call #GNUNET_CONVERSATION_call_stop. */ GNUNET_CONVERSATION_EC_TERMINATED - + }; @@ -207,7 +207,7 @@ GNUNET_CONVERSATION_phone_get_record (struct GNUNET_CONVERSATION_Phone *phone, /** - * Picks up a (ringing) phone. This will connect the speaker + * Picks up a (ringing) phone. This will connect the speaker * to the microphone of the other party, and vice versa. * * @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, * expected to track which peers are connected based on the connect/disconnect * callbacks from #GNUNET_CORE_connect. This function is NOT part of the * 'versioned', 'official' API. This function returns - * synchronously after looking in the CORE API cache. + * synchronously after looking in the CORE API cache. * * @param h the core handle * @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 * Public ECC key (always for NIST P-521) encoded in a format suitable * for network transmission and encryption (ECDH). */ -struct GNUNET_CRYPTO_EccPublicEncryptKey +struct GNUNET_CRYPTO_EccPublicEncryptKey { /** * 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 ssize_t GNUNET_CRYPTO_symmetric_encrypt (const void *block, size_t len, const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, - const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, + const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, void *result); @@ -415,7 +415,7 @@ GNUNET_CRYPTO_symmetric_encrypt (const void *block, size_t len, ssize_t GNUNET_CRYPTO_symmetric_decrypt (const void *block, size_t size, const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, - const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, + const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, void *result); @@ -446,8 +446,8 @@ GNUNET_CRYPTO_symmetric_derive_iv (struct GNUNET_CRYPTO_SymmetricInitializationV void GNUNET_CRYPTO_symmetric_derive_iv_v (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, - const void *salt, - size_t salt_len, + const void *salt, + size_t salt_len, va_list argp); @@ -653,7 +653,7 @@ GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode * hc, * @return Bit \a bit from hashcode \a code, -1 for invalid index */ int -GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode *code, +GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode *code, unsigned int bit); @@ -865,7 +865,7 @@ GNUNET_CRYPTO_ecc_public_sign_key_to_string (const struct GNUNET_CRYPTO_EccPubli * @return #GNUNET_OK on success */ int -GNUNET_CRYPTO_ecc_public_sign_key_from_string (const char *enc, +GNUNET_CRYPTO_ecc_public_sign_key_from_string (const char *enc, size_t enclen, struct GNUNET_CRYPTO_EccPublicSignKey *pub); @@ -890,7 +890,7 @@ GNUNET_CRYPTO_ecc_public_encrypt_key_to_string (const struct GNUNET_CRYPTO_EccPu * @return #GNUNET_OK on success */ int -GNUNET_CRYPTO_ecc_public_encrypt_key_from_string (const char *enc, +GNUNET_CRYPTO_ecc_public_encrypt_key_from_string (const char *enc, size_t enclen, struct GNUNET_CRYPTO_EccPublicEncryptKey *pub); @@ -939,7 +939,7 @@ GNUNET_CRYPTO_ecc_key_create (void); /** * @ingroup crypto - * Clear memory that was used to store a private key. + * Clear memory that was used to store a private key. * * @param pk location of the key */ 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_ * @param key key in the data store * @param count how many values are stored under this key in the datastore */ -typedef void (*PluginKeyProcessor) (void *cls, +typedef void (*PluginKeyProcessor) (void *cls, const struct GNUNET_HashCode *key, unsigned int count); @@ -322,7 +322,7 @@ struct GNUNET_DATASTORE_PluginFunctions * Iterate over all keys in the database. */ PluginGetKeys get_keys; - + }; 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, * (size too big) */ struct GNUNET_DHT_PutHandle * -GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, +GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, const struct GNUNET_HashCode *key, uint32_t desired_replication_level, enum GNUNET_DHT_RouteOption options, @@ -182,7 +182,7 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, * go out over the network (we can't stop that); However, if the PUT * has not yet been sent to the service, cancelling the PUT will stop * this from happening (but there is no way for the user of this API - * to tell if that is the case). The only use for this API is to + * to tell if that is the case). The only use for this API is to * prevent a later call to 'cont' from #GNUNET_DHT_put (i.e. because * the system is shutting down). * @@ -212,9 +212,9 @@ GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph); typedef void (*GNUNET_DHT_GetIterator) (void *cls, struct GNUNET_TIME_Absolute exp, const struct GNUNET_HashCode *key, - const struct GNUNET_PeerIdentity *get_path, + const struct GNUNET_PeerIdentity *get_path, unsigned int get_path_length, - const struct GNUNET_PeerIdentity *put_path, + const struct GNUNET_PeerIdentity *put_path, unsigned int put_path_length, enum GNUNET_BLOCK_Type type, size_t size, const void *data); @@ -239,11 +239,11 @@ typedef void (*GNUNET_DHT_GetIterator) (void *cls, */ struct GNUNET_DHT_GetHandle * GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, - enum GNUNET_BLOCK_Type type, + enum GNUNET_BLOCK_Type type, const struct GNUNET_HashCode *key, uint32_t desired_replication_level, - enum GNUNET_DHT_RouteOption options, - const void *xquery, size_t xquery_size, + enum GNUNET_DHT_RouteOption options, + const void *xquery, size_t xquery_size, GNUNET_DHT_GetIterator iter, void *iter_cls); @@ -297,7 +297,7 @@ typedef void (*GNUNET_DHT_MonitorGetCB) (void *cls, enum GNUNET_DHT_RouteOption options, enum GNUNET_BLOCK_Type type, uint32_t hop_count, - uint32_t desired_replication_level, + uint32_t desired_replication_level, unsigned int path_length, const struct GNUNET_PeerIdentity *path, const struct GNUNET_HashCode * key); @@ -346,7 +346,7 @@ typedef void (*GNUNET_DHT_MonitorPutCB) (void *cls, enum GNUNET_DHT_RouteOption options, enum GNUNET_BLOCK_Type type, uint32_t hop_count, - uint32_t desired_replication_level, + uint32_t desired_replication_level, unsigned int path_length, const struct GNUNET_PeerIdentity *path, 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 { /** * Handle represents a file. - */ - GNUNET_DISK_HANLDE_TYPE_FILE, + */ + GNUNET_DISK_HANLDE_TYPE_FILE, /** * Handle represents a pipe. @@ -157,7 +157,7 @@ enum GNUNET_DISK_MapType * Read-only memory map. */ GNUNET_DISK_MAP_TYPE_READ = 1, - + /** * Write-able memory map. */ @@ -328,7 +328,7 @@ GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h, OFF_T offset, */ int GNUNET_DISK_file_size (const char *filename, uint64_t *size, - int include_symbolic_links, + int include_symbolic_links, int single_file_mode); @@ -348,7 +348,7 @@ GNUNET_DISK_file_size (const char *filename, uint64_t *size, * @return GNUNET_OK on success */ int -GNUNET_DISK_file_get_identifiers (const char *filename, +GNUNET_DISK_file_get_identifiers (const char *filename, uint64_t *dev, uint64_t *ino); @@ -394,7 +394,7 @@ GNUNET_DISK_mkdtemp (const char *t); * @return IO handle on success, NULL on error */ struct GNUNET_DISK_FileHandle * -GNUNET_DISK_file_open (const char *fn, +GNUNET_DISK_file_open (const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm); @@ -421,9 +421,9 @@ GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, * @return handle to the new pipe, NULL on error */ struct GNUNET_DISK_PipeHandle * -GNUNET_DISK_pipe (int blocking_read, - int blocking_write, - int inherit_read, +GNUNET_DISK_pipe (int blocking_read, + int blocking_write, + int inherit_read, int inherit_write); @@ -438,8 +438,8 @@ GNUNET_DISK_pipe (int blocking_read, * @return handle to the new pipe, NULL on error */ struct GNUNET_DISK_PipeHandle * -GNUNET_DISK_pipe_from_fd (int blocking_read, - int blocking_write, +GNUNET_DISK_pipe_from_fd (int blocking_read, + int blocking_write, int fd[2]); @@ -544,7 +544,7 @@ GNUNET_DISK_get_handle_from_native (FILE *fd); * @return the number of bytes read on success, #GNUNET_SYSERR on failure */ ssize_t -GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, +GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, void *result, size_t len); @@ -575,7 +575,7 @@ GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle * h, */ ssize_t GNUNET_DISK_fn_read (const char *fn, - void *result, + void *result, size_t len); @@ -589,7 +589,7 @@ GNUNET_DISK_fn_read (const char *fn, */ ssize_t GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h, - const void *buffer, + const void *buffer, size_t n); @@ -603,7 +603,7 @@ GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h, */ ssize_t GNUNET_DISK_file_write_blocking (const struct GNUNET_DISK_FileHandle *h, - const void *buffer, + const void *buffer, size_t n); @@ -619,7 +619,7 @@ GNUNET_DISK_file_write_blocking (const struct GNUNET_DISK_FileHandle *h, */ ssize_t GNUNET_DISK_fn_write (const char *fn, - const void *buffer, + const void *buffer, size_t n, enum GNUNET_DISK_AccessPermissions mode); @@ -766,7 +766,7 @@ GNUNET_DISK_directory_create (const char *dir); * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ int -GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, +GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, OFF_T lock_start, OFF_T lock_end, int excl); @@ -780,7 +780,7 @@ GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ int -GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh, +GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh, OFF_T unlock_start, OFF_T unlock_end); 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 @@ /** * @file include/gnunet_dns_service.h - * @brief API to access the DNS service. + * @brief API to access the DNS service. * @author Christian Grothoff */ #ifndef GNUNET_DNS_SERVICE_H @@ -41,7 +41,7 @@ struct GNUNET_DNS_RequestHandle; /** * Flags that specify when to call the client's handler. - */ + */ enum GNUNET_DNS_Flags { @@ -153,7 +153,7 @@ GNUNET_DNS_request_drop (struct GNUNET_DNS_RequestHandle *rh); * @param reply reply data */ void -GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh, +GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh, uint16_t reply_length, const char *reply); @@ -165,7 +165,7 @@ GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh, * @param flags when to call rh * @param rh function to call with DNS requests * @param rh_cls closure to pass to rh - * @return DNS handle + * @return DNS handle */ struct GNUNET_DNS_Handle * GNUNET_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 @@ /** * @file include/gnunet_dnsparser_lib.h - * @brief API for helper library to parse DNS packets. + * @brief API for helper library to parse DNS packets. * @author Philipp Toelke * @author Christian Grothoff */ @@ -64,7 +64,7 @@ struct GNUNET_DNSPARSER_Query /** * Name of the record that the query is for (0-terminated). - * In UTF-8 format. The library will convert from and to DNS-IDNA + * In UTF-8 format. The library will convert from and to DNS-IDNA * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an * individual label is well-formed. If a given name is not well-formed, * creating the DNS packet will fail. @@ -89,7 +89,7 @@ struct GNUNET_DNSPARSER_Query */ struct GNUNET_DNSPARSER_MxRecord { - + /** * Preference for this entry (lower value is higher preference). */ @@ -97,7 +97,7 @@ struct GNUNET_DNSPARSER_MxRecord /** * Name of the mail server. - * In UTF-8 format. The library will convert from and to DNS-IDNA + * In UTF-8 format. The library will convert from and to DNS-IDNA * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an * individual label is well-formed. If a given name is not well-formed, * creating the DNS packet will fail. @@ -120,11 +120,11 @@ struct GNUNET_DNSPARSER_MxRecord */ struct GNUNET_DNSPARSER_SrvRecord { - + /** * Service name without the underscore (!). Note that RFC 6335 clarifies the * set of legal characters for service names. - * In UTF-8 format. The library will convert from and to DNS-IDNA + * In UTF-8 format. The library will convert from and to DNS-IDNA * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an * individual label is well-formed. If a given name is not well-formed, * creating the DNS packet will fail. @@ -139,7 +139,7 @@ struct GNUNET_DNSPARSER_SrvRecord /** * Domain name for which the record is valid - * In UTF-8 format. The library will convert from and to DNS-IDNA + * In UTF-8 format. The library will convert from and to DNS-IDNA * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an * individual label is well-formed. If a given name is not well-formed, * creating the DNS packet will fail. @@ -148,7 +148,7 @@ struct GNUNET_DNSPARSER_SrvRecord /** * Hostname offering the service. - * In UTF-8 format. The library will convert from and to DNS-IDNA + * In UTF-8 format. The library will convert from and to DNS-IDNA * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an * individual label is well-formed. If a given name is not well-formed, * creating the DNS packet will fail. @@ -176,17 +176,17 @@ struct GNUNET_DNSPARSER_SrvRecord }; - + /** * Information from SOA records (RFC 1035). */ struct GNUNET_DNSPARSER_SoaRecord { - + /** * The domainname of the name server that was the * original or primary source of data for this zone. - * In UTF-8 format. The library will convert from and to DNS-IDNA + * In UTF-8 format. The library will convert from and to DNS-IDNA * as necessary. Use #GNUNET_DNSPARSER_check_label to test if an * individual label is well-formed. If a given name is not well-formed, * creating the DNS packet will fail. @@ -196,7 +196,7 @@ struct GNUNET_DNSPARSER_SoaRecord /** * A domainname which specifies the mailbox of the * person responsible for this zone. - * In UTF-8 format. The library will convert from and to DNS-IDNA + * In UTF-8 format. The library will convert from and to DNS-IDNA * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an * individual label is well-formed. If a given name is not well-formed, * creating the DNS packet will fail. @@ -204,7 +204,7 @@ struct GNUNET_DNSPARSER_SoaRecord char *rname; /** - * The version number of the original copy of the zone. + * The version number of the original copy of the zone. */ uint32_t serial; @@ -230,7 +230,7 @@ struct GNUNET_DNSPARSER_SoaRecord * from this zone. */ uint32_t minimum_ttl; - + }; @@ -260,7 +260,7 @@ struct GNUNET_DNSPARSER_Record /** * Name of the record that the query is for (0-terminated). - * In UTF-8 format. The library will convert from and to DNS-IDNA + * In UTF-8 format. The library will convert from and to DNS-IDNA * as necessary. Use #GNUNET_DNSPARSER_check_label to test if an * individual label is well-formed. If a given name is not well-formed, * creating the DNS packet will fail. @@ -270,23 +270,23 @@ struct GNUNET_DNSPARSER_Record /** * Payload of the record (which one of these is valid depends on the 'type'). */ - union + union { /** * For NS, CNAME and PTR records, this is the uncompressed 0-terminated hostname. - * In UTF-8 format. The library will convert from and to DNS-IDNA + * In UTF-8 format. The library will convert from and to DNS-IDNA * as necessary. Use #GNUNET_DNSPARSER_check_label to test if an * individual label is well-formed. If a given name is not well-formed, * creating the DNS packet will fail. */ char *hostname; - + /** * SOA data for SOA records. */ struct GNUNET_DNSPARSER_SoaRecord *soa; - + /** * MX data for MX records. */ @@ -370,7 +370,7 @@ struct GNUNET_DNSPARSER_Packet /** * Bitfield of DNS flags. - */ + */ struct GNUNET_TUN_DnsFlags flags; /** @@ -411,7 +411,7 @@ GNUNET_DNSPARSER_check_name (const char *name); * processing and manipulation. * * @param udp_payload wire-format of the DNS packet - * @param udp_payload_length number of bytes in @a udp_payload + * @param udp_payload_length number of bytes in @a udp_payload * @return NULL on error, otherwise the parsed packet */ struct GNUNET_DNSPARSER_Packet * @@ -431,7 +431,7 @@ GNUNET_DNSPARSER_free_packet (struct GNUNET_DNSPARSER_Packet *p); /** * Given a DNS packet @a p, generate the corresponding UDP payload. * Note that we do not attempt to pack the strings with pointers - * as this would complicate the code and this is about being + * as this would complicate the code and this is about being * simple and secure, not fast, fancy and broken like bind. * * @param p packet to pack @@ -645,7 +645,7 @@ GNUNET_DNSPARSER_parse_srv (const char *r_name, /** * Free the given DNS record. - * + * * @param r record to free */ void 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 @@ /** * Opaque handle to the stub resolver. - */ + */ struct GNUNET_DNSSTUB_Context; /** * Opaque handle to a socket doing UDP requests. - */ + */ struct GNUNET_DNSSTUB_RequestSocket; 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 @@ * Boston, MA 02111-1307, USA. */ -/** +/** * @file include/gnunet_env_lib.h * @brief Library providing operations for the @e environment of * PSYC and Social messages, and for (de)serializing variable values. @@ -38,38 +38,38 @@ extern "C" #endif -/** +/** * Possible operations on PSYC state (persistent) and transient variables (per message). */ enum GNUNET_ENV_Operator { - /** + /** * Set value of a transient variable. */ GNUNET_ENV_OP_SET = ':', - /** + /** * Assign value for a persistent state variable. * * If an assigned value is NULL, the variable is deleted. */ GNUNET_ENV_OP_ASSIGN = '=', - /** + /** * Augment state variable. * * Used for appending strings, adding numbers, and adding new items to a list or dictionary. */ GNUNET_ENV_OP_AUGMENT = '+', - /** + /** * Diminish state variable. * * Used for subtracting numbers, and removing items from a list or dictionary. */ GNUNET_ENV_OP_DIMINISH = '-', - /** + /** * Update state variable. * * Used for modifying a single item of a list or dictionary. @@ -78,7 +78,7 @@ enum GNUNET_ENV_Operator }; -/** +/** * PSYC variable types. */ enum GNUNET_ENV_Type @@ -90,26 +90,26 @@ enum GNUNET_ENV_Type }; -/** +/** * PSYC state modifier. */ struct GNUNET_ENV_Modifier { - /** + /** * State operation. */ enum GNUNET_ENV_Operator oper; - /** + /** * Variable name. */ const char *name; - /** + /** * Size of @a value. */ size_t value_size; - /** + /** * Value of variable. */ const void *value; @@ -126,7 +126,7 @@ struct GNUNET_ENV_Modifier { }; -/** +/** * Environment for a message. * * Contains modifiers. @@ -134,16 +134,16 @@ struct GNUNET_ENV_Modifier { struct GNUNET_ENV_Environment; -/** +/** * Create an environment. - * + * * @return A newly allocated environment. */ struct GNUNET_ENV_Environment * GNUNET_ENV_environment_create (); -/** +/** * Add a modifier to the environment. * * @param env The environment. @@ -158,7 +158,7 @@ GNUNET_ENV_environment_add_mod (struct GNUNET_ENV_Environment *env, const void *value, size_t value_size); -/** +/** * Iterator for modifiers in the environment. * * @param cls Closure. @@ -171,7 +171,7 @@ typedef int (*GNUNET_ENV_Iterator) (void *cls, struct GNUNET_ENV_Modifier *mod); -/** +/** * Iterate through all modifiers in the environment. * * @param env The environment. @@ -183,7 +183,7 @@ GNUNET_ENV_environment_iterate (const struct GNUNET_ENV_Environment *env, GNUNET_ENV_Iterator it, void *it_cls); -/** +/** * Get the number of modifiers in the environment. * * @param env The environment. @@ -194,7 +194,7 @@ size_t GNUNET_ENV_environment_get_mod_count (const struct GNUNET_ENV_Environment *env); -/** +/** * Destroy an environment. * * @param env The environment to destroy. @@ -203,18 +203,18 @@ void GNUNET_ENV_environment_destroy (struct GNUNET_ENV_Environment *env); -/** +/** * Get the type of variable. * * @param name Name of the variable. - * + * * @return Variable type. */ enum GNUNET_ENV_Type GNUNET_ENV_var_get_type (char *name); -/** +/** * Perform an operation on a variable. * * @param name Name of variable. @@ -225,7 +225,7 @@ GNUNET_ENV_var_get_type (char *name); * @param args_size Size of @a args. * @param return_value Return value. * @param return_value_size Size of @a return_value. - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ int @@ -234,7 +234,7 @@ GNUNET_ENV_operation (char *name, void *current_value, size_t current_value_size void **return_value, size_t *return_value_size); -/** +/** * Get the variable's value as an integer. * * @param size Size of value. @@ -247,7 +247,7 @@ int GNUNET_ENV_value_to_number (size_t size, const void *value, int64_t *number); -/** +/** * Get the variable's value as a list. * * @param size Size of value. @@ -260,7 +260,7 @@ int GNUNET_ENV_value_to_list (size_t size, const void *value, struct GNUNET_CONTAINER_SList **list); -/** +/** * Get the variable's value as a dictionary. * * @param size Size of value. @@ -273,36 +273,36 @@ int GNUNET_ENV_value_to_dict (size_t size, const void *value, struct GNUNET_CONTAINER_MultiHashMap **dict); -/** +/** * Create a PSYC variable value from an integer. * * @param number The number to convert. * @param[out] value_size Size of returned value. - * + * * @return A newly allocated value or NULL on error. */ void * GNUNET_ENV_value_from_number (int64_t number, size_t *value_size); -/** +/** * Create a PSYC variable value from a list. * * @param list The list to convert. * @param[out] value_size Size of returned value. - * + * * @return A newly allocated value or NULL on error. */ void * GNUNET_ENV_value_from_list (struct GNUNET_CONTAINER_SList *list, size_t *value_size); -/** +/** * Create a PSYC variable value from a dictionary. * * @param dict The dict to convert. * @param[out] value_size Size of returned value. - * + * * @return A newly allocated value or NULL on error. */ void * 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); * @param is_mandatory is this keyword mandatory? */ void -GNUNET_FS_uri_ksk_add_keyword (struct GNUNET_FS_Uri *uri, +GNUNET_FS_uri_ksk_add_keyword (struct GNUNET_FS_Uri *uri, const char *keyword, int is_mandatory); @@ -303,7 +303,7 @@ GNUNET_FS_uri_ksk_create (const char *keywords, char **emsg); * if keywords is not legal (i.e. empty). */ struct GNUNET_FS_Uri * -GNUNET_FS_uri_ksk_create_from_args (unsigned int argc, +GNUNET_FS_uri_ksk_create_from_args (unsigned int argc, const char **argv); @@ -337,7 +337,7 @@ GNUNET_FS_uri_test_sks (const struct GNUNET_FS_Uri *uri); * @return an FS URI for the given namespace and identifier */ struct GNUNET_FS_Uri * -GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EccPublicSignKey *ns, +GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EccPublicSignKey *ns, const char *id); @@ -1698,7 +1698,7 @@ typedef int (*GNUNET_FS_FileInformationProcessor) (void *cls, * file information structures. * * @param s structure to get the filename for - * @return NULL on error, otherwise filename that can be used + * @return NULL on error, otherwise filename that can be used * to read this fi-struct from disk. */ const char * @@ -2055,7 +2055,7 @@ struct GNUNET_FS_PublishSksContext; struct GNUNET_FS_PublishSksContext * GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, const struct GNUNET_CRYPTO_EccPrivateKey *ns, - const char *identifier, + const char *identifier, const char *update, const struct GNUNET_CONTAINER_MetaData *meta, const struct GNUNET_FS_Uri *uri, @@ -2146,10 +2146,10 @@ GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc); * @param last_meta metadata associated with @a last_uri * @param next_id identifier that should be used for updates */ -typedef void (*GNUNET_FS_IdentifierProcessor) (void *cls, +typedef void (*GNUNET_FS_IdentifierProcessor) (void *cls, const char *last_id, const struct GNUNET_FS_Uri *last_uri, - const struct GNUNET_CONTAINER_MetaData *last_meta, + const struct GNUNET_CONTAINER_MetaData *last_meta, const char *next_id); @@ -2283,7 +2283,7 @@ enum GNUNET_FS_DownloadOptions * No options (use defaults for everything). */ GNUNET_FS_DOWNLOAD_OPTION_NONE = 0, - + /** * Only download from the local host, do not access remote systems (no P2P) */ @@ -2600,9 +2600,9 @@ enum GNUNET_FS_DirScannerProgressUpdateReason * #GNUNET_SYSERR if it is neither (or unknown) * @param reason kind of progress we are making */ -typedef void (*GNUNET_FS_DirScannerProgressCallback) (void *cls, +typedef void (*GNUNET_FS_DirScannerProgressCallback) (void *cls, const char *filename, - int is_directory, + int is_directory, enum GNUNET_FS_DirScannerProgressUpdateReason reason); @@ -2685,9 +2685,9 @@ struct GNUNET_FS_DirScanner; */ struct GNUNET_FS_DirScanner * GNUNET_FS_directory_scan_start (const char *filename, - int disable_extractor, + int disable_extractor, const char *ex, - GNUNET_FS_DirScannerProgressCallback cb, + GNUNET_FS_DirScannerProgressCallback cb, void *cb_cls); 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); /** * Continuation function. - * + * * @param cls closure * @param result #GNUNET_OK on success, * #GNUNET_NO if helper process died @@ -145,12 +145,12 @@ struct GNUNET_HELPER_SendHandle; * @param cont continuation to run once the message is out (#GNUNET_OK on succees, #GNUNET_NO * if the helper process died, #GNUNET_SYSERR during #GNUNET_HELPER_destroy). * @param cont_cls closure for @a cont - * @return NULL if the message was dropped, + * @return NULL if the message was dropped, * otherwise handle to cancel @a cont (actual transmission may * not be abortable) */ struct GNUNET_HELPER_SendHandle * -GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h, +GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h, const struct GNUNET_MessageHeader *msg, int can_drop, GNUNET_HELPER_Continuation cont, @@ -166,5 +166,5 @@ GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h, void GNUNET_HELPER_send_cancel (struct GNUNET_HELPER_SendHandle *sh); -#endif +#endif /* 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 @@ Boston, MA 02111-1307, USA. */ -/** +/** * @file include/gnunet_identity_service.h * @brief Identity service; implements identity management for GNUnet * @author Christian Grothoff @@ -49,22 +49,22 @@ extern "C" #include "gnunet_util_lib.h" -/** +/** * Version number of GNUnet Identity API. */ #define GNUNET_IDENTITY_VERSION 0x00000000 -/** +/** * Handle to access the identity service. */ struct GNUNET_IDENTITY_Handle; -/** +/** * Handle for a ego. */ struct GNUNET_IDENTITY_Ego; -/** +/** * Handle for an operation with the identity service. */ struct GNUNET_IDENTITY_Operation; @@ -100,9 +100,9 @@ GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego, struct GNUNET_CRYPTO_EccPublicSignKey *pk); -/** +/** * Method called to inform about the egos of - * this peer. + * this peer. * * When used with #GNUNET_IDENTITY_connect, this function is * 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, * @a ego does indicate an error (i.e. name is taken or no default * value is known). If @a ego is non-NULL and if '*ctx' * is set in those callbacks, the value WILL be passed to a subsequent - * call to the identity callback of #GNUNET_IDENTITY_connect (if + * call to the identity callback of #GNUNET_IDENTITY_connect (if * that one was not NULL). * * When an identity is renamed, this function is called with the - * (known) @a ego but the NEW @a name. + * (known) @a ego but the NEW @a name. * * When an identity is deleted, this function is called with the * (known) ego and "NULL" for the @a name. In this case, @@ -141,7 +141,7 @@ typedef void (*GNUNET_IDENTITY_Callback)(void *cls, const char *name); -/** +/** * Connect to the identity service. * * @param cfg Configuration to contact the identity service. @@ -205,12 +205,12 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *id, * Disconnect from identity service. * * @param h identity service to disconnect - */ + */ void GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h); -/** +/** * Create a new identity with the given name. * * @param id identity service to use @@ -226,7 +226,7 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, void *cont_cls); -/** +/** * Renames an existing identity. * * @param id identity service to use @@ -244,7 +244,7 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id, void *cb_cls); -/** +/** * Delete an existing identity. * * @param id identity service to use @@ -279,13 +279,13 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op); * * @param cls closure * @param ego NULL on error / ego not found - */ + */ typedef void (*GNUNET_IDENTITY_EgoCallback)(void *cls, const struct GNUNET_IDENTITY_Ego *ego); /** * Handle for ego lookup. - */ + */ struct GNUNET_IDENTITY_EgoLookup; 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 * * @param cls the closure from GNUNET_LOCKMANAGER_lock call * - * @param domain_name the locking domain of the lock + * @param domain_name the locking domain of the lock * * @param lock the lock for which this status is relevant * @@ -95,11 +95,11 @@ enum GNUNET_LOCKMANAGER_Status * acquired; GNUNET_LOCKMANAGER_RELEASE when the acquired lock is * lost. */ -typedef void +typedef void (*GNUNET_LOCKMANAGER_StatusCallback) (void *cls, const char *domain_name, uint32_t lock, - enum GNUNET_LOCKMANAGER_Status + enum GNUNET_LOCKMANAGER_Status status); 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 /** * Functions with this signature are called whenever a message is * received. - * + * * Each time the function must call #GNUNET_MESH_receive_done on the tunnel * in order to receive the next message. This doesn't need to be immediate: * can be delayed if some processing is done on the message. @@ -104,7 +104,7 @@ enum MeshTunnelOption * @param tunnel Connection to the other end. * @param tunnel_ctx Place to store local state associated with the tunnel. * @param message The actual message. - * + * * @return #GNUNET_OK to keep the tunnel open, * #GNUNET_SYSERR to close it (signal serious error). */ @@ -164,8 +164,8 @@ typedef void *(GNUNET_MESH_InboundTunnelNotificationHandler) (void *cls, /** * Function called whenever a tunnel is destroyed. Should clean up - * any associated state. - * + * any associated state. + * * It must NOT call #GNUNET_MESH_tunnel_destroy on the tunnel. * * @param cls closure (set from #GNUNET_MESH_connect) @@ -182,7 +182,7 @@ typedef void (GNUNET_MESH_TunnelEndHandler) (void *cls, * Connect to the mesh service. * * @param cfg Configuration to use. - * @param cls Closure for the various callbacks that follow (including + * @param cls Closure for the various callbacks that follow (including * handlers in the handlers array). * @param new_tunnel Function called when an *incoming* tunnel is created. * Can be NULL if no inbound tunnels are desired. @@ -193,15 +193,15 @@ typedef void (GNUNET_MESH_TunnelEndHandler) (void *cls, * @param handlers Callbacks for messages we care about, NULL-terminated. Each * one must call #GNUNET_MESH_receive_done on the tunnel to * receive the next message. Messages of a type that is not - * in the handlers array are ignored if received. + * in the handlers array are ignored if received. * @param ports NULL or 0-terminated array of port numbers for incoming tunnels. * See @c new_tunnel. - * + * * @return handle to the mesh service NULL on error * (in this case, init is never called) */ struct GNUNET_MESH_Handle * -GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, +GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, GNUNET_MESH_InboundTunnelNotificationHandler new_tunnel, GNUNET_MESH_TunnelEndHandler cleaner, @@ -234,7 +234,7 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle); * @return handle to the tunnel */ struct GNUNET_MESH_Tunnel * -GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle *h, +GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle *h, void *tunnel_ctx, const struct GNUNET_PeerIdentity *peer, uint32_t port, @@ -244,7 +244,7 @@ GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle *h, /** * Destroy an existing tunnel. - * + * * The existing end callback for the tunnel will be called immediately. * Any pending outgoing messages will be sent but no incoming messages will be * accepted and no data callbacks will be called. @@ -258,7 +258,7 @@ GNUNET_MESH_tunnel_destroy (struct GNUNET_MESH_Tunnel *tunnel); /** * Struct to retrieve info about a tunnel. */ -union GNUNET_MESH_TunnelInfo +union GNUNET_MESH_TunnelInfo { /** @@ -332,7 +332,7 @@ GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle /** * Indicate readiness to receive the next message on a tunnel. - * + * * Should only be called once per handler called. * * @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 /** * Functions with this signature are called whenever a message is * received. - * + * * Each time the function must call #GNUNET_MESH_receive_done on the channel * in order to receive the next message. This doesn't need to be immediate: * can be delayed if some processing is done on the message. @@ -161,8 +161,8 @@ typedef void *(GNUNET_MESH_InboundChannelNotificationHandler) (void *cls, /** * Function called whenever a channel is destroyed. Should clean up - * any associated state. - * + * any associated state. + * * It must NOT call #GNUNET_MESH_channel_destroy on the channel. * * @param cls closure (set from #GNUNET_MESH_connect) @@ -180,7 +180,7 @@ typedef void (GNUNET_MESH_ChannelEndHandler) (void *cls, * Connect to the mesh service. * * @param cfg Configuration to use. - * @param cls Closure for the various callbacks that follow (including + * @param cls Closure for the various callbacks that follow (including * handlers in the handlers array). * @param new_channel Function called when an *incoming* channel is created. * Can be NULL if no inbound channels are desired. @@ -191,10 +191,10 @@ typedef void (GNUNET_MESH_ChannelEndHandler) (void *cls, * @param handlers Callbacks for messages we care about, NULL-terminated. Each * one must call #GNUNET_MESH_receive_done on the channel to * receive the next message. Messages of a type that is not - * in the handlers array are ignored if received. + * in the handlers array are ignored if received. * @param ports NULL or 0-terminated array of port numbers for incoming channels. * See @a new_channel. - * + * * @return handle to the mesh service NULL on error * (in this case, init is never called) */ @@ -231,7 +231,7 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle); * @return handle to the channel */ struct GNUNET_MESH_Channel * -GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, +GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, void *channel_ctx, const struct GNUNET_PeerIdentity *peer, uint32_t port, @@ -241,7 +241,7 @@ GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, /** * Destroy an existing channel. - * + * * The existing end callback for the channel will be called immediately. * Any pending outgoing messages will be sent but no incoming messages will be * accepted and no data callbacks will be called. @@ -255,7 +255,7 @@ GNUNET_MESH_channel_destroy (struct GNUNET_MESH_Channel *channel); /** * Struct to retrieve info about a channel. */ -union GNUNET_MESH_ChannelInfo +union GNUNET_MESH_ChannelInfo { /** @@ -329,7 +329,7 @@ GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle /** * Indicate readiness to receive the next message on a channel. - * + * * Should only be called once per handler called. * * @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 @@ /* This file is part of GNUnet (C) 2013 Christian Grothoff (and other contributing authors) - + GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. - + GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the 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; /** * Error codes for the queue. - */ + */ enum GNUNET_MQ_Error { /** * FIXME: document! - */ + */ GNUNET_MQ_ERROR_READ = 1, /** * FIXME: document! - */ + */ GNUNET_MQ_ERROR_WRITE = 2, /** * FIXME: document! - */ + */ GNUNET_MQ_ERROR_TIMEOUT = 4 }; @@ -193,7 +193,7 @@ typedef void * destruction of a message queue. * Implementations must not free @a mq, but should * take care of @a impl_state. - * + * * @param mq the message queue to destroy * @param impl_state state of the implementation */ @@ -203,7 +203,7 @@ typedef void /** * Implementation function that cancels the currently sent message. - * + * * @param mq message queue * @param impl_state state specific to the implementation */ @@ -239,7 +239,7 @@ typedef void struct GNUNET_MQ_MessageHandler { /** - * Callback, called every time a new message of + * Callback, called every time a new message of * the specified type has been receied. */ GNUNET_MQ_MessageCallback cb; @@ -262,7 +262,7 @@ struct GNUNET_MQ_MessageHandler /** * Create a new envelope. - * + * * @param mhp message header to store the allocated message header in, can be NULL * @param size size of the message to allocate * @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); /** * Send a message with the give message queue. * May only be called once per message. - * + * * @param mq message queue * @param ev the envelope with the message to send. */ void -GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, +GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev); @@ -385,7 +385,7 @@ GNUNET_MQ_queue_for_callbacks (GNUNET_MQ_SendImpl send, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *cls); - + /** 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 @@ Boston, MA 02111-1307, USA. */ -/** +/** * @file include/gnunet_multicast_service.h * @brief multicast service; establish tunnels to distant peers * @author Christian Grothoff @@ -39,7 +39,7 @@ extern "C" #include "gnunet_util_lib.h" #include "gnunet_transport_service.h" -/** +/** * Version number of GNUnet-multicast API. */ #define GNUNET_MULTICAST_VERSION 0x00000000 @@ -49,12 +49,12 @@ extern "C" */ #define GNUNET_MULTICAST_FRAGMENT_MAX_SIZE 63 * 1024 -/** +/** * Opaque handle for a multicast group member. */ struct GNUNET_MULTICAST_Member; -/** +/** * Handle for the origin of a multicast group. */ struct GNUNET_MULTICAST_Origin; @@ -72,7 +72,7 @@ enum GNUNET_MULTICAST_MessageFlags */ GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT = 1 << 1, - /** + /** * OR'ed flags if message is not fragmented. */ GNUNET_MULTICAST_MESSAGE_NOT_FRAGMENTED @@ -83,7 +83,7 @@ enum GNUNET_MULTICAST_MessageFlags GNUNET_NETWORK_STRUCT_BEGIN -/** +/** * Header of a multicast message fragment. * * This format is public as the replay mechanism must replay message fragments using the @@ -93,12 +93,12 @@ GNUNET_NETWORK_STRUCT_BEGIN struct GNUNET_MULTICAST_MessageHeader { - /** + /** * Header for all multicast message fragments from the origin. */ struct GNUNET_MessageHeader header; - /** + /** * Number of hops this message fragment has taken since the origin. * * Helpful to determine shortest paths to the origin among honest peers for @@ -107,36 +107,36 @@ struct GNUNET_MULTICAST_MessageHeader */ uint32_t hop_counter GNUNET_PACKED; - /** + /** * ECC signature of the message fragment. * * Signature must match the public key of the multicast group. */ struct GNUNET_CRYPTO_EccSignature signature; - /** + /** * Purpose for the signature and size of the signed data. */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - /** + /** * Number of the message fragment, monotonically increasing. */ uint64_t fragment_id GNUNET_PACKED; - /** + /** * Byte offset of this @e fragment of the @e message. */ uint64_t fragment_offset GNUNET_PACKED; - /** + /** * Number of the message this fragment belongs to. * * Set in GNUNET_MULTICAST_origin_to_all(). */ uint64_t message_id GNUNET_PACKED; - /** + /** * Counter that monotonically increases whenever a member parts the group. * * Set in GNUNET_MULTICAST_origin_to_all(). @@ -159,7 +159,7 @@ struct GNUNET_MULTICAST_MessageHeader GNUNET_NETWORK_STRUCT_END -/** +/** * Handle that identifies a join request. * * Used to match calls to #GNUNET_MULTICAST_JoinCallback to the @@ -168,7 +168,7 @@ GNUNET_NETWORK_STRUCT_END struct GNUNET_MULTICAST_JoinHandle; -/** +/** * Function to call with the decision made for a join request. * * 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, const struct GNUNET_MessageHeader *join_response); -/** +/** * Method called whenever another peer wants to join the multicast group. * * Implementations of this function must call GNUNET_MULTICAST_join_decision() @@ -219,13 +219,13 @@ typedef void struct GNUNET_MULTICAST_JoinHandle *jh); -/** +/** * Handle to pass back for the answer of a membership test. */ struct GNUNET_MULTICAST_MembershipTestHandle; -/** +/** * Call informing multicast about the decision taken for a membership test. * * @param mth Handle that was given for the query. @@ -237,7 +237,7 @@ GNUNET_MULTICAST_membership_test_result (struct GNUNET_MULTICAST_MembershipTestH int result); -/** +/** * Method called to test if a member was in the group at a particular time. * * It is called when a replay request is received to determine if the requested @@ -259,14 +259,14 @@ typedef void struct GNUNET_MULTICAST_MembershipTestHandle *mth); -/** +/** * Function called whenever a group member has transmitted a request * to the origin (other than joining or leaving). * * FIXME: need to distinguish between origin cancelling a message (some fragments * were sent, then the rest 'discarded') and the case where we got disconnected; * right now, both would mean 'msg' is NULL, but they could be quite different... - * So the semantics from the receiver side of + * So the semantics from the receiver side of * GNUNET_MULTICAST_member_to_origin_cancel() are not clear here. Maybe we * should do something with the flags in this case? * @@ -282,7 +282,7 @@ typedef void enum GNUNET_MULTICAST_MessageFlags flags); -/** +/** * Function called whenever a group member is receiving a message fragment from * the origin. * @@ -293,7 +293,7 @@ typedef void * FIXME: need to distinguish between origin cancelling a message (some fragments * were sent, then the rest 'discarded') and the case where we got disconnected; * right now, both would mean 'msg' is NULL, but they could be quite different... - * So the semantics from the receiver side of + * So the semantics from the receiver side of * GNUNET_MULTICAST_origin_to_all_cancel() are not clear here. * * @param cls Closure (set from GNUNET_MULTICAST_member_join()) @@ -306,11 +306,11 @@ typedef void const struct GNUNET_MessageHeader *msg); -/** +/** * Function called with the result of an asynchronous operation. * * @see GNUNET_MULTICAST_replay_fragment() - * + * * @param result Result of the operation. */ typedef void @@ -318,13 +318,13 @@ typedef void int result); -/** +/** * Opaque handle to a replay request from the multicast service. */ struct GNUNET_MULTICAST_ReplayHandle; -/** +/** * Functions with this signature are called whenever the multicast service needs * a message fragment to be replayed by fragment_id. * @@ -346,7 +346,7 @@ typedef void uint64_t flags, struct GNUNET_MULTICAST_ReplayHandle *rh); -/** +/** * Functions with this signature are called whenever the multicast service needs * a message fragment to be replayed by message_id and fragment_offset. * @@ -371,18 +371,18 @@ typedef void struct GNUNET_MULTICAST_ReplayHandle *rh); -/** +/** * Possible error codes during replay. */ enum GNUNET_MULTICAST_ReplayErrorCode { - /** + /** * Everything is fine. */ GNUNET_MULTICAST_REC_OK = 0, - /** + /** * Message fragment not found in the message store. * * Either discarded if it is too old, or not arrived yet if this member has @@ -390,7 +390,7 @@ enum GNUNET_MULTICAST_ReplayErrorCode */ GNUNET_MULTICAST_REC_NOT_FOUND = 1, - /** + /** * Fragment ID counter was larger than the highest counter this * replay function has ever encountered; thus it is likely the * origin never sent it and we're at the HEAD of the multicast @@ -400,12 +400,12 @@ enum GNUNET_MULTICAST_ReplayErrorCode */ GNUNET_MULTICAST_REC_PAST_HEAD = 2, - /** + /** * Access is denied to the requested fragment, membership test did not pass. */ GNUNET_MULTICAST_REC_ACCESS_DENIED = 3, - /** + /** * Internal error (i.e. database error). Try some other peer. */ GNUNET_MULTICAST_REC_INTERNAL_ERROR = 4 @@ -413,7 +413,7 @@ enum GNUNET_MULTICAST_ReplayErrorCode }; -/** +/** * Replay a message fragment for the multicast group. * * @param rh Replay handle identifying which replay operation was requested. @@ -426,7 +426,7 @@ GNUNET_MULTICAST_replay_response (struct GNUNET_MULTICAST_ReplayHandle *rh, enum GNUNET_MULTICAST_ReplayErrorCode ec); -/** +/** * Indicate the end of the replay session. * * Invalidates the replay handle. @@ -448,7 +448,7 @@ typedef int void *data); -/** +/** * Replay a message for the multicast group. * * @param rh Replay handle identifying which replay operation was requested. @@ -461,7 +461,7 @@ GNUNET_MULTICAST_replay_response2 (struct GNUNET_MULTICAST_ReplayHandle *rh, void *notify_cls); -/** +/** * Start a multicast group. * * 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, GNUNET_MULTICAST_MessageCallback message_cb, void *cls); -/** +/** * Function called to provide data for a transmission from the origin to all * members. * @@ -526,14 +526,14 @@ typedef int void *data); -/** +/** * Handle for a request to send a message to all multicast group members * (from the origin). */ struct GNUNET_MULTICAST_OriginMessageHandle; -/** +/** * Send a message to the multicast group. * * @param origin Handle to the multicast group. @@ -553,7 +553,7 @@ GNUNET_MULTICAST_origin_to_all (struct GNUNET_MULTICAST_Origin *origin, -/** +/** * Resume message transmission to multicast group. * * @param mh Request to cancel. @@ -562,7 +562,7 @@ void GNUNET_MULTICAST_origin_to_all_resume (struct GNUNET_MULTICAST_OriginMessageHandle *mh); -/** +/** * Cancel request for message transmission to multicast group. * * @param mh Request to cancel. @@ -571,7 +571,7 @@ void GNUNET_MULTICAST_origin_to_all_cancel (struct GNUNET_MULTICAST_OriginMessageHandle *mh); -/** +/** * Stop a multicast group. * * @param origin Multicast group to stop. @@ -580,7 +580,7 @@ void GNUNET_MULTICAST_origin_stop (struct GNUNET_MULTICAST_Origin *origin); -/** +/** * Join a multicast group. * * 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, GNUNET_MULTICAST_MessageCallback message_cb, void *cls); -/** +/** * Handle for a replay request. */ struct GNUNET_MULTICAST_MemberReplayHandle; -/** +/** * Request a fragment to be replayed by fragment ID. * * 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, uint64_t flags); -/** +/** * Request a message fr to be replayed. * * 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, void *result_cb_cls); -/** +/** * Cancel a replay request. * * @param rh Request to cancel. @@ -695,7 +695,7 @@ void GNUNET_MULTICAST_member_replay_cancel (struct GNUNET_MULTICAST_MemberReplayHandle *rh); -/** +/** * Part a multicast group. * * Disconnects from all group members and invalidates the @a member handle. @@ -709,7 +709,7 @@ void GNUNET_MULTICAST_member_part (struct GNUNET_MULTICAST_Member *member); -/** +/** * Function called to provide data for a transmission from a member to the origin. * * Note that returning #GNUNET_OK or #GNUNET_SYSERR (but not #GNUNET_NO) @@ -733,15 +733,15 @@ typedef int void *data); -/** +/** * Handle for a message to be delivered from a member to the origin. */ struct GNUNET_MULTICAST_MemberRequestHandle; -/** +/** * Send a message to the origin of the multicast group. - * + * * @param member Membership handle. * @param message_id Application layer ID for the message. Opaque to multicast. * @param notify Callback to call to get the message. @@ -755,7 +755,7 @@ GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member, void *notify_cls); -/** +/** * Resume message transmission to origin. * * @param rh Request to cancel. @@ -764,7 +764,7 @@ void GNUNET_MULTICAST_member_to_origin_resume (struct GNUNET_MULTICAST_MemberRequestHandle *rh); -/** +/** * Cancel request for message transmission to origin. * * @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, /** * Destroy a mysql context. Also frees all associated prepared statements. - * + * * @param mc context to destroy */ void 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 * @param block block to cache * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ - int (*cache_block) (void *cls, + int (*cache_block) (void *cls, const struct GNUNET_NAMESTORE_Block *block); @@ -97,7 +97,7 @@ struct GNUNET_NAMESTORE_PluginFunctions * @param iter_cls closure for @a iter * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error */ - int (*lookup_block) (void *cls, + int (*lookup_block) (void *cls, const struct GNUNET_HashCode *query, GNUNET_NAMESTORE_BlockCallback iter, void *iter_cls); @@ -114,7 +114,7 @@ struct GNUNET_NAMESTORE_PluginFunctions * @param rd array of records with data to store * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ - int (*store_records) (void *cls, + int (*store_records) (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *zone, const char *label, unsigned int rd_count, @@ -132,7 +132,7 @@ struct GNUNET_NAMESTORE_PluginFunctions * @param iter_cls closure for @a iter * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error */ - int (*iterate_records) (void *cls, + int (*iterate_records) (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *zone, uint64_t offset, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls); @@ -149,7 +149,7 @@ struct GNUNET_NAMESTORE_PluginFunctions * @param iter_cls closure for @a iter * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error */ - int (*zone_to_name) (void *cls, + int (*zone_to_name) (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *zone, const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, 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, */ enum GNUNET_NAMESTORE_RecordFlags { - + /** * No special options. */ @@ -251,7 +251,7 @@ struct GNUNET_NAMESTORE_Block * of encrypted data that follow. */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - + /** * Expiration time of the block. */ @@ -266,7 +266,7 @@ GNUNET_NETWORK_STRUCT_END /** * Store an item in the namestore. If the item is already present, - * it is replaced with the new record. + * it is replaced with the new record. * * @param h handle to the namestore * @param block block to store @@ -317,7 +317,7 @@ typedef void (*GNUNET_NAMESTORE_BlockProcessor) (void *cls, /** * Get a result for a particular key from the namestore. The processor - * will only be called once. + * will only be called once. * * @param h handle to the namestore * @param derived_hash hash of zone key combined with name to lookup @@ -328,7 +328,7 @@ typedef void (*GNUNET_NAMESTORE_BlockProcessor) (void *cls, * @return a handle that can be used to cancel */ struct GNUNET_NAMESTORE_QueueEntry * -GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h, +GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_HashCode *derived_hash, GNUNET_NAMESTORE_BlockProcessor proc, void *proc_cls); @@ -363,7 +363,7 @@ typedef void (*GNUNET_NAMESTORE_RecordMonitor) (void *cls, * cancel */ struct GNUNET_NAMESTORE_QueueEntry * -GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, +GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EccPrivateKey *zone, const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls); @@ -444,7 +444,7 @@ struct GNUNET_NAMESTORE_ZoneMonitor; /** - * Function called once the monitor has caught up with the current + * Function called once the monitor has caught up with the current * state of the database. Will be called AGAIN after each disconnect * (record monitor called with 'NULL' for zone_key) once we're again * in sync. @@ -534,7 +534,7 @@ GNUNET_NAMESTORE_records_deserialize (size_t len, /** - * Convert the binary value @a data of a record of + * Convert the binary value @a data of a record of * type @a type to a human-readable string. * * @param type type of the record @@ -587,7 +587,7 @@ GNUNET_NAMESTORE_number_to_typename (uint32_t type); /** * Test if a given record is expired. - * + * * @param rd record to test * @return #GNUNET_YES if the record is expired, * #GNUNET_NO if not @@ -619,11 +619,11 @@ GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicSignKey *z); /** * Convert public key to the respective absolute domain name in the - * ".zkey" pTLD. + * ".zkey" pTLD. * This is one of the very few calls in the entire API that is * NOT reentrant! - * - * @param pkey a public key with a point on the eliptic curve + * + * @param pkey a public key with a point on the eliptic curve * @return string "X.zkey" where X is the coordinates of the public * key in an encoding suitable for DNS labels. */ @@ -634,10 +634,10 @@ GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey /** * Convert an absolute domain name in the ".zkey" pTLD to the * respective public key. - * + * * @param zkey string "X.zkey" where X is the public * key in an encoding suitable for DNS labels. - * @param pkey set to a public key on the eliptic curve + * @param pkey set to a public key on the eliptic curve * @return #GNUNET_SYSERR if @a zkey has the wrong syntax */ int @@ -647,7 +647,7 @@ GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey, /** * Calculate the DHT query for a given @a label in a given @a zone. - * + * * @param zone private key of the zone * @param label label of the record * @param query hash to use for the query @@ -660,7 +660,7 @@ GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EccPrivateKe /** * Calculate the DHT query for a given @a label in a given @a zone. - * + * * @param pub public key of the zone * @param label label of the record * @param query hash to use for the query @@ -707,7 +707,7 @@ GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block); * @param label the name for the records * @param proc function to call with the result * @param proc_cls closure for @a proc - * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was + * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was * not well-formed */ int @@ -722,7 +722,7 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, * Compares if two records are equal * * @param a a record - * @param b another record + * @param b another record * @return #GNUNET_YES if the records are equal, or #GNUNET_NO if not. */ int @@ -736,11 +736,11 @@ GNUNET_NAMESTORE_records_cmp (const struct GNUNET_NAMESTORE_RecordData *a, * expiration time. * * @param rd_count number of records given in @a rd - * @param rd array of records + * @param rd array of records * @return absolute expiration time */ struct GNUNET_TIME_Absolute -GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count, +GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd); 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 * GNUNET_NAT_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_NAT_AutoResultCallback cb, void *cb_cls); - + /** * 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); * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ int -GNUNET_NETWORK_socket_set_blocking (struct GNUNET_NETWORK_Handle *fd, +GNUNET_NETWORK_socket_set_blocking (struct GNUNET_NETWORK_Handle *fd, int doBlock); 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 @@ * processes using signals. Because signals are not supported on W32 * and Java (at least not nicely), we can alternatively use a pipe * to send signals to the child processes (if the child process is - * a full-blown GNUnet process that supports reading signals from + * a full-blown GNUnet process that supports reading signals from * a pipe, of course). Naturally, this also only works for 'normal' * termination via signals, and not as a replacement for SIGKILL. * Thus using pipes to communicate signals should only be enabled if @@ -72,7 +72,7 @@ enum GNUNET_OS_InheritStdioFlags * inherit stdin of the parent. */ GNUNET_OS_INHERIT_STD_IN = 1, - + /** * When this flag is set, the child process will * inherit stdout of the parent. @@ -319,7 +319,7 @@ GNUNET_OS_start_process_vap (int pipe_control, enum GNUNET_OS_InheritStdioFlags std_inheritance, struct GNUNET_DISK_PipeHandle *pipe_stdin, struct GNUNET_DISK_PipeHandle *pipe_stdout, - const char *filename, + const char *filename, char *const argv[]); @@ -375,7 +375,7 @@ GNUNET_OS_start_process_va (int pipe_control, struct GNUNET_OS_Process * GNUNET_OS_start_process_v (int pipe_control, enum GNUNET_OS_InheritStdioFlags std_inheritance, - const SOCKTYPE *lsocks, + const SOCKTYPE *lsocks, const char *filename, char *const argv[]); @@ -482,7 +482,7 @@ GNUNET_OS_install_parent_control_handler (void *cls, * GNUNET_NO if not SUID (but binary exists), * GNUNET_SYSERR on error (no such binary or not executable) */ -int +int GNUNET_OS_check_helper_binary (const char *binary, int check_suid, const char * params); 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); /** * Continuation called with a status result. - * + * * @param cls closure * @param emsg error message, NULL on success */ 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" * @param ret return value from database operation to check * @param expected_status desired status * @param command description of the command that was run - * @param args arguments given to the command + * @param args arguments given to the command * @param filename name of the source file where the command was run * @param line line number in the source file * @return GNUNET_OK if the result is acceptable @@ -66,7 +66,7 @@ GNUNET_POSTGRES_check_result_ (PGconn *dbh, PGresult * ret, int expected_status, * @param ret return value from database operation to check * @param expected_status desired status * @param command description of the command that was run - * @param args arguments given to the command + * @param args arguments given to the command * @return GNUNET_OK if the result is acceptable */ #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, * @param dbh database handle * @param sql statement to run * @param filename filename for error reporting - * @param line code line for error reporting + * @param line code line for error reporting * @return GNUNET_OK on success */ int 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 @@ * @brief constants for network protocols * @author Christian Grothoff * @defgroup protocols Types of messages used in GNUnet - * @{ + * @{ */ /******************************************************************************* @@ -149,7 +149,7 @@ extern "C" ******************************************************************************/ /** - * Type of data messages from the plugin to the gnunet-wlan-helper + * Type of data messages from the plugin to the gnunet-wlan-helper */ #define GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER 39 @@ -843,7 +843,7 @@ extern "C" #define GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY 266 /** - * Request the destruction of a whole tunnel + * Request the destruction of a whole tunnel */ #define GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY 267 @@ -1888,7 +1888,7 @@ extern "C" /** * Result in response to regex search. - */ + */ #define GNUNET_MESSAGE_TYPE_REGEX_RESULT 622 /******************************************************************************* @@ -2187,7 +2187,7 @@ extern "C" #define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_BUSY 741 /** - * Mesh: audio data + * Mesh: audio data */ #define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO 742 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 @@ Boston, MA 02111-1307, USA. */ -/** +/** * @file include/gnunet_psyc_service.h * @brief PSYC service; high-level access to the PSYC protocol * note that clients of this API are NOT expected to @@ -90,13 +90,13 @@ extern "C" #include "gnunet_multicast_service.h" -/** +/** * Version number of GNUnet-PSYC API. */ #define GNUNET_PSYC_VERSION 0x00000000 -/** +/** * Policy flags for a channel. */ enum GNUNET_PSYC_ChannelFlags @@ -113,7 +113,7 @@ enum GNUNET_PSYC_ChannelFlags GNUNET_PSYC_CHANNEL_RESTRICTED_HISTORY = 1 << 1, }; -/** +/** * PSYC channel policies. */ enum GNUNET_PSYC_Policy @@ -125,7 +125,7 @@ enum GNUNET_PSYC_Policy */ GNUNET_PSYC_CHANNEL_ANONYMOUS = 0, - /** + /** * The master must approve membership to the channel, messages must only be * distributed to current channel slaves. This includes the channel * state as well as transient messages. @@ -135,7 +135,7 @@ enum GNUNET_PSYC_Policy | GNUNET_PSYC_CHANNEL_RESTRICTED_HISTORY, #if IDEAS_FOR_FUTURE - /** + /** * Anyone can freely join the channel (no approval required); * however, messages must only be distributed to current channel * slaves, so the master must still acknowledge that the slave @@ -170,7 +170,7 @@ enum GNUNET_PSYC_MessageFlags */ GNUNET_PSYC_MESSAGE_LAST_FRAGMENT = 1 << 1, - /** + /** * OR'ed flags if message is not fragmented. */ GNUNET_PSYC_MESSAGE_NOT_FRAGMENTED @@ -274,7 +274,7 @@ struct GNUNET_PSYC_MessageData uint8_t status; }; -/** +/** * Handle that identifies a join request. * * Used to match calls to #GNUNET_PSYC_JoinCallback to the @@ -283,7 +283,7 @@ struct GNUNET_PSYC_MessageData struct GNUNET_PSYC_JoinHandle; -/** +/** * Method called from PSYC upon receiving a message indicating a call to a * @e method. * @@ -316,7 +316,7 @@ typedef int enum GNUNET_PSYC_MessageFlags flags); -/** +/** * Method called from PSYC upon receiving a join request. * * @param cls Closure. @@ -341,7 +341,7 @@ typedef int struct GNUNET_PSYC_JoinHandle *jh); -/** +/** * Function to call with the decision made for a join request. * * 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, size_t data_size); -/** +/** * Handle for the master of a PSYC channel. */ struct GNUNET_PSYC_Master; -/** +/** * Function called after the channel master started. * * @param cls Closure. @@ -391,7 +391,7 @@ typedef void (*GNUNET_PSYC_MasterStartCallback) (void *cls, uint64_t max_message_id); -/** +/** * Start a PSYC master channel. * * 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, void *cls); -/** +/** * Function called to provide data for a transmission via PSYC. * * Note that returning #GNUNET_OK or #GNUNET_SYSERR (but not #GNUNET_NO) @@ -459,13 +459,13 @@ typedef int enum GNUNET_PSYC_MasterTransmitFlags { GNUNET_PSYC_MASTER_TRANSMIT_NONE = 0, - /** + /** * Whether this message should reset the channel state, * i.e. remove all previously stored state variables. */ GNUNET_PSYC_MASTER_TRANSMIT_RESET_STATE = 1 << 0, - /** + /** * Whether we need to increment the group generation counter after * transmitting this message. */ @@ -478,13 +478,13 @@ enum GNUNET_PSYC_MasterTransmitFlags }; -/** +/** * Handle for a pending PSYC transmission operation. */ struct GNUNET_PSYC_MasterTransmitHandle; -/** +/** * Send a message to call a method to all members in the PSYC channel. * * @param master Handle to the PSYC channel. @@ -505,7 +505,7 @@ GNUNET_PSYC_master_transmit (struct GNUNET_PSYC_Master *master, enum GNUNET_PSYC_MasterTransmitFlags flags); -/** +/** * Resume transmission to the channel. * * @param th Handle of the request that is being resumed. @@ -514,7 +514,7 @@ void GNUNET_PSYC_master_transmit_resume (struct GNUNET_PSYC_MasterTransmitHandle *th); -/** +/** * Abort transmission request to channel. * * @param th Handle of the request that is being aborted. @@ -523,7 +523,7 @@ void GNUNET_PSYC_master_transmit_cancel (struct GNUNET_PSYC_MasterTransmitHandle *th); -/** +/** * Stop a PSYC master channel. * * @param master PSYC channel master to stop. @@ -532,13 +532,13 @@ void GNUNET_PSYC_master_stop (struct GNUNET_PSYC_Master *master); -/** +/** * Handle for a PSYC channel slave. */ struct GNUNET_PSYC_Slave; -/** +/** * Function called after the slave joined. * * @param cls Closure. @@ -548,7 +548,7 @@ typedef void (*GNUNET_PSYC_SlaveJoinCallback) (void *cls, uint64_t max_message_id); -/** +/** * Join a PSYC channel. * * 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, size_t data_size); -/** +/** * Part a PSYC channel. * * Will terminate the connection to the PSYC service. Polite clients should @@ -606,7 +606,7 @@ void GNUNET_PSYC_slave_part (struct GNUNET_PSYC_Slave *slave); -/** +/** * Function called to provide data for a transmission to the channel master * (a.k.a. the @e host of the channel). * @@ -638,13 +638,13 @@ enum GNUNET_PSYC_SlaveTransmitFlags }; -/** +/** * Handle for a pending PSYC transmission operation. */ struct GNUNET_PSYC_SlaveTransmitHandle; -/** +/** * Request a message to be sent to the channel master. * * @param slave Slave handle. @@ -664,7 +664,7 @@ GNUNET_PSYC_slave_transmit (struct GNUNET_PSYC_Slave *slave, enum GNUNET_PSYC_SlaveTransmitFlags flags); -/** +/** * Resume transmission to the master. * * @param th Handle of the request that is being resumed. @@ -673,7 +673,7 @@ void GNUNET_PSYC_slave_transmit_resume (struct GNUNET_PSYC_MasterTransmitHandle *th); -/** +/** * Abort transmission request to master. * * @param th Handle of the request that is being aborted. @@ -682,13 +682,13 @@ void GNUNET_PSYC_slave_transmit_cancel (struct GNUNET_PSYC_SlaveTransmitHandle *th); -/** +/** * Handle to access PSYC channel operations for both the master and slaves. */ struct GNUNET_PSYC_Channel; -/** +/** * Convert a channel @a master to a @e channel handle to access the @e channel * APIs. * @@ -699,7 +699,7 @@ struct GNUNET_PSYC_Channel * GNUNET_PSYC_master_get_channel (struct GNUNET_PSYC_Master *master); -/** +/** * Convert @a slave to a @e channel handle to access the @e channel APIs. * * @param slave Slave handle. @@ -709,7 +709,7 @@ struct GNUNET_PSYC_Channel * GNUNET_PSYC_slave_get_channel (struct GNUNET_PSYC_Slave *slave); -/** +/** * Add a slave to the channel's membership list. * * 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, uint64_t effective_since); -/** +/** * Remove a slave from the channel's membership list. * * 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, uint64_t announced_at); -/** +/** * Function called to inform a member about stored state values for a channel. * * @param cls Closure. @@ -791,13 +791,13 @@ typedef void (*GNUNET_PSYC_FinishCallback) (void *cls); -/** +/** * Handle to a story telling operation. */ struct GNUNET_PSYC_Story; -/** +/** * Request to be told the message history of the channel. * * 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, void *cls); -/** +/** * Abort story telling. * * 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); struct GNUNET_PSYC_StateQuery; -/** +/** * Retrieve the best matching channel state variable. * * 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, void *cb_cls); -/** +/** * Return all channel state variables whose name matches a given prefix. * * 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, void *cb_cls); -/** +/** * Cancel a state query operation. * * @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 */ void *cls; - /** + /** * Store join/leave events for a PSYC channel in order to be able to answer * membership test queries later. * @@ -66,7 +66,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions uint64_t effective_since, uint64_t group_generation); - /** + /** * Test if a member was admitted to the channel at the given message ID. * * @see GNUNET_PSYCSTORE_membership_test() @@ -80,7 +80,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key, uint64_t message_id); - /** + /** * Store a message fragment sent to a channel. * * @see GNUNET_PSYCSTORE_fragment_store() @@ -93,7 +93,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions const struct GNUNET_MULTICAST_MessageHeader *message, uint32_t psycstore_flags); - /** + /** * Set additional flags for a given message. * * They are OR'd with any existing flags set. @@ -111,7 +111,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions uint64_t message_id, uint64_t psycstore_flags); - /** + /** * Retrieve a message fragment by fragment ID. * * @see GNUNET_PSYCSTORE_fragment_get() @@ -125,7 +125,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions GNUNET_PSYCSTORE_FragmentCallback cb, void *cb_cls); - /** + /** * Retrieve all fragments of a message. * * @see GNUNET_PSYCSTORE_message_get() @@ -140,7 +140,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions GNUNET_PSYCSTORE_FragmentCallback cb, void *cb_cls); - /** + /** * Retrieve a fragment of message specified by its message ID and fragment * offset. * @@ -156,7 +156,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions GNUNET_PSYCSTORE_FragmentCallback cb, void *cb_cls); - /** + /** * Retrieve the max. values of message counters for a channel. * * @see GNUNET_PSYCSTORE_counters_get() @@ -170,7 +170,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions uint64_t *max_message_id, uint64_t *max_group_generation); - /** + /** * Retrieve the max. values of state counters for a channel. * * @see GNUNET_PSYCSTORE_counters_get() @@ -183,7 +183,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions uint64_t *max_state_message_id); - /** + /** * Begin modifying current state. * * @see GNUNET_PSYCSTORE_state_modify() @@ -195,7 +195,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, uint64_t message_id, uint64_t state_delta); - /** + /** * Set the current value of a state variable. * * The state modification process is started with state_modify_begin(), @@ -212,7 +212,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions const char *name, const void *value, size_t value_size); - /** + /** * End modifying current state. * * @see GNUNET_PSYCSTORE_state_modify() @@ -225,7 +225,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions uint64_t message_id); - /** + /** * Begin synchronizing state. * * @see GNUNET_PSYCSTORE_state_sync() @@ -236,7 +236,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions (*state_sync_begin) (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key); - /** + /** * Set the value of a state variable while synchronizing state. * * The state synchronization process is started with state_sync_begin(), @@ -253,7 +253,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions const char *name, const void *value, size_t value_size); - /** + /** * End synchronizing state. * * @see GNUNET_PSYCSTORE_state_sync() @@ -266,7 +266,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions uint64_t message_id); - /** + /** * Reset the state of a channel. * * Delete all state variables stored for the given channel. @@ -289,7 +289,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key); - /** + /** * Retrieve a state variable by name (exact match). * * @return #GNUNET_OK on success, else #GNUNET_SYSERR @@ -301,7 +301,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions GNUNET_PSYCSTORE_StateCallback cb, void *cb_cls); - /** + /** * Retrieve all state variables for a channel with the given prefix. * * @see GNUNET_PSYCSTORE_state_get_prefix() @@ -316,7 +316,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions void *cb_cls); - /** + /** * Retrieve all signed state variables for a channel. * * @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 @@ Boston, MA 02111-1307, USA. */ -/** +/** * @file include/gnunet_psycstore_service.h * @brief PSYCstore service; implements persistent storage for the PSYC service * @author Gabor X Toth @@ -40,7 +40,7 @@ extern "C" #include "gnunet_multicast_service.h" #include "gnunet_psyc_service.h" -/** +/** * Version number of GNUnet PSYCstore API. */ #define GNUNET_PSYCSTORE_VERSION 0x00000000 @@ -67,13 +67,13 @@ enum GNUNET_PSYCSTORE_MessageFlags }; -/** +/** * Handle for a PSYCstore */ struct GNUNET_PSYCSTORE_Handle; -/** +/** * Connect to the PSYCstore service. * * @param cfg Configuration to use. @@ -84,7 +84,7 @@ struct GNUNET_PSYCSTORE_Handle * GNUNET_PSYCSTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); -/** +/** * Disconnect from the PSYCstore service. * * @param h Handle for the connection. @@ -93,15 +93,15 @@ void GNUNET_PSYCSTORE_disconnect (struct GNUNET_PSYCSTORE_Handle *h); -/** +/** * Handle for an operation on the PSYCSTORE (useful to cancel the operation). */ struct GNUNET_PSYCSTORE_OperationHandle; -/** +/** * Function called with the result of an asynchronous operation. - * + * * @param result #GNUNET_SYSERR on error, * #GNUNET_YES on success or if the peer was a member, * #GNUNET_NO if the peer was not a member @@ -112,7 +112,7 @@ typedef void const char *err_msg); -/** +/** * Store join/leave events for a PSYC channel in order to be able to answer * membership test queries later. * @@ -143,7 +143,7 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, void *rcb_cls); -/** +/** * Test if a member was admitted to the channel at the given message ID. * * 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, void *rcb_cls); -/** +/** * Store a message fragment sent to a channel. * * @param h Handle for the PSYCstore. @@ -183,7 +183,7 @@ GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h, * state modifiers. * @param rcb Callback to call with the result of the operation. * @param rcb_cls Closure for the callback. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -195,7 +195,7 @@ GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h, void *rcb_cls); -/** +/** * Function called with one message fragment, as the result of a * GNUNET_PSYCSTORE_fragment_get() or GNUNET_PSYCSTORE_message_get() call. * @@ -213,7 +213,7 @@ typedef int enum GNUNET_PSYCSTORE_MessageFlags psycstore_flags); -/** +/** * Retrieve a message fragment by fragment ID. * * @param h Handle for the PSYCstore. @@ -222,7 +222,7 @@ typedef int * @param fcb Callback to call with the retrieved fragment. * @param rcb Callback to call with the result of the operation. * @param cls Closure for the callbacks. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -234,7 +234,7 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, void *cls); -/** +/** * Retrieve all fragments of a message. * * @param h Handle for the PSYCstore. @@ -243,7 +243,7 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, * @param fcb Callback to call with the retrieved fragments. * @param rcb Callback to call with the result of the operation. * @param cls Closure for the callbacks. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -255,7 +255,7 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, void *cls); -/** +/** * Retrieve a fragment of message specified by its message ID and fragment * offset. * @@ -266,7 +266,7 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, * @param fcb Callback to call with the retrieved fragments. * @param rcb Callback to call with the result of the operation. * @param cls Closure for the callbacks. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -279,7 +279,7 @@ GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h, void *cls); -/** +/** * Callback used to return the latest value of counters for the channel master. * * @see GNUNET_PSYCSTORE_counters_get() @@ -299,7 +299,7 @@ typedef void uint64_t max_state_message_id); -/** +/** * Retrieve latest values of counters for a channel. * * The current value of counters are needed @@ -311,7 +311,7 @@ typedef void * @param channel_key Public key that identifies the channel. * @param ccb Callback to call with the result. * @param ccb_cls Closure for the callback. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -321,7 +321,7 @@ GNUNET_PSYCSTORE_counters_get (struct GNUNET_PSYCSTORE_Handle *h, void *ccb_cls); -/** +/** * Apply modifiers of a message to the current channel state. * * An error is returned if there are missing messages containing state @@ -335,7 +335,7 @@ GNUNET_PSYCSTORE_counters_get (struct GNUNET_PSYCSTORE_Handle *h, * @param modifiers List of modifiers to apply. * @param rcb Callback to call with the result of the operation. * @param rcb_cls Closure for the callback. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -349,7 +349,7 @@ GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h, void *rcb_cls); -/** +/** * Store synchronized state. * * @param h Handle for the PSYCstore. @@ -359,7 +359,7 @@ GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h, * @param modifiers Full state to store. * @param rcb Callback to call with the result of the operation. * @param rcb_cls Closure for the callback. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -373,7 +373,7 @@ GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h, -/** +/** * Reset the state of a channel. * * Delete all state variables stored for the given channel. @@ -382,7 +382,7 @@ GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h, * @param channel_key The channel we are interested in. * @param rcb Callback to call with the result of the operation. * @param rcb_cls Closure for the callback. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -393,7 +393,7 @@ GNUNET_PSYCSTORE_state_reset (struct GNUNET_PSYCSTORE_Handle *h, void *rcb_cls); -/** +/** * Update signed values of state variables in the state store. * * @param h Handle for the PSYCstore. @@ -413,7 +413,7 @@ GNUNET_PSYCSTORE_state_hash_update (struct GNUNET_PSYCSTORE_Handle *h, void *rcb_cls); -/** +/** * Function called with the value of a state variable. * * @param cls Closure. @@ -430,7 +430,7 @@ typedef int const void *value, size_t value_size); -/** +/** * Retrieve the best matching state variable. * * @param h Handle for the PSYCstore. @@ -439,7 +439,7 @@ typedef int * @param scb Callback to return the matching state variable. * @param rcb Callback to call with the result of the operation. * @param cls Closure for the callbacks. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -451,7 +451,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, void *cls); -/** +/** * Retrieve all state variables for a channel with the given prefix. * * @param h Handle for the PSYCstore. @@ -460,7 +460,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, * @param scb Callback to return matching state variables. * @param rcb Callback to call with the result of the operation. * @param cls Closure for the callbacks. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -472,7 +472,7 @@ GNUNET_PSYCSTORE_state_get_prefix (struct GNUNET_PSYCSTORE_Handle *h, void *cls); -/** +/** * Cancel an operation. * * @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; * Announce this peer under the given regular expression. Does * not free resources, must call #GNUNET_REGEX_announce_cancel for * that. - * + * * @param cfg configuration to use * @param regex Regular expression to announce. * @param refresh_delay after what delay should the announcement be repeated? @@ -76,7 +76,7 @@ GNUNET_REGEX_announce (const struct GNUNET_CONFIGURATION_Handle *cfg, /** * Stop announcing the regex specified by the given handle. - * + * * @param a handle returned by a previous #GNUNET_REGEX_announce call. */ void @@ -122,7 +122,7 @@ GNUNET_REGEX_search (const struct GNUNET_CONFIGURATION_Handle *cfg, /** * Stop search and free all data used by a #GNUNET_REGEX_search call. - * + * * @param s Handle returned by a previous #GNUNET_REGEX_search call. */ void 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); * Perform a reverse DNS lookup. * * @param sa host address - * @param salen length of @a sa + * @param salen length of @a sa * @param do_resolve use #GNUNET_NO to return numeric hostname * @param timeout how long to try resolving * @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; * Callback to call with the result of a key revocation query. * * @param cls closure - * @param is_valid #GNUNET_NO of the key is/was revoked, + * @param is_valid #GNUNET_NO of the key is/was revoked, * #GNUNET_YES if the key is still valid, * #GNUNET_SYSERR if we had trouble querying the service * 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, enum GNUNET_SCALARPRODUCT_ResponseStatus status); /** * Process a datum that was stored in the scalarproduct. - * + * * @param cls closure * @param status Status of the request * @param type result of the computation @@ -77,7 +77,7 @@ typedef void (*GNUNET_SCALARPRODUCT_DatumProcessor) (void *cls, /** * Request by Alice's client for computing a scalar product - * + * * @param h handle to the master context * @param key Session key - unique to the requesting client * @param peer PeerID of the other peer @@ -100,8 +100,8 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cont_cls); /** - * Used by Bob's client to cooperate with Alice, - * + * Used by Bob's client to cooperate with Alice, + * * @param h handle to our configuration * @param key Session key - unique to the requesting client * @param elements Array of elements of the vector @@ -119,7 +119,7 @@ GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle *cfg, /** * Cancel an ongoing computation or revoke our collaboration offer. * Closes the connection to the service - * + * * @param h handel to terminate */ void @@ -128,7 +128,7 @@ GNUNET_SCALARPRODUCT_cancel (struct GNUNET_SCALARPRODUCT_ComputationHandle * h); /** * Cancel ALL ongoing computation or revoke our collaboration offer. * Closes ALL connections to the service - * + * */ void GNUNET_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, * only valid until "task" is started! */ GNUNET_SCHEDULER_TaskIdentifier -GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, +GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, struct GNUNET_TIME_Relative delay, const struct GNUNET_NETWORK_FDSet *rs, 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); * serious error) */ void -GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, +GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, int success); @@ -326,7 +326,7 @@ GNUNET_SERVER_client_get_user_context_ (struct GNUNET_SERVER_Client *client, * @param ptr pointer to user context * @param size number of bytes in user context struct (for verification only) */ -void +void GNUNET_SERVER_client_set_user_context_ (struct GNUNET_SERVER_Client *client, void *ptr, size_t size); @@ -500,7 +500,7 @@ GNUNET_SERVER_connect_notify (struct GNUNET_SERVER_Handle *server, /** * Ask the server to stop notifying us whenever a client disconnects. - * Arguments must match exactly those given to + * Arguments must match exactly those given to * #GNUNET_SERVER_disconnect_notify. It is not necessary to call this * function during shutdown of the server; in fact, most applications * will never use this function. @@ -517,7 +517,7 @@ GNUNET_SERVER_disconnect_notify_cancel (struct GNUNET_SERVER_Handle *server, /** * Ask the server to stop notifying us whenever a client connects. - * Arguments must match exactly those given to + * Arguments must match exactly those given to * #GNUNET_SERVER_connect_notify. It is not necessary to call this * function during shutdown of the server; in fact, most applications * will never use this function. @@ -693,7 +693,7 @@ GNUNET_SERVER_notification_context_add (struct GNUNET_SERVER_NotificationContext void GNUNET_SERVER_notification_context_unicast (struct GNUNET_SERVER_NotificationContext *nc, struct GNUNET_SERVER_Client *client, - const struct GNUNET_MessageHeader *msg, + const struct GNUNET_MessageHeader *msg, int can_drop); @@ -706,7 +706,7 @@ GNUNET_SERVER_notification_context_unicast (struct GNUNET_SERVER_NotificationCon */ void GNUNET_SERVER_notification_context_broadcast (struct GNUNET_SERVER_NotificationContext *nc, - const struct GNUNET_MessageHeader *msg, + const struct GNUNET_MessageHeader *msg, int can_drop); @@ -811,7 +811,7 @@ typedef void (*GNUNET_SERVER_MstDestroyCallback) (void *cls, void *mst); * @param one_shot only call callback once, keep rest of message in buffer * @return #GNUNET_OK if we are done processing (need more data) * #GNUNET_NO if one_shot was set and we have another message ready - * #GNUNET_SYSERR if the data stream is corrupt + * #GNUNET_SYSERR if the data stream is corrupt */ typedef int (*GNUNET_SERVER_MstReceiveCallback) (void *cls, void *mst, 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 * if we shutdown nicely */ int -GNUNET_SERVICE_run (int argc, char *const *argv, +GNUNET_SERVICE_run (int argc, char *const *argv, const char *service_name, - enum GNUNET_SERVICE_Options options, - GNUNET_SERVICE_Main task, + enum GNUNET_SERVICE_Options options, + GNUNET_SERVICE_Main task, void *task_cls); 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, * Wait for set operation requests for the given application ID. * If the connection to the set service is lost, the listener is * re-created transparently with exponential backoff. - * + * * @param cfg configuration to use for connecting to * the set service * @param operation operation we want to listen for @@ -351,7 +351,7 @@ GNUNET_SET_listen_cancel (struct GNUNET_SET_ListenHandle *lh); * GNUNET_SET_listen, as the 'struct GNUNET_SET_Request' becomes invalid * afterwards. * Call GNUNET_SET_commit to provide the local set to use for the operation, - * and to begin the exchange with the remote peer. + * and to begin the exchange with the remote peer. * * @param request request to accept * @param result_mode specified how results will be returned, @@ -375,7 +375,7 @@ GNUNET_SET_accept (struct GNUNET_SET_Request *request, * set information and call the result callback with the * result information. * - * @param oh handle to the set operation + * @param oh handle to the set operation * @param set the set to use for the operation * @return GNUNET_OK on success, GNUNET_SYSERR if the * 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 @@ Boston, MA 02111-1307, USA. */ -/** +/** * @file include/gnunet_social_service.h * @brief Social service; implements social functionality using the PSYC service. * @author Gabor X Toth @@ -41,34 +41,34 @@ extern "C" #include "gnunet_multicast_service.h" -/** +/** * Version number of GNUnet Social API. */ #define GNUNET_SOCIAL_VERSION 0x00000000 -/** +/** * Handle for another user (who is likely pseudonymous) in the network. */ struct GNUNET_SOCIAL_Nym; -/** +/** * Handle for a place where social interactions happen. */ struct GNUNET_SOCIAL_Place; -/** +/** * Handle for a place that one of our egos hosts. */ struct GNUNET_SOCIAL_Home; -/** +/** * Handle to an implementation of try-and-slice. */ struct GNUNET_SOCIAL_Slicer; -/** +/** * Method called from SOCIAL upon receiving a message indicating a call * to a @e method. * @@ -101,7 +101,7 @@ typedef int enum GNUNET_PSYC_MessageFlags flags); -/** +/** * Create a try-and-slice instance. * * @return A new try-and-slice construct. @@ -110,7 +110,7 @@ struct GNUNET_SOCIAL_Slicer * GNUNET_SOCIAL_slicer_create (void); -/** +/** * Add a method to the try-and-slice instance. * * 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, void *method_cls); -/** +/** * Remove a registered method from the try-and-slice instance. * * @param slicer The try-and-slice instance. @@ -141,7 +141,7 @@ GNUNET_SOCIAL_slicer_remove (struct GNUNET_SOCIAL_Slicer *slicer, const char *method_name, GNUNET_SOCIAL_Method method); -/** +/** * Destroy a given try-and-slice instance. * * @param slicer slicer to destroy @@ -150,7 +150,7 @@ void GNUNET_SOCIAL_slicer_destroy (struct GNUNET_SOCIAL_Slicer *slicer); -/** +/** * Function called asking for nym to be admitted to the place. * * Should call either GNUNET_SOCIAL_home_admit() or @@ -178,9 +178,9 @@ typedef void size_t data_size); -/** +/** * Function called when a @a nym leaves the place. - * + * * This is also called if the @a nym was never given permission to enter * (i.e. the @a nym stopped asking to get in). * @@ -196,7 +196,7 @@ typedef void GNUNET_PSYC_Modifier *variables); -/** +/** * Enter a home where guests (nyms) can be hosted. * * A home is created upon first entering, and exists until @@ -225,7 +225,7 @@ GNUNET_SOCIAL_home_enter (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls); -/** +/** * Admit @a nym to the @a home. * * 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, struct GNUNET_SOCIAL_Nym *nym); -/** +/** * Throw @a nym out of the @a home. * * The @a nym reference will remain valid until the @@ -254,7 +254,7 @@ GNUNET_SOCIAL_home_eject (struct GNUNET_SOCIAL_Home *home, struct GNUNET_SOCIAL_Nym *nym); -/** +/** * Refuse @a nym entry into the @a home. * * @param home Home to disallow @a nym to enter. @@ -273,7 +273,7 @@ GNUNET_SOCIAL_home_reject_entry (struct GNUNET_SOCIAL_Home *home, size_t data_size); -/** +/** * Get the public key of a nym. * * 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, struct GNUNET_CRYPTO_EccPublicSignKey *nym_key); -/** +/** * Obtain the private-public key pair of the home. - * + * * @param home Home to get the key of. * @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. */ @@ -297,7 +297,7 @@ GNUNET_SOCIAL_home_get_key (struct GNUNET_SOCIAL_Home *home, struct GNUNET_CRYPTO_EccPrivateKey *home_key); -/** +/** * Advertise @a home under @a name in the GNS zone of the @e ego. * * @param home The home to advertise. @@ -322,9 +322,9 @@ GNUNET_SOCIAL_home_advertise (struct GNUNET_SOCIAL_Home *home, */ enum GNUNET_PSYC_AnnouncementFlags { - /** + /** * Whether this announcement removes all objects from the home. - * + * * New objects can be still added to the now empty home using the @e env * parameter of the same announcement. */ @@ -332,13 +332,13 @@ enum GNUNET_PSYC_AnnouncementFlags }; -/** +/** * Handle for an announcement request. */ struct GNUNET_SOCIAL_Announcement; -/** +/** * Send a message to all nyms that are present in the home. * * 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, GNUNET_SOCIAL_AnnouncementFlags flags); -/** +/** * Cancel announcement. * * @param a The announcement to cancel. @@ -371,7 +371,7 @@ void GNUNET_SOCIAL_home_announce_cancel (struct GNUNET_SOCIAL_Announcement *a); -/** +/** * Convert our home to a place so we can access it via the place API. * * @param home Handle for the home. @@ -383,7 +383,7 @@ struct GNUNET_SOCIAL_Place * GNUNET_SOCIAL_home_get_place (struct GNUNET_SOCIAL_Home *home, int keep_active); -/** +/** * Leave a home. * Invalidates home handle. @@ -394,7 +394,7 @@ GNUNET_SOCIAL_home_get_place (struct GNUNET_SOCIAL_Home *home, int keep_active); void GNUNET_SOCIAL_home_leave (struct GNUNET_SOCIAL_Home *home); -/** +/** * Request entry to a place (home hosted by someone else). * * @param cfg Configuration to contact the social service. @@ -421,7 +421,7 @@ GNUNET_SOCIAL_place_enter (const struct GNUNET_CONFIGURATION_Handle *cfg, size_t data_size, struct GNUNET_SOCIAL_Slicer *slicer); -/** +/** * Request entry to a place (home hosted by someone else). * * @param cfg Configuration to contact the social service. @@ -453,14 +453,14 @@ GNUNET_SOCIAL_place_enter2 (const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SOCIAL_WatchHandle; -/** +/** * Watch a place for changed objects. * * @param place Place to watch. * @param object_filter Object prefix to match. * @param state_cb Function to call when an object/state changes. * @param state_cb_cls Closure for callback. - * + * * @return Handle that can be used to cancel watching. */ struct GNUNET_SOCIAL_WatchHandle * @@ -470,7 +470,7 @@ GNUNET_SOCIAL_place_watch (struct GNUNET_SOCIAL_Place *place, void *state_cb_cls); -/** +/** * Cancel watching a place for changed objects. * * @param wh Watch handle to cancel. @@ -482,14 +482,14 @@ GNUNET_SOCIAL_place_watch_cancel (struct GNUNET_SOCIAL_WatchHandle *wh); struct GNUNET_SOCIAL_LookHandle; -/** +/** * Look at objects in the place with a matching name prefix. * * @param place The place to look its objects at. * @param name_prefix Look at objects with names beginning with this value. * @param state_cb Function to call for each object found. * @param state_cb_cls Closure for callback function. - * + * * @return Handle that can be used to stop looking at objects. */ struct GNUNET_SOCIAL_LookHandle * @@ -499,7 +499,7 @@ GNUNET_SOCIAL_place_look (struct GNUNET_SOCIAL_Place *place, void *state_cb_cls); -/** +/** * Stop looking at objects. * * @param lh Look handle to stop. @@ -509,7 +509,7 @@ GNUNET_SOCIAL_place_look_cancel (struct GNUNET_SOCIAL_LookHandle *lh); -/** +/** * Look at a particular object in the place. * * 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, enum GNUNET_SOCIAL_TalkFlags; -/** +/** * A talk request. */ struct GNUNET_SOCIAL_TalkRequest; -/** +/** * Talk to the host of the place. * * @param place Place where we want to talk to the host. @@ -558,7 +558,7 @@ GNUNET_SOCIAL_place_talk (struct GNUNET_SOCIAL_Place *place, GNUNET_SOCIAL_TalkFlags flags); -/** +/** * Cancel talking to the host of the place. * * @param tr Talk request to cancel. @@ -567,12 +567,12 @@ void GNUNET_SOCIAL_place_talk_cancel (struct GNUNET_SOCIAL_TalkRequest *tr); -/** +/** * A history lesson. */ struct GNUNET_SOCIAL_HistoryLesson; -/** +/** * Learn about the history of a place. * * Sends messages through the slicer function of the place where @@ -580,7 +580,7 @@ struct GNUNET_SOCIAL_HistoryLesson; * The messages will have the #GNUNET_PSYC_MESSAGE_HISTORIC flag set. * * To get the latest message, use 0 for both the start and end message ID. - * + * * @param place Place we want to learn more about. * @param start_message_id First historic message we are interested in. * @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, void *finish_cb_cls); -/** +/** * Stop processing messages from the history lesson. * * Must not be called after the finish callback of the history lesson is called. @@ -613,11 +613,11 @@ void GNUNET_SOCIAL_place_get_history_cancel (struct GNUNET_SOCIAL_HistoryLesson *hist); -/** +/** * Leave a place permanently. * * Notifies the owner of the place about leaving, and destroys the place handle. - * + * * @param place Place to leave permanently. * @param keep_active Keep place active after last application disconnected. */ 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 @@ /* This file is part of GNUnet (C) 2013 Christian Grothoff (and other contributing authors) - + GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. - + GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the 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, * @return the converted string (0-terminated) */ char * -GNUNET_STRINGS_to_utf8 (const char *input, - size_t len, +GNUNET_STRINGS_to_utf8 (const char *input, + size_t len, const char *charset); @@ -137,8 +137,8 @@ GNUNET_STRINGS_to_utf8 (const char *input, * string is returned. */ char * -GNUNET_STRINGS_from_utf8 (const char *input, - size_t len, +GNUNET_STRINGS_from_utf8 (const char *input, + size_t len, const char *charset); @@ -150,7 +150,7 @@ GNUNET_STRINGS_from_utf8 (const char *input, * @param output output buffer */ void -GNUNET_STRINGS_utf8_tolower (const char* input, +GNUNET_STRINGS_utf8_tolower (const char* input, char** output); @@ -198,9 +198,9 @@ GNUNET_STRINGS_filename_expand (const char *fil); * (or number of bytes that would have been written) */ size_t -GNUNET_STRINGS_buffer_fill (char *buffer, - size_t size, - unsigned int count, +GNUNET_STRINGS_buffer_fill (char *buffer, + size_t size, + unsigned int count, ...); @@ -237,7 +237,7 @@ GNUNET_STRINGS_absolute_time_to_string (struct GNUNET_TIME_Absolute t); /** * Give relative time in human-readable fancy format. * This is one of the very few calls in the entire API that is - * NOT reentrant! + * NOT reentrant! * * @param delta time in milli seconds * @param do_round are we allowed to round a bit? @@ -279,9 +279,9 @@ GNUNET_STRINGS_get_short_name (const char *filename); * @return pointer to the next byte in 'out' or NULL on error. */ char * -GNUNET_STRINGS_data_to_string (const void *data, +GNUNET_STRINGS_data_to_string (const void *data, size_t size, - char *out, + char *out, size_t out_size); @@ -296,9 +296,9 @@ GNUNET_STRINGS_data_to_string (const void *data, * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong encoding */ int -GNUNET_STRINGS_string_to_data (const char *enc, +GNUNET_STRINGS_string_to_data (const char *enc, size_t enclen, - void *out, + void *out, size_t out_size); @@ -319,7 +319,7 @@ GNUNET_STRINGS_string_to_data (const char *enc, * (if they weren't NULL). */ int -GNUNET_STRINGS_parse_uri (const char *path, +GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part, const char **path_part); @@ -339,9 +339,9 @@ GNUNET_STRINGS_parse_uri (const char *path, * @return GNUNET_YES if 'filename' is absolute, GNUNET_NO otherwise. */ int -GNUNET_STRINGS_path_is_absolute (const char *filename, +GNUNET_STRINGS_path_is_absolute (const char *filename, int can_be_uri, - int *r_is_uri, + int *r_is_uri, char **r_uri_scheme); @@ -367,7 +367,7 @@ enum GNUNET_STRINGS_FilenameCheck /** * Check that the path is an absolute path. - */ + */ GNUNET_STRINGS_CHECK_IS_ABSOLUTE = 0x00000008 }; @@ -375,7 +375,7 @@ enum GNUNET_STRINGS_FilenameCheck /** * Perform checks on 'filename'. FIXME: some duplication with * "GNUNET_DISK_"-APIs. We should unify those. - * + * * @param filename file to check * @param checks checks to perform * @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, /** * Tries to convert 'zt_addr' string to an IPv6 address. * The string is expected to have the format "[ABCD::01]:80". - * + * * @param zt_addr 0-terminated string. May be mangled by the function. * @param addrlen length of zt_addr (not counting 0-terminator). * @param r_buf a buffer to fill. Initially gets filled with zeroes, @@ -398,7 +398,7 @@ GNUNET_STRINGS_check_filename (const char *filename, * case the contents of r_buf are undefined. */ int -GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, +GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, uint16_t addrlen, struct sockaddr_in6 *r_buf); @@ -406,7 +406,7 @@ GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, /** * Tries to convert 'zt_addr' string to an IPv4 address. * The string is expected to have the format "1.2.3.4:80". - * + * * @param zt_addr 0-terminated string. May be mangled by the function. * @param addrlen length of zt_addr (not counting 0-terminator). * @param r_buf a buffer to fill. @@ -414,7 +414,7 @@ GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, * the contents of r_buf are undefined. */ int -GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr, +GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr, uint16_t addrlen, struct sockaddr_in *r_buf); @@ -422,7 +422,7 @@ GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr, /** * Tries to convert 'addr' string to an IP (v4 or v6) address. * Will automatically decide whether to treat 'addr' as v4 or v6 address. - * + * * @param addr a string, may not be 0-terminated. * @param addrlen number of bytes in addr (if addr is 0-terminated, * 0-terminator should not be counted towards addrlen). @@ -451,8 +451,8 @@ GNUNET_STRINGS_to_address_ip (const char *addr, * @return GNUNET_OK on success, GNUNET_SYSERR on failure */ int -GNUNET_STRINGS_get_utf8_args (int argc, - char *const *argv, +GNUNET_STRINGS_get_utf8_args (int argc, + char *const *argv, int *u8argc, char *const **u8argv); 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 @@ /** * @file include/gnunet_testbed_logger_service.h * @brief API for submitting data to the testbed logger service - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #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, * @param nsuccess the number of successful overlay connects * @param nfailures the number of overlay connects which failed */ -typedef void (*GNUNET_TESTBED_TopologyCompletionCallback) (void *cls, +typedef void (*GNUNET_TESTBED_TopologyCompletionCallback) (void *cls, unsigned int nsuccess, unsigned int nfailures); @@ -1277,7 +1277,7 @@ GNUNET_TESTBED_service_connect (void *op_cls, * cancels the operation, frees its resources and ensures the no event is * generated with respect to this operation. Note that however cancelling an * operation does NOT guarantee that the operation will be fully undone (or that - * nothing ever happened). + * nothing ever happened). * * This function MUST be called for every operation to fully remove the * operation from the operation queue. After calling this function, if @@ -1491,7 +1491,7 @@ enum GNUNET_TESTBED_BarrierStatus * Error status */ GNUNET_TESTBED_BARRIERSTATUS_ERROR, - + }; @@ -1518,7 +1518,7 @@ typedef void (*GNUNET_TESTBED_barrier_status_cb) (void *cls, /** * Initialise a barrier and call the given callback when the required percentage - * of peers (quorum) reach the barrier. + * of peers (quorum) reach the barrier. * * @param controller the handle to the controller * @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" #endif /** - * Size of each hostkey in the hostkey file (in BYTES). + * Size of each hostkey in the hostkey file (in BYTES). */ #define GNUNET_TESTING_HOSTKEYFILESIZE sizeof (struct GNUNET_CRYPTO_EccPrivateKey) @@ -138,7 +138,7 @@ struct GNUNET_TESTING_System * GNUNET_TESTING_system_create_with_portrange (const char *testdir, const char *trusted_ip, const char *hostname, - const struct + const struct GNUNET_TESTING_SharedService * shared_services, uint16_t lowport, @@ -162,7 +162,7 @@ GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system, * faster peer startup. This function can be used to * access the n-th key of those pre-created hostkeys; note * that these keys are ONLY useful for testing and not - * secure as the private keys are part of the public + * secure as the private keys are part of the public * GNUnet source code. * * This is primarily a helper function used internally @@ -186,7 +186,7 @@ GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, * @param system system to use for reservation tracking * @return 0 if no free port was available */ -uint16_t +uint16_t GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system); @@ -226,14 +226,14 @@ GNUNET_TESTING_configuration_create (struct GNUNET_TESTING_System *system, /** * Configure a GNUnet peer. GNUnet must be installed on the local - * system and available in the PATH. + * system and available in the PATH. * * @param system system to use to coordinate resource usage * @param cfg configuration to use; will be UPDATED (to reflect needed * changes in port numbers and paths) * @param key_number number of the hostkey to use for the peer * @param id identifier for the daemon, will be set, can be NULL - * @param emsg set to freshly allocated error message (set to NULL on success), + * @param emsg set to freshly allocated error message (set to NULL on success), * can be NULL * @return handle to the peer, NULL on error */ @@ -257,7 +257,7 @@ GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer, /** - * Start the peer. + * Start the peer. * * @param peer peer to start * @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); * @param success GNUNET_YES if the peer is stopped; GNUNET_SYSERR upon any * error */ -typedef void (*GNUNET_TESTING_PeerStopCallback) (void *cls, +typedef void (*GNUNET_TESTING_PeerStopCallback) (void *cls, struct GNUNET_TESTING_Peer * peer, int success); @@ -358,7 +358,7 @@ GNUNET_TESTING_peer_stop_async_cancel (struct GNUNET_TESTING_Peer *peer); /** * Signature of the 'main' function for a (single-peer) testcase that * is run using 'GNUNET_TESTING_peer_run'. - * + * * @param cls closure * @param cfg configuration of the peer that was started * @param peer identity of the peer that was created @@ -424,14 +424,14 @@ GNUNET_TESTING_service_run (const char *testdir, * Sometimes we use the binary name to determine which specific * test to run. In those cases, the string after the last "_" * in 'argv[0]' specifies a string that determines the configuration - * file or plugin to use. + * file or plugin to use. * * This function returns the respective substring, taking care * of issues such as binaries ending in '.exe' on W32. * * @param argv0 the name of the binary * @return string between the last '_' and the '.exe' (or the end of the string), - * NULL if argv0 has no '_' + * NULL if argv0 has no '_' */ char * GNUNET_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); * * @return the offset we currently skew the locale time by */ -long long +long long GNUNET_TIME_get_offset (void); @@ -507,10 +507,10 @@ GNUNET_TIME_year_to_time (unsigned int year); /** * Convert an expiration time to the respective year (rounds) * - * @param at absolute time + * @param at absolute time * @return year a year (after 1970), 0 on error */ -unsigned int +unsigned int GNUNET_TIME_time_to_year (struct GNUNET_TIME_Absolute at); 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 * Function that should be called by the transport plugin * whenever a message is received. If this field is "NULL", * the plugin should load in 'stub' mode and NOT fully - * initialize and instead only return an API with the + * initialize and instead only return an API with the * 'address_pretty_printer', 'address_to_string' and * 'string_to_address' functions. */ 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 /** * Header from Linux TUN interface. - */ + */ struct GNUNET_TUN_Layer2PacketHeader { /** * Some flags (unused). - */ + */ uint16_t flags GNUNET_PACKED; /** @@ -97,7 +97,7 @@ struct GNUNET_TUN_IPv4Header * Length of the packet, including this header. */ uint16_t total_length GNUNET_PACKED; - + /** * Unique random ID for matching up fragments. */ @@ -124,12 +124,12 @@ struct GNUNET_TUN_IPv4Header /** * Origin of the packet. - */ + */ struct in_addr source_address GNUNET_PACKED; /** * Destination of the packet. - */ + */ struct in_addr destination_address GNUNET_PACKED; } GNUNET_GCC_STRUCT_LAYOUT; @@ -168,12 +168,12 @@ struct GNUNET_TUN_IPv6Header /** * Origin of the packet. - */ + */ struct in6_addr source_address GNUNET_PACKED; /** * Destination of the packet. - */ + */ struct in6_addr destination_address GNUNET_PACKED; } GNUNET_GCC_STRUCT_LAYOUT; @@ -222,7 +222,7 @@ struct GNUNET_TUN_TcpHeader unsigned int reserved : 4 GNUNET_PACKED; #else #error byteorder undefined -#endif +#endif /** * Flags (SYN, FIN, ACK, etc.) @@ -316,108 +316,108 @@ struct GNUNET_TUN_DnsFlags /** * Set to 1 if recursion is desired (client -> server) */ - unsigned int recursion_desired : 1 GNUNET_PACKED; - + unsigned int recursion_desired : 1 GNUNET_PACKED; + /** * Set to 1 if message is truncated */ - unsigned int message_truncated : 1 GNUNET_PACKED; - + unsigned int message_truncated : 1 GNUNET_PACKED; + /** * Set to 1 if this is an authoritative answer */ unsigned int authoritative_answer : 1 GNUNET_PACKED; - + /** * See GNUNET_TUN_DNS_OPCODE_ defines. */ - unsigned int opcode : 4 GNUNET_PACKED; - + unsigned int opcode : 4 GNUNET_PACKED; + /** * query:0, response:1 */ - unsigned int query_or_response : 1 GNUNET_PACKED; - + unsigned int query_or_response : 1 GNUNET_PACKED; + /** * See GNUNET_TUN_DNS_RETURN_CODE_ defines. */ - unsigned int return_code : 4 GNUNET_PACKED; - + unsigned int return_code : 4 GNUNET_PACKED; + /** * See RFC 4035. */ - unsigned int checking_disabled : 1 GNUNET_PACKED; - + unsigned int checking_disabled : 1 GNUNET_PACKED; + /** * Response has been cryptographically verified, RFC 4035. */ unsigned int authenticated_data : 1 GNUNET_PACKED; - + /** * Always zero. */ unsigned int zero : 1 GNUNET_PACKED; - + /** * Set to 1 if recursion is available (server -> client) */ - unsigned int recursion_available : 1 GNUNET_PACKED; + unsigned int recursion_available : 1 GNUNET_PACKED; #elif __BYTE_ORDER == __BIG_ENDIAN - + /** * query:0, response:1 */ - unsigned int query_or_response : 1 GNUNET_PACKED; - + unsigned int query_or_response : 1 GNUNET_PACKED; + /** * See GNUNET_TUN_DNS_OPCODE_ defines. */ - unsigned int opcode : 4 GNUNET_PACKED; - + unsigned int opcode : 4 GNUNET_PACKED; + /** * Set to 1 if this is an authoritative answer */ unsigned int authoritative_answer : 1 GNUNET_PACKED; - + /** * Set to 1 if message is truncated */ - unsigned int message_truncated : 1 GNUNET_PACKED; - + unsigned int message_truncated : 1 GNUNET_PACKED; + /** * Set to 1 if recursion is desired (client -> server) */ - unsigned int recursion_desired : 1 GNUNET_PACKED; + unsigned int recursion_desired : 1 GNUNET_PACKED; + - /** * Set to 1 if recursion is available (server -> client) */ unsigned int recursion_available : 1 GNUNET_PACKED; - + /** * Always zero. */ unsigned int zero : 1 GNUNET_PACKED; - + /** * Response has been cryptographically verified, RFC 4035. */ unsigned int authenticated_data : 1 GNUNET_PACKED; - + /** * See RFC 4035. */ - unsigned int checking_disabled : 1 GNUNET_PACKED; - + unsigned int checking_disabled : 1 GNUNET_PACKED; + /** * See GNUNET_TUN_DNS_RETURN_CODE_ defines. - */ - unsigned int return_code : 4 GNUNET_PACKED; + */ + unsigned int return_code : 4 GNUNET_PACKED; #else #error byteorder undefined #endif - + } GNUNET_GCC_STRUCT_LAYOUT; @@ -468,18 +468,18 @@ struct GNUNET_TUN_DnsSoaRecord * The version number of the original copy of the zone. (NBO) */ uint32_t serial GNUNET_PACKED; - + /** * Time interval before the zone should be refreshed. (NBO) */ uint32_t refresh GNUNET_PACKED; - + /** * Time interval that should elapse before a failed refresh should * be retried. (NBO) */ uint32_t retry GNUNET_PACKED; - + /** * Time value that specifies the upper limit on the time interval * that can elapse before the zone is no longer authoritative. (NBO) @@ -654,12 +654,12 @@ struct GNUNET_TUN_DnsRecordLine */ struct GNUNET_TUN_IcmpHeader { uint8_t type; - uint8_t code; + uint8_t code; uint16_t crc GNUNET_PACKED; union { /** - * ICMP Echo (request/reply) + * ICMP Echo (request/reply) */ struct { uint16_t identifier GNUNET_PACKED; @@ -667,7 +667,7 @@ struct GNUNET_TUN_IcmpHeader { } echo; /** - * ICMP Destination Unreachable (RFC 1191) + * ICMP Destination Unreachable (RFC 1191) */ struct ih_pmtu { uint16_t empty GNUNET_PACKED; @@ -676,7 +676,7 @@ struct GNUNET_TUN_IcmpHeader { } destination_unreachable; /** - * ICMP Redirect + * ICMP Redirect */ struct in_addr redirect_gateway_address GNUNET_PACKED; 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 @@ /** * @file include/gnunet_vpn_service.h - * @brief API to access the VPN service. + * @brief API to access the VPN service. * @author Christian Grothoff */ #ifndef GNUNET_VPN_SERVICE_H @@ -50,7 +50,7 @@ struct GNUNET_VPN_RedirectionRequest; * will match 'result_af' from the request * @param address IP address (struct in_addr or struct in_addr6, depending on 'af') * that the VPN allocated for the redirection; - * traffic to this IP will now be redirected to the + * traffic to this IP will now be redirected to the * specified target peer; NULL on error */ typedef void (*GNUNET_VPN_AllocationCallback)(void *cls, @@ -124,7 +124,7 @@ GNUNET_VPN_redirect_to_peer (struct GNUNET_VPN_Handle *vh, * anyway) */ struct GNUNET_VPN_RedirectionRequest * -GNUNET_VPN_redirect_to_ip (struct GNUNET_VPN_Handle *vh, +GNUNET_VPN_redirect_to_ip (struct GNUNET_VPN_Handle *vh, int result_af, int addr_af, const void *addr, @@ -137,7 +137,7 @@ GNUNET_VPN_redirect_to_ip (struct GNUNET_VPN_Handle *vh, * Connect to the VPN service * * @param cfg configuration to use - * @return VPN handle + * @return VPN handle */ struct GNUNET_VPN_Handle * GNUNET_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 @@ -/* - * TAP-Windows -- A kernel driver to provide virtual tap - * device functionality on Windows. - * - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. - * - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., - * and is released under the GPL version 2 (see below). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program (see the file COPYING included with this - * distribution); if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -/** - * @file include/tap-windows.h - * @brief TAP32 virtual network driver defines - * @attention This file is part of openvpn and for kept - * as a separate file to allow easier upgrading. - */ -#ifndef __TAP_WIN_H -#define __TAP_WIN_H - -/* - * ============= - * TAP IOCTLs - * ============= - */ - -#define TAP_WIN_CONTROL_CODE(request,method) \ - CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) - -/* Present in 8.1 */ - -#define TAP_WIN_IOCTL_GET_MAC TAP_WIN_CONTROL_CODE (1, METHOD_BUFFERED) -#define TAP_WIN_IOCTL_GET_VERSION TAP_WIN_CONTROL_CODE (2, METHOD_BUFFERED) -#define TAP_WIN_IOCTL_GET_MTU TAP_WIN_CONTROL_CODE (3, METHOD_BUFFERED) -#define TAP_WIN_IOCTL_GET_INFO TAP_WIN_CONTROL_CODE (4, METHOD_BUFFERED) -#define TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT TAP_WIN_CONTROL_CODE (5, METHOD_BUFFERED) -#define TAP_WIN_IOCTL_SET_MEDIA_STATUS TAP_WIN_CONTROL_CODE (6, METHOD_BUFFERED) -#define TAP_WIN_IOCTL_CONFIG_DHCP_MASQ TAP_WIN_CONTROL_CODE (7, METHOD_BUFFERED) -#define TAP_WIN_IOCTL_GET_LOG_LINE TAP_WIN_CONTROL_CODE (8, METHOD_BUFFERED) -#define TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT TAP_WIN_CONTROL_CODE (9, METHOD_BUFFERED) - -/* Added in 8.2 */ - -/* obsoletes TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT */ -#define TAP_WIN_IOCTL_CONFIG_TUN TAP_WIN_CONTROL_CODE (10, METHOD_BUFFERED) - -/* - * ================= - * Registry keys - * ================= - */ - -#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" - -#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}" - -/* - * ====================== - * Filesystem prefixes - * ====================== - */ - -#define USERMODEDEVICEDIR "\\\\.\\Global\\" -#define SYSDEVICEDIR "\\Device\\" -#define USERDEVICEDIR "\\DosDevices\\Global\\" -#define TAP_WIN_SUFFIX ".tap" - -#endif +/* + * TAP-Windows -- A kernel driver to provide virtual tap + * device functionality on Windows. + * + * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. + * + * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., + * and is released under the GPL version 2 (see below). + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program (see the file COPYING included with this + * distribution); if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/** + * @file include/tap-windows.h + * @brief TAP32 virtual network driver defines + * @attention This file is part of openvpn and for kept + * as a separate file to allow easier upgrading. + */ +#ifndef __TAP_WIN_H +#define __TAP_WIN_H + +/* + * ============= + * TAP IOCTLs + * ============= + */ + +#define TAP_WIN_CONTROL_CODE(request,method) \ + CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) + +/* Present in 8.1 */ + +#define TAP_WIN_IOCTL_GET_MAC TAP_WIN_CONTROL_CODE (1, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_GET_VERSION TAP_WIN_CONTROL_CODE (2, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_GET_MTU TAP_WIN_CONTROL_CODE (3, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_GET_INFO TAP_WIN_CONTROL_CODE (4, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT TAP_WIN_CONTROL_CODE (5, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_SET_MEDIA_STATUS TAP_WIN_CONTROL_CODE (6, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_CONFIG_DHCP_MASQ TAP_WIN_CONTROL_CODE (7, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_GET_LOG_LINE TAP_WIN_CONTROL_CODE (8, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT TAP_WIN_CONTROL_CODE (9, METHOD_BUFFERED) + +/* Added in 8.2 */ + +/* obsoletes TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT */ +#define TAP_WIN_IOCTL_CONFIG_TUN TAP_WIN_CONTROL_CODE (10, METHOD_BUFFERED) + +/* + * ================= + * Registry keys + * ================= + */ + +#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" + +#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}" + +/* + * ====================== + * Filesystem prefixes + * ====================== + */ + +#define USERMODEDEVICEDIR "\\\\.\\Global\\" +#define SYSDEVICEDIR "\\Device\\" +#define USERDEVICEDIR "\\DosDevices\\Global\\" +#define TAP_WIN_SUFFIX ".tap" + +#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; static struct TransportPlugin *ptail; -static int +static int map_check_it (void *cls, const struct GNUNET_PeerIdentity * key, void *value) @@ -138,7 +138,7 @@ map_check_it (void *cls, } -static int +static int map_cleanup_it (void *cls, const struct GNUNET_PeerIdentity * key, void *value) @@ -216,7 +216,7 @@ check_lowlevel_connections (int port, int protocol) char line[1024]; int count = -1; - switch (protocol) + switch (protocol) { case tcp: #ifdef MINGW @@ -292,7 +292,7 @@ find_plugin (char * name) return cur; } -static int +static int stats_check_cb (void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent) @@ -412,33 +412,33 @@ struct PONG GNUNET_NETWORK_STRUCT_END -static size_t +static size_t send_transport_ping_cb (void *cls, size_t size, void *buf) { struct PeerContainer * pc = cls; struct PING ping; size_t mlen = sizeof (struct PING); - + if (size < mlen) { GNUNET_break (0); return 0; } - + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending transport ping to `%s'\n", GNUNET_i2s (&pc->id)); ping.header.size = htons (mlen); ping.header.type = htons (1234); ping.src = htons (0); - + pc->th_ping = NULL; - + memcpy (buf, &ping, mlen); return mlen; } -static size_t +static size_t send_core_ping_cb (void *cls, size_t size, void *buf) { struct PeerContainer * pc = cls; @@ -450,21 +450,21 @@ send_core_ping_cb (void *cls, size_t size, void *buf) GNUNET_break (0); return 0; } - + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending core ping to `%s'\n", GNUNET_i2s (&pc->id)); ping.header.size = htons (mlen); ping.header.type = htons (1234); ping.src = htons (1); - + pc->ch_ping = NULL; - + memcpy (buf, &ping, mlen); return mlen; } -static int +static int map_ping_it (void *cls, const struct GNUNET_PeerIdentity * key, void *value) @@ -522,7 +522,7 @@ stats_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } -static size_t +static size_t send_transport_pong_cb (void *cls, size_t size, void *buf) { struct PeerContainer * pc = cls; @@ -548,27 +548,27 @@ send_transport_pong_cb (void *cls, size_t size, void *buf) } -static size_t +static size_t send_core_pong_cb (void *cls, size_t size, void *buf) { struct PeerContainer * pc = cls; struct PING ping; size_t mlen = sizeof (struct PING); - + if (size < mlen) { GNUNET_break (0); return 0; } - + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending core pong to `%s'\n", GNUNET_i2s (&pc->id)); ping.header.size = htons (mlen); ping.header.type = htons (4321); ping.src = htons (1); - + pc->ch_pong = NULL; - + memcpy (buf, &ping, mlen); return mlen; } @@ -768,7 +768,7 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (NULL != ch) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Disconnecting from core service\n"); GNUNET_CORE_disconnect (ch); ch = NULL; @@ -822,9 +822,9 @@ transport_notify_disconnect_cb (void *cls, const struct GNUNET_PeerIdentity *peer) { GNUNET_assert (transport_connections > 0); - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "TRANSPORT disconnect for peer `%s' (%u total)\n", - GNUNET_i2s (peer), + GNUNET_i2s (peer), transport_connections); map_disconnect (peer, th); transport_connections --; @@ -851,7 +851,7 @@ transport_notify_receive_cb (void *cls, if ((message->size == ntohs (sizeof (struct PING))) && (message->type == ntohs (1234))) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received %s %s from peer `%s'\n", "TRANSPORT", "PING", @@ -877,7 +877,7 @@ transport_notify_receive_cb (void *cls, } } -static int +static int core_notify_receive_cb (void *cls, const struct GNUNET_PeerIdentity * peer, const struct GNUNET_MessageHeader * message) @@ -970,7 +970,7 @@ core_disconnect_cb (void *cls, static void -core_init_cb (void *cls, +core_init_cb (void *cls, const struct GNUNET_PeerIdentity *my_identity) { 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, * @param cls Closure. * @param peer Peer in the tunnel's tree. * @param parent Parent of the current peer. All 0 when peer is root. - * + * */ static void tunnel_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 @@ * - relay corking down to core * - set ttl relative to path length * TODO END - * + * * Dictionary: * - peer: other mesh instance. If there is direct connection it's a neighbor. * - tunnel: encrypted connection to a peer, neighbor or not. @@ -409,7 +409,7 @@ tunnel_notify_connection_broken (struct MeshTunnel2 *t, * @brief Use the given path for the tunnel. * Update the next and prev hops (and RCs). * (Re)start the path refresh in case the tunnel is locally owned. - * + * * @param t Tunnel to update. * @param p Path to use. * @@ -420,10 +420,10 @@ tunnel_use_path (struct MeshTunnel2 *t, struct MeshPeerPath *p); /** * Tunnel is empty: destroy it. - * + * * Notifies all participants (peers, cleints) about the destruction. - * - * @param t Tunnel to destroy. + * + * @param t Tunnel to destroy. */ static void tunnel_destroy_empty (struct MeshTunnel2 *t); @@ -469,7 +469,7 @@ __mesh_divider______________________________________________________________(); * * @param s Tunnel state. * - * @return String representation. + * @return String representation. */ static const char * GNUNET_MESH_DEBUG_TS2S (enum MeshTunnelState s) @@ -640,7 +640,7 @@ tunnel_get_buffer (struct MeshTunnel2 *t, int fwd) /** - * FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME + * FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME * Encrypt data with the tunnel key. * * @param t Tunnel whose key to use. @@ -660,7 +660,7 @@ tunnel_encrypt (struct MeshTunnel2 *t, /** - * FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME + * FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME * Decrypt data with the tunnel key. * * @param t Tunnel whose key to use. @@ -763,7 +763,7 @@ send_connection_create (struct MeshConnection *connection) * @param fwd Is this a fwd ACK? (First is bck (SYNACK), second is fwd (ACK)) */ static void -send_connection_ack (struct MeshConnection *connection, int fwd) +send_connection_ack (struct MeshConnection *connection, int fwd) { struct MeshTunnel2 *t; @@ -938,7 +938,7 @@ connection_debug (struct MeshConnection *c) } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connection %s:%X\n", peer2s (c->t->peer), GNUNET_h2s (&c->id)); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " state: %u, pending msgs: %u\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " state: %u, pending msgs: %u\n", c->state, c->pending_messages); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " FWD FC\n"); fc_debug (&c->fwd_fc); @@ -1099,8 +1099,8 @@ tunnel_use_path (struct MeshTunnel2 *t, struct MeshPeerPath *p) * some of its peers. Sends a notification towards the root of the tree. * In case the peer is the owner of the tree, notifies the client that owns * the tunnel and tries to reconnect. - * - * FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME + * + * FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME * * @param t Tunnel affected. * @param p1 Peer that got disconnected from p2. @@ -1117,13 +1117,13 @@ tunnel_notify_connection_broken (struct MeshTunnel2* t, // { // return; // } -// +// // if (tree_get_predecessor (t->tree) != 0) // { // /* We are the peer still connected, notify owner of the disconnection. */ // struct GNUNET_MESH_PathBroken msg; // struct GNUNET_PeerIdentity neighbor; -// +// // msg.header.size = htons (sizeof (msg)); // msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_BROKEN); // GNUNET_PEER_resolve (t->id.oid, &msg.oid); @@ -1184,7 +1184,7 @@ send_ack (struct MeshConnection *c, struct MeshChannel *ch, int fwd) GNUNET_assert (NULL != ch); channel_send_connections_ack (ch, buffer, fwd); } - else + else { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending on connection\n"); connection_send_ack (c, buffer, fwd); @@ -1358,7 +1358,7 @@ tunnel_destroy (struct MeshTunnel2 *t) * * Notifies all connections about the destruction. * - * @param t Tunnel to destroy. + * @param t Tunnel to destroy. */ static void tunnel_destroy_empty (struct MeshTunnel2 *t) @@ -1910,7 +1910,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, pk = GNUNET_CRYPTO_ecc_key_create_from_configuration (c); GNUNET_assert (NULL != pk); my_private_key = pk; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, + GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, &my_full_id.public_key); myid = GNUNET_PEER_intern (&my_full_id); 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 /** * Struct containing information about a client of the service - * + * * TODO: add a list of 'waiting' ports */ struct MeshClient @@ -626,7 +626,7 @@ static unsigned long long dht_replication_level; static unsigned long long max_tunnels; /** - * How many messages *in total* are we willing to queue, divided by number of + * How many messages *in total* are we willing to queue, divided by number of * tunnels to get tunnel queue size. */ static unsigned long long max_msgs_queue; @@ -879,7 +879,7 @@ tunnel_bck_keepalive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); * @brief Use the given path for the tunnel. * Update the next and prev hops (and RCs). * (Re)start the path refresh in case the tunnel is locally owned. - * + * * @param t Tunnel to update. * @param p Path to use. */ @@ -888,10 +888,10 @@ tunnel_use_path (struct MeshTunnel *t, struct MeshPeerPath *p); /** * Tunnel is empty: destroy it. - * + * * Notifies all participants (peers, cleints) about the destruction. - * - * @param t Tunnel to destroy. + * + * @param t Tunnel to destroy. */ static void tunnel_destroy_empty (struct MeshTunnel *t); @@ -915,12 +915,12 @@ tunnel_destroy (struct MeshTunnel *t); /** * @brief Queue and pass message to core when possible. - * + * * If type is payload (UNICAST, TO_ORIGIN, MULTICAST) checks for queue status * and accounts for it. In case the queue is full, the message is dropped and * a break issued. - * - * Otherwise, message is treated as internal and allowed to go regardless of + * + * Otherwise, message is treated as internal and allowed to go regardless of * queue status. * * @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) /** * Build a local ACK message and send it to a local client. - * + * * @param t Tunnel on which to send the ACK. * @param c Client to whom send the ACK. * @param is_fwd Set to GNUNET_YES for FWD ACK (dest->owner) @@ -1310,7 +1310,7 @@ send_path_create (struct MeshTunnel *t) * @param t Tunnel which to confirm. */ static void -send_path_ack (struct MeshTunnel *t) +send_path_ack (struct MeshTunnel *t) { struct MeshPeer *neighbor; @@ -1327,7 +1327,7 @@ send_path_ack (struct MeshTunnel *t) /** * Build an ACK message and queue it to send to the given peer. - * + * * @param t Tunnel on which to send the ACK. * @param peer Peer to whom send the ACK. * @param ack Value of the ACK. @@ -1536,7 +1536,7 @@ peer_get_short (const GNUNET_PEER_Id peer) * * @param pi Peer we want to poll. * @param t Tunnel about which we want to poll. - * + * * @return PID to use, either last sent or first_in_queue - 1 */ static uint32_t @@ -1571,7 +1571,7 @@ peer_get_first_payload_pid (struct MeshPeer *p, struct MeshTunnel *t) /** * Choose the best path towards a peer considering the tunnel properties. - * + * * @param peer The destination peer. * @param t The tunnel the path is for. * @@ -1626,7 +1626,7 @@ peer_connect (struct MeshPeer *peer, struct MeshTunnel *t) GNUNET_PEER_resolve (peer->id, &id); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Starting DHT GET for peer %s\n", + "Starting DHT GET for peer %s\n", GNUNET_i2s (&id)); GNUNET_CRYPTO_hash (&id, sizeof (my_full_id), &phash); peer->dhtget = GNUNET_DHT_get_start (dht_handle, /* handle */ @@ -1947,7 +1947,7 @@ peer_add_path_to_origin (struct MeshPeer *peer_info, /** * Add a tunnel to the list of tunnels a peer participates in. * Update the tunnel's destination. - * + * * @param p Peer to add to. * @param t Tunnel to add. */ @@ -1968,7 +1968,7 @@ peer_add_tunnel (struct MeshPeer *p, struct MeshTunnel *t) /** * Remove a tunnel from the list of tunnels a peer participates in. * Free the tunnel's destination. - * + * * @param p Peer to clean. * @param t Tunnel to remove. */ @@ -2034,7 +2034,7 @@ tunnel_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_break (0); return; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** peer: %s!\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** peer: %s!\n", GNUNET_i2s(GNUNET_PEER_resolve2 (peer))); if (0 == peer) { @@ -2274,7 +2274,7 @@ tunnel_change_state (struct MeshTunnel *t, enum MeshTunnelState state) /** * Add a client to a tunnel, initializing all needed data structures. - * + * * @param t Tunnel to which add the client. * @param c Client which to add to the tunnel. */ @@ -2368,13 +2368,13 @@ tunnel_notify_connection_broken (struct MeshTunnel *t, GNUNET_PEER_Id p1, // { // return; // } -// +// // if (tree_get_predecessor (t->tree) != 0) // { // /* We are the peer still connected, notify owner of the disconnection. */ // struct GNUNET_MESH_PathBroken msg; // struct GNUNET_PeerIdentity neighbor; -// +// // msg.header.size = htons (sizeof (msg)); // msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_BROKEN); // GNUNET_PEER_resolve (t->id.oid, &msg.oid); @@ -2390,7 +2390,7 @@ tunnel_notify_connection_broken (struct MeshTunnel *t, GNUNET_PEER_Id p1, /** * Send an end-to-end FWD ACK message for the most recent in-sequence payload. - * + * * @param t Tunnel this is about. * @param fwd Is for FWD traffic? (ACK dest->owner) */ @@ -2447,7 +2447,7 @@ tunnel_send_data_ack (struct MeshTunnel *t, int fwd) * If buffering is on, send when sent to children and buffer space is free. * Note that although the name is fwd_ack, the FWD mean forward *traffic*, * the ACK itself goes "back" (towards root). - * + * * @param t Tunnel on which to send the ACK. * @param type Type of message that triggered the ACK transmission. * @param fwd Is this FWD ACK? (Going dest->owner) @@ -2518,7 +2518,7 @@ tunnel_send_ack (struct MeshTunnel *t, uint16_t type, int fwd) delta_mid = rel->mid_sent - rel->head_sent->mid; else delta_mid = 0; - if (0 > delta || (GNUNET_YES == t->reliable && + if (0 > delta || (GNUNET_YES == t->reliable && NULL != o && (10 < rel->n_sent || 64 <= delta_mid))) delta = 0; @@ -2549,7 +2549,7 @@ tunnel_send_ack (struct MeshTunnel *t, uint16_t type, int fwd) /** * Modify the mesh message TID from global to local and send to client. - * + * * @param t Tunnel on which to send the message. * @param msg Message to modify and send. * @param c Client to send to. @@ -2585,7 +2585,7 @@ tunnel_send_client_to_tid (struct MeshTunnel *t, /** * Modify the unicast message TID from global to local and send to client. - * + * * @param t Tunnel on which to send the message. * @param msg Message to modify and send. * @param fwd Forward? @@ -2604,7 +2604,7 @@ tunnel_send_client_data (struct MeshTunnel *t, /** * Send up to 64 buffered messages to the client for in order delivery. - * + * * @param t Tunnel on which to empty the message buffer. * @param c Client to send to. * @param rel Reliability structure to corresponding peer. @@ -2650,7 +2650,7 @@ tunnel_send_client_buffered_data (struct MeshTunnel *t, struct MeshClient *c, /** * We have received a message out of order, buffer it until we receive * the missing one and we can feed the rest to the client. - * + * * @param t Tunnel to add to. * @param msg Message to buffer. * @param rel Reliability data to the corresponding direction. @@ -2697,7 +2697,7 @@ tunnel_add_buffered_data (struct MeshTunnel *t, * Destroy a reliable message after it has been acknowledged, either by * direct mid ACK or bitfield. Updates the appropriate data structures and * timers and frees all memory. - * + * * @param copy Message that is no longer needed: remote peer got it. */ static void @@ -3111,7 +3111,7 @@ tunnel_destroy (struct MeshTunnel *t) GNUNET_break (0); r = GNUNET_SYSERR; } - if (GNUNET_YES != + if (GNUNET_YES != GNUNET_CONTAINER_multihashmap32_remove (incoming_tunnels, t->local_tid_dest, t)) { @@ -3163,10 +3163,10 @@ tunnel_destroy (struct MeshTunnel *t) /** * Tunnel is empty: destroy it. - * + * * Notifies all participants (peers, cleints) about the destruction. - * - * @param t Tunnel to destroy. + * + * @param t Tunnel to destroy. */ static void tunnel_destroy_empty (struct MeshTunnel *t) @@ -3192,7 +3192,7 @@ tunnel_destroy_empty (struct MeshTunnel *t) /** * Initialize a Flow Control structure to the initial state. - * + * * @param fc Flow Control structure to initialize. */ static void @@ -3209,12 +3209,12 @@ fc_init (struct MeshFlowControl *fc) /** * Create a new tunnel - * + * * @param owner Who is the owner of the tunnel (short ID). * @param tid Tunnel Number of the tunnel. * @param client Clients that owns the tunnel, NULL for foreign tunnels. * @param local Tunnel Number for the tunnel, for the client point of view. - * + * * @return A new initialized tunnel. NULL on error. */ static struct MeshTunnel * @@ -3277,7 +3277,7 @@ tunnel_new (GNUNET_PEER_Id owner, /** * Set options in a tunnel, extracted from a bit flag field - * + * * @param t Tunnel to set options to. * @param options Bit array in host byte order. */ @@ -3789,12 +3789,12 @@ queue_send (void *cls, size_t size, void *buf) /** * @brief Queue and pass message to core when possible. - * + * * If type is payload (UNICAST, TO_ORIGIN) checks for queue status and * accounts for it. In case the queue is full, the message is dropped and * a break issued. - * - * Otherwise, message is treated as internal and allowed to go regardless of + * + * Otherwise, message is treated as internal and allowed to go regardless of * queue status. * * @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, /* Eliminate tunnel when origin dies */ tunnel_reset_timeout (t, GNUNET_YES); /* Keep tunnel alive in direction dest->owner*/ - tunnel_reset_timeout (t, GNUNET_NO); + tunnel_reset_timeout (t, GNUNET_NO); } else { @@ -4753,7 +4753,7 @@ handle_mesh_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer, return GNUNET_OK; } - fwd = GNUNET_MESSAGE_TYPE_MESH_FWD_KEEPALIVE == ntohs (message->type) ? + fwd = GNUNET_MESSAGE_TYPE_MESH_FWD_KEEPALIVE == ntohs (message->type) ? GNUNET_YES : GNUNET_NO; c = fwd ? t->client : t->owner; hop = fwd ? t->next_hop : t->prev_hop; @@ -4845,7 +4845,7 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp, GNUNET_PEER_resolve (peer->tunnels[i]->id.oid, &id); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ... tunnel %s:%X (%X / %X)\n", GNUNET_i2s (&id), peer->tunnels[i]->id.tid, - peer->tunnels[i]->local_tid, + peer->tunnels[i]->local_tid, peer->tunnels[i]->local_tid_dest); if (peer->tunnels[i]->state == MESH_TUNNEL_SEARCHING) { @@ -5152,7 +5152,7 @@ handle_local_tunnel_destroy (void *cls, struct GNUNET_SERVER_Client *client, peer_remove_tunnel (peer_get_short (t->dest), t); t->owner = NULL; } - else + else { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, " tunnel %X client %p (%p, %p)\n", @@ -5225,7 +5225,7 @@ handle_local_data (void *cls, struct GNUNET_SERVER_Client *client, t->owner->handle == client) || (tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV && - t->client && + t->client && t->client->handle == client) ) ) { GNUNET_break (0); @@ -5621,7 +5621,7 @@ server_init (void) * @param identity the public identity of this peer */ static void -core_init (void *cls, +core_init (void *cls, const struct GNUNET_PeerIdentity *identity) { const struct GNUNET_CONFIGURATION_Handle *c = cls; @@ -5901,7 +5901,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, GNUNET_free (keyfile); GNUNET_assert (NULL != pk); my_private_key = pk; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, + GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, &my_full_id.public_key); myid = GNUNET_PEER_intern (&my_full_id); 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, /** * Send data to a client. - * + * * If the client is ready, send directly, otherwise buffer while listening * for a local ACK. * @@ -377,7 +377,7 @@ channel_get (struct MeshTunnel2 *t, MESH_ChannelNumber chid) /** * Add a client to a channel, initializing all needed data structures. - * + * * @param ch Channel to which add the client. * @param c Client which to add to the channel. */ @@ -466,7 +466,7 @@ static unsigned int channel_get_buffer (struct MeshChannel *ch, int fwd) { struct MeshChannelReliability *rel; - + rel = fwd ? ch->dest_rel : ch->root_rel; /* If rel is NULL it means that the end is not yet created, @@ -735,7 +735,7 @@ channel_send_connections_ack (struct MeshChannel *ch, * Destroy a reliable message after it has been acknowledged, either by * direct mid ACK or bitfield. Updates the appropriate data structures and * timers and frees all memory. - * + * * @param copy Message that is no longer needed: remote peer got it. */ static void @@ -907,7 +907,7 @@ send_client_buffered_data (struct MeshChannel *ch, /** * Destroy a channel and free all resources. - * + * * @param ch Channel to destroy. */ static void @@ -1004,7 +1004,7 @@ channel_new (struct MeshTunnel2 *t, /** * Set options in a channel, extracted from a bit flag field - * + * * @param ch Channel to set options to. * @param options Bit array in host byte order. */ @@ -1145,7 +1145,7 @@ GMCH_send_channel_destroy (struct MeshChannel *ch, int fwd) /** * Send data on a channel. - * + * * If the destination is local, send it to client, otherwise encrypt and * send to next hop. * 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); /** * Send data on a channel. - * + * * If the destination is local, send it to client, otherwise encrypt and * send to next hop. * 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; static unsigned long long max_connections; /** - * How many messages *in total* are we willing to queue, divide by number of + * How many messages *in total* are we willing to queue, divide by number of * connections to get connection queue size. */ static unsigned long long max_msgs_queue; @@ -293,7 +293,7 @@ static struct GNUNET_CORE_Handle *core_handle; * * @param s Tunnel state. * - * @return String representation. + * @return String representation. */ static const char * GMC_DEBUG_state2s (enum MeshTunnelState s) @@ -317,7 +317,7 @@ GMC_DEBUG_state2s (enum MeshTunnelState s) /** * Initialize a Flow Control structure to the initial state. - * + * * @param fc Flow Control structure to initialize. */ static void @@ -680,7 +680,7 @@ queue_add (void *cls, uint16_t type, size_t size, GNUNET_break (0); return; } - + if (NULL == peer->connections) { /* We are not connected to this peer, ignore request. */ @@ -1172,9 +1172,9 @@ static unsigned int connection_get_buffer (struct MeshConnection *c, int fwd) { struct MeshFlowControl *fc; - + fc = fwd ? &c->fwd_fc : &c->bck_fc; - + return (fc->queue_max - fc->queue_n); } @@ -1337,7 +1337,7 @@ connection_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** Polling!\n"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** connection [%X]\n", GNUNET_h2s (&c->id)); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** %s\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** %s\n", fc == &c->fwd_fc ? "FWD" : "BCK"); msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_POLL); @@ -1378,7 +1378,7 @@ connection_get_prev_hop (struct MeshConnection *c) * * @param c Connection. * - * @return Next peer in the connection. + * @return Next peer in the connection. */ static struct MeshPeer * connection_get_next_hop (struct MeshConnection *c) @@ -1400,7 +1400,7 @@ connection_get_next_hop (struct MeshConnection *c) * @param c Connection. * @param fwd Next hop? * - * @return Next peer in the connection. + * @return Next peer in the connection. */ static struct MeshPeer * connection_get_hop (struct MeshConnection *c, int fwd) @@ -1598,7 +1598,7 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) * @param identity the public identity of this peer */ static void -core_init (void *cls, +core_init (void *cls, const struct GNUNET_PeerIdentity *identity) { const struct GNUNET_CONFIGURATION_Handle *c = cls; @@ -2310,7 +2310,7 @@ handle_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer, return GNUNET_OK; } - fwd = GNUNET_MESSAGE_TYPE_MESH_FWD_KEEPALIVE == ntohs (message->type) ? + fwd = GNUNET_MESSAGE_TYPE_MESH_FWD_KEEPALIVE == ntohs (message->type) ? GNUNET_YES : GNUNET_NO; /* 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); * Count connections in a DLL. */ unsigned int -GMC_count (const struct MeshConnection *head); +GMC_count (const struct MeshConnection *head); /** * 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 @@ /** * Struct containing information about a client of the service - * + * * TODO: add a list of 'waiting' ports */ struct MeshClient @@ -462,7 +462,7 @@ handle_channel_destroy (void *cls, struct GNUNET_SERVER_Client *client, { ch->root = NULL; } - else + else { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, " channel %X client %p (%p, %p)\n", @@ -538,7 +538,7 @@ handle_data (void *cls, struct GNUNET_SERVER_Client *client, ch->root->handle == client) || (!fwd && - ch->dest && + ch->dest && ch->dest->handle == client) ) ) { GNUNET_break (0); @@ -654,16 +654,16 @@ handle_ack (void *cls, struct GNUNET_SERVER_Client *client, // struct GNUNET_SERVER_Client *client = cls; // struct MeshChannel *ch = value; // struct GNUNET_MESH_LocalMonitor *msg; -// +// // msg = GNUNET_malloc (sizeof(struct GNUNET_MESH_LocalMonitor)); // msg->channel_id = htonl (ch->gid); // msg->header.size = htons (sizeof (struct GNUNET_MESH_LocalMonitor)); // msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS); -// +// // GNUNET_log (GNUNET_ERROR_TYPE_INFO, // "* sending info about tunnel %s\n", // GNUNET_i2s (&msg->owner)); -// +// // GNUNET_SERVER_notification_context_unicast (nc, client, // &msg->header, GNUNET_NO); // 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; /** * Initialize server subsystem. - * + * * @param handle Server handle. */ void @@ -123,7 +123,7 @@ GML_send_channel_destroy (struct MeshClient *c, uint32_t id); /** * Modify the mesh message TID from global to local and send to client. - * + * * @param ch Channel on which to send the message. * @param msg Message to modify and send. * @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 * Transmission queue to core DLL head */ struct MeshPeerQueue *queue_head; - + /** * Transmission queue to core DLL tail */ @@ -121,8 +121,8 @@ static unsigned long long max_peers; * #GNUNET_NO if not. */ static int -shutdown_tunnel (void *cls, - const struct GNUNET_PeerIdentity *key, +shutdown_tunnel (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { struct MeshPeer *p = value; @@ -148,10 +148,10 @@ peer_destroy (struct MeshPeer *peer) struct GNUNET_PeerIdentity id; struct MeshPeerPath *p; struct MeshPeerPath *nextp; - + GNUNET_PEER_resolve (peer->id, &id); GNUNET_PEER_change_rc (peer->id, -1); - + if (GNUNET_YES != GNUNET_CONTAINER_multipeermap_remove (peers, &id, peer)) { @@ -188,10 +188,10 @@ static int peer_is_used (struct MeshPeer *peer) { struct MeshPeerPath *p; - + if (NULL != peer->tunnel) return GNUNET_YES; - + for (p = peer->path_head; NULL != p; p = p->next) { if (p->length < 3) @@ -215,14 +215,14 @@ peer_get_oldest (void *cls, { struct MeshPeer *p = value; struct GNUNET_TIME_Absolute *abs = cls; - + /* Don't count active peers */ if (GNUNET_YES == peer_is_used (p)) return GNUNET_YES; - + if (abs->abs_value_us < p->last_contact.abs_value_us) abs->abs_value_us = p->last_contact.abs_value_us; - + return GNUNET_YES; } @@ -241,7 +241,7 @@ peer_timeout (void *cls, { struct MeshPeer *p = value; struct GNUNET_TIME_Absolute *abs = cls; - + if (p->last_contact.abs_value_us == abs->abs_value_us && GNUNET_NO == peer_is_used (p)) { @@ -259,9 +259,9 @@ static void peer_delete_oldest (void) { struct GNUNET_TIME_Absolute abs; - + abs = GNUNET_TIME_UNIT_FOREVER_ABS; - + GNUNET_CONTAINER_multipeermap_iterate (peers, &peer_get_oldest, &abs); @@ -283,7 +283,7 @@ static struct MeshPeer * peer_get (const struct GNUNET_PeerIdentity *peer_id) { struct MeshPeer *peer; - + peer = GNUNET_CONTAINER_multipeermap_get (peers, peer_id); if (NULL == peer) { @@ -297,7 +297,7 @@ peer_get (const struct GNUNET_PeerIdentity *peer_id) peer->id = GNUNET_PEER_intern (peer_id); } peer->last_contact = GNUNET_TIME_absolute_get(); - + return peer; } @@ -333,13 +333,13 @@ peer_get_path_cost (const struct MeshPeer *peer, unsigned int overlap; unsigned int i; unsigned int j; - + if (NULL == path) return 0; - + overlap = 0; GNUNET_assert (NULL != peer->tunnel); - + for (i = 0; i < path->length; i++) { for (c = peer->tunnel->connection_head; NULL != c; c = c->next) @@ -373,7 +373,7 @@ peer_get_best_path (const struct MeshPeer *peer) struct MeshConnection *c; unsigned int best_cost; unsigned int cost; - + best_cost = UINT_MAX; best_p = NULL; for (p = peer->path_head; NULL != p; p = p->next) @@ -383,7 +383,7 @@ peer_get_best_path (const struct MeshPeer *peer) break; if (NULL != c) continue; /* If path is in use in a connection, skip it. */ - + if ((cost = peer_get_path_cost (peer, p)) < best_cost) { best_cost = cost; @@ -410,7 +410,7 @@ peer_add_path (struct MeshPeer *peer_info, struct MeshPeerPath *path, struct MeshPeerPath *aux; unsigned int l; unsigned int l2; - + if ((NULL == peer_info) || (NULL == path)) { GNUNET_break (0); @@ -444,17 +444,17 @@ peer_add_path (struct MeshPeer *peer_info, struct MeshPeerPath *path, GNUNET_realloc (path->peers, path->length * sizeof (GNUNET_PEER_Id)); } } - + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "adding path [%u] to peer %s\n", path->length, peer2s (peer_info)); - + l = path_get_length (path); if (0 == l) { path_destroy (path); return; } - + GNUNET_assert (peer_info->id == path->peers[path->length - 1]); for (aux = peer_info->path_head; aux != NULL; aux = aux->next) { @@ -569,7 +569,7 @@ GMP_connect (struct MeshPeer *peer) { /* This case can happen when the path includes a first hop that is * not yet known to be connected. - * + * * This happens quite often during testing when running mesh * under valgrind: core connect notifications come very late and the * 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" * notify_transmit_ready None (queue / GNUNET_CLIENT_ntf_tmt_rdy) * notify_transmit_ready_cancel None (clear of internal data structures) * - * + * * EVENT MESSAGE USED * ----- ------------ * data GNUNET_MESH_Unicast OR * GNUNET_MESH_Multicast OR * GNUNET_MESH_ToOrigin * data ack GNUNET_MESH_LocalAck - * + * * new incoming tunnel GNUNET_MESH_PeerControl * peer connects to a tunnel FIXME * peer disconnects from a tunnel FIXME @@ -305,9 +305,9 @@ GMC_min_pid (uint32_t a, uint32_t b); * Generated with: * FIND: "#define ([^ ]+)[ ]*([0-9]+)" * REPLACE: " case \2: return "\1"; break;" - * + * * @param m Message type. - * + * * @return Human readable string description. */ const 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 * Time to the next reconnect in case one reconnect fails */ struct GNUNET_TIME_Relative reconnect_time; - + /** * Task for trying to reconnect. */ @@ -373,9 +373,9 @@ th_is_payload (struct GNUNET_MESH_TransmitHandle *th) /** * Check whether there is any message ready in the queue and find the size. - * + * * @param h Mesh handle. - * + * * @return The size of the first ready message in the queue, * 0 if there is none. */ @@ -483,8 +483,8 @@ destroy_tunnel (struct GNUNET_MESH_Tunnel *t, int call_cleaner) GNUNET_break (0); return; } - LOG (GNUNET_ERROR_TYPE_DEBUG, - "destroy_tunnel %X\n", + LOG (GNUNET_ERROR_TYPE_DEBUG, + "destroy_tunnel %X\n", t->tid); h = t->mesh; @@ -508,7 +508,7 @@ destroy_tunnel (struct GNUNET_MESH_Tunnel *t, int call_cleaner) /* clean up request */ if (GNUNET_SCHEDULER_NO_TASK != th->timeout_task) GNUNET_SCHEDULER_cancel (th->timeout_task); - GNUNET_free (th); + GNUNET_free (th); } /* 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) /** * Notify client that the transmission has timed out - * + * * @param cls closure * @param tc task context */ @@ -590,7 +590,7 @@ send_packet (struct GNUNET_MESH_Handle *h, /** * Send an ack on the tunnel to confirm the processing of a message. - * + * * @param t Tunnel on which to send the ACK. */ static void @@ -702,7 +702,7 @@ do_reconnect (struct GNUNET_MESH_Handle *h) GNUNET_TIME_relative_min (GNUNET_TIME_UNIT_SECONDS, GNUNET_TIME_relative_multiply (h->reconnect_time, 2)); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Next retry in %s\n", GNUNET_STRINGS_relative_time_to_string (h->reconnect_time, GNUNET_NO)); @@ -916,7 +916,7 @@ process_incoming_data (struct GNUNET_MESH_Handle *h, LOG (GNUNET_ERROR_TYPE_DEBUG, " %s data on tunnel %s [%X]\n", t->tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV ? "fwd" : "bck", - GNUNET_i2s (GNUNET_PEER_resolve2(t->peer)), + GNUNET_i2s (GNUNET_PEER_resolve2(t->peer)), ntohl (dmsg->tid)); type = ntohs (payload->type); LOG (GNUNET_ERROR_TYPE_DEBUG, " payload type %u\n", type); @@ -948,7 +948,7 @@ process_incoming_data (struct GNUNET_MESH_Handle *h, /** * Process a local ACK message, enabling the client to send * more data to the service. - * + * * @param h Mesh handle. * @param message Message itself. */ @@ -1082,7 +1082,7 @@ msg_received (void *cls, const struct GNUNET_MessageHeader *msg) if (msg == NULL) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Mesh service disconnected, reconnecting\n", h); reconnect (h); return; @@ -1265,7 +1265,7 @@ send_callback (void *cls, size_t size, void *buf) * Auxiliary function to send an already constructed packet to the service. * Takes care of creating a new queue element, copying the message and * calling the tmt_rdy function if necessary. - * + * * @param h mesh handle * @param msg message to transmit * @param tunnel tunnel this send is related to (NULL if N/A) @@ -1441,7 +1441,7 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle) * @return handle to the tunnel */ struct GNUNET_MESH_Tunnel * -GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle *h, +GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle *h, void *tunnel_ctx, const struct GNUNET_PeerIdentity *peer, uint32_t port, @@ -1723,7 +1723,7 @@ static size_t mesh_mq_ntr (void *cls, size_t size, void *buf) { - struct GNUNET_MQ_Handle *mq = cls; + struct GNUNET_MQ_Handle *mq = cls; struct MeshMQState *state = GNUNET_MQ_impl_state (mq); const struct GNUNET_MessageHeader *msg = GNUNET_MQ_impl_current (mq); uint16_t msize; @@ -1769,7 +1769,7 @@ mesh_mq_send_impl (struct GNUNET_MQ_Handle *mq, GNUNET_MESH_notify_transmit_ready (state->tunnel, /* FIXME: add option for corking */ GNUNET_NO, - GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_TIME_UNIT_FOREVER_REL, ntohs (msg->size), mesh_mq_ntr, mq); @@ -1781,7 +1781,7 @@ mesh_mq_send_impl (struct GNUNET_MQ_Handle *mq, * destruction of a message queue. * Implementations must not free 'mq', but should * take care of 'impl_state'. - * + * * @param mq the message queue to destroy * @param impl_state state of the implementation */ 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 * Time to the next reconnect in case one reconnect fails */ struct GNUNET_TIME_Relative reconnect_time; - + /** * Task for trying to reconnect. */ @@ -356,9 +356,9 @@ th_is_payload (struct GNUNET_MESH_TransmitHandle *th) /** * Check whether there is any message ready in the queue and find the size. - * + * * @param h Mesh handle. - * + * * @return The size of the first ready message in the queue, * 0 if there is none. */ @@ -492,7 +492,7 @@ destroy_channel (struct GNUNET_MESH_Channel *ch, int call_cleaner) /* clean up request */ if (GNUNET_SCHEDULER_NO_TASK != th->timeout_task) GNUNET_SCHEDULER_cancel (th->timeout_task); - GNUNET_free (th); + GNUNET_free (th); } /* 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) /** * Notify client that the transmission has timed out - * + * * @param cls closure * @param tc task context */ @@ -574,7 +574,7 @@ send_packet (struct GNUNET_MESH_Handle *h, /** * Send an ack on the channel to confirm the processing of a message. - * + * * @param ch Channel on which to send the ACK. */ static void @@ -926,7 +926,7 @@ process_incoming_data (struct GNUNET_MESH_Handle *h, /** * Process a local ACK message, enabling the client to send * more data to the service. - * + * * @param h Mesh handle. * @param message Message itself. */ @@ -1059,7 +1059,7 @@ msg_received (void *cls, const struct GNUNET_MessageHeader *msg) if (msg == NULL) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Mesh service disconnected, reconnecting\n", h); reconnect (h); return; @@ -1242,7 +1242,7 @@ send_callback (void *cls, size_t size, void *buf) * Auxiliary function to send an already constructed packet to the service. * Takes care of creating a new queue element, copying the message and * calling the tmt_rdy function if necessary. - * + * * @param h mesh handle * @param msg message to transmit * @param channel channel this send is related to (NULL if N/A) @@ -1414,7 +1414,7 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle) * @return handle to the channel */ struct GNUNET_MESH_Channel * -GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, +GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, void *channel_ctx, const struct GNUNET_PeerIdentity *peer, uint32_t port, @@ -1695,7 +1695,7 @@ static size_t mesh_mq_ntr (void *cls, size_t size, void *buf) { - struct GNUNET_MQ_Handle *mq = cls; + struct GNUNET_MQ_Handle *mq = cls; struct MeshMQState *state = GNUNET_MQ_impl_state (mq); const struct GNUNET_MessageHeader *msg = GNUNET_MQ_impl_current (mq); uint16_t msize; @@ -1734,7 +1734,7 @@ mesh_mq_send_impl (struct GNUNET_MQ_Handle *mq, GNUNET_MESH_notify_transmit_ready (state->channel, /* FIXME: add option for corking */ GNUNET_NO, - GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_TIME_UNIT_FOREVER_REL, ntohs (msg->size), mesh_mq_ntr, mq); @@ -1746,7 +1746,7 @@ mesh_mq_send_impl (struct GNUNET_MQ_Handle *mq, * destruction of a message queue. * Implementations must not free 'mq', but should * take care of 'impl_state'. - * + * * @param mq the message queue to destroy * @param impl_state state of the implementation */ 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); * Generated with: * FIND: "#define ([^ ]+)[ ]*([0-9]+)" * REPLACE: " case \2: return "\1"; break;" - * + * * @param m Message type. - * + * * @return Human readable string description. */ const 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 * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_(FWD|BCK)_KEEPALIVE */ struct GNUNET_MessageHeader header; - + /** * TID of the tunnel */ uint32_t tid GNUNET_PACKED; - + /** * OID of the tunnel */ 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 * Number of hops to live. */ uint32_t ttl GNUNET_PACKED; - + /** * Always 0. */ 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 * Main function of the test to run once all MESHs are available. */ GNUNET_MESH_TEST_AppMain app_main; - + /** * Closure for 'app_main'. */ @@ -137,7 +137,7 @@ mesh_connect_adapter (void *cls, * @param cls closure * @param op_result service handle returned from the connect adapter */ -static void +static void mesh_disconnect_adapter (void *cls, void *op_result) { @@ -154,12 +154,12 @@ mesh_disconnect_adapter (void *cls, * * @param cls The callback closure from functions generating an operation. * @param op The operation that has been finished. - * @param ca_result The service handle returned from + * @param ca_result The service handle returned from * GNUNET_TESTBED_ConnectAdapter() (mesh handle). * @param emsg Error message in case the operation has failed. * NULL if operation has executed successfully. */ -static void +static void mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, @@ -167,7 +167,7 @@ mesh_connect_cb (void *cls, { struct GNUNET_MESH_TEST_Context *ctx = cls; unsigned int i; - + if (NULL != emsg) { fprintf (stderr, "Failed to connect to MESH service: %s\n", @@ -211,7 +211,7 @@ GNUNET_MESH_TEST_cleanup (struct GNUNET_MESH_TEST_Context *ctx) /** * Callback run when the testbed is ready (peers running and connected to * each other) - * + * * @param cls Closure (context). * @param h the run handle * @param num_peers Number of peers that are running. @@ -252,7 +252,7 @@ mesh_test_run (void *cls, } -void +void GNUNET_MESH_TEST_run (const char *testname, const char *cfgname, 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, * @param handlers Message handlers. * @param ports Ports the peers offer. */ -void +void GNUNET_MESH_TEST_run (const char *testname, const char *cfgname, 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) * * @return peerinfo of the peer who is the first hop in the tunnel * NULL on error - * + * * FIXME use PEER_Id */ struct 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) * @param channel connection to the other end * @param channel_ctx place to store local state associated with the channel * @param message the actual message - * + * * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ @@ -190,11 +190,11 @@ static struct GNUNET_MESH_MessageHandler handlers2[] = { /** * Data send callback: fillbuffer with test packet. - * + * * @param cls Closure (unused). * @param size Buffer size. * @param buf Buffer to fill. - * + * * @return size of test packet. */ static size_t @@ -216,7 +216,7 @@ do_send (void *cls, size_t size, void *buf) /** * Connect to other client and send data - * + * * @param cls Closue (unused). * @param tc TaskContext. */ @@ -238,13 +238,13 @@ do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /** * Initialize framework and start test - * + * * @param cls Closure (unused). * @param cfg Configuration handle. * @param peer Testing peer handle. */ static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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) * @param channel connection to the other end * @param channel_ctx place to store local state associated with the channel * @param message the actual message - * + * * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ @@ -196,11 +196,11 @@ static struct GNUNET_MESH_MessageHandler handlers1[] = { /** * Data send callback: fillbuffer with test packet. - * + * * @param cls Closure (unused). * @param size Buffer size. * @param buf Buffer to fill. - * + * * @return size of test packet. */ static size_t @@ -223,7 +223,7 @@ do_send (void *cls, size_t size, void *buf) /** * Connect to other client and send data - * + * * @param cls Closue (unused). * @param tc TaskContext. */ @@ -244,13 +244,13 @@ do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /** * Initialize framework and start test - * + * * @param cls Closure (unused). * @param cfg Configuration handle. * @param peer Testing peer handle. */ static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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) /** * Shut down peergroup, clean up. - * + * * @param cls Closure (unused). * @param tc Task Context. */ @@ -221,7 +221,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /** * Disconnect from mesh services af all peers, call shutdown. - * + * * @param cls Closure (unused). * @param tc Task Context. */ @@ -260,7 +260,7 @@ disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /** * Abort test: schedule disconnect and shutdown immediately - * + * * @param line Line in the code the abort is requested from (__LINE__). */ static void @@ -276,11 +276,11 @@ abort_test (long line) /** * Transmit ready callback. - * + * * @param cls Closure (message type). * @param size Size of the tranmist buffer. * @param buf Pointer to the beginning of the buffer. - * + * * @return Number of bytes written to buf. */ static size_t @@ -289,7 +289,7 @@ tmt_rdy (void *cls, size_t size, void *buf); /** * Task to schedule a new data transmission. - * + * * @param cls Closure (peer #). * @param tc Task Context. */ @@ -385,7 +385,7 @@ tmt_rdy (void *cls, size_t size, void *buf) GNUNET_SCHEDULER_add_now (&data_task, NULL); } } - + return size_payload; } @@ -615,10 +615,10 @@ channel_cleaner (void *cls, const struct GNUNET_MESH_Channel *channel, /** * START THE TESTCASE ITSELF, AS WE ARE CONNECTED TO THE MESH SERVICES. - * + * * Testcase continues when the root receives confirmation of connected peers, * on callback funtion ch. - * + * * @param cls Closure (unsued). * @param tc Task Context. */ @@ -663,7 +663,7 @@ do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) data_received = 0; data_sent = 0; GNUNET_MESH_notify_transmit_ready (ch, GNUNET_NO, - GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_TIME_UNIT_FOREVER_REL, size_payload, &tmt_rdy, (void *) 1L); } 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 @@ Boston, MA 02111-1307, USA. */ -/** +/** * @file multicast/multicast.h * @brief multicast IPC messages * @author Christian Grothoff @@ -57,7 +57,7 @@ struct MulticastJoinDecisionMessage uint32_t relay_count; /* followed by 'relay_count' peer identities */ - + /* followed by the join response message */ }; @@ -243,7 +243,7 @@ struct MulticastReplayRequestMessage { /** - * The message type can be either + * The message type can be either * #GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST or * #GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST_CANCEL. */ 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 @@ Boston, MA 02111-1307, USA. */ -/** +/** * @file multicast/multicast_api.c * @brief multicast service; establish tunnels to distant peers * @author Christian Grothoff @@ -30,7 +30,7 @@ #include "gnunet_multicast_service.h" #include "multicast.h" -/** +/** * Handle for a request to send a message to all multicast group members * (from the origin). */ @@ -45,7 +45,7 @@ struct GNUNET_MULTICAST_OriginMessageHandle }; -/** +/** * Handle for the origin of a multicast group. */ struct GNUNET_MULTICAST_Origin @@ -65,7 +65,7 @@ struct GNUNET_MULTICAST_Origin }; -/** +/** * Handle for a message to be delivered from a member to the origin. */ struct GNUNET_MULTICAST_MemberRequestHandle @@ -73,7 +73,7 @@ struct GNUNET_MULTICAST_MemberRequestHandle }; -/** +/** * Opaque handle for a multicast group member. */ struct GNUNET_MULTICAST_Member @@ -83,12 +83,12 @@ struct GNUNET_MULTICAST_Member GNUNET_NETWORK_STRUCT_BEGIN -/** +/** * Header of a request from a member to the origin. */ struct GNUNET_MULTICAST_RequestHeader { - /** + /** * Header for all requests from a member to the origin. */ struct GNUNET_MessageHeader header; @@ -98,29 +98,29 @@ struct GNUNET_MULTICAST_RequestHeader */ struct GNUNET_CRYPTO_EccPublicSignKey member_key; - /** + /** * ECC signature of the request fragment. * * Signature must match the public key of the multicast group. */ struct GNUNET_CRYPTO_EccSignature signature; - /** + /** * Purpose for the signature and size of the signed data. */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - /** + /** * Number of the request fragment, monotonically increasing. */ uint64_t fragment_id GNUNET_PACKED; - /** + /** * Byte offset of this @e fragment of the @e request. */ uint64_t fragment_offset GNUNET_PACKED; - /** + /** * Number of the request this fragment belongs to. * * Set in GNUNET_MULTICAST_origin_to_all(). @@ -135,24 +135,24 @@ struct GNUNET_MULTICAST_RequestHeader /* Followed by request body. */ }; -/** +/** * Header of a join request sent to the origin or another member. */ struct GNUNET_MULTICAST_JoinRequest { - /** + /** * Header for the join request. */ struct GNUNET_MessageHeader header; - /** + /** * ECC signature of the rest of the fields of the join request. * * Signature must match the public key of the joining member. */ struct GNUNET_CRYPTO_EccSignature signature; - /** + /** * Purpose for the signature and size of the signed data. */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; @@ -178,7 +178,7 @@ struct GNUNET_MULTICAST_JoinRequest GNUNET_NETWORK_STRUCT_END -/** +/** * Handle that identifies a join request. * * Used to match calls to #GNUNET_MULTICAST_JoinCallback to the @@ -189,7 +189,7 @@ struct GNUNET_MULTICAST_JoinHandle }; -/** +/** * Function to call with the decision made for a join request. * * 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, } -/** +/** * Handle to pass back for the answer of a membership test. */ struct GNUNET_MULTICAST_MembershipTestHandle @@ -230,7 +230,7 @@ struct GNUNET_MULTICAST_MembershipTestHandle }; -/** +/** * Call informing multicast about the decision taken for a membership test. * * @param mth Handle that was given for the query. @@ -244,7 +244,7 @@ GNUNET_MULTICAST_membership_test_result (struct GNUNET_MULTICAST_MembershipTestH } -/** +/** * Opaque handle to a replay request from the multicast service. */ struct GNUNET_MULTICAST_ReplayHandle @@ -252,7 +252,7 @@ struct GNUNET_MULTICAST_ReplayHandle }; -/** +/** * Replay a message fragment for the multicast group. * * @param rh Replay handle identifying which replay operation was requested. @@ -267,7 +267,7 @@ GNUNET_MULTICAST_replay_response (struct GNUNET_MULTICAST_ReplayHandle *rh, } -/** +/** * Indicate the end of the replay session. * * Invalidates the replay handle. @@ -280,7 +280,7 @@ GNUNET_MULTICAST_replay_response_end (struct GNUNET_MULTICAST_ReplayHandle *rh) } -/** +/** * Replay a message for the multicast group. * * @param rh Replay handle identifying which replay operation was requested. @@ -295,7 +295,7 @@ GNUNET_MULTICAST_replay_response2 (struct GNUNET_MULTICAST_ReplayHandle *rh, } -/** +/** * Start a multicast group. * * 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 } -/** +/** * Send a message to the multicast group. * * @param origin Handle to the multicast group. @@ -433,7 +433,7 @@ GNUNET_MULTICAST_origin_to_all (struct GNUNET_MULTICAST_Origin *origin, } -/** +/** * Resume message transmission to multicast group. * * @param mh Request to cancel. @@ -445,7 +445,7 @@ GNUNET_MULTICAST_origin_to_all_resume (struct GNUNET_MULTICAST_OriginMessageHand } -/** +/** * Cancel request for message transmission to multicast group. * * @param mh Request to cancel. @@ -456,7 +456,7 @@ GNUNET_MULTICAST_origin_to_all_cancel (struct GNUNET_MULTICAST_OriginMessageHand } -/** +/** * Stop a multicast group. * * @param origin Multicast group to stop. @@ -468,7 +468,7 @@ GNUNET_MULTICAST_origin_stop (struct GNUNET_MULTICAST_Origin *origin) } -/** +/** * Join a multicast group. * * 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, } -/** +/** * Handle for a replay request. */ struct GNUNET_MULTICAST_MemberReplayHandle @@ -538,7 +538,7 @@ struct GNUNET_MULTICAST_MemberReplayHandle }; -/** +/** * Request a fragment to be replayed by fragment ID. * * 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, } -/** +/** * Request a message fragment to be replayed. * * 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, } -/** +/** * Cancel a replay request. * * @param rh Request to cancel. @@ -599,7 +599,7 @@ GNUNET_MULTICAST_member_replay_cancel (struct GNUNET_MULTICAST_MemberReplayHandl } -/** +/** * Part a multicast group. * * Disconnects from all group members and invalidates the @a member handle. @@ -616,9 +616,9 @@ GNUNET_MULTICAST_member_part (struct GNUNET_MULTICAST_Member *member) } -/** +/** * Send a message to the origin of the multicast group. - * + * * @param member Membership handle. * @param message_id Application layer ID for the message. Opaque to multicast. * @param notify Callback to call to get the message. @@ -635,7 +635,7 @@ GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member, } -/** +/** * Resume message transmission to origin. * * @param rh Request to cancel. @@ -647,7 +647,7 @@ GNUNET_MULTICAST_member_to_origin_resume (struct GNUNET_MULTICAST_MemberRequestH } -/** +/** * Cancel request for message transmission to origin. * * @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 struct MHD_PostProcessor *pp; /** - * URL to serve in response to this POST (if this request + * URL to serve in response to this POST (if this request * was a 'POST') */ const char *post_url; @@ -129,7 +129,7 @@ struct Request * Active request with the namestore. */ struct GNUNET_NAMESTORE_QueueEntry *qe; - + /** * Current processing phase. */ @@ -171,7 +171,7 @@ struct ZoneinfoRequest * Buffer length */ size_t buf_len; - + /** * Buffer write offset */ @@ -270,8 +270,8 @@ iterate_cb (void *cls, MHD_add_response_header (response, MHD_HTTP_HEADER_CONTENT_TYPE, MIME_HTML); - MHD_queue_response (zr->connection, - MHD_HTTP_OK, + MHD_queue_response (zr->connection, + MHD_HTTP_OK, response); MHD_destroy_response (response); GNUNET_free (zr->zoneinfo); @@ -305,9 +305,9 @@ iterate_cb (void *cls, zr->zoneinfo = new_buf; zr->buf_len *= 2; } - sprintf (zr->zoneinfo + zr->write_offset, - "%s%s", - name, + sprintf (zr->zoneinfo + zr->write_offset, + "%s%s", + name, pkey); zr->write_offset = strlen (zr->zoneinfo); GNUNET_NAMESTORE_zone_iterator_next (zr->list_it); @@ -359,8 +359,8 @@ serve_main_page (struct MHD_Connection *connection) MHD_add_response_header (response, MHD_HTTP_HEADER_CONTENT_TYPE, MIME_HTML); - ret = MHD_queue_response (connection, - MHD_HTTP_OK, + ret = MHD_queue_response (connection, + MHD_HTTP_OK, response); MHD_destroy_response (response); return ret; @@ -394,8 +394,8 @@ fill_s_reply (const char *info, MHD_add_response_header (response, MHD_HTTP_HEADER_CONTENT_TYPE, MIME_HTML); - ret = MHD_queue_response (connection, - MHD_HTTP_OK, + ret = MHD_queue_response (connection, + MHD_HTTP_OK, response); MHD_destroy_response (response); return ret; @@ -471,7 +471,7 @@ post_iterator (void *cls, * GNUNET_YES (or other positive value) on success * @param emsg NULL on success, otherwise an error message */ -static void +static void put_continuation (void *cls, int32_t success, const char *emsg) @@ -502,7 +502,7 @@ put_continuation (void *cls, * @param rd_count number of entries in 'rd' array * @param rd array of records with data to store */ -static void +static void zone_to_name_cb (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, const char *name, @@ -512,7 +512,7 @@ zone_to_name_cb (void *cls, struct Request *request = cls; struct GNUNET_NAMESTORE_RecordData r; struct GNUNET_CRYPTO_EccPublicSignKey pub; - + request->qe = NULL; if (NULL != name) { @@ -548,14 +548,14 @@ zone_to_name_cb (void *cls, * @param rd_count number of entries in 'rd' array * @param rd array of records with data to store */ -static void +static void lookup_result_processor (void *cls, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) { struct Request *request = cls; struct GNUNET_CRYPTO_EccPublicSignKey pub; - + if (0 != rd_count) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -606,7 +606,7 @@ lookup_block_processor (void *cls, } GNUNET_CRYPTO_ecc_key_get_public_for_signature (&fcfs_zone_pkey, &pub); - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_NAMESTORE_block_decrypt (block, &pub, request->domain_name, @@ -650,7 +650,7 @@ create_response (void *cls, const char *url, const char *method, const char *version, - const char *upload_data, + const char *upload_data, size_t *upload_data_size, void **ptr) { @@ -688,7 +688,7 @@ create_response (void *cls, _("Failed to setup post processor for `%s'\n"), url); return MHD_NO; /* internal error */ - } + } return MHD_YES; } if (NULL != request->pp) @@ -759,14 +759,14 @@ create_response (void *cls, GNUNET_break (0); return MHD_NO; } - return MHD_YES; /* will have a reply later... */ + return MHD_YES; /* will have a reply later... */ } /* unsupported HTTP method */ response = MHD_create_response_from_buffer (strlen (METHOD_ERROR), (void *) METHOD_ERROR, MHD_RESPMEM_PERSISTENT); - ret = MHD_queue_response (connection, - MHD_HTTP_METHOD_NOT_ACCEPTABLE, + ret = MHD_queue_response (connection, + MHD_HTTP_METHOD_NOT_ACCEPTABLE, response); MHD_destroy_response (response); return ret; @@ -900,7 +900,7 @@ do_shutdown (void *cls, } -/** +/** * Method called to inform about the egos of this peer. * * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get, @@ -908,7 +908,7 @@ do_shutdown (void *cls, * @a ego does indicate an error (i.e. name is taken or no default * value is known). If @a ego is non-NULL and if '*ctx' * is set in those callbacks, the value WILL be passed to a subsequent - * call to the identity callback of #GNUNET_IDENTITY_connect (if + * call to the identity callback of #GNUNET_IDENTITY_connect (if * that one was not NULL). * * @param cls closure, NULL @@ -941,12 +941,12 @@ identity_cb (void *cls, { httpd = MHD_start_daemon (options, (uint16_t) port, - NULL, NULL, - &create_response, NULL, + NULL, NULL, + &create_response, NULL, MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 128, MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 1, MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 16, - MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (4 * 1024), + MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (4 * 1024), MHD_OPTION_NOTIFY_COMPLETED, &request_completed_callback, NULL, MHD_OPTION_END); if (MHD_USE_DEBUG == options) @@ -1026,7 +1026,7 @@ main (int argc, char *const *argv) ret = (GNUNET_OK == GNUNET_PROGRAM_run (argc, argv, "fcfsd", - _("GNU Name System First Come First Serve name registration service"), + _("GNU Name System First Come First Serve name registration service"), options, &run, NULL)) ? 0 : 1; 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, if ( (NULL == del_qe) && (NULL == list_qe) && (NULL == add_qe_uri) && - (NULL == add_qe) ) + (NULL == add_qe) ) GNUNET_SCHEDULER_shutdown (); return; } @@ -365,12 +365,12 @@ display_record (void *cls, at.abs_value_us = rd[i].expiration_time; ets = GNUNET_STRINGS_absolute_time_to_string (at); } - FPRINTF (stdout, + FPRINTF (stdout, "\t%s: %s (%s)\n", - typestring, + typestring, s, ets); - GNUNET_free (s); + GNUNET_free (s); } FPRINTF (stdout, "%s", "\n"); GNUNET_NAMESTORE_zone_iterator_next (list_it); @@ -435,7 +435,7 @@ get_existing_record (void *cls, } else if (GNUNET_NO == etime_is_rel) rde->expiration_time = etime_abs.abs_value_us; - else + else rde->expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; GNUNET_assert (NULL != name); add_qe = GNUNET_NAMESTORE_records_store (ns, @@ -479,7 +479,7 @@ display_records_from_block (void *cls, } FPRINTF (stdout, "%s:\n", - name); + name); for (i=0;ipurpose.size) - - sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + - sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) - sizeof (struct GNUNET_TIME_AbsoluteNBO); r = GNUNET_malloc (sizeof (struct LookupBlockResponseMessage) + esize); r->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE); @@ -369,15 +369,15 @@ handle_lookup_block_it (void *cls, r->gns_header.r_id = htonl (lnc->request_id); r->expire = block->expiration_time; r->signature = block->signature; - r->derived_key = block->derived_key; + r->derived_key = block->derived_key; memcpy (&r[1], &block[1], esize); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Sending `%s' message with expiration time %s\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Sending `%s' message with expiration time %s\n", "NAMESTORE_LOOKUP_BLOCK_RESPONSE", GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (r->expire))); - GNUNET_SERVER_notification_context_unicast (snc, - lnc->nc->client, - &r->gns_header.header, + GNUNET_SERVER_notification_context_unicast (snc, + lnc->nc->client, + &r->gns_header.header, GNUNET_NO); GNUNET_free (r); } @@ -401,38 +401,38 @@ handle_lookup_block (void *cls, struct LookupBlockResponseMessage zir_end; int ret; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Received `%s' message\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Received `%s' message\n", "NAMESTORE_LOOKUP_BLOCK"); nc = client_lookup(client); ln_msg = (const struct LookupBlockMessage *) message; lnc.request_id = ntohl (ln_msg->gns_header.r_id); lnc.nc = nc; if (GNUNET_SYSERR == - (ret = GSN_database->lookup_block (GSN_database->cls, + (ret = GSN_database->lookup_block (GSN_database->cls, &ln_msg->query, &handle_lookup_block_it, &lnc))) { /* internal error (in database plugin); might be best to just hang up on - plugin rather than to signal that there are 'no' results, which + plugin rather than to signal that there are 'no' results, which might also be false... */ - GNUNET_break (0); + GNUNET_break (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); return; - } + } if (0 == ret) { /* no records match at all, generate empty response */ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Sending empty `%s' message\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Sending empty `%s' message\n", "NAMESTORE_LOOKUP_BLOCK_RESPONSE"); memset (&zir_end, 0, sizeof (zir_end)); zir_end.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE); zir_end.gns_header.header.size = htons (sizeof (struct LookupBlockResponseMessage)); zir_end.gns_header.r_id = ln_msg->gns_header.r_id; - GNUNET_SERVER_notification_context_unicast (snc, - client, - &zir_end.gns_header.header, + GNUNET_SERVER_notification_context_unicast (snc, + client, + &zir_end.gns_header.header, GNUNET_NO); } @@ -453,7 +453,7 @@ handle_block_cache (void *cls, const struct GNUNET_MessageHeader *message) { struct NamestoreClient *nc; - const struct BlockCacheMessage *rp_msg; + const struct BlockCacheMessage *rp_msg; struct BlockCacheResponseMessage rpr_msg; struct GNUNET_NAMESTORE_Block *block; size_t esize; @@ -475,7 +475,7 @@ handle_block_cache (void *cls, sizeof (struct GNUNET_TIME_AbsoluteNBO) + esize); block->expiration_time = rp_msg->expire; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message with expiration time %s\n", "NAMESTORE_BLOCK_CACHE", GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (block->expiration_time))); @@ -488,9 +488,9 @@ handle_block_cache (void *cls, rpr_msg.gns_header.header.size = htons (sizeof (struct BlockCacheResponseMessage)); rpr_msg.gns_header.r_id = rp_msg->gns_header.r_id; rpr_msg.op_result = htonl (res); - GNUNET_SERVER_notification_context_unicast (snc, - nc->client, - &rpr_msg.gns_header.header, + GNUNET_SERVER_notification_context_unicast (snc, + nc->client, + &rpr_msg.gns_header.header, GNUNET_NO); GNUNET_SERVER_receive_done (client, GNUNET_OK); } @@ -525,7 +525,7 @@ send_lookup_response (struct GNUNET_SERVER_NotificationContext *nc, char *rd_ser; name_len = strlen (name) + 1; - rd_ser_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); + rd_ser_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); msg_size = sizeof (struct RecordResultMessage) + name_len + rd_ser_len; zir_msg = GNUNET_malloc (msg_size); @@ -540,13 +540,13 @@ send_lookup_response (struct GNUNET_SERVER_NotificationContext *nc, memcpy (name_tmp, name, name_len); rd_ser = &name_tmp[name_len]; GNUNET_NAMESTORE_records_serialize (rd_count, rd, rd_ser_len, rd_ser); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Sending `%s' message with %u records and size %u\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Sending `%s' message with %u records and size %u\n", "RECORD_RESULT", rd_count, msg_size); GNUNET_SERVER_notification_context_unicast (nc, - client, + client, &zir_msg->gns_header.header, GNUNET_NO); GNUNET_free (zir_msg); @@ -569,7 +569,7 @@ refresh_block (const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, const struct GNUNET_NAMESTORE_RecordData *rd) { struct GNUNET_NAMESTORE_Block *block; - + if (0 == rd_count) block = GNUNET_NAMESTORE_block_create (zone_key, GNUNET_TIME_UNIT_ZERO_ABS, @@ -589,7 +589,7 @@ refresh_block (const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, _("Failed to cache encrypted block of my own zone!\n")); } GNUNET_free (block); -} +} /** @@ -620,8 +620,8 @@ handle_record_store (void *cls, struct GNUNET_CRYPTO_EccPublicSignKey pubkey; struct ZoneMonitor *zm; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Received `%s' message\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Received `%s' message\n", "NAMESTORE_RECORD_STORE"); if (ntohs (message->size) < sizeof (struct RecordStoreMessage)) { @@ -686,9 +686,9 @@ handle_record_store (void *cls, conv_name, GNUNET_NAMESTORE_z2s (&pubkey)); - if ( (0 == rd_count) && - (GNUNET_NO == - GSN_database->iterate_records (GSN_database->cls, + if ( (0 == rd_count) && + (GNUNET_NO == + GSN_database->iterate_records (GSN_database->cls, &rp_msg->private_key, 0, NULL, 0)) ) { /* This name does not exist, so cannot be removed */ @@ -701,15 +701,15 @@ handle_record_store (void *cls, { res = GSN_database->store_records (GSN_database->cls, &rp_msg->private_key, - conv_name, + conv_name, rd_count, rd); if (GNUNET_OK == res) { refresh_block (&rp_msg->private_key, conv_name, rd_count, rd); - - for (zm = monitor_head; NULL != zm; zm = zm->next) + + for (zm = monitor_head; NULL != zm; zm = zm->next) if (0 == memcmp (&rp_msg->private_key, &zm->zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) send_lookup_response (monitor_nc, @@ -722,10 +722,10 @@ handle_record_store (void *cls, GNUNET_free (conv_name); } } - + /* Send response */ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Sending `%s' message\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Sending `%s' message\n", "RECORD_STORE_RESPONSE"); rcr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE); rcr_msg.gns_header.header.size = htons (sizeof (struct RecordStoreResponseMessage)); @@ -788,8 +788,8 @@ handle_zone_to_name_it (void *cls, char *name_tmp; char *rd_tmp; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Found result for zone-to-name lookup: `%s'\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Found result for zone-to-name lookup: `%s'\n", name); res = GNUNET_YES; name_len = (NULL == name) ? 0 : strlen (name) + 1; @@ -840,7 +840,7 @@ handle_zone_to_name (void *cls, struct ZoneToNameCtx ztn_ctx; struct ZoneToNameResponseMessage ztnr_msg; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ZONE_TO_NAME"); ztn_msg = (const struct ZoneToNameMessage *) message; @@ -849,7 +849,7 @@ handle_zone_to_name (void *cls, ztn_ctx.nc = nc; ztn_ctx.success = GNUNET_NO; if (GNUNET_SYSERR == - GSN_database->zone_to_name (GSN_database->cls, + GSN_database->zone_to_name (GSN_database->cls, &ztn_msg->zone, &ztn_msg->value_zone, &handle_zone_to_name_it, &ztn_ctx)) @@ -858,7 +858,7 @@ handle_zone_to_name (void *cls, that might be wrong */ GNUNET_break (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); - return; + return; } if (GNUNET_NO == ztn_ctx.success) { @@ -945,17 +945,17 @@ zone_iteraterate_proc (void *cls, if ((NULL == zone_key) && (NULL == name)) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Iteration done\n"); proc->res_iteration_finished = IT_SUCCESS_NOT_MORE_RESULTS_AVAILABLE; return; } - if ((NULL == zone_key) || (NULL == name)) + if ((NULL == zone_key) || (NULL == name)) { /* what is this!? should never happen */ proc->res_iteration_finished = IT_START; GNUNET_break (0); - return; + return; } proc->res_iteration_finished = IT_SUCCESS_MORE_AVAILABLE; send_lookup_response (snc, @@ -1001,11 +1001,11 @@ run_zone_iteration_round (struct ZoneIteration *zi) while (IT_START == proc.res_iteration_finished) { if (GNUNET_SYSERR == - (ret = GSN_database->iterate_records (GSN_database->cls, - (0 == memcmp (&zi->zone, &zero, sizeof (zero))) - ? NULL + (ret = GSN_database->iterate_records (GSN_database->cls, + (0 == memcmp (&zi->zone, &zero, sizeof (zero))) + ? NULL : &zi->zone, - zi->offset, + zi->offset, &zone_iteraterate_proc, &proc))) { GNUNET_break (0); @@ -1027,10 +1027,10 @@ run_zone_iteration_round (struct ZoneIteration *zi) rrm.gns_header.header.size = htons (sizeof (rrm)); rrm.gns_header.r_id = htonl (zi->request_id); GNUNET_SERVER_notification_context_unicast (snc, - zi->client->client, + zi->client->client, &rrm.gns_header.header, GNUNET_NO); - GNUNET_CONTAINER_DLL_remove (zi->client->op_head, + GNUNET_CONTAINER_DLL_remove (zi->client->op_head, zi->client->op_tail, zi); GNUNET_free (zi); @@ -1159,7 +1159,7 @@ handle_iteration_next (void *cls, * Send 'sync' message to zone monitor, we're now in sync. * * @param zm monitor that is now in sync - */ + */ static void monitor_sync (struct ZoneMonitor *zm) { @@ -1234,8 +1234,8 @@ handle_monitor_start (void *cls, { const struct ZoneMonitorStartMessage *zis_msg; struct ZoneMonitor *zm; - - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ZONE_MONITOR_START"); zis_msg = (const struct ZoneMonitorStartMessage *) message; @@ -1249,7 +1249,7 @@ handle_monitor_start (void *cls, GNUNET_SERVER_disable_receive_done_warning (client); GNUNET_SERVER_notification_context_add (monitor_nc, client); - zm->task = GNUNET_SCHEDULER_add_now (&monitor_next, zm); + zm->task = GNUNET_SCHEDULER_add_now (&monitor_next, zm); } @@ -1265,7 +1265,7 @@ monitor_next (void *cls, { struct ZoneMonitor *zm = cls; int ret; - + zm->task = GNUNET_SCHEDULER_NO_TASK; ret = GSN_database->iterate_records (GSN_database->cls, &zm->zone, @@ -1332,7 +1332,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, GNUNET_free (database); if (NULL == GSN_database) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not load database backend `%s'\n", db_lib_name); 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 uint16_t rd_len GNUNET_PACKED; /** - * Number of records contained + * Number of records contained */ uint16_t rd_count GNUNET_PACKED; @@ -221,12 +221,12 @@ struct ZoneToNameMessage struct GNUNET_NAMESTORE_Header gns_header; /** - * The private key of the zone to look up in + * The private key of the zone to look up in */ struct GNUNET_CRYPTO_EccPrivateKey zone; /** - * The public key of the target zone + * The public key of the target zone */ struct GNUNET_CRYPTO_EccPublicSignKey value_zone; }; @@ -259,7 +259,7 @@ struct ZoneToNameResponseMessage /** * result in NBO: #GNUNET_OK on success, #GNUNET_NO if there were no - * results, #GNUNET_SYSERR on error + * results, #GNUNET_SYSERR on error */ int16_t res GNUNET_PACKED; @@ -297,7 +297,7 @@ struct RecordResultMessage uint16_t rd_len GNUNET_PACKED; /** - * Number of records contained + * Number of records contained */ uint16_t rd_count GNUNET_PACKED; 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, size_t size) { struct GNUNET_NAMESTORE_Block *block; - char buf[size + sizeof (struct GNUNET_NAMESTORE_Block) + char buf[size + sizeof (struct GNUNET_NAMESTORE_Block) - sizeof (struct LookupBlockResponseMessage)]; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Received `%s'\n", + "Received `%s'\n", "LOOKUP_BLOCK_RESPONSE"); if (0 == GNUNET_TIME_absolute_ntoh (msg->expire).abs_value_us) { @@ -290,7 +290,7 @@ handle_lookup_block_response (struct GNUNET_NAMESTORE_QueueEntry *qe, block->signature = msg->signature; block->derived_key = msg->derived_key; block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN); - block->purpose.size = htonl (size - sizeof (struct LookupBlockResponseMessage) + + block->purpose.size = htonl (size - sizeof (struct LookupBlockResponseMessage) + sizeof (struct GNUNET_TIME_AbsoluteNBO) + sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)); block->expiration_time = msg->expire; @@ -332,11 +332,11 @@ handle_block_cache_response (struct GNUNET_NAMESTORE_QueueEntry *qe, "BLOCK_CACHE_RESPONSE"); res = ntohl (msg->op_result); /* TODO: add actual error message from namestore to response... */ - if (NULL != qe->cont) - qe->cont (qe->cont_cls, - res, - (GNUNET_OK == res) ? - NULL + if (NULL != qe->cont) + qe->cont (qe->cont_cls, + res, + (GNUNET_OK == res) ? + NULL : _("Namestore failed to cache block")); return GNUNET_OK; } @@ -358,8 +358,8 @@ handle_record_store_response (struct GNUNET_NAMESTORE_QueueEntry *qe, { int res; const char *emsg; - - LOG (GNUNET_ERROR_TYPE_DEBUG, + + LOG (GNUNET_ERROR_TYPE_DEBUG, "Received `%s'\n", "RECORD_STORE_RESPONSE"); /* TODO: add actual error message from namestore to response... */ @@ -368,7 +368,7 @@ handle_record_store_response (struct GNUNET_NAMESTORE_QueueEntry *qe, emsg = _("Namestore failed to store record\n"); else emsg = NULL; - if (NULL != qe->cont) + if (NULL != qe->cont) qe->cont (qe->cont_cls, res, emsg); return GNUNET_OK; } @@ -397,7 +397,7 @@ handle_record_result (struct GNUNET_NAMESTORE_QueueEntry *qe, unsigned int rd_count; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Received `%s'\n", + "Received `%s'\n", "RECORD_RESULT"); rd_len = ntohs (msg->rd_len); rd_count = ntohs (msg->rd_count); @@ -429,11 +429,11 @@ handle_record_result (struct GNUNET_NAMESTORE_QueueEntry *qe, if (0 == name_len) name = NULL; if (NULL != qe->proc) - qe->proc (qe->proc_cls, + qe->proc (qe->proc_cls, &msg->private_key, name, rd_count, - (rd_count > 0) ? rd : NULL); + (rd_count > 0) ? rd : NULL); } return GNUNET_OK; } @@ -461,7 +461,7 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, const char *name_tmp; const char *rd_tmp; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Received `%s'\n", "ZONE_TO_NAME_RESPONSE"); res = ntohs (msg->res); @@ -472,11 +472,11 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, "An error occured during zone to name operation\n"); break; case GNUNET_NO: - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Namestore has no result for zone to name mapping \n"); break; case GNUNET_YES: - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Namestore has result for zone to name mapping \n"); name_len = ntohs (msg->name_len); rd_count = ntohs (msg->rd_count); @@ -499,10 +499,10 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, } /* normal end, call continuation with result */ if (NULL != qe->proc) - qe->proc (qe->proc_cls, + qe->proc (qe->proc_cls, &msg->zone, - name_tmp, - rd_count, rd); + name_tmp, + rd_count, rd); /* return is important here: break would call continuation with error! */ return GNUNET_OK; } @@ -530,11 +530,11 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, static int manage_record_operations (struct GNUNET_NAMESTORE_QueueEntry *qe, const struct GNUNET_MessageHeader *msg, - uint16_t type, + uint16_t type, size_t size) { /* handle different message type */ - switch (type) + switch (type) { case GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE: if (size < sizeof (struct LookupBlockResponseMessage)) @@ -601,7 +601,7 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze, const char *name_tmp; const char *rd_ser_tmp; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Received `%s'\n", "ZONE_ITERATION_RESPONSE"); msg_len = ntohs (msg->gns_header.header.size); @@ -614,8 +614,8 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze, GNUNET_break (0); return GNUNET_SYSERR; } - if ( (0 == name_len) && - (0 == (memcmp (&msg->private_key, + if ( (0 == name_len) && + (0 == (memcmp (&msg->private_key, &priv_dummy, sizeof (priv_dummy)))) ) { @@ -635,18 +635,18 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze, { struct GNUNET_NAMESTORE_RecordData rd[rd_count]; - if (GNUNET_OK != GNUNET_NAMESTORE_records_deserialize (rd_len, - rd_ser_tmp, - rd_count, + if (GNUNET_OK != GNUNET_NAMESTORE_records_deserialize (rd_len, + rd_ser_tmp, + rd_count, rd)) { GNUNET_break (0); return GNUNET_SYSERR; } if (NULL != ze->proc) - ze->proc (ze->proc_cls, - &msg->private_key, - name_tmp, + ze->proc (ze->proc_cls, + &msg->private_key, + name_tmp, rd_count, rd); return GNUNET_YES; } @@ -669,7 +669,7 @@ manage_zone_operations (struct GNUNET_NAMESTORE_ZoneIterator *ze, int type, size_t size) { /* handle different message type */ - switch (type) + switch (type) { case GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT: if (size < sizeof (struct RecordResultMessage)) @@ -678,7 +678,7 @@ manage_zone_operations (struct GNUNET_NAMESTORE_ZoneIterator *ze, return GNUNET_SYSERR; } return handle_zone_iteration_response (ze, - (const struct RecordResultMessage *) msg, + (const struct RecordResultMessage *) msg, size); default: GNUNET_break (0); @@ -695,7 +695,7 @@ manage_zone_operations (struct GNUNET_NAMESTORE_ZoneIterator *ze, * @param msg message received, NULL on timeout or fatal error */ static void -process_namestore_message (void *cls, +process_namestore_message (void *cls, const struct GNUNET_MessageHeader *msg) { struct GNUNET_NAMESTORE_Handle *h = cls; @@ -717,7 +717,7 @@ process_namestore_message (void *cls, if (size < sizeof (struct GNUNET_NAMESTORE_Header)) { GNUNET_break_op (0); - GNUNET_CLIENT_receive (h->client, + GNUNET_CLIENT_receive (h->client, &process_namestore_message, h, GNUNET_TIME_UNIT_FOREVER_REL); return; @@ -726,9 +726,9 @@ process_namestore_message (void *cls, r_id = ntohl (gm->r_id); LOG (GNUNET_ERROR_TYPE_DEBUG, - "Received message type %u size %u op %u\n", + "Received message type %u size %u op %u\n", (unsigned int) type, - (unsigned int) size, + (unsigned int) size, (unsigned int) r_id); /* Is it a record related operation ? */ @@ -738,7 +738,7 @@ process_namestore_message (void *cls, if (NULL != qe) { ret = manage_record_operations (qe, msg, type, size); - if (GNUNET_SYSERR == ret) + if (GNUNET_SYSERR == ret) { /* protocol error, need to reconnect */ h->reconnect = GNUNET_YES; @@ -802,8 +802,8 @@ do_transmit (struct GNUNET_NAMESTORE_Handle *h); * @return number of bytes copied into @a buf */ static size_t -transmit_message_to_namestore (void *cls, - size_t size, +transmit_message_to_namestore (void *cls, + size_t size, void *buf) { struct GNUNET_NAMESTORE_Handle *h = cls; @@ -819,14 +819,14 @@ transmit_message_to_namestore (void *cls, } ret = 0; cbuf = buf; - while ( (NULL != (p = h->pending_head)) && + while ( (NULL != (p = h->pending_head)) && (p->size <= size) ) { memcpy (&cbuf[ret], &p[1], p->size); ret += p->size; size -= p->size; GNUNET_CONTAINER_DLL_remove (h->pending_head, - h->pending_tail, + h->pending_tail, p); if (GNUNET_NO == h->is_receiving) { @@ -889,7 +889,7 @@ reconnect (struct GNUNET_NAMESTORE_Handle *h) * @param tc scheduler context */ static void -reconnect_task (void *cls, +reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_NAMESTORE_Handle *h = cls; @@ -1010,7 +1010,7 @@ GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h) /** * Store an item in the namestore. If the item is already present, - * it is replaced with the new record. + * it is replaced with the new record. * * @param h handle to the namestore * @param block block to store @@ -1032,8 +1032,8 @@ GNUNET_NAMESTORE_block_cache (struct GNUNET_NAMESTORE_Handle *h, size_t msg_size; GNUNET_assert (NULL != h); - blen = ntohl (block->purpose.size) - - sizeof (struct GNUNET_TIME_AbsoluteNBO) + blen = ntohl (block->purpose.size) + - sizeof (struct GNUNET_TIME_AbsoluteNBO) - sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose); rid = get_op_id (h); qe = GNUNET_new (struct GNUNET_NAMESTORE_QueueEntry); @@ -1055,9 +1055,9 @@ GNUNET_NAMESTORE_block_cache (struct GNUNET_NAMESTORE_Handle *h, msg->signature = block->signature; msg->derived_key = block->derived_key; memcpy (&msg[1], &block[1], blen); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message with size %u and expiration %s\n", - "NAMESTORE_BLOCK_CACHE", + "NAMESTORE_BLOCK_CACHE", (unsigned int) msg_size, GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (msg->expire))); 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, name_tmp = (char *) &msg[1]; memcpy (name_tmp, label, name_len); rd_ser = &name_tmp[name_len]; - GNUNET_break (rd_ser_len == - GNUNET_NAMESTORE_records_serialize (rd_count, rd, - rd_ser_len, + GNUNET_break (rd_ser_len == + GNUNET_NAMESTORE_records_serialize (rd_count, rd, + rd_ser_len, rd_ser)); - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Sending `%s' message for name `%s' with size %u and %u records\n", + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Sending `%s' message for name `%s' with size %u and %u records\n", "NAMESTORE_RECORD_STORE", label, msg_size, rd_count); 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, /** * Get a result for a particular key from the namestore. The processor - * will only be called once. + * will only be called once. * * @param h handle to the namestore * @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, * @return a handle that can be used to cancel */ struct GNUNET_NAMESTORE_QueueEntry * -GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h, +GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_HashCode *derived_hash, GNUNET_NAMESTORE_BlockProcessor proc, void *proc_cls) { @@ -1328,7 +1328,7 @@ GNUNET_NAMESTORE_zone_iterator_next (struct GNUNET_NAMESTORE_ZoneIterator *it) msg->gns_header.header.size = htons (msg_size); msg->gns_header.r_id = htonl (it->op_id); LOG (GNUNET_ERROR_TYPE_DEBUG, - "Sending `%s' message\n", + "Sending `%s' message\n", "ZONE_ITERATION_NEXT"); GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); do_transmit (h); @@ -1360,8 +1360,8 @@ GNUNET_NAMESTORE_zone_iteration_stop (struct GNUNET_NAMESTORE_ZoneIterator *it) msg->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP); msg->gns_header.header.size = htons (msg_size); msg->gns_header.r_id = htonl (it->op_id); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Sending `%s' message\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Sending `%s' message\n", "ZONE_ITERATION_STOP"); GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); 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 * Flags for the record, network byte order. */ uint32_t flags GNUNET_PACKED; - + }; GNUNET_NETWORK_STRUCT_END @@ -103,7 +103,7 @@ GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicSignKey *z) static char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) * 8]; char *end; - end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z, + end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), buf, sizeof (buf)); if (NULL == end) @@ -137,7 +137,7 @@ GNUNET_NAMESTORE_records_get_size (unsigned int rd_count, GNUNET_assert ((ret + rd[i].data_size) >= ret); ret += rd[i].data_size; } - return ret; + return ret; } @@ -159,7 +159,7 @@ GNUNET_NAMESTORE_records_serialize (unsigned int rd_count, struct NetworkRecord rec; unsigned int i; size_t off; - + off = 0; for (i=0;iexpiration_time, + a->expiration_time, b->expiration_time); return GNUNET_NO; } - if ((a->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS) + if ((a->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS) != (b->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS)) { LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -227,8 +227,8 @@ GNUNET_NAMESTORE_records_cmp (const struct GNUNET_NAMESTORE_RecordData *a, if (a->data_size != b->data_size) { LOG (GNUNET_ERROR_TYPE_DEBUG, - "Data size %lu != %lu\n", - a->data_size, + "Data size %lu != %lu\n", + a->data_size, b->data_size); return GNUNET_NO; } @@ -262,7 +262,7 @@ GNUNET_NAMESTORE_records_deserialize (size_t len, struct NetworkRecord rec; unsigned int i; size_t off; - + off = 0; for (i=0;ipurpose.size = htonl (sizeof (uint32_t) + payload_len + + block->purpose.size = htonl (sizeof (uint32_t) + payload_len + sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + sizeof (struct GNUNET_TIME_AbsoluteNBO)); block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN); @@ -436,8 +436,8 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, */ int GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block) -{ - return GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, +{ + return GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, &block->purpose, &block->signature, &block->derived_key); @@ -452,7 +452,7 @@ GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block) * @param label the name for the records * @param proc function to call with the result * @param proc_cls closure for proc - * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was + * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was * not well-formed */ int @@ -468,7 +468,7 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, struct GNUNET_CRYPTO_SymmetricInitializationVector iv; struct GNUNET_CRYPTO_SymmetricSessionKey skey; - if (ntohl (block->purpose.size) < + if (ntohl (block->purpose.size) < sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + sizeof (struct GNUNET_TIME_AbsoluteNBO)) { @@ -477,7 +477,7 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, } derive_block_aes_key (&iv, &skey, label, zone_key); { - char payload[payload_len]; + char payload[payload_len]; uint32_t rd_count; GNUNET_break (payload_len == @@ -496,7 +496,7 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, } { struct GNUNET_NAMESTORE_RecordData rd[rd_count]; - + if (GNUNET_OK != GNUNET_NAMESTORE_records_deserialize (payload_len - sizeof (uint32_t), &payload[sizeof (uint32_t)], @@ -555,7 +555,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, { GNUNET_break_op (0); return NULL; - } + } return ns; } case GNUNET_DNSPARSER_TYPE_CNAME: @@ -572,7 +572,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, { GNUNET_break_op (0); return NULL; - } + } return cname; } case GNUNET_DNSPARSER_TYPE_SOA: @@ -590,13 +590,13 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, GNUNET_break_op (0); return NULL; } - GNUNET_asprintf (&result, + GNUNET_asprintf (&result, "rname=%s mname=%s %lu,%lu,%lu,%lu,%lu", - soa->rname, + soa->rname, soa->mname, - soa->serial, + soa->serial, soa->refresh, - soa->retry, + soa->retry, soa->expire, soa->minimum_ttl); GNUNET_DNSPARSER_free_soa (soa); @@ -616,7 +616,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, { GNUNET_break_op (0); return NULL; - } + } return ptr; } case GNUNET_DNSPARSER_TYPE_MX: @@ -634,8 +634,8 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, GNUNET_break_op (0); return NULL; } - GNUNET_asprintf (&result, - "%hu,%s", + GNUNET_asprintf (&result, + "%hu,%s", mx->preference, mx->mxhost); GNUNET_DNSPARSER_free_mx (mx); @@ -710,7 +710,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, { GNUNET_break_op (0); return NULL; - } + } return ns; } case GNUNET_DNSPARSER_TYPE_SRV: @@ -729,7 +729,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, GNUNET_break_op (0); return NULL; } - GNUNET_asprintf (&result, + GNUNET_asprintf (&result, "%d %d %d _%s._%s.%s", srv->priority, srv->weight, @@ -750,7 +750,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, ('\0' != cdata[data_size - 1]) ) return NULL; /* malformed */ tlsa = data; - if (0 == GNUNET_asprintf (&tlsa_str, + if (0 == GNUNET_asprintf (&tlsa_str, "%c %c %c %s", tlsa->usage, tlsa->selector, @@ -794,7 +794,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, char s_peer[103 + 1]; char s_serv[253 + 1]; unsigned int proto; - + if (NULL == s) return GNUNET_SYSERR; switch (type) @@ -820,7 +820,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, { char nsbuf[256]; size_t off; - + off = 0; if (GNUNET_OK != GNUNET_DNSPARSER_builder_add_name (nsbuf, @@ -842,7 +842,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, { char cnamebuf[256]; size_t off; - + off = 0; if (GNUNET_OK != GNUNET_DNSPARSER_builder_add_name (cnamebuf, @@ -873,7 +873,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, unsigned int soa_min; size_t off; - if (7 != SSCANF (s, + if (7 != SSCANF (s, "rname=%253s mname=%253s %u,%u,%u,%u,%u", soa_rname, soa_mname, &soa_serial, &soa_refresh, &soa_retry, &soa_expire, &soa_min)) @@ -912,7 +912,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, { char ptrbuf[256]; size_t off; - + off = 0; if (GNUNET_OK != GNUNET_DNSPARSER_builder_add_name (ptrbuf, @@ -970,7 +970,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, *data_size = strlen (s); return GNUNET_OK; case GNUNET_DNSPARSER_TYPE_AAAA: - if (1 != inet_pton (AF_INET6, s, &value_aaaa)) + if (1 != inet_pton (AF_INET6, s, &value_aaaa)) { LOG (GNUNET_ERROR_TYPE_ERROR, _("Unable to parse IPv6 address `%s'\n"), @@ -1005,7 +1005,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, (1 != sscanf (s, "%u-", &line)) || (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (dash + 1, - strlen (dash + 1), + strlen (dash + 1), &peer.public_key)) ) { LOG (GNUNET_ERROR_TYPE_ERROR, @@ -1055,7 +1055,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, { char nsbuf[256]; size_t off; - + off = 0; if (GNUNET_OK != GNUNET_DNSPARSER_builder_add_name (nsbuf, @@ -1083,7 +1083,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, (char*)&tlsa[1])) { LOG (GNUNET_ERROR_TYPE_ERROR, - _("Unable to parse TLSA record string `%s'\n"), + _("Unable to parse TLSA record string `%s'\n"), s); *data_size = 0; GNUNET_free (tlsa); @@ -1103,9 +1103,9 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, * Mapping of record type numbers to human-readable * record type names. */ -static struct { - const char *name; - uint32_t number; +static struct { + const char *name; + uint32_t number; } name_map[] = { { "A", GNUNET_DNSPARSER_TYPE_A }, { "NS", GNUNET_DNSPARSER_TYPE_NS }, @@ -1141,7 +1141,7 @@ GNUNET_NAMESTORE_typename_to_number (const char *dns_typename) while ( (name_map[i].name != NULL) && (0 != strcasecmp (dns_typename, name_map[i].name)) ) i++; - return name_map[i].number; + return name_map[i].number; } @@ -1160,13 +1160,13 @@ GNUNET_NAMESTORE_number_to_typename (uint32_t type) while ( (name_map[i].name != NULL) && (type != name_map[i].number) ) i++; - return name_map[i].name; + return name_map[i].name; } /** * Test if a given record is expired. - * + * * @return #GNUNET_YES if the record is expired, * #GNUNET_NO if not */ @@ -1184,7 +1184,7 @@ GNUNET_NAMESTORE_is_expired (const struct GNUNET_NAMESTORE_RecordData *rd) /** * Calculate the DHT query for a given @a label in a given @a zone. - * + * * @param zone private key of the zone * @param label label of the record * @param query hash to use for the query @@ -1203,7 +1203,7 @@ GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EccPrivateKe /** * Calculate the DHT query for a given @a label in a given @a zone. - * + * * @param pub public key of the zone * @param label label of the record * @param query hash to use for the query @@ -1222,12 +1222,12 @@ GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicSign /** * Convert public key to the respective absolute domain name in the - * ".zkey" pTLD. + * ".zkey" pTLD. * This is one of the very few calls in the entire API that is * NOT reentrant! - * - * @param pkey a public key with a point on the eliptic curve - * @return string "X.zkey" where X is the public + * + * @param pkey a public key with a point on the eliptic curve + * @return string "X.zkey" where X is the public * key in an encoding suitable for DNS labels. */ const char * @@ -1249,10 +1249,10 @@ GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey /** * Convert an absolute domain name in the ".zkey" pTLD to the * respective public key. - * + * * @param zkey string "X.zkey" where X is the coordinates of the public * key in an encoding suitable for DNS labels. - * @param pkey set to a public key on the eliptic curve + * @param pkey set to a public key on the eliptic curve * @return #GNUNET_SYSERR if @a zkey has the wrong syntax */ int @@ -1262,13 +1262,13 @@ GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey, char *cpy; char *dot; const char *x; - + cpy = GNUNET_strdup (zkey); x = cpy; if (NULL == (dot = strchr (x, (int) '.'))) goto error; *dot = '\0'; - if (0 != strcasecmp (dot + 1, + if (0 != strcasecmp (dot + 1, "zkey")) goto error; 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, GNUNET_break (0); reconnect (zm); return; - } + } GNUNET_CLIENT_receive (zm->h, &handle_updates, zm, GNUNET_TIME_UNIT_FOREVER_REL); - zm->monitor (zm->cls, + zm->monitor (zm->cls, &lrm->private_key, - name_tmp, + name_tmp, rd_count, rd); } } @@ -224,7 +224,7 @@ transmit_monitor_message (void *cls, zm->th = NULL; if (size < sizeof (struct ZoneMonitorStartMessage)) - { + { reconnect (zm); return 0; } 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) GNUNET_POSTGRES_exec (dbh, "CREATE INDEX ir_name_rv ON ns091records (record_name_hash,rvalue)")) || (GNUNET_OK != GNUNET_POSTGRES_exec (dbh, "CREATE INDEX ir_rv ON ns091records (rvalue)")) ) - LOG (GNUNET_ERROR_TYPE_ERROR, + LOG (GNUNET_ERROR_TYPE_ERROR, _("Failed to create indices\n")); } @@ -113,7 +113,7 @@ database_setup (struct Plugin *plugin) "namestore-postgres"); if (NULL == plugin->dbh) return GNUNET_SYSERR; - if (GNUNET_YES == + if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (plugin->cfg, "namestore-postgres", "TEMPORARY_TABLE")) @@ -121,15 +121,15 @@ database_setup (struct Plugin *plugin) res = PQexec (plugin->dbh, "CREATE TEMPORARY TABLE ns091records (" - " zone_key BYTEA NOT NULL DEFAULT ''," - " zone_delegation BYTEA NOT NULL DEFAULT ''," - " zone_hash BYTEA NOT NULL DEFAULT ''," + " zone_key BYTEA NOT NULL DEFAULT ''," + " zone_delegation BYTEA NOT NULL DEFAULT ''," + " zone_hash BYTEA NOT NULL DEFAULT ''," " record_count INTEGER NOT NULL DEFAULT 0," " record_data BYTEA NOT NULL DEFAULT ''," - " block_expiration_time BIGINT NOT NULL DEFAULT 0," + " block_expiration_time BIGINT NOT NULL DEFAULT 0," " signature BYTEA NOT NULL DEFAULT ''," - " record_name TEXT NOT NULL DEFAULT ''," - " record_name_hash BYTEA NOT NULL DEFAULT ''," + " record_name TEXT NOT NULL DEFAULT ''," + " record_name_hash BYTEA NOT NULL DEFAULT ''," " rvalue BIGINT NOT NULL DEFAULT 0" ")" "WITH OIDS"); } @@ -137,15 +137,15 @@ database_setup (struct Plugin *plugin) res = PQexec (plugin->dbh, "CREATE TABLE ns091records (" - " zone_key BYTEA NOT NULL DEFAULT ''," - " zone_delegation BYTEA NOT NULL DEFAULT ''," - " zone_hash BYTEA NOT NULL DEFAULT ''," + " zone_key BYTEA NOT NULL DEFAULT ''," + " zone_delegation BYTEA NOT NULL DEFAULT ''," + " zone_hash BYTEA NOT NULL DEFAULT ''," " record_count INTEGER NOT NULL DEFAULT 0," " record_data BYTEA NOT NULL DEFAULT ''," - " block_expiration_time BIGINT NOT NULL DEFAULT 0," + " block_expiration_time BIGINT NOT NULL DEFAULT 0," " signature BYTEA NOT NULL DEFAULT ''," - " record_name TEXT NOT NULL DEFAULT ''," - " record_name_hash BYTEA NOT NULL DEFAULT ''," + " record_name TEXT NOT NULL DEFAULT ''," + " record_name_hash BYTEA NOT NULL DEFAULT ''," " rvalue BIGINT NOT NULL DEFAULT 0" ")" "WITH OIDS"); @@ -167,7 +167,7 @@ database_setup (struct Plugin *plugin) if ((GNUNET_OK != GNUNET_POSTGRES_prepare (plugin->dbh, "put_records", - "INSERT INTO ns091records (zone_key, record_name, record_count, record_data, block_expiration_time, signature" + "INSERT INTO ns091records (zone_key, record_name, record_count, record_data, block_expiration_time, signature" ", zone_delegation, zone_hash, record_name_hash, rvalue) VALUES " "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", 10)) || (GNUNET_OK != @@ -177,22 +177,22 @@ database_setup (struct Plugin *plugin) (GNUNET_OK != GNUNET_POSTGRES_prepare (plugin->dbh, "iterate_records", - "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" + "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" " FROM ns091records WHERE zone_hash=$1 AND record_name_hash=$2 ORDER BY rvalue LIMIT 1 OFFSET $3", 3)) || (GNUNET_OK != GNUNET_POSTGRES_prepare (plugin->dbh, "iterate_by_zone", - "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" + "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" " FROM ns091records WHERE zone_hash=$1 ORDER BY rvalue LIMIT 1 OFFSET $2", 2)) || (GNUNET_OK != GNUNET_POSTGRES_prepare (plugin->dbh, "iterate_by_name", - "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" + "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" " FROM ns091records WHERE record_name_hash=$1 ORDER BY rvalue LIMIT 1 OFFSET $2", 2)) || (GNUNET_OK != GNUNET_POSTGRES_prepare (plugin->dbh, "iterate_all", - "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" + "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" " FROM ns091records ORDER BY rvalue LIMIT 1 OFFSET $1", 1)) || (GNUNET_OK != GNUNET_POSTGRES_prepare (plugin->dbh, @@ -223,8 +223,8 @@ TODO: removed * @param name name to remove (at most 255 characters long) * @return GNUNET_OK on success */ -static int -namestore_postgres_remove_records (void *cls, +static int +namestore_postgres_remove_records (void *cls, const struct GNUNET_CRYPTO_ShortHashCode *zone, const char *name) { @@ -267,12 +267,12 @@ namestore_postgres_remove_records (void *cls, * @param name name that is being mapped (at most 255 characters long) * @param rd_count number of entries in 'rd' array * @param rd array of records with data to store - * @param signature signature of the record block, NULL if signature is unavailable (i.e. + * @param signature signature of the record block, NULL if signature is unavailable (i.e. * because the user queried for a particular record type only) * @return GNUNET_OK on success, else GNUNET_SYSERR */ -static int -namestore_postgres_put_records (void *cls, +static int +namestore_postgres_put_records (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *zone_key, struct GNUNET_TIME_Absolute expire, const char *name, @@ -290,7 +290,7 @@ namestore_postgres_put_records (void *cls, size_t data_size; unsigned int i; - GNUNET_CRYPTO_short_hash (zone_key, + GNUNET_CRYPTO_short_hash (zone_key, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), &zone); (void) namestore_postgres_remove_records (plugin, &zone, name); @@ -336,7 +336,7 @@ namestore_postgres_put_records (void *cls, sizeof (uint32_t), data_size, sizeof (uint64_t), - sizeof (struct GNUNET_CRYPTO_EccSignature), + sizeof (struct GNUNET_CRYPTO_EccSignature), sizeof (struct GNUNET_CRYPTO_ShortHashCode), sizeof (struct GNUNET_CRYPTO_ShortHashCode), sizeof (struct GNUNET_CRYPTO_ShortHashCode), @@ -358,7 +358,7 @@ namestore_postgres_put_records (void *cls, return GNUNET_SYSERR; PQclear (ret); } - return GNUNET_OK; + return GNUNET_OK; } #endif @@ -404,7 +404,7 @@ get_record_and_call_iterator (struct Plugin *plugin, if (0 == (cnt = PQntuples (res))) { /* no result */ - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Ending iteration (no more results)\n"); PQclear (res); @@ -412,10 +412,10 @@ get_record_and_call_iterator (struct Plugin *plugin, return GNUNET_NO; } GNUNET_assert (1 == cnt); - if ((6 != PQnfields (res)) || - (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) != PQgetlength (res, 0, 0)) || - (sizeof (uint32_t) != PQfsize (res, 2)) || - (sizeof (uint64_t) != PQfsize (res, 4)) || + if ((6 != PQnfields (res)) || + (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) != PQgetlength (res, 0, 0)) || + (sizeof (uint32_t) != PQfsize (res, 2)) || + (sizeof (uint64_t) != PQfsize (res, 4)) || (sizeof (struct GNUNET_CRYPTO_EccSignature) != PQgetlength (res, 0, 5))) { GNUNET_break (0); @@ -444,7 +444,7 @@ get_record_and_call_iterator (struct Plugin *plugin, { struct GNUNET_NAMESTORE_RecordData rd[record_count]; char buf[name_len + 1]; - + memcpy (buf, name, name_len); buf[name_len] = '\0'; if (GNUNET_OK != @@ -461,7 +461,7 @@ get_record_and_call_iterator (struct Plugin *plugin, return GNUNET_OK; } #endif - + /** * Iterate over the results for a particular key and zone in the * datastore. Will return at most one result to the iterator. @@ -474,8 +474,8 @@ get_record_and_call_iterator (struct Plugin *plugin, * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUNET_SYSERR on error * 'iter' will have been called unless the return value is 'GNUNET_SYSERR' */ -static int -namestore_postgres_iterate_records (void *cls, +static int +namestore_postgres_iterate_records (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *zone, uint64_t offset, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) @@ -537,7 +537,7 @@ namestore_postgres_iterate_records (void *cls, first_param = 0; } res = - PQexecPrepared (plugin->dbh, stmt_name, num_params, + PQexecPrepared (plugin->dbh, stmt_name, num_params, ¶mValues[first_param], ¶mLengths[first_param], ¶mFormats[first_param], 1); @@ -561,7 +561,7 @@ namestore_postgres_iterate_records (void *cls, * 'iter' will have been called unless the return value is 'GNUNET_SYSERR' */ static int -namestore_postgres_zone_to_name (void *cls, +namestore_postgres_zone_to_name (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *zone, const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) @@ -595,7 +595,7 @@ namestore_postgres_zone_to_name (void *cls, * @param cls closure (internal context for the plugin) * @param zone zone to delete */ -static void +static void namestore_postgres_delete_zone (void *cls, const struct GNUNET_CRYPTO_ShortHashCode *zone) { @@ -717,7 +717,7 @@ libgnunet_plugin_namestore_postgres_init (void *cls) if (NULL != plugin.cfg) return NULL; /* can only initialize once! */ memset (&plugin, 0, sizeof (struct Plugin)); - plugin.cfg = cfg; + plugin.cfg = cfg; if (GNUNET_OK != database_setup (&plugin)) { database_shutdown (&plugin); @@ -733,7 +733,7 @@ libgnunet_plugin_namestore_postgres_init (void *cls) api->iterate_records = &namestore_postgres_iterate_records; api->zone_to_name = &namestore_postgres_zone_to_name; /* api->delete_zone = &namestore_postgres_delete_zone; */ - LOG (GNUNET_ERROR_TYPE_INFO, + LOG (GNUNET_ERROR_TYPE_INFO, _("Postgres database running\n")); return api; } @@ -754,7 +754,7 @@ libgnunet_plugin_namestore_postgres_done (void *cls) database_shutdown (plugin); plugin->cfg = NULL; GNUNET_free (api); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "postgres plugin is finished\n"); return NULL; } 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) result = sqlite3_prepare_v2 (dbh, zSql, strlen (zSql), ppStmt, (const char **) &dummy); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Prepared `%s' / %p: %d\n", zSql, *ppStmt, result); return result; } @@ -166,7 +166,7 @@ create_indices (sqlite3 * dbh) (SQLITE_OK != sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS it_iter ON ns096records (rvalue)", NULL, NULL, NULL)) ) - LOG (GNUNET_ERROR_TYPE_ERROR, + LOG (GNUNET_ERROR_TYPE_ERROR, "Failed to create indices: %s\n", sqlite3_errmsg (dbh)); } @@ -262,11 +262,11 @@ database_setup (struct Plugin *plugin) if ((sqlite3_step (stmt) == SQLITE_DONE) && (sqlite3_exec (plugin->dbh, - "CREATE TABLE ns096blocks (" - " query BLOB NOT NULL DEFAULT ''," - " block BLOB NOT NULL DEFAULT ''," - " expiration_time INT8 NOT NULL DEFAULT 0" - ")", + "CREATE TABLE ns096blocks (" + " query BLOB NOT NULL DEFAULT ''," + " block BLOB NOT NULL DEFAULT ''," + " expiration_time INT8 NOT NULL DEFAULT 0" + ")", NULL, NULL, NULL) != SQLITE_OK)) { LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec"); @@ -282,14 +282,14 @@ database_setup (struct Plugin *plugin) if ((sqlite3_step (stmt) == SQLITE_DONE) && (sqlite3_exec (plugin->dbh, - "CREATE TABLE ns096records (" - " zone_private_key BLOB NOT NULL DEFAULT ''," - " pkey_hash BLOB," + "CREATE TABLE ns096records (" + " zone_private_key BLOB NOT NULL DEFAULT ''," + " pkey_hash BLOB," " rvalue INT8 NOT NULL DEFAULT ''," " record_count INT NOT NULL DEFAULT 0," " record_data BLOB NOT NULL DEFAULT ''," - " label TEXT NOT NULL DEFAULT ''" - ")", + " label TEXT NOT NULL DEFAULT ''" + ")", NULL, NULL, NULL) != SQLITE_OK)) { LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec"); @@ -332,14 +332,14 @@ database_setup (struct Plugin *plugin) &plugin->zone_to_name) != SQLITE_OK) || (sq_prepare (plugin->dbh, - "SELECT record_count,record_data,label" + "SELECT record_count,record_data,label" " FROM ns096records WHERE zone_private_key=? ORDER BY rvalue LIMIT 1 OFFSET ?", &plugin->iterate_zone) != SQLITE_OK) || (sq_prepare (plugin->dbh, - "SELECT record_count,record_data,label,zone_private_key" + "SELECT record_count,record_data,label,zone_private_key" " FROM ns096records ORDER BY rvalue LIMIT 1 OFFSET ?", - &plugin->iterate_all_zones) != SQLITE_OK) + &plugin->iterate_all_zones) != SQLITE_OK) ) { LOG_SQLITE (plugin,GNUNET_ERROR_TYPE_ERROR, "precompiling"); @@ -415,7 +415,7 @@ namestore_sqlite_expire_blocks (struct Plugin *plugin) int n; now = GNUNET_TIME_absolute_get (); - if (SQLITE_OK != sqlite3_bind_int64 (plugin->expire_blocks, + if (SQLITE_OK != sqlite3_bind_int64 (plugin->expire_blocks, 1, now.abs_value_us)) { LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, @@ -454,8 +454,8 @@ namestore_sqlite_expire_blocks (struct Plugin *plugin) * @param block block to cache * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ -static int -namestore_sqlite_cache_block (void *cls, +static int +namestore_sqlite_cache_block (void *cls, const struct GNUNET_NAMESTORE_Block *block) { struct Plugin *plugin = cls; @@ -466,16 +466,16 @@ namestore_sqlite_cache_block (void *cls, int n; namestore_sqlite_expire_blocks (plugin); - GNUNET_CRYPTO_hash (&block->derived_key, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + GNUNET_CRYPTO_hash (&block->derived_key, + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), &query); expiration = GNUNET_TIME_absolute_ntoh (block->expiration_time); dval = (int64_t) expiration.abs_value_us; if (dval < 0) dval = INT64_MAX; - block_size = ntohl (block->purpose.size) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + - sizeof (struct GNUNET_CRYPTO_EccSignature); + block_size = ntohl (block->purpose.size) + + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + + sizeof (struct GNUNET_CRYPTO_EccSignature); if (block_size > 64 * 65536) { GNUNET_break (0); @@ -483,11 +483,11 @@ namestore_sqlite_cache_block (void *cls, } /* delete old version of the block */ - if ( (SQLITE_OK != - sqlite3_bind_blob (plugin->delete_block, 1, - &query, sizeof (struct GNUNET_HashCode), + if ( (SQLITE_OK != + sqlite3_bind_blob (plugin->delete_block, 1, + &query, sizeof (struct GNUNET_HashCode), SQLITE_STATIC)) || - (SQLITE_OK != + (SQLITE_OK != sqlite3_bind_int64 (plugin->delete_block, 2, dval)) ) { @@ -519,30 +519,30 @@ namestore_sqlite_cache_block (void *cls, "sqlite3_reset"); /* insert new version of the block */ - if ((SQLITE_OK != - sqlite3_bind_blob (plugin->cache_block, 1, - &query, sizeof (struct GNUNET_HashCode), + if ((SQLITE_OK != + sqlite3_bind_blob (plugin->cache_block, 1, + &query, sizeof (struct GNUNET_HashCode), SQLITE_STATIC)) || - (SQLITE_OK != - sqlite3_bind_blob (plugin->cache_block, 2, - block, block_size, + (SQLITE_OK != + sqlite3_bind_blob (plugin->cache_block, 2, + block, block_size, SQLITE_STATIC)) || - (SQLITE_OK != - sqlite3_bind_int64 (plugin->cache_block, 3, + (SQLITE_OK != + sqlite3_bind_int64 (plugin->cache_block, 3, dval))) { - LOG_SQLITE (plugin, + LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_bind_XXXX"); if (SQLITE_OK != sqlite3_reset (plugin->cache_block)) - LOG_SQLITE (plugin, + LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_reset"); return GNUNET_SYSERR; - + } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Caching block under derived key `%s'\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Caching block under derived key `%s'\n", GNUNET_h2s_full (&query)); n = sqlite3_step (plugin->cache_block); if (SQLITE_OK != sqlite3_reset (plugin->cache_block)) @@ -551,7 +551,7 @@ namestore_sqlite_cache_block (void *cls, switch (n) { case SQLITE_DONE: - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Record stored\n"); return GNUNET_OK; case SQLITE_BUSY: @@ -561,7 +561,7 @@ namestore_sqlite_cache_block (void *cls, default: LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_step"); - return GNUNET_SYSERR; + return GNUNET_SYSERR; } } @@ -577,7 +577,7 @@ namestore_sqlite_cache_block (void *cls, * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error */ static int -namestore_sqlite_lookup_block (void *cls, +namestore_sqlite_lookup_block (void *cls, const struct GNUNET_HashCode *query, GNUNET_NAMESTORE_BlockCallback iter, void *iter_cls) { @@ -598,26 +598,26 @@ namestore_sqlite_lookup_block (void *cls, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_reset"); return GNUNET_SYSERR; - } + } ret = GNUNET_NO; if (SQLITE_ROW == (sret = sqlite3_step (plugin->lookup_block))) - { + { block = sqlite3_column_blob (plugin->lookup_block, 0); block_size = sqlite3_column_bytes (plugin->lookup_block, 0); if ( (block_size < sizeof (struct GNUNET_NAMESTORE_Block)) || - (ntohl (block->purpose.size) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + + (ntohl (block->purpose.size) + + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + sizeof (struct GNUNET_CRYPTO_EccSignature) != block_size) ) { GNUNET_break (0); - ret = GNUNET_SYSERR; + ret = GNUNET_SYSERR; } else { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Found block under derived key `%s'\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Found block under derived key `%s'\n", GNUNET_h2s_full (query)); - iter (iter_cls, block); + iter (iter_cls, block); ret = GNUNET_YES; } } @@ -625,13 +625,13 @@ namestore_sqlite_lookup_block (void *cls, { if (SQLITE_DONE != sret) { - LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite_step"); + LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite_step"); ret = GNUNET_SYSERR; } else { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "No block found under derived key `%s'\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "No block found under derived key `%s'\n", GNUNET_h2s_full (query)); } } @@ -654,8 +654,8 @@ namestore_sqlite_lookup_block (void *cls, * @param rd array of records with data to store * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ -static int -namestore_sqlite_store_records (void *cls, +static int +namestore_sqlite_store_records (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, const char *label, unsigned int rd_count, @@ -696,19 +696,19 @@ namestore_sqlite_store_records (void *cls, } /* First delete 'old' records */ - if ((SQLITE_OK != sqlite3_bind_blob (plugin->delete_records, 1, + if ((SQLITE_OK != sqlite3_bind_blob (plugin->delete_records, 1, zone_key, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) || (SQLITE_OK != sqlite3_bind_text (plugin->delete_records, 2, label, -1, SQLITE_STATIC))) { - LOG_SQLITE (plugin, + LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_bind_XXXX"); if (SQLITE_OK != sqlite3_reset (plugin->delete_records)) - LOG_SQLITE (plugin, + LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_reset"); return GNUNET_SYSERR; - + } n = sqlite3_step (plugin->delete_records); if (SQLITE_OK != sqlite3_reset (plugin->delete_records)) @@ -717,7 +717,7 @@ namestore_sqlite_store_records (void *cls, if (0 != rd_count) { - if ((SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 1, + if ((SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 1, zone_key, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) || (SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 2, &pkey_hash, sizeof (struct GNUNET_HashCode), SQLITE_STATIC)) || @@ -726,11 +726,11 @@ namestore_sqlite_store_records (void *cls, (SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 5, data, data_size, SQLITE_STATIC)) || (SQLITE_OK != sqlite3_bind_text (plugin->store_records, 6, label, -1, SQLITE_STATIC))) { - LOG_SQLITE (plugin, + LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_bind_XXXX"); if (SQLITE_OK != sqlite3_reset (plugin->store_records)) - LOG_SQLITE (plugin, + LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_reset"); return GNUNET_SYSERR; @@ -756,7 +756,7 @@ namestore_sqlite_store_records (void *cls, default: LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_step"); - return GNUNET_SYSERR; + return GNUNET_SYSERR; } } @@ -775,7 +775,7 @@ namestore_sqlite_store_records (void *cls, */ static int get_record_and_call_iterator (struct Plugin *plugin, - sqlite3_stmt *stmt, + sqlite3_stmt *stmt, const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) { @@ -788,7 +788,7 @@ get_record_and_call_iterator (struct Plugin *plugin, ret = GNUNET_NO; if (SQLITE_ROW == (sret = sqlite3_step (stmt))) - { + { record_count = sqlite3_column_int (stmt, 0); data_size = sqlite3_column_bytes (stmt, 1); data = sqlite3_column_blob (stmt, 1); @@ -813,7 +813,7 @@ get_record_and_call_iterator (struct Plugin *plugin, because database might contain a large value here */ GNUNET_break (0); ret = GNUNET_SYSERR; - } + } else { struct GNUNET_NAMESTORE_RecordData rd[record_count]; @@ -857,8 +857,8 @@ get_record_and_call_iterator (struct Plugin *plugin, * @param iter_cls closure for @a iter * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error */ -static int -namestore_sqlite_iterate_records (void *cls, +static int +namestore_sqlite_iterate_records (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *zone, uint64_t offset, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) @@ -876,7 +876,7 @@ namestore_sqlite_iterate_records (void *cls, else { stmt = plugin->iterate_zone; - err = ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, + err = ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) || (SQLITE_OK != sqlite3_bind_int64 (stmt, 2, @@ -891,7 +891,7 @@ namestore_sqlite_iterate_records (void *cls, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_reset"); return GNUNET_SYSERR; - } + } return get_record_and_call_iterator (plugin, stmt, zone, iter, iter_cls); } @@ -908,7 +908,7 @@ namestore_sqlite_iterate_records (void *cls, * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error */ static int -namestore_sqlite_zone_to_name (void *cls, +namestore_sqlite_zone_to_name (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *zone, const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) @@ -917,10 +917,10 @@ namestore_sqlite_zone_to_name (void *cls, sqlite3_stmt *stmt; stmt = plugin->zone_to_name; - if ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, + if ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) || - (SQLITE_OK != sqlite3_bind_blob (stmt, 2, + (SQLITE_OK != sqlite3_bind_blob (stmt, 2, value_zone, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), SQLITE_STATIC)) ) { @@ -931,7 +931,7 @@ namestore_sqlite_zone_to_name (void *cls, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_reset"); return GNUNET_SYSERR; - } + } return get_record_and_call_iterator (plugin, stmt, zone, iter, iter_cls); } @@ -952,7 +952,7 @@ libgnunet_plugin_namestore_sqlite_init (void *cls) if (NULL != plugin.cfg) return NULL; /* can only initialize once! */ memset (&plugin, 0, sizeof (struct Plugin)); - plugin.cfg = cfg; + plugin.cfg = cfg; if (GNUNET_OK != database_setup (&plugin)) { database_shutdown (&plugin); @@ -965,7 +965,7 @@ libgnunet_plugin_namestore_sqlite_init (void *cls) api->store_records = &namestore_sqlite_store_records; api->iterate_records = &namestore_sqlite_iterate_records; api->zone_to_name = &namestore_sqlite_zone_to_name; - LOG (GNUNET_ERROR_TYPE_INFO, + LOG (GNUNET_ERROR_TYPE_INFO, _("Sqlite database running\n")); return api; } @@ -986,7 +986,7 @@ libgnunet_plugin_namestore_sqlite_done (void *cls) database_shutdown (plugin); plugin->cfg = NULL; GNUNET_free (api); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "sqlite plugin is finished\n"); return NULL; } 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, &pubkey, name, &rd_decrypt_cb, (void *) name)); } -static void +static void cache_cont (void *cls, int32_t success, const char *emsg) { const char *name = cls; @@ -166,7 +166,7 @@ cache_cont (void *cls, int32_t success, const char *emsg) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { @@ -175,7 +175,7 @@ run (void *cls, char *hostkey_file; const char * name = "dummy.dummy.gnunet"; - endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, + endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &endbadly, NULL); GNUNET_asprintf (&hostkey_file, "zonefiles%s%s", @@ -224,7 +224,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api", "namestore", "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, &pubkey, name, &rd_decrypt_cb, (void *) name)); } -static void +static void put_cont (void *cls, int32_t success, const char *emsg) { const char *name = cls; @@ -154,7 +154,7 @@ put_cont (void *cls, int32_t success, const char *emsg) GNUNET_assert (NULL != cls); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Name store added record for `%s': %s\n", + "Name store added record for `%s': %s\n", name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); @@ -168,7 +168,7 @@ put_cont (void *cls, int32_t success, const char *emsg) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { @@ -176,7 +176,7 @@ run (void *cls, char *hostkey_file; const char * name = "dummy.dummy.gnunet"; - endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, + endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &endbadly, NULL); GNUNET_asprintf (&hostkey_file, "zonefiles%s%s", @@ -213,7 +213,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api", "namestore", "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, static int returned_records; static int fail = GNUNET_NO; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Comparing results name %s\n", + "Comparing results name %s\n", name); if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) @@ -191,7 +191,7 @@ zone_proc (void *cls, } if (2 == ++returned_records) - { + { if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) { GNUNET_SCHEDULER_cancel (endbadly_task); @@ -254,7 +254,7 @@ create_record (unsigned int count) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { @@ -266,7 +266,7 @@ run (void *cls, "zonefiles%s%s", DIR_SEPARATOR_STR, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); GNUNET_free (hostkey_file); @@ -334,7 +334,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api-monitoring", "namestore", "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, static int returned_records; static int fail = GNUNET_NO; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Comparing results name %s\n", + "Comparing results name %s\n", name); if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) @@ -192,7 +192,7 @@ zone_proc (void *cls, } if (2 == ++returned_records) - { + { if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) { GNUNET_SCHEDULER_cancel (endbadly_task); @@ -272,7 +272,7 @@ create_record (unsigned int count) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg, struct GNUNET_TESTING_Peer *peer) { @@ -284,7 +284,7 @@ run (void *cls, "zonefiles%s%s", DIR_SEPARATOR_STR, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); GNUNET_free (hostkey_file); @@ -339,7 +339,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api-monitoring", "namestore", "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) { const char * name = cls; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Name store added record for `%s': %s\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Name store added record for `%s': %s\n", name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); if (success == GNUNET_OK) res = 0; @@ -131,7 +131,7 @@ create_record (unsigned int count) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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) static void -remove_cont (void *cls, - int32_t success, +remove_cont (void *cls, + int32_t success, const char *emsg) { if (GNUNET_YES != success) @@ -128,16 +128,16 @@ rd_decrypt_cb (void *cls, GNUNET_assert (GNUNET_NO == removed); GNUNET_assert (1 == rd_count); - GNUNET_assert (NULL != rd); + GNUNET_assert (NULL != rd); memset (rd_cmp_data, 'a', TEST_RECORD_DATALEN); - + GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type); GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size); GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN)); - + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Block was decrypted successfully, removing records \n"); - + nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, 0, NULL, &remove_cont, (void *) name); } @@ -178,14 +178,14 @@ name_lookup_proc (void *cls, } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Namestore returned block, decrypting \n"); - GNUNET_assert (GNUNET_OK == + GNUNET_assert (GNUNET_OK == GNUNET_NAMESTORE_block_decrypt (block, &pubkey, name, &rd_decrypt_cb, (void *) name)); } static void -put_cont (void *cls, int32_t success, +put_cont (void *cls, int32_t success, const char *emsg) { const char *name = cls; @@ -195,7 +195,7 @@ put_cont (void *cls, int32_t success, { GNUNET_break (0); GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Namestore could not store record: `%s'\n", + "Namestore could not store record: `%s'\n", emsg); if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) GNUNET_SCHEDULER_cancel (endbadly_task); @@ -229,7 +229,7 @@ put_cont (void *cls, int32_t success, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { @@ -274,7 +274,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api", "namestore", "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 main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api", "namestore", "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, &pubkey, name, &rd_decrypt_cb, (void *) name)); } -static void +static void put_cont (void *cls, int32_t success, const char *emsg) { const char *name = cls; @@ -153,7 +153,7 @@ put_cont (void *cls, int32_t success, const char *emsg) GNUNET_assert (NULL != cls); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Name store added record for `%s': %s\n", + "Name store added record for `%s': %s\n", name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); @@ -166,7 +166,7 @@ put_cont (void *cls, int32_t success, const char *emsg) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { @@ -174,7 +174,7 @@ run (void *cls, char *hostkey_file; const char * name = "dummy.dummy.gnunet"; - endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, + endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &endbadly, NULL); GNUNET_asprintf (&hostkey_file, "zonefiles%s%s", @@ -211,7 +211,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api", "namestore", "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, { char rd_cmp_data[TEST_RECORD_DATALEN]; memset (rd_cmp_data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); - + GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type); GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size); GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN)); - + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Block was decrypted successfully, updating record \n"); - + rd_new.flags = GNUNET_NAMESTORE_RF_NONE; rd_new.expiration_time = GNUNET_TIME_absolute_get().abs_value_us; rd_new.record_type = TEST_RECORD_TYPE2; rd_new.data_size = TEST_RECORD_DATALEN2; rd_new.data = GNUNET_malloc (TEST_RECORD_DATALEN2); memset ((char *) rd_new.data, TEST_RECORD_DATA2, TEST_RECORD_DATALEN2); - + nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, 1, &rd_new, &put_cont, (void *) name); update_performed = GNUNET_YES; @@ -146,11 +146,11 @@ rd_decrypt_cb (void *cls, { char rd_cmp_data[TEST_RECORD_DATALEN2]; memset (rd_cmp_data, TEST_RECORD_DATA2, TEST_RECORD_DATALEN2); - + GNUNET_assert (TEST_RECORD_TYPE2 == rd[0].record_type); GNUNET_assert (TEST_RECORD_DATALEN2 == rd[0].data_size); GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN2)); - + GNUNET_SCHEDULER_add_now (&end, NULL); } } @@ -210,7 +210,7 @@ put_cont (void *cls, int32_t success, const char *emsg) static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { @@ -218,7 +218,7 @@ run (void *cls, char *hostkey_file; update_performed = GNUNET_NO; - endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, + endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &endbadly, NULL); GNUNET_asprintf (&hostkey_file, "zonefiles%s%s", @@ -255,7 +255,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api-store-update", "namestore", "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, else res = 1; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received last result, iteration done after receing %u results\n", returned_records ); GNUNET_SCHEDULER_add_now (&end, NULL); @@ -414,7 +414,7 @@ empty_zone_proc (void *cls, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { @@ -438,7 +438,7 @@ int main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration", "namestore", "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 main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration", "namestore", "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 main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration-stop", "namestore", "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 main (int argc, char *argv[]) { res = 1; - if (0 != + if (0 != GNUNET_TESTING_service_run ("test-namestore-api-zone-to-name", "namestore", "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) } -static void +static void test_record (void *cls, const struct GNUNET_CRYPTO_EccPrivateKey *private_key, const char *label, @@ -134,7 +134,7 @@ put_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp, int id) rd[i].data_size = id % 10; rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES).abs_value_us; rd[i].record_type = 1 + (id % 13); - rd[i].flags = (id % 7); + rd[i].flags = (id % 7); } memset (&zone_private_key, (id % 241), sizeof (zone_private_key)); memset (&signature, (id % 243), sizeof (signature)); @@ -150,14 +150,14 @@ static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { - struct GNUNET_NAMESTORE_PluginFunctions *nsp; - + struct GNUNET_NAMESTORE_PluginFunctions *nsp; + ok = 0; nsp = load_plugin (cfg); if (NULL == nsp) { FPRINTF (stderr, - "%s", + "%s", "Failed to initialize namestore. Database likely not setup, skipping test.\n"); return; } 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 }; /** - * Will this binary be run in permissions testing mode? + * Will this binary be run in permissions testing mode? */ static boolean privilege_testing = FALSE; @@ -468,10 +468,10 @@ main (int argc, char *const *argv) struct in_addr target; WSADATA wsaData; unsigned int p; - + if (argc > 1 && 0 != strcmp (argv[1], "-d")){ privilege_testing = TRUE; - fprintf (stderr, + fprintf (stderr, "%s", "DEBUG: Running binary in privilege testing mode."); argv++; @@ -489,14 +489,14 @@ main (int argc, char *const *argv) (1 != inet_pton (AF_INET, argv[2], &target))) { fprintf (stderr, - "Error parsing IPv4 address: %s\n", + "Error parsing IPv4 address: %s\n", strerror (errno)); return 1; } if ((1 != sscanf (argv[3], "%u", &p)) || (0 == p) || (0xFFFF < p)) { - fprintf (stderr, - "Error parsing port value `%s'\n", + fprintf (stderr, + "Error parsing port value `%s'\n", argv[3]); return 1; } @@ -504,14 +504,14 @@ main (int argc, char *const *argv) if (0 != WSAStartup (MAKEWORD (2, 1), &wsaData)) { - fprintf (stderr, + fprintf (stderr, "%s", "Failed to find Winsock 2.1 or better.\n"); return 2; } if (1 != inet_pton (AF_INET, DUMMY_IP, &dummy)) { - fprintf (stderr, + fprintf (stderr, "%s", "Internal error converting dummy IP to binary.\n"); return 2; @@ -522,7 +522,7 @@ main (int argc, char *const *argv) send_icmp (&external, &target); send_icmp_udp (&external, &target); } - closesocket (rawsock); + closesocket (rawsock); WSACleanup (); return 0; } 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 }; /** - * Will this binary be run in permissions testing mode? + * Will this binary be run in permissions testing mode? */ static boolean privilege_testing = FALSE; @@ -533,7 +533,7 @@ main (int argc, char *const *argv) WSADATA wsaData; unsigned int alt = 0; - if ( (argc > 1) && (0 != strcmp (argv[1], "-d"))) + if ( (argc > 1) && (0 != strcmp (argv[1], "-d"))) { privilege_testing = TRUE; fprintf (stderr, @@ -542,7 +542,7 @@ main (int argc, char *const *argv) argv++; argc--; } - + if (2 != argc) { 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) } /* select failed (internal error or OS out of resources) */ - global_ret = 11; + global_ret = 11; error_exit: if (-1 != icmpsock) (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, if ((h->internal_address != NULL) && (inet_pton (AF_INET, h->internal_address, &in_addr) != 1)) { - GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, + GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, "nat", "INTERNAL_ADDRESS", _("malformed")); 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 * Last phase, we're done. */ AUTO_DONE - + }; @@ -105,12 +105,12 @@ struct GNUNET_NAT_AutoHandle * Function to call when done. */ GNUNET_NAT_AutoResultCallback fin_cb; - + /** * Closure for 'fin_cb'. */ void *fin_cb_cls; - + /** * Handle for active 'GNUNET_NAT_mini_get_external_ipv4'-operation. */ @@ -171,7 +171,7 @@ fail_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) ah->task = GNUNET_SCHEDULER_NO_TASK; GNUNET_NAT_test_stop (ah->tst); ah->tst = NULL; - GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", + GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", "ENABLE_ICMP_SERVER", "NO"); next_phase (ah); @@ -195,10 +195,10 @@ result_callback (void *cls, int success) GNUNET_NAT_test_stop (ah->tst); ah->tst = NULL; GNUNET_log (GNUNET_ERROR_TYPE_INFO, - success + success ? _("NAT traversal with ICMP Server succeeded.\n") : _("NAT traversal with ICMP Server failed.\n")); - GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", "ENABLE_ICMP_SERVER", + GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", "ENABLE_ICMP_SERVER", success ? "YES": "NO"); next_phase (ah); } @@ -352,7 +352,7 @@ nipo (void *cls, const char *name, int isDefault, const struct sockaddr *addr, /** - * Determine our local IP addresses; detect internal IP & IPv6-support + * Determine our local IP addresses; detect internal IP & IPv6-support * * @param ah auto setup context */ @@ -361,7 +361,7 @@ test_local_ip (struct GNUNET_NAT_AutoHandle *ah) { ah->have_v6 = GNUNET_NO; GNUNET_OS_network_interfaces_list (&nipo, ah); - GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", "DISABLEV6", + GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", "DISABLEV6", (GNUNET_YES == ah->have_v6) ? "NO" : "YES"); next_phase (ah); } @@ -396,10 +396,10 @@ test_upnpc (struct GNUNET_NAT_AutoHandle *ah) /* FIXME: test if upnpc is actually working, that is, if transports start to work once we use UPnP */ GNUNET_log (GNUNET_ERROR_TYPE_INFO, - (have_upnpc) + (have_upnpc) ? _("upnpc found, enabling its use\n") : _("upnpc not found\n")); - GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", "ENABLE_UPNP", + GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", "ENABLE_UPNP", (GNUNET_YES == have_upnpc) ? "YES" : "NO"); next_phase (ah); } @@ -430,7 +430,7 @@ test_icmp_server (struct GNUNET_NAT_AutoHandle *ah) GNUNET_free_non_null (tmp); GNUNET_free (binary); GNUNET_log (GNUNET_ERROR_TYPE_INFO, - (hns) + (hns) ? _("gnunet-helper-nat-server found, testing it\n") : _("No working gnunet-helper-nat-server found\n")); if (hns) @@ -465,7 +465,7 @@ test_icmp_client (struct GNUNET_NAT_AutoHandle *ah) GNUNET_free_non_null (tmp); GNUNET_free (binary); GNUNET_log (GNUNET_ERROR_TYPE_INFO, - (hnc) + (hnc) ? _("gnunet-helper-nat-client found, enabling it\n") : _("gnunet-helper-nat-client not found or behind NAT, disabling it\n")); next_phase (ah); @@ -543,14 +543,14 @@ GNUNET_NAT_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg, ah->initial_cfg = GNUNET_CONFIGURATION_dup (cfg); /* never use loopback addresses if user wanted autoconfiguration */ - GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", - "USE_LOCALADDR", + GNUNET_CONFIGURATION_set_value_string (ah->cfg, "nat", + "USE_LOCALADDR", "NO"); next_phase (ah); return ah; } - + /** * Abort autoconfiguration. * 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; /** * Name of the file with the hosts to run the test over (configuration option) - */ + */ static char *hosts_file; /** @@ -274,7 +274,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (GNUNET_YES == shutting_down) return; shutting_down = GNUNET_YES; - LOG_DEBUG ("Ending test.\n"); + LOG_DEBUG ("Ending test.\n"); close_monitor_connections (); if (NULL != data_file) { @@ -314,7 +314,7 @@ shutdown_now () * of the size estimation values seen */ static void -handle_estimate (void *cls, +handle_estimate (void *cls, struct GNUNET_TIME_Absolute timestamp, double estimate, double std_dev) { @@ -329,7 +329,7 @@ handle_estimate (void *cls, peer, estimate, std_dev); return; } - size = GNUNET_snprintf (output_buffer, + size = GNUNET_snprintf (output_buffer, sizeof (output_buffer), "%p %llu %llu %f %f %f\n", peer, peers_running, @@ -345,7 +345,7 @@ handle_estimate (void *cls, /** * Adapter function called to establish a connection to * NSE service. - * + * * @param cls closure (the 'struct NSEPeer') * @param cfg configuration of the peer to connect to; will be available until * GNUNET_TESTBED_operation_done() is called on the operation returned @@ -365,11 +365,11 @@ nse_connect_adapter (void *cls, /** * Adapter function called to destroy a connection to * NSE service. - * + * * @param cls closure * @param op_result service handle returned from the connect adapter */ -static void +static void nse_disconnect_adapter (void *cls, void *op_result) { @@ -389,7 +389,7 @@ nse_disconnect_adapter (void *cls, */ static int stat_iterator (void *cls, - const char *subsystem, + const char *subsystem, const char *name, uint64_t value, int is_persistent) { @@ -404,7 +404,7 @@ stat_iterator (void *cls, if (0 != flag) flag = 1; size = GNUNET_asprintf (&output_buffer, "%llu %llu %u\n", - now.abs_value_us / 1000LL / 1000LL, + now.abs_value_us / 1000LL / 1000LL, value, flag); if (size != GNUNET_DISK_file_write (data_file, output_buffer, size)) { @@ -431,7 +431,7 @@ stat_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) { struct NSEPeer *peer = cls; - + peer->sh = GNUNET_STATISTICS_create ("nse-profiler", cfg); return peer->sh; } @@ -502,18 +502,18 @@ connect_nse_service () unsigned int connections; if (0 == connection_limit) - return; + return; LOG_DEBUG ("Connecting to nse service of peers\n"); connections = 0; for (i = 0; i < num_peers_in_round[current_round]; i++) { - if ((num_peers_in_round[current_round] > connection_limit) && + if ((num_peers_in_round[current_round] > connection_limit) && (0 != (i % (num_peers_in_round[current_round] / connection_limit)))) continue; LOG_DEBUG ("Connecting to nse service of peer %d\n", i); current_peer = GNUNET_malloc (sizeof (struct NSEPeer)); current_peer->daemon = daemons[i]; - current_peer->nse_op + current_peer->nse_op = GNUNET_TESTBED_service_connect (NULL, current_peer->daemon, "nse", @@ -545,7 +545,7 @@ connect_nse_service () * @param tc scheduler context (unused) */ static void -next_round (void *cls, +next_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); @@ -558,7 +558,7 @@ next_round (void *cls, * @param tc unused */ static void -finish_round (void *cls, +finish_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) @@ -606,12 +606,12 @@ make_oplist_entry () * @param op the operation handle * @param emsg NULL on success; otherwise an error description */ -static void +static void manage_service_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg) { struct OpListEntry *entry = cls; - + GNUNET_TESTBED_operation_done (entry->op); if (NULL != emsg) { @@ -673,13 +673,13 @@ adjust_running_peers () * @param tc unused */ static void -next_round (void *cls, +next_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; LOG_DEBUG ("Disconnecting nse service of peers\n"); - current_round++; + current_round++; if (current_round == num_rounds) { /* this was the last round, terminate */ @@ -705,7 +705,7 @@ next_round (void *cls, * @param event information on what is happening */ static void -master_controller_cb (void *cls, +master_controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) { switch (event->type) @@ -735,7 +735,7 @@ master_controller_cb (void *cls, * @param links_failed the number of overlay link connection attempts that * failed */ -static void +static void test_master (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers_, @@ -775,7 +775,7 @@ run (void *cls, char *const *args, const char *cfgfile, { char *tok; uint64_t event_mask; - unsigned int num; + unsigned int num; ok = 1; testing_cfg = GNUNET_CONFIGURATION_dup (cfg); @@ -806,7 +806,7 @@ run (void *cls, char *const *args, const char *cfgfile, return; } if ( (NULL != data_filename) && - (NULL == (data_file = + (NULL == (data_file = GNUNET_DISK_file_open (data_filename, GNUNET_DISK_OPEN_READWRITE | GNUNET_DISK_OPEN_TRUNCATE | @@ -839,7 +839,7 @@ run (void *cls, char *const *args, const char *cfgfile, NULL, /* master_controller_cb cls */ &test_master, NULL); /* test_master cls */ - shutdown_task_id = + shutdown_task_id = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, NULL); } 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 @@ /** * Should messages be delayed randomly? This option should be set to - * #GNUNET_NO only for experiments, not in production. + * #GNUNET_NO only for experiments, not in production. */ #define USE_RANDOM_DELAYS GNUNET_YES @@ -406,13 +406,13 @@ setup_estimate_message (struct GNUNET_NSE_ClientMessage *em) * @param message the message received */ static void -handle_start_message (void *cls, +handle_start_message (void *cls, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { struct GNUNET_NSE_ClientMessage em; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received START message from client\n"); GNUNET_SERVER_notification_context_add (nc, client); setup_estimate_message (&em); @@ -483,7 +483,7 @@ pow_hash (const void *buf, size_t buf_len, struct GNUNET_HashCode *result) { - GNUNET_break (0 == + GNUNET_break (0 == gcry_kdf_derive (buf, buf_len, GCRY_KDF_SCRYPT, 1 /* subalgo */, @@ -572,7 +572,7 @@ get_transmit_delay (int round_offset) * @param tc scheduler context */ static void -transmit_task_cb (void *cls, +transmit_task_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); @@ -586,7 +586,7 @@ transmit_task_cb (void *cls, * @return number of bytes written to @a buf */ static size_t -transmit_ready (void *cls, +transmit_ready (void *cls, size_t size, void *buf) { @@ -635,7 +635,7 @@ transmit_ready (void *cls, GNUNET_NO); #if ENABLE_NSE_HISTOGRAM peer_entry->transmitted_messages++; - peer_entry->last_transmitted_size = + peer_entry->last_transmitted_size = ntohl(size_estimate_messages[idx].matching_bits); #endif memcpy (buf, &size_estimate_messages[idx], @@ -651,7 +651,7 @@ transmit_ready (void *cls, * @param tc scheduler context */ static void -transmit_task_cb (void *cls, +transmit_task_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct NSEPeerEntry *peer_entry = cls; @@ -681,8 +681,8 @@ update_network_size_estimate () struct GNUNET_NSE_ClientMessage em; setup_estimate_message (&em); - GNUNET_SERVER_notification_context_broadcast (nc, - &em.header, + GNUNET_SERVER_notification_context_broadcast (nc, + &em.header, GNUNET_YES); } @@ -734,8 +734,8 @@ setup_flood_message (unsigned int slot, * @return #GNUNET_OK (continue to iterate) */ static int -schedule_current_round (void *cls, - const struct GNUNET_PeerIdentity * key, +schedule_current_round (void *cls, + const struct GNUNET_PeerIdentity * key, void *value) { struct NSEPeerEntry *peer_entry = value; @@ -774,7 +774,7 @@ schedule_current_round (void *cls, * @param tc context for this message */ static void -update_flood_message (void *cls, +update_flood_message (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_TIME_Relative offset; @@ -989,8 +989,8 @@ verify_message_crypto (const struct GNUNET_NSE_FloodMessage *incoming_flood) * @return #GNUNET_OK (continue to iterate) */ static int -update_flood_times (void *cls, - const struct GNUNET_PeerIdentity *key, +update_flood_times (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { struct NSEPeerEntry *exclude = cls; @@ -1032,7 +1032,7 @@ update_flood_times (void *cls, * @param peer peer identity this message is from (ignored) */ static int -handle_p2p_size_estimate (void *cls, +handle_p2p_size_estimate (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message) { @@ -1059,12 +1059,12 @@ handle_p2p_size_estimate (void *cls, char pred[5]; struct GNUNET_PeerIdentity os; - GNUNET_snprintf (origin, - sizeof (origin), - "%4s", + GNUNET_snprintf (origin, + sizeof (origin), + "%4s", GNUNET_i2s (&incoming_flood->origin)); - GNUNET_snprintf (pred, - sizeof (pred), + GNUNET_snprintf (pred, + sizeof (pred), "%4s", GNUNET_i2s (peer)); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -1083,7 +1083,7 @@ handle_p2p_size_estimate (void *cls, } #if ENABLE_NSE_HISTOGRAM peer_entry->received_messages++; - if (peer_entry->transmitted_messages > 0 && + if (peer_entry->transmitted_messages > 0 && peer_entry->last_transmitted_size >= matching_bits) GNUNET_STATISTICS_update(stats, "# cross messages", 1, GNUNET_NO); #endif @@ -1117,7 +1117,7 @@ handle_p2p_size_estimate (void *cls, { /* send to self, update our own estimate IF this also comes from us! */ if (0 == - memcmp (&incoming_flood->origin, + memcmp (&incoming_flood->origin, &my_identity, sizeof (my_identity))) update_network_size_estimate (); return GNUNET_OK; @@ -1131,7 +1131,7 @@ handle_p2p_size_estimate (void *cls, peer_entry->previous_round = GNUNET_YES; if (idx != estimate_index) { - /* do not transmit information for the previous round to this peer + /* do not transmit information for the previous round to this peer anymore (but allow current round) */ return GNUNET_OK; } @@ -1249,7 +1249,7 @@ handle_core_connect (void *cls, * @param peer peer identity this notification is about */ static void -handle_core_disconnect (void *cls, +handle_core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) { struct NSEPeerEntry *pos; @@ -1288,8 +1288,8 @@ handle_core_disconnect (void *cls, * @param cls NULL * @param size the amount of data sent (ignored) */ -static void -flush_comp_cb (void *cls, +static void +flush_comp_cb (void *cls, size_t size) { GNUNET_TESTBED_LOGGER_disconnect (lh); @@ -1359,7 +1359,7 @@ shutdown_task (void *cls, * @param identity the public identity of this peer */ static void -core_init (void *cls, +core_init (void *cls, const struct GNUNET_PeerIdentity *identity) { struct GNUNET_TIME_Absolute now; @@ -1406,7 +1406,7 @@ core_init (void *cls, * @param c configuration to use */ static void -run (void *cls, +run (void *cls, struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c) { @@ -1424,7 +1424,7 @@ run (void *cls, struct GNUNET_CRYPTO_EccPrivateKey *pk; cfg = c; - srv = server; + srv = server; if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg, "NSE", "INTERVAL", &gnunet_nse_interval)) @@ -1436,7 +1436,7 @@ run (void *cls, } if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg, "NSE", "WORKDELAY", - &proof_find_delay)) + &proof_find_delay)) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "NSE", "WORKDELAY"); @@ -1461,7 +1461,7 @@ run (void *cls, GNUNET_SCHEDULER_shutdown (); return; } - + #if ENABLE_NSE_HISTOGRAM if (NULL == (lh = GNUNET_TESTBED_LOGGER_connect (cfg))) { @@ -1477,7 +1477,7 @@ run (void *cls, pk = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg); GNUNET_assert (NULL != pk); my_private_key = pk; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, + GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, &my_identity.public_key); if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "NSE", "PROOFFILE", &proof)) @@ -1486,7 +1486,7 @@ run (void *cls, _ ("NSE service is lacking key configuration settings. Exiting.\n")); GNUNET_free (my_private_key); - my_private_key = NULL; + my_private_key = NULL; GNUNET_SCHEDULER_shutdown (); return; } @@ -1530,7 +1530,7 @@ run (void *cls, * @return 0 ok, 1 on error */ int -main (int argc, +main (int argc, char *const *argv) { return (GNUNET_OK == @@ -1545,7 +1545,7 @@ main (int argc, /** * MINIMIZE heap size (way below 128k) since this process doesn't need much. */ -void __attribute__ ((constructor)) +void __attribute__ ((constructor)) GNUNET_ARM_memory_init () { 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) GNUNET_CLIENT_disconnect (h->client); h->client = NULL; h->reconnect_task = - GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, + GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h); return; } @@ -118,7 +118,7 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg) } client_msg = (const struct GNUNET_NSE_ClientMessage *) msg; h->recv_cb (h->recv_cb_cls, GNUNET_TIME_absolute_ntoh (client_msg->timestamp), - GNUNET_ntoh_double (client_msg->size_estimate), + GNUNET_ntoh_double (client_msg->size_estimate), GNUNET_ntoh_double (client_msg->std_deviation)); GNUNET_CLIENT_receive (h->client, &message_handler, h, GNUNET_TIME_UNIT_FOREVER_REL); @@ -175,13 +175,13 @@ send_start (void *cls, size_t size, void *buf) { /* Connect error... */ LOG (GNUNET_ERROR_TYPE_DEBUG, - "Error while trying to transmit `%s' request.\n", + "Error while trying to transmit `%s' request.\n", "START"); reschedule_connect (h); return 0; } - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Transmitting `%s' request.\n", + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Transmitting `%s' request.\n", "START"); GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader)); @@ -201,7 +201,7 @@ send_start (void *cls, size_t size, void *buf) * @param tc scheduler context */ static void -reconnect (void *cls, +reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { 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, size_t buf_len, struct GNUNET_HashCode *result) { - GNUNET_break (0 == + GNUNET_break (0 == gcry_kdf_derive (buf, buf_len, GCRY_KDF_SCRYPT, 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, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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 /** * Handle to NSE service. - */ + */ struct GNUNET_NSE_Handle *nse_handle; }; @@ -100,9 +100,9 @@ handle_estimate (void *cls, struct GNUNET_TIME_Absolute timestamp, FPRINTF (stderr, "Received network size estimate from peer %u. logSize: %f std.dev. %f (%f/%u)\n", - (unsigned int) (peer - nse_peers), + (unsigned int) (peer - nse_peers), estimate, std_dev, - GNUNET_NSE_log_estimate_to_n (estimate), + GNUNET_NSE_log_estimate_to_n (estimate), NUM_PEERS); ok = 0; } @@ -118,7 +118,7 @@ handle_estimate (void *cls, struct GNUNET_TIME_Absolute timestamp, * operation has executed successfully. */ static void -nse_connect_complete_cb (void *cls, +nse_connect_complete_cb (void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg) @@ -143,18 +143,18 @@ nse_connect_complete_cb (void *cls, /** * Adapter function called to establish a connection to * the NSE service. - * + * * @param cls closure * @param cfg configuration of the peer to connect to; will be available until * GNUNET_TESTBED_operation_done() is called on the operation returned * from GNUNET_TESTBED_service_connect() * @return service handle to return in 'op_result', NULL on error */ -static void * +static void * nse_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) { - return GNUNET_NSE_connect (cfg, + return GNUNET_NSE_connect (cfg, &handle_estimate, cls); } @@ -163,7 +163,7 @@ nse_connect_adapter (void *cls, /** * Adapter function called to destroy connection to * NSE service. - * + * * @param cls closure * @param op_result service handle returned from the connect adapter */ @@ -177,7 +177,7 @@ nse_disconnect_adapter (void *cls, /** * Actual "main" function for the testcase. - * + * * @param cls closure * @param h the run handle * @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 * Printable address. */ char *result; - + /** * Print context this address record belongs to. */ @@ -90,7 +90,7 @@ struct PrintContext * Identity of the peer. */ struct GNUNET_PeerIdentity peer; - + /** * List of printable addresses. */ @@ -140,7 +140,7 @@ static int include_friend_only; static int get_self; /** - * Option + * Option */ static int get_uri; @@ -155,7 +155,7 @@ static int default_operation; static int get_info; /** - * Option + * Option */ static char *put_uri; @@ -248,7 +248,7 @@ dump_pc (struct PrintContext *pc) GNUNET_free (pc); if ( (NULL == pc_head) && (NULL == pic) ) - tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL); + tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL); } @@ -330,7 +330,7 @@ print_address (void *cls, const struct GNUNET_HELLO_Address *address, * Currently prints the GNUNET_PeerIdentity and the transport address. * * @param cls the 'struct PrintContext' - * @param peer identity of the peer + * @param peer identity of the peer * @param hello addresses of the peer * @param err_msg error message */ @@ -346,7 +346,7 @@ print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer, pic = NULL; /* end of iteration */ if (NULL != err_msg) { - FPRINTF (stderr, + FPRINTF (stderr, _("Error in communication with PEERINFO service: %s\n"), err_msg); } @@ -366,13 +366,13 @@ print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer, } pc = GNUNET_malloc (sizeof (struct PrintContext)); GNUNET_CONTAINER_DLL_insert (pc_head, - pc_tail, + pc_tail, pc); pc->peer = *peer; pc->friend_only = friend_only; - GNUNET_HELLO_iterate_addresses (hello, - GNUNET_NO, - &count_address, + GNUNET_HELLO_iterate_addresses (hello, + GNUNET_NO, + &count_address, pc); if (0 == pc->off) { @@ -381,7 +381,7 @@ print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer, } pc->address_list_size = pc->off; pc->address_list = GNUNET_malloc (sizeof (struct AddressRecord) * pc->off); - GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, + GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, &print_address, pc); } @@ -479,7 +479,7 @@ dump_my_hello (void *cls, const struct GNUNET_PeerIdentity *peer, */ static void print_my_uri (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_HELLO_Message *hello, + const struct GNUNET_HELLO_Message *hello, const char *err_msg) { if (peer == NULL) @@ -487,7 +487,7 @@ print_my_uri (void *cls, const struct GNUNET_PeerIdentity *peer, pic = NULL; if (err_msg != NULL) FPRINTF (stderr, - _("Error in communication with PEERINFO service: %s\n"), + _("Error in communication with PEERINFO service: %s\n"), err_msg); tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL); return; @@ -526,7 +526,7 @@ add_continuation (void *cls, /** - * Parse the PUT URI given at the command line and add it to our peerinfo + * Parse the PUT URI given at the command line and add it to our peerinfo * database. * * @param put_uri URI string to parse @@ -537,7 +537,7 @@ parse_hello_uri (const char *put_uri) { struct GNUNET_HELLO_Message *hello = NULL; - int ret = GNUNET_HELLO_parse_uri(put_uri, &my_peer_identity.public_key, + int ret = GNUNET_HELLO_parse_uri(put_uri, &my_peer_identity.public_key, &hello, &GPI_plugins_find); if (NULL != hello) { @@ -639,10 +639,10 @@ run (void *cls, char *const *args, const char *cfgfile, put_uri = GNUNET_strdup (args[0]); args++; } - if (NULL != args[0]) + if (NULL != args[0]) { - FPRINTF (stderr, - _("Invalid command line argument `%s'\n"), + FPRINTF (stderr, + _("Invalid command line argument `%s'\n"), args[0]); return; } @@ -669,7 +669,7 @@ run (void *cls, char *const *args, const char *cfgfile, return; } GNUNET_free (fn); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv, + GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv, &my_peer_identity.public_key); GNUNET_free (priv); } @@ -719,7 +719,7 @@ state_machine (void *cls, { get_self = GNUNET_NO; if (be_quiet) - printf ("%s\n", + printf ("%s\n", GNUNET_i2s_full (&my_peer_identity)); else 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 * Server transmit context */ struct GNUNET_SERVER_TransmitContext *tc; - + /** * Include friend only HELLOs GNUNET_YES or _NO */ @@ -315,7 +315,7 @@ update_hello (const struct GNUNET_PeerIdentity *peer, * addresses. Removes the file if one the HELLO is mal-formed. If all * addresses are expired, the HELLO is also removed (but the HELLO * with the public key is still returned if it was found and valid). - * + * * The file can contain multiple HELLO messages, but onlu a public and a friend only * HELLO should be included * @@ -351,7 +351,7 @@ read_host_file (const char *fn, int unlink_garbage, struct ReadHostFileContext * GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to parse HELLO in file `%s': %s\n"), fn, "Fail has invalid size"); - if ( (GNUNET_YES == unlink_garbage) && + if ( (GNUNET_YES == unlink_garbage) && (0 != UNLINK (fn)) && (ENOENT != errno) ) 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 * GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to parse HELLO in file `%s': %s %u \n"), fn, "HELLO is invalid and has size of ", size_hello); - if ((GNUNET_YES == unlink_garbage) && + if ((GNUNET_YES == unlink_garbage) && (0 != UNLINK (fn)) && (ENOENT != errno) ) GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn); return; } - + now = GNUNET_TIME_absolute_get (); hello_clean = GNUNET_HELLO_iterate_addresses (hello, GNUNET_YES, &discard_expired, &now); left = 0; (void) GNUNET_HELLO_iterate_addresses (hello_clean, GNUNET_NO, &count_addresses, &left); - + if (0 == left) { GNUNET_free (hello_clean); break; } - + if (GNUNET_NO == GNUNET_HELLO_is_friend_only (hello_clean)) { if (NULL == r->hello) @@ -497,7 +497,7 @@ struct DirScanContext * GNUNET_YES if we should remove files that are broken, * GNUNET_NO if the directory we are iterating over should * be treated as read-only by us. - */ + */ int remove_files; /** @@ -565,7 +565,7 @@ hosts_directory_scan_callback (void *cls, const char *fullname) } id = id_public; } - + if ( (NULL != r.hello) && (NULL != r.friend_only_hello) && (0 != memcmp (&id_friend, &id_public, sizeof (id_friend))) ) { @@ -575,7 +575,7 @@ hosts_directory_scan_callback (void *cls, const char *fullname) remove_garbage (fullname); return GNUNET_OK; } - if (GNUNET_OK == GNUNET_CRYPTO_ecc_public_sign_key_from_string (filename, + if (GNUNET_OK == GNUNET_CRYPTO_ecc_public_sign_key_from_string (filename, strlen (filename), &identity.public_key)) { @@ -641,7 +641,7 @@ cron_scan_directory_data_hosts (void *cls, if ((0 == dsc.matched) && (0 == (++retries & 31))) GNUNET_log (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, _("Still no peers found in `%s'!\n"), networkIdDirectory); - GNUNET_SCHEDULER_add_delayed_with_priority (DATA_HOST_FREQ, + GNUNET_SCHEDULER_add_delayed_with_priority (DATA_HOST_FREQ, GNUNET_SCHEDULER_PRIORITY_IDLE, &cron_scan_directory_data_hosts, NULL); @@ -655,14 +655,14 @@ update_friend_hello (const struct GNUNET_HELLO_Message *hello, struct GNUNET_HELLO_Message * res; struct GNUNET_HELLO_Message * tmp; struct GNUNET_CRYPTO_EccPublicSignKey pk; - + if (NULL != friend_hello) { res = GNUNET_HELLO_merge (hello, friend_hello); GNUNET_assert (GNUNET_YES == GNUNET_HELLO_is_friend_only (res)); return res; } - + if (GNUNET_OK != GNUNET_HELLO_get_key (hello, &pk)) { @@ -779,7 +779,7 @@ update_hello (const struct GNUNET_PeerIdentity *peer, store_friend_hello = GNUNET_YES; size += GNUNET_HELLO_size (host->friend_only_hello); } - + if ((GNUNET_NO == store_hello) && (GNUNET_NO == store_friend_hello)) { /* no valid addresses, don't put HELLO on disk; in fact, @@ -790,7 +790,7 @@ update_hello (const struct GNUNET_PeerIdentity *peer, { buffer = GNUNET_malloc (size); pos = 0; - + if (GNUNET_YES == store_hello) { memcpy (buffer, host->hello, GNUNET_HELLO_size (host->hello)); @@ -802,7 +802,7 @@ update_hello (const struct GNUNET_PeerIdentity *peer, pos += GNUNET_HELLO_size (host->friend_only_hello); } GNUNET_assert (pos == size); - + if (GNUNET_SYSERR == GNUNET_DISK_fn_write (fn, buffer, size, GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE | @@ -860,13 +860,13 @@ add_to_tc (void *cls, const struct GNUNET_PeerIdentity *key, void *value) GNUNET_assert (hs < GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct InfoMessage)); memcpy (&im[1], pos->friend_only_hello, hs); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending friend-only HELLO with size %u for peer `%4s'\n", hs, GNUNET_i2s (key)); } else { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding no HELLO for peer `%s'\n", GNUNET_i2s (key)); } @@ -1086,14 +1086,14 @@ do_notify_entry (void *cls, const struct GNUNET_PeerIdentity *key, void *value) /* We have no public hello */ return GNUNET_YES; } - - if ( (NULL == he->friend_only_hello) && + + if ( (NULL == he->friend_only_hello) && (GNUNET_YES == nc->include_friend_only) ) { /* We have no friend hello */ return GNUNET_YES; } - + msg = make_info_message (he, nc->include_friend_only); GNUNET_SERVER_notification_context_unicast (notify_list, nc->client, @@ -1118,13 +1118,13 @@ handle_notify (void *cls, struct GNUNET_SERVER_Client *client, struct NotifyMessage *nm = (struct NotifyMessage *) message; struct NotificationContext *nc; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "`%s' message received\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "`%s' message received\n", "NOTIFY"); nc = GNUNET_malloc (sizeof (struct NotificationContext)); nc->client = client; nc->include_friend_only = ntohl (nm->include_friend_only); - + GNUNET_CONTAINER_DLL_insert (nc_head, nc_tail, nc); GNUNET_SERVER_client_mark_monitor (client); GNUNET_SERVER_notification_context_add (notify_list, client); @@ -1139,7 +1139,7 @@ handle_notify (void *cls, struct GNUNET_SERVER_Client *client, * @param cls unused * @param client server client */ -static void +static void disconnect_cb (void *cls,struct GNUNET_SERVER_Client *client) { struct NotificationContext *cur; @@ -1251,7 +1251,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, GNUNET_SCHEDULER_shutdown (); return; } - + GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE, &cron_scan_directory_data_hosts, NULL); 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, * * @param ac handle for the add operation to cancel */ -void +void GNUNET_PEERINFO_add_peer_cancel (struct GNUNET_PEERINFO_AddContext *ac) { struct GNUNET_PEERINFO_Handle *h = ac->h; @@ -528,7 +528,7 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg) h->in_receive = GNUNET_YES; GNUNET_CLIENT_receive (h->client, &peerinfo_handler, h, GNUNET_TIME_absolute_get_remaining (h->ic_head->timeout)); - } + } if (NULL != cb) cb (cb_cls, NULL, NULL, NULL); return; @@ -557,11 +557,11 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg) "Received HELLO for peer `%s', expected peer `%s'\n", GNUNET_i2s (&im->peer), GNUNET_i2s (&ic->peer)); - + GNUNET_break (0); GNUNET_PEERINFO_iterate_cancel (ic); reconnect (h); - if (NULL != cb) + if (NULL != cb) cb (cb_cls, NULL, NULL, _("Received invalid message from `PEERINFO' service.")); return; @@ -576,7 +576,7 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg) GNUNET_break (0); GNUNET_PEERINFO_iterate_cancel (ic); reconnect (h); - if (NULL != cb) + if (NULL != cb) cb (cb_cls, NULL, NULL, _("Received invalid message from `PEERINFO' service.")); return; @@ -587,7 +587,7 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg) GNUNET_break (0); GNUNET_PEERINFO_iterate_cancel (ic); reconnect (h); - if (NULL != cb) + if (NULL != cb) cb (cb_cls, NULL, NULL, _("Received invalid message from `PEERINFO' service.")); return; @@ -598,7 +598,7 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg) GNUNET_break (0); GNUNET_PEERINFO_iterate_cancel (ic); reconnect (h); - if (NULL != cb) + if (NULL != cb) cb (cb_cls, NULL, NULL, _("Received invalid message from `PEERINFO' service.")); 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, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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 () static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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, static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { 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 struct TransmitMessage *tmit_head; struct TransmitMessage *tmit_tail; - char *tmit_buf; + char *tmit_buf; uint32_t tmit_mod_count; uint32_t tmit_mod_recvd; 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 @@ * Boston, MA 02111-1307, USA. */ -/** +/** * @file psyc/psyc_api.c * @brief PSYC service; high-level access to the PSYC protocol * note that clients of this API are NOT expected to @@ -46,7 +46,7 @@ struct OperationHandle const struct GNUNET_MessageHeader *msg; }; -/** +/** * Handle to access PSYC channel operations for both the master and slaves. */ struct GNUNET_PSYC_Channel @@ -109,7 +109,7 @@ struct GNUNET_PSYC_Channel }; -/** +/** * Handle for the master of a PSYC channel. */ struct GNUNET_PSYC_Master @@ -122,7 +122,7 @@ struct GNUNET_PSYC_Master }; -/** +/** * Handle for a PSYC channel slave. */ struct GNUNET_PSYC_Slave @@ -131,7 +131,7 @@ struct GNUNET_PSYC_Slave }; -/** +/** * Handle that identifies a join request. * * Used to match calls to #GNUNET_PSYC_JoinCallback to the @@ -143,7 +143,7 @@ struct GNUNET_PSYC_JoinHandle }; -/** +/** * Handle for a pending PSYC transmission operation. */ struct GNUNET_PSYC_MasterTransmitHandle @@ -156,7 +156,7 @@ struct GNUNET_PSYC_MasterTransmitHandle }; -/** +/** * Handle for a pending PSYC transmission operation. */ struct GNUNET_PSYC_SlaveTransmitHandle @@ -165,7 +165,7 @@ struct GNUNET_PSYC_SlaveTransmitHandle }; -/** +/** * Handle to a story telling operation. */ struct GNUNET_PSYC_Story @@ -435,7 +435,7 @@ disconnect (void *c) } -/** +/** * Start a PSYC master channel. * * 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, } -/** +/** * Stop a PSYC master channel. * * @param master PSYC channel master to stop. @@ -507,7 +507,7 @@ GNUNET_PSYC_master_stop (struct GNUNET_PSYC_Master *mst) } -/** +/** * Function to call with the decision made for a join request. * * 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) } -/** +/** * Send a message to call a method to all members in the PSYC channel. * * @param mst Handle to the PSYC channel. @@ -610,7 +610,7 @@ GNUNET_PSYC_master_transmit (struct GNUNET_PSYC_Master *mst, GNUNET_CONTAINER_DLL_insert (ch->transmit_head, ch->transmit_tail, op); GNUNET_ENV_environment_iterate (env, send_modifier, mst); - + struct GNUNET_PSYC_MasterTransmitHandle *th = GNUNET_malloc (sizeof (*th)); th->master = mst; th->env = env; @@ -620,7 +620,7 @@ GNUNET_PSYC_master_transmit (struct GNUNET_PSYC_Master *mst, } -/** +/** * Abort transmission request to the channel. * * @param th Handle of the request that is being aborted. @@ -633,11 +633,11 @@ GNUNET_PSYC_master_transmit_cancel (struct GNUNET_PSYC_MasterTransmitHandle *th) if (GNUNET_NO != ch->in_transmit) return; - + } -/** +/** * Join a PSYC channel. * * 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, } -/** +/** * Part a PSYC channel. * * Will terminate the connection to the PSYC service. Polite clients should @@ -720,7 +720,7 @@ GNUNET_PSYC_slave_part (struct GNUNET_PSYC_Slave *slv) } -/** +/** * Request a message to be sent to the channel master. * * @param slave Slave handle. @@ -745,7 +745,7 @@ GNUNET_PSYC_slave_transmit (struct GNUNET_PSYC_Slave *slave, } -/** +/** * Abort transmission request to master. * * @param th Handle of the request that is being aborted. @@ -757,7 +757,7 @@ GNUNET_PSYC_slave_transmit_cancel (struct GNUNET_PSYC_SlaveTransmitHandle *th) } -/** +/** * Convert a channel @a master to a @e channel handle to access the @e channel * APIs. * @@ -771,7 +771,7 @@ GNUNET_PSYC_master_get_channel (struct GNUNET_PSYC_Master *master) } -/** +/** * Convert @a slave to a @e channel handle to access the @e channel APIs. * * @param slave Slave handle. @@ -784,7 +784,7 @@ GNUNET_PSYC_slave_get_channel (struct GNUNET_PSYC_Slave *slave) } -/** +/** * Add a slave to the channel's membership list. * * 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, } -/** +/** * Remove a slave from the channel's membership list. * * 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, } -/** +/** * Request to be told the message history of the channel. * * 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, } -/** +/** * Abort story telling. * * 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) } -/** +/** * Retrieve the best matching channel state variable. * * 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, } -/** +/** * Return all channel state variables whose name matches a given prefix. * * 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, } -/** +/** * Cancel a state query operation. * * @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) } -/** +/** * Send a result code back to the client. * * @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) GNUNET_free_non_null (plugin->fn); } -/** +/** * Execute a prepared statement with a @a channel_key argument. * * @param plugin Plugin handle. * @param stmt Statement to execute. * @param channel_key Public key of the channel. - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int @@ -778,7 +778,7 @@ slave_key_store (struct Plugin *plugin, } -/** +/** * Store join/leave events for a PSYC channel in order to be able to answer * membership test queries later. * @@ -840,11 +840,11 @@ membership_store (void *cls, return GNUNET_OK; } -/** +/** * Test if a member was admitted to the channel at the given message ID. * * @see GNUNET_PSYCSTORE_membership_test() - * + * * @return #GNUNET_YES if the member was admitted, #GNUNET_NO if not, * #GNUNET_SYSERR if there was en error. */ @@ -888,11 +888,11 @@ membership_test (void *cls, return ret; } -/** +/** * Store a message fragment sent to a channel. * * @see GNUNET_PSYCSTORE_fragment_store() - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int @@ -961,11 +961,11 @@ fragment_store (void *cls, return GNUNET_OK; } -/** +/** * Set additional flags for a given message. * * They are OR'd with any existing flags set. - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int @@ -1036,11 +1036,11 @@ fragment_row (sqlite3_stmt *stmt, GNUNET_PSYCSTORE_FragmentCallback cb, return cb (cb_cls, (void *) msg, sqlite3_column_int64 (stmt, 8)); } -/** +/** * Retrieve a message fragment by fragment ID. * * @see GNUNET_PSYCSTORE_fragment_get() - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int @@ -1087,11 +1087,11 @@ fragment_get (void *cls, return ret; } -/** +/** * Retrieve all fragments of a message. * * @see GNUNET_PSYCSTORE_message_get() - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int @@ -1150,12 +1150,12 @@ message_get (void *cls, return ret; } -/** +/** * Retrieve a fragment of message specified by its message ID and fragment * offset. * * @see GNUNET_PSYCSTORE_message_get_fragment() - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int @@ -1204,11 +1204,11 @@ message_get_fragment (void *cls, return ret; } -/** +/** * Retrieve the max. values of message counters for a channel. * * @see GNUNET_PSYCSTORE_counters_get() - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int @@ -1257,11 +1257,11 @@ counters_message_get (void *cls, return ret; } -/** +/** * Retrieve the max. values of state counters for a channel. * * @see GNUNET_PSYCSTORE_counters_get() - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int @@ -1307,9 +1307,9 @@ counters_state_get (void *cls, } -/** +/** * Set a state variable to the given value. - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int @@ -1440,11 +1440,11 @@ state_modify_begin (void *cls, } -/** +/** * Set the current value of state variable. * * @see GNUNET_PSYCSTORE_state_modify() - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int @@ -1494,11 +1494,11 @@ state_sync_begin (void *cls, } -/** +/** * Set the current value of state variable. * * @see GNUNET_PSYCSTORE_state_modify() - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int @@ -1539,11 +1539,11 @@ state_sync_end (void *cls, } -/** +/** * Reset the state of a channel. * * @see GNUNET_PSYCSTORE_state_reset() - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int @@ -1554,11 +1554,11 @@ state_reset (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key } -/** +/** * Update signed values of state variables in the state store. * * @see GNUNET_PSYCSTORE_state_hash_update() - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int @@ -1570,11 +1570,11 @@ state_update_signed (void *cls, } -/** +/** * Retrieve a state variable by name. * * @see GNUNET_PSYCSTORE_state_get() - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int @@ -1621,11 +1621,11 @@ state_get (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, } -/** +/** * Retrieve all state variables for a channel with the given prefix. * * @see GNUNET_PSYCSTORE_state_get_prefix() - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int @@ -1688,11 +1688,11 @@ state_get_prefix (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channe } -/** +/** * Retrieve all signed state variables for a channel. * * @see GNUNET_PSYCSTORE_state_get_signed() - * + * * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int @@ -1748,7 +1748,7 @@ state_get_signed (void *cls, } -/** +/** * Entry point for the plugin. * * @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 @@ typedef void (*DataCallback) (); -/** +/** * Handle for an operation with the PSYCstore service. */ struct GNUNET_PSYCSTORE_OperationHandle @@ -162,9 +162,9 @@ get_next_op_id (struct GNUNET_PSYCSTORE_Handle *h) } -/** +/** * Find operation by ID. - * + * * @return OperationHandle if found, or NULL otherwise. */ static struct GNUNET_PSYCSTORE_OperationHandle * @@ -634,7 +634,7 @@ GNUNET_PSYCSTORE_operation_cancel (struct GNUNET_PSYCSTORE_OperationHandle *op) } -/** +/** * Store join/leave events for a PSYC channel in order to be able to answer * membership test queries later. * @@ -699,7 +699,7 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, } -/** +/** * Test if a member was admitted to the channel at the given message ID. * * 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, } -/** +/** * Store a message fragment sent to a channel. * * @param h Handle for the PSYCstore. @@ -764,7 +764,7 @@ GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h, * state modifiers. * @param rcb Callback to call with the result of the operation. * @param rcb_cls Closure for the callback. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -801,7 +801,7 @@ GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h, } -/** +/** * Retrieve a message fragment by fragment ID. * * @param h Handle for the PSYCstore. @@ -810,7 +810,7 @@ GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h, * @param fcb Callback to call with the retrieved fragments. * @param rcb Callback to call with the result of the operation. * @param cls Closure for the callbacks. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -846,7 +846,7 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, } -/** +/** * Retrieve all fragments of a message. * * @param h Handle for the PSYCstore. @@ -855,7 +855,7 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, * @param fcb Callback to call with the retrieved fragments. * @param rcb Callback to call with the result of the operation. * @param cls Closure for the callbacks. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -891,7 +891,7 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, } -/** +/** * Retrieve a fragment of message specified by its message ID and fragment * offset. * @@ -902,7 +902,7 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, * @param fcb Callback to call with the retrieved fragments. * @param rcb Callback to call with the result of the operation. * @param cls Closure for the callbacks. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -940,7 +940,7 @@ GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h, } -/** +/** * Retrieve latest values of counters for a channel master. * * 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, * @param channel_key Public key that identifies the channel. * @param mccb Callback to call with the result. * @param mccb_cls Closure for the callback. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -982,7 +982,7 @@ GNUNET_PSYCSTORE_counters_get (struct GNUNET_PSYCSTORE_Handle *h, } -/** +/** * Apply modifiers of a message to the current channel state. * * An error is returned if there are missing messages containing state @@ -996,7 +996,7 @@ GNUNET_PSYCSTORE_counters_get (struct GNUNET_PSYCSTORE_Handle *h, * @param modifiers List of modifiers to apply. * @param rcb Callback to call with the result of the operation. * @param rcb_cls Closure for the callback. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -1055,7 +1055,7 @@ GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h, } -/** +/** * Store synchronized state. * * @param h Handle for the PSYCstore. @@ -1065,7 +1065,7 @@ GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h, * @param modifiers Full state to store. * @param rcb Callback to call with the result of the operation. * @param rcb_cls Closure for the callback. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -1118,7 +1118,7 @@ GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h, } -/** +/** * Reset the state of a channel. * * Delete all state variables stored for the given channel. @@ -1127,7 +1127,7 @@ GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h, * @param channel_key The channel we are interested in. * @param rcb Callback to call with the result of the operation. * @param rcb_cls Closure for the callback. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -1161,7 +1161,7 @@ GNUNET_PSYCSTORE_state_reset (struct GNUNET_PSYCSTORE_Handle *h, -/** +/** * Update signed values of state variables in the state store. * * @param h Handle for the PSYCstore. @@ -1204,7 +1204,7 @@ GNUNET_PSYCSTORE_state_hash_update (struct GNUNET_PSYCSTORE_Handle *h, } -/** +/** * Retrieve the best matching state variable. * * @param h Handle for the PSYCstore. @@ -1213,7 +1213,7 @@ GNUNET_PSYCSTORE_state_hash_update (struct GNUNET_PSYCSTORE_Handle *h, * @param scb Callback to return the matching state variable. * @param rcb Callback to call with the result of the operation. * @param cls Closure for the callbacks. - * + * * @return Handle that can be used to cancel the operation. */ struct GNUNET_PSYCSTORE_OperationHandle * @@ -1251,7 +1251,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, -/** +/** * Retrieve all state variables for a channel with the given prefix. * * @param h Handle for the PSYCstore. @@ -1260,7 +1260,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, * @param scb Callback to return matching state variables. * @param rcb Callback to call with the result of the operation. * @param cls Closure for the callbacks. - * + * * @return Handle that can be used to cancel the operation. */ struct 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 /** * DNS answers */ - ANSWERS = 0, + ANSWERS = 0, /** * DNS authority records @@ -92,7 +92,7 @@ struct ReplyContext * Handle to submit the final result. */ struct GNUNET_DNS_RequestHandle *rh; - + /** * DNS packet that is being modified. */ @@ -117,7 +117,7 @@ struct ReplyContext * Group that is being modified */ enum RequestGroup group; - + }; @@ -144,7 +144,7 @@ struct MeshExit * not initialze a tunnel to this peer yet. */ struct GNUNET_MESH_Tunnel *mesh_tunnel; - + /** * At what time did the peer's advertisement expire? */ @@ -177,7 +177,7 @@ struct MeshExit /** * Identity of the peer that is providing the exit for us. - */ + */ struct GNUNET_PeerIdentity peer; /** @@ -218,7 +218,7 @@ struct RequestContext * Handle for interaction with DNS service. */ struct GNUNET_DNS_RequestHandle *rh; - + /** * Message we're sending out via MESH, allocated at the * end of this struct. @@ -243,7 +243,7 @@ struct RequestContext /** * #GNUNET_NO if this request is still in the transmit_queue, * #GNUNET_YES if we are in the receive_queue. - */ + */ int16_t was_transmitted; }; @@ -388,7 +388,7 @@ get_tunnel_weight (struct MeshExit *exit) uint32_t dropped; uint32_t drop_percent; uint32_t good_percent; - + GNUNET_assert (exit->num_transmitted >= exit->num_answered); dropped = exit->num_transmitted - exit->num_answered; if (exit->num_transmitted > 0) @@ -408,7 +408,7 @@ get_tunnel_weight (struct MeshExit *exit) /** * Choose a mesh exit for a DNS request. We try to use a tunnel - * that is reliable and currently available. All existing + * that is reliable and currently available. All existing * tunnels are given a base weight of 1, plus a score relating * to the total number of queries answered in relation to the * total number of queries we sent to that tunnel. That @@ -520,7 +520,7 @@ submit_request (struct ReplyContext *rc); * will match 'result_af' from the request * @param address IP address (struct in_addr or struct in_addr6, depending on 'af') * that the VPN allocated for the redirection; - * traffic to this IP will now be redirected to the + * traffic to this IP will now be redirected to the * specified target peer; NULL on error */ static void @@ -633,7 +633,7 @@ submit_request (struct ReplyContext *rc) finish_request (rc); return; default: - GNUNET_assert (0); + GNUNET_assert (0); } for (i=rc->offset;iexit; - + if (rc->was_transmitted) { exit->num_transmitted++; @@ -844,7 +844,7 @@ timeout_request (void *cls, exit_tail, exit); /* go back to semi-innocent: mark as not great, but - avoid a prohibitively negative score (see + avoid a prohibitively negative score (see #get_tunnel_weight, which checks for a certain minimum number of transmissions before making up an opinion) */ @@ -858,7 +858,7 @@ timeout_request (void *cls, /** - * This function is called *before* the DNS request has been + * This function is called *before* the DNS request has been * given to a "local" DNS resolver. Tunneling for DNS requests * was enabled, so we now need to send the request via some MESH * tunnel to a DNS EXIT for resolution. @@ -868,7 +868,7 @@ timeout_request (void *cls, * @param request_length number of bytes in request * @param request udp payload of the DNS request */ -static void +static void dns_pre_request_handler (void *cls, struct GNUNET_DNS_RequestHandle *rh, size_t request_length, @@ -943,7 +943,7 @@ dns_pre_request_handler (void *cls, * #GNUNET_SYSERR to close it (signal serious error) */ static int -receive_dns_response (void *cls, +receive_dns_response (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx, const struct GNUNET_MessageHeader *message) @@ -979,7 +979,7 @@ receive_dns_response (void *cls, GNUNET_free (rc); exit->num_answered++; exit->num_transmitted++; - return GNUNET_OK; + return GNUNET_OK; } } GNUNET_STATISTICS_update (stats, @@ -993,7 +993,7 @@ receive_dns_response (void *cls, * Abort all pending DNS requests with the given mesh exit. * * @param exit mesh exit to abort requests for - */ + */ static void abort_all_requests (struct MeshExit *exit) { @@ -1006,7 +1006,7 @@ abort_all_requests (struct MeshExit *exit) rc); GNUNET_DNS_request_drop (rc->rh); GNUNET_SCHEDULER_cancel (rc->timeout_task); - GNUNET_free (rc); + GNUNET_free (rc); } while (NULL != (rc = exit->transmit_queue_head)) { @@ -1015,7 +1015,7 @@ abort_all_requests (struct MeshExit *exit) rc); GNUNET_DNS_request_drop (rc->rh); GNUNET_SCHEDULER_cancel (rc->timeout_task); - GNUNET_free (rc); + GNUNET_free (rc); } } @@ -1093,7 +1093,7 @@ cleanup (void *cls, /** * Function called whenever a tunnel is destroyed. Should clean up * the associated state and attempt to build a new one. - * + * * It must NOT call #GNUNET_MESH_tunnel_destroy on the tunnel. * * @param cls closure (the `struct MeshExit` set from #GNUNET_MESH_connect) @@ -1103,12 +1103,12 @@ cleanup (void *cls, */ static void mesh_tunnel_end_cb (void *cls, - const struct GNUNET_MESH_Tunnel *tunnel, + const struct GNUNET_MESH_Tunnel *tunnel, void *tunnel_ctx) { struct MeshExit *exit = tunnel_ctx; struct MeshExit *alt; - struct RequestContext *rc; + struct RequestContext *rc; if (NULL != exit->mesh_th) { @@ -1149,7 +1149,7 @@ mesh_tunnel_end_cb (void *cls, else { /* the same peer was chosen, just make sure the queue processing is restarted */ - alt = exit; + alt = exit; } if ( (NULL == alt->mesh_th) && (NULL != (rc = alt->transmit_queue_head)) ) @@ -1163,7 +1163,7 @@ mesh_tunnel_end_cb (void *cls, /** - * Function called whenever we find an advertisement for a + * Function called whenever we find an advertisement for a * DNS exit in the DHT. If we don't have a mesh tunnel, * we should build one; otherwise, we should save the * advertisement for later use. @@ -1185,7 +1185,7 @@ static void handle_dht_result (void *cls, struct GNUNET_TIME_Absolute exp, const struct GNUNET_HashCode *key, - const struct GNUNET_PeerIdentity *get_path, + const struct GNUNET_PeerIdentity *get_path, unsigned int get_path_length, const struct GNUNET_PeerIdentity *put_path, unsigned int put_path_length, @@ -1201,7 +1201,7 @@ handle_dht_result (void *cls, return; } ad = data; - for (exit = exit_head; NULL != exit; exit = exit->next) + for (exit = exit_head; NULL != exit; exit = exit->next) if (0 == memcmp (&ad->peer, &exit->peer, sizeof (struct GNUNET_PeerIdentity))) @@ -1240,23 +1240,23 @@ run (void *cls, char *const *args GNUNET_UNUSED, cfg = cfg_; stats = GNUNET_STATISTICS_create ("pt", cfg); ipv4_pt = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_IPV4"); - ipv6_pt = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_IPV6"); - dns_tunnel = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_DNS"); + ipv6_pt = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_IPV6"); + dns_tunnel = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_DNS"); if (! (ipv4_pt || ipv6_pt || dns_tunnel)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("No useful service enabled. Exiting.\n")); GNUNET_SCHEDULER_shutdown (); - return; + return; } GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls); if (ipv4_pt || ipv6_pt) { - dns_post_handle - = GNUNET_DNS_connect (cfg, + dns_post_handle + = GNUNET_DNS_connect (cfg, GNUNET_DNS_FLAG_POST_RESOLUTION, &dns_post_request_handler, NULL); - if (NULL == dns_post_handle) + if (NULL == dns_post_handle) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to connect to %s service. Exiting.\n"), @@ -1281,11 +1281,11 @@ run (void *cls, char *const *args GNUNET_UNUSED, {NULL, 0, 0} }; - dns_pre_handle - = GNUNET_DNS_connect (cfg, + dns_pre_handle + = GNUNET_DNS_connect (cfg, GNUNET_DNS_FLAG_PRE_RESOLUTION, &dns_pre_request_handler, NULL); - if (NULL == dns_pre_handle) + if (NULL == dns_pre_handle) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("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 () } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download complete, shutting down!\n"); do_shutdown (); - return; + return; } - GNUNET_assert (CURLM_OK == curl_multi_fdset (multi, &rs, &ws, &es, &max)); + GNUNET_assert (CURLM_OK == curl_multi_fdset (multi, &rs, &ws, &es, &max)); if ( (CURLM_OK != curl_multi_timeout (multi, &timeout)) || (-1 == timeout) ) delay = GNUNET_TIME_UNIT_SECONDS; @@ -236,14 +236,14 @@ curl_main () &nrs, &nws, &curl_task, - NULL); + NULL); } static void start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - GNUNET_asprintf (&url, + GNUNET_asprintf (&url, "http://%s/hello_world", TEST_DOMAIN); curl = curl_easy_init (); @@ -280,7 +280,7 @@ disco_ns (void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * will match 'result_af' from the request * @param address IP address (struct in_addr or struct in_addr6, depending on 'af') * that the VPN allocated for the redirection; - * traffic to this IP will now be redirected to the + * traffic to this IP will now be redirected to the * specified target peer; NULL on error */ static void @@ -290,11 +290,11 @@ commence_testing (void *cls, int32_t success, const char *emsg) if ((emsg != NULL) && (GNUNET_YES != success)) { - fprintf (stderr, + fprintf (stderr, "NS failed to create record %s\n", emsg); GNUNET_SCHEDULER_shutdown (); return; - } + } GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), &start_curl, NULL); } @@ -302,7 +302,7 @@ commence_testing (void *cls, int32_t success, const char *emsg) /** * Function to keep the HTTP server running. */ -static void +static void mhd_main (void); @@ -316,7 +316,7 @@ mhd_task (void *cls, } -static void +static void mhd_main () { struct GNUNET_NETWORK_FDSet nrs; @@ -351,7 +351,7 @@ mhd_main () &nrs, &nws, &mhd_task, - NULL); + NULL); } @@ -367,7 +367,7 @@ run (void *cls, struct GNUNET_NAMESTORE_RecordData rd; char *rd_string; char *zone_keyfile; - + GNUNET_TESTING_peer_get_identity (peer, &id); GNUNET_CRYPTO_hash_to_enc ((struct GNUNET_HashCode*)&id, &peername); @@ -383,7 +383,7 @@ run (void *cls, MHD_OPTION_END); GNUNET_assert (NULL != mhd); mhd_main (); - + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", "ZONEKEY", &zone_keyfile)) @@ -433,7 +433,7 @@ open_dev_null (int target_fd, if (fd == target_fd) return; if (-1 == dup2 (fd, target_fd)) - { + { (void) close (fd); abort (); } @@ -443,13 +443,13 @@ open_dev_null (int target_fd, /** * Run the given command and wait for it to complete. - * + * * @param file name of the binary to run * @param cmd command line arguments (as given to 'execv') * @return 0 on success, 1 on any error */ static int -fork_and_exec (const char *file, +fork_and_exec (const char *file, char *const cmd[]) { int status; @@ -459,8 +459,8 @@ fork_and_exec (const char *file, pid = fork (); if (-1 == pid) { - fprintf (stderr, - "fork failed: %s\n", + fprintf (stderr, + "fork failed: %s\n", strerror (errno)); return 1; } @@ -469,25 +469,25 @@ fork_and_exec (const char *file, /* we are the child process */ /* close stdin/stdout to not cause interference with the helper's main protocol! */ - (void) close (0); + (void) close (0); open_dev_null (0, O_RDONLY); - (void) close (1); + (void) close (1); open_dev_null (1, O_WRONLY); (void) execv (file, cmd); /* can only get here on error */ - fprintf (stderr, - "exec `%s' failed: %s\n", + fprintf (stderr, + "exec `%s' failed: %s\n", file, strerror (errno)); _exit (1); } /* keep running waitpid as long as the only error we get is 'EINTR' */ while ( (-1 == (ret = waitpid (pid, &status, 0))) && - (errno == EINTR) ); + (errno == EINTR) ); if (-1 == ret) { - fprintf (stderr, - "waitpid failed: %s\n", + fprintf (stderr, + "waitpid failed: %s\n", strerror (errno)); return 1; } @@ -508,19 +508,19 @@ main (int argc, char *const *argv) { "iptables", "-t", "mangle", "-L", "-v", NULL }; - + if (0 == access ("/sbin/iptables", X_OK)) sbin_iptables = "/sbin/iptables"; else if (0 == access ("/usr/sbin/iptables", X_OK)) sbin_iptables = "/usr/sbin/iptables"; else { - fprintf (stderr, + fprintf (stderr, "Executable iptables not found in approved directories: %s, skipping\n", strerror (errno)); return 0; } - + if (0 != fork_and_exec (sbin_iptables, iptables_args)) { fprintf (stderr, @@ -548,20 +548,20 @@ main (int argc, char *const *argv) 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 (GNUNET_YES != GNUNET_OS_check_helper_binary (bin_dns, GNUNET_YES, NULL))) ) // TODO: once we have a windows-testcase, add test parameters here - { + { fprintf (stderr, "WARNING: gnunet-helper-{exit,vpn,dns} binaries in $PATH are not SUID, refusing to run test (as it would have to fail).\n"); fprintf (stderr, "Change $PATH ('.' in $PATH before $GNUNET_PREFIX/bin is problematic) or permissions (run 'make install' as root) to fix this!\n"); - GNUNET_free (bin_vpn); + GNUNET_free (bin_vpn); GNUNET_free (bin_exit); GNUNET_free (bin_dns); return 0; } - GNUNET_free (bin_vpn); + GNUNET_free (bin_vpn); GNUNET_free (bin_exit); GNUNET_free (bin_dns); - + dest_ip = "169.254.86.1"; dest_af = AF_INET; src_af = AF_INET; @@ -570,11 +570,11 @@ main (int argc, char *const *argv) use_v6 = GNUNET_YES; else use_v6 = GNUNET_NO; - + if ( (GNUNET_OK != GNUNET_NETWORK_test_pf (src_af)) || (GNUNET_OK != GNUNET_NETWORK_test_pf (dest_af)) ) { - fprintf (stderr, + fprintf (stderr, "Required address families not supported by this system, skipping test.\n"); return 0; } 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, struct in6_addr v6; void *addr; enum MHD_FLAG flags; - + vpn = GNUNET_VPN_connect (cfg); GNUNET_assert (NULL != vpn); flags = MHD_USE_DEBUG; @@ -366,8 +366,8 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, mhd = MHD_start_daemon (flags, PORT, NULL, NULL, &mhd_ahc, NULL, MHD_OPTION_END); - - + + GNUNET_assert (NULL != mhd); mhd_main (); addr = NULL; @@ -384,7 +384,7 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, default: GNUNET_assert (0); } - rr = GNUNET_VPN_redirect_to_ip (vpn, src_af, dest_af, addr, + rr = GNUNET_VPN_redirect_to_ip (vpn, src_af, dest_af, addr, GNUNET_TIME_UNIT_FOREVER_ABS, &allocation_cb, NULL); ctrl_c_task_id = @@ -436,7 +436,7 @@ main (int argc, char *const *argv) return 1; } type++; - /* on Windows, .exe is suffixed to these binaries, + /* on Windows, .exe is suffixed to these binaries, * thus cease comparison after the 6th char. */ if (0 == strncmp (type, "4_to_6",6)) @@ -468,7 +468,7 @@ main (int argc, char *const *argv) fprintf (stderr, "invalid binary suffix `%s'\n", type); return 1; } - if ((GNUNET_OK != GNUNET_NETWORK_test_pf (src_af)) || + if ((GNUNET_OK != GNUNET_NETWORK_test_pf (src_af)) || (GNUNET_OK != GNUNET_NETWORK_test_pf (dest_af))) { fprintf (stderr, @@ -483,8 +483,8 @@ main (int argc, char *const *argv) if (0 != GNUNET_TESTING_peer_run ("test-gnunet-vpn", "test_gnunet_vpn.conf", &run, NULL)) - return 1; - GNUNET_DISK_directory_remove ("/tmp/gnunet-test-vpn"); + return 1; + GNUNET_DISK_directory_remove ("/tmp/gnunet-test-vpn"); return global_ret; } 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) /** * Announce a previously announced regex re-using cached data. - * + * * @param cls Closure (regex to announce if needed). * @param tc TaskContext. */ @@ -309,7 +309,7 @@ run (void *cls, char *const *args GNUNET_UNUSED, "REANNOUNCE_PERIOD_MAX", &reannounce_period_max)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "reannounce_period_max not given. Using 10 minutes.\n"); reannounce_period_max = 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, if (GNUNET_YES == peer->search_str_matched) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "String %s on peer %u already matched!\n", peer->search_str, peer->id); return; @@ -824,7 +824,7 @@ search_timed_out (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Search timed out after %s." - "Collecting stats and shutting down.\n", + "Collecting stats and shutting down.\n", GNUNET_STRINGS_relative_time_to_string (search_timeout_time, GNUNET_NO)); @@ -1008,7 +1008,7 @@ announce_next_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Starting daemon %u\n", next_search); peer = &peers[next_search]; - peer->daemon_op = + peer->daemon_op = GNUNET_TESTBED_peer_manage_service (NULL, peer->peer_handle, "regexprofiler", @@ -1113,7 +1113,7 @@ dht_da (void *cls, void *op_result) * @param links_failed the number of overlay link connection attempts that * failed */ -static void +static void test_master (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers_, @@ -1148,7 +1148,7 @@ test_master (void *cls, settle_time = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 10 * num_peers); - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Waiting for DHT for %s to settle new connections.\n\n", GNUNET_STRINGS_relative_time_to_string(settle_time, GNUNET_NO)); GNUNET_SCHEDULER_add_delayed (settle_time, &do_announce, NULL); @@ -1168,7 +1168,7 @@ test_master (void *cls, * @param event information on what is happening */ static void -master_controller_cb (void *cls, +master_controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) { switch (event->type) @@ -1315,7 +1315,7 @@ run (void *cls, char *const *args, const char *cfgfile, "REANNOUNCE_PERIOD_MAX", &reannounce_period_max)) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "reannounce_period_max not given. Using 10 minutes.\n"); reannounce_period_max = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10); @@ -1424,7 +1424,7 @@ run (void *cls, char *const *args, const char *cfgfile, "SETUP_TIMEOUT", &abort_time)) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "SETUP_TIMEOUT not given. Using 15 minutes.\n"); abort_time = 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, * @param message the actual message */ static void -handle_announce (void *cls, +handle_announce (void *cls, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { @@ -238,7 +238,7 @@ handle_announce (void *cls, return; } GNUNET_CONTAINER_DLL_insert (client_head, - client_tail, + client_tail, ce); GNUNET_SERVER_receive_done (client, GNUNET_OK); } @@ -254,7 +254,7 @@ handle_announce (void *cls, * @param put_path Path of the put request. * @param put_path_length Length of the put_path. */ -static void +static void handle_search_result (void *cls, const struct GNUNET_PeerIdentity *id, const struct GNUNET_PeerIdentity *get_path, @@ -283,11 +283,11 @@ handle_search_result (void *cls, result->put_path_length = htons ((uint16_t) put_path_length); result->id = *id; gp = &result->id; - memcpy (&gp[1], + memcpy (&gp[1], get_path, get_path_length * sizeof (struct GNUNET_PeerIdentity)); - memcpy (&gp[1 + get_path_length], - put_path, + memcpy (&gp[1 + get_path_length], + put_path, put_path_length * sizeof (struct GNUNET_PeerIdentity)); GNUNET_SERVER_notification_context_unicast (nc, ce->client, @@ -304,7 +304,7 @@ handle_search_result (void *cls, * @param message the actual message */ static void -handle_search (void *cls, +handle_search (void *cls, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { @@ -338,7 +338,7 @@ handle_search (void *cls, return; } GNUNET_CONTAINER_DLL_insert (client_head, - client_tail, + client_tail, ce); GNUNET_SERVER_notification_context_add (nc, client); GNUNET_SERVER_receive_done (client, GNUNET_OK); @@ -364,7 +364,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, my_private_key = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg); if (NULL == my_private_key) - { + { GNUNET_SCHEDULER_shutdown (); return; } 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 @@ * @param num_edges number of edges leaving current state. * @param edges edges leaving current state. */ -static void +static void print_edge (void *cls, const struct GNUNET_HashCode *key, const char *proof, @@ -64,7 +64,7 @@ print_edge (void *cls, /** * The main function of the regex performace test. - * + * * Read a set of regex from a file, combine them and create a DFA from the * resulting combined regex. * @@ -86,7 +86,7 @@ main (int argc, char *const *argv) if (3 != argc) { fprintf (stderr, - "Usage: %s REGEX_FILE COMPRESSION\n", + "Usage: %s REGEX_FILE COMPRESSION\n", argv[0]); return 1; } @@ -104,9 +104,9 @@ main (int argc, char *const *argv) GNUNET_asprintf (®ex, "GNUNET_REGEX_PROFILER_(%s)(0|1)*", buffer); size = strlen (regex); - fprintf (stderr, - "Combined regex (%ld bytes):\n%s\n", - size, + fprintf (stderr, + "Combined regex (%ld bytes):\n%s\n", + size, regex); dfa = REGEX_INTERNAL_construct_dfa (regex, size, compression); 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, if (ntohl (rba->purpose.size) != sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + sizeof (struct GNUNET_TIME_AbsoluteNBO) + - sizeof (struct GNUNET_HashCode)) + sizeof (struct GNUNET_HashCode)) { GNUNET_break_op(0); return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; @@ -184,7 +184,7 @@ evaluate_block_regex_accept (void *cls, enum GNUNET_BLOCK_Type type, /* technically invalid, but can happen without an error, so we're nice by reporting it as a 'duplicate' */ return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE; - } + } if (GNUNET_OK != GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT, &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 */ struct GNUNET_CLIENT_Connection *client; - /** + /** * Our configuration. */ const struct GNUNET_CONFIGURATION_Handle *cfg; - + /** * Message we're sending to the service. */ @@ -55,7 +55,7 @@ struct GNUNET_REGEX_Announcement /** * We got a response (!?) or disconnect after asking regex * to do the announcement. Retry. - * + * * @param cls the 'struct GNUNET_REGEX_Announcement' to retry * @param msg NULL on disconnect */ @@ -65,7 +65,7 @@ handle_a_reconnect (void *cls, /** - * Try sending the announcement request to regex. On + * Try sending the announcement request to regex. On * errors (i.e. regex died), try again. * * @param a the announcement to retry @@ -87,7 +87,7 @@ retry_announcement (struct GNUNET_REGEX_Announcement *a) /** * We got a response (!?) or disconnect after asking regex * to do the announcement. Retry. - * + * * @param cls the 'struct GNUNET_REGEX_Announcement' to retry * @param msg NULL on disconnect */ @@ -107,7 +107,7 @@ handle_a_reconnect (void *cls, * Announce the given peer under the given regular expression. Does * not free resources, must call GNUNET_REGEX_announce_cancel for * that. - * + * * @param cfg configuration to use * @param regex Regular expression to announce. * @param refresh_delay after what delay should the announcement be repeated? @@ -151,7 +151,7 @@ GNUNET_REGEX_announce (const struct GNUNET_CONFIGURATION_Handle *cfg, /** * Stop announcing the regex specified by the given handle. - * + * * @param a handle returned by a previous GNUNET_REGEX_announce call. */ void @@ -172,11 +172,11 @@ struct GNUNET_REGEX_Search */ struct GNUNET_CLIENT_Connection *client; - /** + /** * Our configuration. */ const struct GNUNET_CONFIGURATION_Handle *cfg; - + /** * Function to call with results. */ @@ -186,7 +186,7 @@ struct GNUNET_REGEX_Search * Closure for 'callback'. */ void *callback_cls; - + /** * Search message to transmit to the service. */ @@ -197,7 +197,7 @@ struct GNUNET_REGEX_Search /** * We got a response or disconnect after asking regex * to do the search. Handle it. - * + * * @param cls the 'struct GNUNET_REGEX_Search' to retry * @param msg NULL on disconnect */ @@ -207,7 +207,7 @@ handle_search_response (void *cls, /** - * Try sending the search request to regex. On + * Try sending the search request to regex. On * errors (i.e. regex died), try again. * * @param s the search to retry @@ -229,7 +229,7 @@ retry_search (struct GNUNET_REGEX_Search *s) /** * We got a response or disconnect after asking regex * to do the search. Handle it. - * + * * @param cls the 'struct GNUNET_REGEX_Search' to retry * @param msg NULL on disconnect, otherwise presumably a response */ @@ -257,7 +257,7 @@ handle_search_response (void *cls, result = (const struct ResultMessage *) msg; gpl = ntohs (result->get_path_length); ppl = ntohs (result->put_path_length); - if (size == (sizeof (struct ResultMessage) + + if (size == (sizeof (struct ResultMessage) + (gpl + ppl) * sizeof (struct GNUNET_PeerIdentity))) { const struct GNUNET_PeerIdentity *pid; @@ -269,7 +269,7 @@ handle_search_response (void *cls, s->callback (s->callback_cls, pid, &pid[1], gpl, - &pid[1 + gpl], ppl); + &pid[1 + gpl], ppl); return; } } @@ -323,7 +323,7 @@ GNUNET_REGEX_search (const struct GNUNET_CONFIGURATION_Handle *cfg, /** * Stop search and free all data used by a GNUNET_REGEX_search call. - * + * * @param s Handle returned by a previous GNUNET_REGEX_search call. */ void 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 * @param block block to test * @param size number of bytes in block * @return GNUNET_YES if the block is accepting, GNUNET_NO if not - */ + */ int GNUNET_BLOCK_is_accepting (const struct RegexBlock *block, size_t size) @@ -164,7 +164,7 @@ struct CheckEdgeContext * @param token Token that follows to next state. * @param len Lenght of token. * @param key Hash of next state. - * + * * @return GNUNET_YES, to keep iterating */ static int @@ -175,7 +175,7 @@ check_edge (void *cls, { struct CheckEdgeContext *ctx = cls; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "edge %.*s [%u]: %s->%s\n", (int) len, token, len, GNUNET_h2s(key)); if (NULL == ctx->xquery) @@ -212,7 +212,7 @@ REGEX_BLOCK_check (const struct RegexBlock *block, int res; LOG (GNUNET_ERROR_TYPE_DEBUG, "Block check\n"); - if (GNUNET_OK != + if (GNUNET_OK != REGEX_BLOCK_get_key (block, size, &key)) { @@ -267,17 +267,17 @@ REGEX_BLOCK_get_key (const struct RegexBlock *block, uint16_t num_edges; size_t total; - if (block_len < sizeof (struct RegexBlock)) + if (block_len < sizeof (struct RegexBlock)) { GNUNET_break_op (0); return GNUNET_SYSERR; - } + } num_destinations = ntohs (block->num_destinations); num_edges = ntohs (block->num_edges); len = ntohs (block->proof_len); destinations = (const struct GNUNET_HashCode *) &block[1]; edges = (const struct EdgeInfo *) &destinations[num_destinations]; - total = sizeof (struct RegexBlock) + num_destinations * sizeof (struct GNUNET_HashCode) + num_edges + sizeof (struct EdgeInfo) + len; + total = sizeof (struct RegexBlock) + num_destinations * sizeof (struct GNUNET_HashCode) + num_edges + sizeof (struct EdgeInfo) + len; if (block_len < total) { GNUNET_break_op (0); @@ -321,7 +321,7 @@ REGEX_BLOCK_iterate (const struct RegexBlock *block, size_t off; LOG (GNUNET_ERROR_TYPE_DEBUG, "Block iterate\n"); - if (size < sizeof (struct RegexBlock)) + if (size < sizeof (struct RegexBlock)) { GNUNET_break_op (0); return GNUNET_SYSERR; @@ -333,14 +333,14 @@ REGEX_BLOCK_iterate (const struct RegexBlock *block, edges = (const struct EdgeInfo *) &destinations[num_destinations]; aux = (const char *) &edges[num_edges]; total = sizeof (struct RegexBlock) + num_destinations * sizeof (struct GNUNET_HashCode) + num_edges * sizeof (struct EdgeInfo) + len; - if (size < total) + if (size < total) { GNUNET_break_op (0); return GNUNET_SYSERR; } for (n=0;n UINT16_MAX) + if (len > UINT16_MAX) { GNUNET_break (0); return NULL; @@ -413,7 +413,7 @@ REGEX_BLOCK_create (const char *proof, for (i=0;i UINT16_MAX) + if (slen > UINT16_MAX) { GNUNET_break (0); return NULL; @@ -449,7 +449,7 @@ REGEX_BLOCK_create (const char *proof, edgeinfos = (struct EdgeInfo *) &dests[unique_destinations]; aux = (char *) &edgeinfos[num_edges]; off = len; - memcpy (aux, proof, len); + memcpy (aux, proof, len); for (i=0;isbuf, s2->sbuf, s1->slen); } - + /** - * Compare two strings for equality. + * Compare two strings for equality. * * @param s1 first string for comparison. * @param s2 second string for comparison. @@ -622,7 +622,7 @@ sb_strcmp (const struct StringBuffer *s1, return -1; return memcmp (s1->sbuf, s2->sbuf, s1->slen); } - + /** * Reallocate the buffer of 'ret' to fit 'nlen' characters; @@ -647,7 +647,7 @@ sb_realloc (struct StringBuffer *ret, ret->sbuf = ret->abuf; GNUNET_free_non_null (old); } - + /** * Append a string. @@ -669,7 +669,7 @@ sb_append (struct StringBuffer *ret, sarg->slen); ret->slen += sarg->slen; } - + /** * Append a C string. @@ -693,7 +693,7 @@ sb_append_cstr (struct StringBuffer *ret, cstr_len); ret->slen += cstr_len; } - + /** * Wrap a string buffer, that is, set ret to the format string @@ -854,7 +854,7 @@ sb_free (struct StringBuffer *sb) static void sb_strdup (struct StringBuffer *out, const struct StringBuffer *in) - + { out->null_flag = in->null_flag; if (GNUNET_YES == out->null_flag) @@ -935,7 +935,7 @@ needs_parentheses (const struct StringBuffer *str) } /* while '(' before ')', count opening parens */ while ( (NULL != (op = memchr (pos, '(', end - pos))) && - (op < cl) ) + (op < cl) ) { cnt++; pos = op + 1; @@ -971,7 +971,7 @@ remove_parentheses (struct StringBuffer *str) if (0) return; sbuf = str->sbuf; - if ( (GNUNET_YES == str->null_flag) || + if ( (GNUNET_YES == str->null_flag) || (1 >= (slen = str->slen)) || ('(' != str->sbuf[0]) || (')' != str->sbuf[slen - 1]) ) @@ -981,7 +981,7 @@ remove_parentheses (struct StringBuffer *str) end = &sbuf[slen - 1]; op = memchr (pos, '(', end - pos); cp = memchr (pos, ')', end - pos); - while (NULL != cp) + while (NULL != cp) { while ( (NULL != op) && (op < cp) ) @@ -1007,7 +1007,7 @@ remove_parentheses (struct StringBuffer *str) return; } str->sbuf++; - str->slen -= 2; + str->slen -= 2; } @@ -1022,10 +1022,10 @@ remove_parentheses (struct StringBuffer *str) static int has_epsilon (const struct StringBuffer *str) { - return - (GNUNET_YES != str->null_flag) && + return + (GNUNET_YES != str->null_flag) && (0 < str->slen) && - ('(' == str->sbuf[0]) && + ('(' == str->sbuf[0]) && ('|' == str->sbuf[1]) && (')' == str->sbuf[str->slen - 1]); } @@ -1048,8 +1048,8 @@ remove_epsilon (const struct StringBuffer *str, { ret->null_flag = GNUNET_YES; return; - } - if ( (str->slen > 1) && + } + if ( (str->slen > 1) && ('(' == str->sbuf[0]) && ('|' == str->sbuf[1]) && (')' == str->sbuf[str->slen - 1]) ) @@ -1080,11 +1080,11 @@ remove_epsilon (const struct StringBuffer *str, * @return -1 if any of the strings is NULL, 0 if equal, non 0 otherwise */ static int -sb_strncmp (const struct StringBuffer *str1, +sb_strncmp (const struct StringBuffer *str1, const struct StringBuffer *str2, size_t n) { size_t max; - + if ( (str1->slen != str2->slen) && ( (str1->slen < n) || (str2->slen < n) ) ) @@ -1106,17 +1106,17 @@ sb_strncmp (const struct StringBuffer *str1, * @return -1 if any of the strings is NULL, 0 if equal, non 0 otherwise */ static int -sb_strncmp_cstr (const struct StringBuffer *str1, +sb_strncmp_cstr (const struct StringBuffer *str1, const char *str2, size_t n) { - if (str1->slen < n) + if (str1->slen < n) return -1; return memcmp (str1->sbuf, str2, n); } /** - * Initialize string buffer for storing strings of up to n + * Initialize string buffer for storing strings of up to n * characters. * * @param sb buffer to initialize @@ -1143,7 +1143,7 @@ sb_init (struct StringBuffer *sb, * @return -1 if any of the strings is NULL, 0 if equal, non 0 otherwise */ static int -sb_strkcmp (const struct StringBuffer *str1, +sb_strkcmp (const struct StringBuffer *str1, const struct StringBuffer *str2, size_t k) { if ( (GNUNET_YES == str1->null_flag) || @@ -1196,7 +1196,7 @@ number_states (void *cls, const unsigned int count, * @param R_cur_r optimization -- kept between iterations to avoid realloc */ static void -automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij, +automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij, const struct StringBuffer *R_last_ik, const struct StringBuffer *R_last_kk, const struct StringBuffer *R_last_kj, @@ -1227,8 +1227,8 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij, * R_cur_r == R^{(k-1)}_{ik} ( R^{(k-1)}_{kk} )^* R^{(k-1)}_{kj} */ - if ( (GNUNET_YES == R_last_ij->null_flag) && - ( (GNUNET_YES == R_last_ik->null_flag) || + if ( (GNUNET_YES == R_last_ij->null_flag) && + ( (GNUNET_YES == R_last_ik->null_flag) || (GNUNET_YES == R_last_kj->null_flag))) { /* R^{(k)}_{ij} = N | N */ @@ -1237,13 +1237,13 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij, return; } - if ( (GNUNET_YES == R_last_ik->null_flag) || + if ( (GNUNET_YES == R_last_ik->null_flag) || (GNUNET_YES == R_last_kj->null_flag) ) { /* R^{(k)}_{ij} = R^{(k-1)}_{ij} | N */ if (GNUNET_YES == R_last_ij->synced) { - R_cur_ij->synced = GNUNET_YES; + R_cur_ij->synced = GNUNET_YES; R_cur_ij->null_flag = GNUNET_NO; return; } @@ -1256,10 +1256,10 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij, /* $R^{(k)}_{ij} = N | R^{(k-1)}_{ik} ( R^{(k-1)}_{kk} )^* R^{(k-1)}_{kj} OR * $R^{(k)}_{ij} = R^{(k-1)}_{ij} | R^{(k-1)}_{ik} ( R^{(k-1)}_{kk} )^* R^{(k-1)}_{kj} */ - R_cur_r->null_flag = GNUNET_YES; - R_cur_r->slen = 0; - R_cur_l->null_flag = GNUNET_YES; - R_cur_l->slen = 0; + R_cur_r->null_flag = GNUNET_YES; + R_cur_r->slen = 0; + R_cur_l->null_flag = GNUNET_YES; + R_cur_l->slen = 0; /* cache results from strcmp, we might need these many times */ 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, remove_epsilon (R_last_ij, &R_temp_ij); remove_parentheses (&R_temp_ij); - if ( (0 == sb_strcmp (&R_temp_ij, &R_temp_ik)) && - (0 == sb_strcmp (&R_temp_ik, &R_temp_kk)) && + if ( (0 == sb_strcmp (&R_temp_ij, &R_temp_ik)) && + (0 == sb_strcmp (&R_temp_ik, &R_temp_kk)) && (0 == sb_strcmp (&R_temp_kk, &R_temp_kj)) ) { if (0 == R_temp_ij.slen) @@ -1395,16 +1395,16 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij, length = R_temp_kk.slen - R_last_ik->slen; /* a(ba)*bx = (ab)+x */ - if ( (length > 0) && + if ( (length > 0) && (GNUNET_YES != R_last_kk->null_flag) && (0 < R_last_kk->slen) && - (GNUNET_YES != R_last_kj->null_flag) && + (GNUNET_YES != R_last_kj->null_flag) && (0 < R_last_kj->slen) && (GNUNET_YES != R_last_ik->null_flag) && (0 < R_last_ik->slen) && (0 == sb_strkcmp (&R_temp_kk, R_last_ik, length)) && (0 == sb_strncmp (&R_temp_kk, R_last_kj, length)) ) - { + { struct StringBuffer temp_a; struct StringBuffer temp_b; @@ -1452,7 +1452,7 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij, sb_printf1 (R_cur_r, "%.*s*", 1, &R_temp_kk); } /* aa*a = a+a */ - else if ( (0 == clean_ik_kk_cmp) && + else if ( (0 == clean_ik_kk_cmp) && (0 == clean_kk_kj_cmp) && (! has_epsilon (R_last_ik)) ) { @@ -1550,7 +1550,7 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij, sb_free (&R_temp_kk); sb_free (&R_temp_kj); - if ( (GNUNET_YES == R_cur_l->null_flag) && + if ( (GNUNET_YES == R_cur_l->null_flag) && (GNUNET_YES == R_cur_r->null_flag) ) { R_cur_ij->null_flag = GNUNET_YES; @@ -1670,7 +1670,7 @@ automaton_create_proofs (struct REGEX_INTERNAL_Automaton *a) for (i = 0; i < n; i++) for (j = 0; j < n; j++) if (needs_parentheses (&R_last[i * n + j])) - sb_wrap (&R_last[i * n + j], "(%.*s)", 2); + sb_wrap (&R_last[i * n + j], "(%.*s)", 2); /* Compute regular expressions of length "k" between each pair of states per * induction */ memset (&R_cur_l, 0, sizeof (struct StringBuffer)); @@ -1726,14 +1726,14 @@ automaton_create_proofs (struct REGEX_INTERNAL_Automaton *a) if ( (0 == complete_regex.slen) && (0 < R_last[a->start->dfs_id * n + i].slen) ) { - sb_append (&complete_regex, + sb_append (&complete_regex, &R_last[a->start->dfs_id * n + i]); } else if ( (GNUNET_YES != R_last[a->start->dfs_id * n + i].null_flag) && (0 < R_last[a->start->dfs_id * n + i].slen) ) { sb_append_cstr (&complete_regex, "|"); - sb_append (&complete_regex, + sb_append (&complete_regex, &R_last[a->start->dfs_id * n + i]); } } @@ -1742,11 +1742,11 @@ automaton_create_proofs (struct REGEX_INTERNAL_Automaton *a) /* cleanup */ sb_free (&complete_regex); - for (i = 0; i < n; i++) + for (i = 0; i < n; i++) for (j = 0; j < n; j++) { - sb_free (&R_cur[i * n + j]); - sb_free (&R_last[i * n + j]); + sb_free (&R_cur[i * n + j]); + sb_free (&R_last[i * n + j]); } GNUNET_free (R_cur); GNUNET_free (R_last); @@ -1804,15 +1804,15 @@ dfa_state_create (struct REGEX_INTERNAL_Context *ctx, pos += strlen (pos); /* Add a transition for each distinct label to NULL state */ - for (ctran = cstate->transitions_head; NULL != ctran; ctran = ctran->next) + for (ctran = cstate->transitions_head; NULL != ctran; ctran = ctran->next) if (NULL != ctran->label) - state_add_transition (ctx, s, ctran->label, NULL); + state_add_transition (ctx, s, ctran->label, NULL); /* If the nfa_states contain an accepting state, the new dfa state is also * accepting. */ if (cstate->accepting) s->accepting = 1; - } + } pos[-1] = '}'; s->name = GNUNET_realloc (s->name, strlen (s->name) + 1); @@ -2495,7 +2495,7 @@ nfa_closure_set_create (struct REGEX_INTERNAL_StateSet *ret, /* Add start state to closure only for epsilon closure */ if (NULL == label) state_set_append (ret, s); - + /* initialize work stack */ cls_stack.head = NULL; cls_stack.tail = NULL; @@ -2506,7 +2506,7 @@ nfa_closure_set_create (struct REGEX_INTERNAL_StateSet *ret, { GNUNET_CONTAINER_MDLL_remove (ST, cls_stack.head, cls_stack.tail, currentstate); - cls_stack.len--; + cls_stack.len--; for (ctran = currentstate->transitions_head; NULL != ctran; ctran = ctran->next) { @@ -2521,7 +2521,7 @@ nfa_closure_set_create (struct REGEX_INTERNAL_StateSet *ret, clsstate); cls_stack.len++; clsstate->contained = 1; - } + } } } for (i = 0; i < ret->off; i++) @@ -3429,9 +3429,9 @@ REGEX_INTERNAL_iterate_all_edges (struct REGEX_INTERNAL_Automaton *a, unsigned int num_edges; num_edges = state_get_edges (s, edges); - if ( ( (NULL != s->proof) && + if ( ( (NULL != s->proof) && (0 < strlen (s->proof)) ) || s->accepting) - iterator (iterator_cls, &s->hash, s->proof, + iterator (iterator_cls, &s->hash, s->proof, s->accepting, num_edges, edges); s->marked = GNUNET_NO; @@ -3439,7 +3439,7 @@ REGEX_INTERNAL_iterate_all_edges (struct REGEX_INTERNAL_Automaton *a, iterate_initial_edge (GNUNET_REGEX_INITIAL_BYTES, GNUNET_REGEX_INITIAL_BYTES, - NULL, a->start, + NULL, a->start, iterator, iterator_cls); } 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, ab.purpose.purpose = ntohl (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT); ab.expiration_time = GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_DHT_MAX_EXPIRATION)); ab.key = *key; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (h->priv, + GNUNET_CRYPTO_ecc_key_get_public_for_signature (h->priv, &ab.peer.public_key); GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecc_sign (h->priv, @@ -151,7 +151,7 @@ regex_iterator (void *cls, GNUNET_DHT_put (h->dht, key, DHT_REPLICATION, DHT_OPT, - GNUNET_BLOCK_TYPE_REGEX, + GNUNET_BLOCK_TYPE_REGEX, size, block, GNUNET_TIME_relative_to_absolute (DHT_TTL), DHT_TTL, @@ -167,13 +167,13 @@ regex_iterator (void *cls, /** * Announce a regular expression: put all states of the automaton in the DHT. * Does not free resources, must call REGEX_INTERNAL_announce_cancel for that. - * + * * @param dht An existing and valid DHT service handle. CANNOT be NULL. * @param priv our private key, must remain valid until the announcement is cancelled * @param regex Regular expression to announce. * @param compression How many characters per edge can we squeeze? * @param stats Optional statistics handle to report usage. Can be NULL. - * + * * @return Handle to reuse o free cached resources. * Must be freed by calling REGEX_INTERNAL_announce_cancel. */ @@ -201,14 +201,14 @@ REGEX_INTERNAL_announce (struct GNUNET_DHT_Handle *dht, /** * Announce again a regular expression previously announced. * Does use caching to speed up process. - * + * * @param h Handle returned by a previous REGEX_INTERNAL_announce call. */ void REGEX_INTERNAL_reannounce (struct REGEX_INTERNAL_Announcement *h) { GNUNET_assert (NULL != h->dfa); /* make sure to call announce first */ - LOG (GNUNET_ERROR_TYPE_INFO, + LOG (GNUNET_ERROR_TYPE_INFO, "REGEX_INTERNAL_reannounce: %s\n", h->regex); REGEX_INTERNAL_iterate_reachable_edges (h->dfa, ®ex_iterator, h); @@ -218,7 +218,7 @@ REGEX_INTERNAL_reannounce (struct REGEX_INTERNAL_Announcement *h) /** * Clear all cached data used by a regex announce. * Does not close DHT connection. - * + * * @param h Handle returned by a previous REGEX_INTERNAL_announce call. */ void @@ -264,7 +264,7 @@ struct RegexSearchContext /** * Type of values in 'dht_get_results'. - */ + */ struct Result { /** @@ -306,7 +306,7 @@ struct REGEX_INTERNAL_Search struct GNUNET_CONTAINER_MultiHashMap *dht_get_handles; /** - * Results from running DHT GETs, values are of type + * Results from running DHT GETs, values are of type * 'struct Result'. */ struct GNUNET_CONTAINER_MultiHashMap *dht_get_results; @@ -320,7 +320,7 @@ struct REGEX_INTERNAL_Search * Number of contexts (branches/steps in search). */ unsigned int n_contexts; - + /** * @param callback Callback for found peers. */ @@ -375,14 +375,14 @@ dht_get_string_accept_handler (void *cls, struct GNUNET_TIME_Absolute exp, struct RegexSearchContext *ctx = cls; struct REGEX_INTERNAL_Search *info = ctx->info; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Regex result accept for %s (key %s)\n", info->description, GNUNET_h2s(key)); - GNUNET_STATISTICS_update (info->stats, + GNUNET_STATISTICS_update (info->stats, "# regex accepting blocks found", 1, GNUNET_NO); - GNUNET_STATISTICS_update (info->stats, + GNUNET_STATISTICS_update (info->stats, "# regex accepting block bytes found", size, GNUNET_NO); info->callback (info->callback_cls, @@ -395,7 +395,7 @@ dht_get_string_accept_handler (void *cls, struct GNUNET_TIME_Absolute exp, /** * Find a path to a peer that offers a regex servcie compatible * with a given string. - * + * * @param key The key of the accepting state. * @param ctx Context containing info about the string, tunnel, etc. */ @@ -457,7 +457,7 @@ dht_get_string_handler (void *cls, struct GNUNET_TIME_Absolute exp, size_t len; struct Result *copy; - LOG (GNUNET_ERROR_TYPE_INFO, + LOG (GNUNET_ERROR_TYPE_INFO, "DHT GET result for %s (%s)\n", GNUNET_h2s (key), ctx->info->description); copy = GNUNET_malloc (sizeof (struct Result) + size); @@ -503,18 +503,18 @@ regex_result_iterator (void *cls, const struct RegexBlock *block = result->data; struct RegexSearchContext *ctx = cls; - if ( (GNUNET_YES == + if ( (GNUNET_YES == GNUNET_BLOCK_is_accepting (block, result->size)) && (ctx->position == strlen (ctx->info->description)) ) { - LOG (GNUNET_ERROR_TYPE_INFO, + LOG (GNUNET_ERROR_TYPE_INFO, "Found accepting known block\n"); regex_find_path (key, ctx); return GNUNET_YES; // We found an accept state! } - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "* %u, %u, [%u]\n", - ctx->position, + ctx->position, strlen (ctx->info->description), GNUNET_BLOCK_is_accepting (block, result->size)); regex_next_edge (block, result->size, ctx); @@ -554,12 +554,12 @@ regex_edge_iterator (void *cls, if (len > current_len) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Token too long, END\n"); - return GNUNET_YES; + return GNUNET_YES; } if (0 != strncmp (current, token, len)) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Token doesn't match, END\n"); - return GNUNET_YES; + return GNUNET_YES; } if (len > ctx->longest_match) @@ -598,7 +598,7 @@ regex_next_edge (const struct RegexBlock *block, int result; LOG (GNUNET_ERROR_TYPE_DEBUG, "Next edge\n"); - /* Find the longest match for the current string position, + /* Find the longest match for the current string position, * among tokens in the given block */ ctx->longest_match = 0; result = REGEX_BLOCK_iterate (block, size, @@ -608,7 +608,7 @@ regex_next_edge (const struct RegexBlock *block, /* Did anything match? */ if (0 == ctx->longest_match) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "no match in block\n"); return; } @@ -623,7 +623,7 @@ regex_next_edge (const struct RegexBlock *block, if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (info->dht_get_handles, hash)) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "GET for %s running, END\n", GNUNET_h2s (hash)); GNUNET_CONTAINER_multihashmap_get_multiple (info->dht_get_results, @@ -636,11 +636,11 @@ regex_next_edge (const struct RegexBlock *block, GNUNET_STATISTICS_update (info->stats, "# regex nodes traversed", 1, GNUNET_NO); - LOG (GNUNET_ERROR_TYPE_INFO, + LOG (GNUNET_ERROR_TYPE_INFO, "looking for %s\n", GNUNET_h2s (hash)); rest = &new_ctx->info->description[new_ctx->position]; - get_h = + get_h = GNUNET_DHT_get_start (info->dht, /* handle */ GNUNET_BLOCK_TYPE_REGEX, /* type */ hash, /* key to search */ @@ -671,7 +671,7 @@ regex_next_edge (const struct RegexBlock *block, * @param callback Callback for found peers. * @param callback_cls Closure for @c callback. * @param stats Optional statistics handle to report usage. Can be NULL. - * + * * @return Handle to stop search and free resources. * Must be freed by calling REGEX_INTERNAL_search_cancel. */ @@ -712,8 +712,8 @@ REGEX_INTERNAL_search (struct GNUNET_DHT_Handle *dht, ctx->position = size; ctx->info = h; GNUNET_array_append (h->contexts, h->n_contexts, ctx); - LOG (GNUNET_ERROR_TYPE_DEBUG, - "consumed %u bits out of %u, now looking for %s\n", + LOG (GNUNET_ERROR_TYPE_DEBUG, + "consumed %u bits out of %u, now looking for %s\n", size, len, GNUNET_h2s (&key)); 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; /** * Announce a regular expression: put all states of the automaton in the DHT. * Does not free resources, must call REGEX_INTERNAL_announce_cancel for that. - * + * * @param dht An existing and valid DHT service handle. CANNOT be NULL. * @param priv our private key, must remain valid until the announcement is cancelled * @param regex Regular expression to announce. * @param compression How many characters per edge can we squeeze? * @param stats Optional statistics handle to report usage. Can be NULL. - * + * * @return Handle to reuse o free cached resources. * Must be freed by calling REGEX_INTERNAL_announce_cancel. */ @@ -191,7 +191,7 @@ REGEX_INTERNAL_announce (struct GNUNET_DHT_Handle *dht, /** * Announce again a regular expression previously announced. * Does use caching to speed up process. - * + * * @param h Handle returned by a previous REGEX_INTERNAL_announce call. */ void @@ -201,7 +201,7 @@ REGEX_INTERNAL_reannounce (struct REGEX_INTERNAL_Announcement *h); /** * Clear all cached data used by a regex announce. * Does not close DHT connection. - * + * * @param h Handle returned by a previous REGEX_INTERNAL_announce call. */ void @@ -236,7 +236,7 @@ typedef void (*REGEX_INTERNAL_Found)(void *cls, * @param callback Callback for found peers. * @param callback_cls Closure for @c callback. * @param stats Optional statistics handle to report usage. Can be NULL. - * + * * @return Handle to stop search and free resources. * Must be freed by calling REGEX_INTERNAL_search_cancel. */ @@ -250,7 +250,7 @@ REGEX_INTERNAL_search (struct GNUNET_DHT_Handle *dht, /** * Stop search and free all data used by a REGEX_INTERNAL_search call. * Does not close DHT connection. - * + * * @param h Handle returned by a previous REGEX_INTERNAL_search call. */ void 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 * How many characters can we squeeze per edge? */ uint16_t compression; - + /** * Always zero. */ @@ -97,7 +97,7 @@ struct ResultMessage * Identity of the peer that was found. */ struct GNUNET_PeerIdentity id; - + /* followed by GET path and PUT path arrays */ }; 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 @@ /* * This file is part of GNUnet * (C) 2012 Christian Grothoff (and other contributing authors) - * + * * GNUnet is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 3, or (at your * option) any later version. - * + * * GNUnet is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNUnet; see the file COPYING. If not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, @@ -153,10 +153,10 @@ regex_combine (struct RegexCombineCtx *ctx) /** * Get the number of matching characters on the prefix of both strings. - * + * * @param s1 String 1. * @param s2 String 2. - * + * * @return Number of characters of matching prefix. */ static unsigned int @@ -183,10 +183,10 @@ get_prefix_length (const char *s1, const char *s2) /** * Return the child context with the longest prefix match with the regex. * Usually only one child will match, search all just in case. - * + * * @param ctx Context whose children to search. * @param regex String to match. - * + * * @return Child with the longest prefix, NULL if no child matches. */ static 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 @@ /* * This file is part of GNUnet * (C) 2012 Christian Grothoff (and other contributing authors) - * + * * GNUnet is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 3, or (at your * option) any later version. - * + * * GNUnet is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNUnet; see the file COPYING. If not, write to the * 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 () * @param put_path Path of the put request. * @param put_path_length Length of the put_path. */ -static void +static void found_cb (void *cls, const struct GNUNET_PeerIdentity *id, const struct GNUNET_PeerIdentity *get_path, @@ -106,7 +106,7 @@ run (void *cls, die_task = GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, &end_badly, NULL); - a = GNUNET_REGEX_announce (cfg, + a = GNUNET_REGEX_announce (cfg, "my long prefix - hello world(0|1)*", GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 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 static void -key_iterator (void *cls, const struct GNUNET_HashCode *key, +key_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof, int accepting, unsigned int num_edges, 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; /** * Handle for revocation. - */ + */ static struct GNUNET_REVOCATION_Handle *h; /** @@ -71,12 +71,12 @@ static struct GNUNET_IDENTITY_EgoLookup *el; /** * Our configuration. - */ + */ static const struct GNUNET_CONFIGURATION_Handle *cfg; /** * Number of matching bits required for revocation. - */ + */ static unsigned long long matching_bits; @@ -178,7 +178,7 @@ print_revocation_result (void *cls, /** * Data needed to perform a revocation. */ -struct RevocationData +struct RevocationData { /** * Public key. @@ -226,7 +226,7 @@ calculate_pow (void *cls, if ( (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) || (0 == (rd->pow % 128) ) ) - { + { if (0 == (rd->pow % 128 * 1024)) { if (0 == (rd->pow % (1024 * 128 * 80))) @@ -308,7 +308,7 @@ ego_callback (void *cls, &key); rd = GNUNET_new (struct RevocationData); if ( (NULL != filename) && - (GNUNET_YES == + (GNUNET_YES == GNUNET_DISK_file_test (filename)) && (sizeof (struct RevocationData) == GNUNET_DISK_fn_read (filename, @@ -325,10 +325,10 @@ ego_callback (void *cls, revoke_ego); GNUNET_free (rd); return; - } + } } else - { + { GNUNET_REVOCATION_sign_revocation (GNUNET_IDENTITY_ego_get_private_key (ego), &rd->sig); rd->key = key; @@ -362,8 +362,8 @@ ego_callback (void *cls, * @param c configuration */ static void -run (void *cls, - char *const *args, +run (void *cls, + char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) { 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 @@ * - broadcast p2p revocations * - handle p2p connect (trigger SET union) * - optimization: avoid sending revocation back to peer that we got it from; - * - optimization: have randomized delay in sending revocations to other peers + * - optimization: have randomized delay in sending revocations to other peers * to make it rare to traverse each link twice (NSE-style) */ #include "platform.h" @@ -83,7 +83,7 @@ static struct GNUNET_SET_Handle *revocation_set; /** * Hash map with all revoked keys, maps the hash of the public key * to the respective `struct RevokeMessage`. - */ + */ static struct GNUNET_CONTAINER_MultiHashMap *revocation_map; /** @@ -147,7 +147,7 @@ verify_revoke_message (const struct RevokeMessage *rm) rm->proof_of_work, (unsigned int) revocation_work_required)) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Proof of work invalid: %llu!\n", (unsigned long long) GNUNET_ntohll (rm->proof_of_work)); @@ -175,7 +175,7 @@ verify_revoke_message (const struct RevokeMessage *rm) * @param message the message received */ static void -handle_query_message (void *cls, +handle_query_message (void *cls, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { @@ -188,15 +188,15 @@ handle_query_message (void *cls, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), &hc); res = GNUNET_CONTAINER_multihashmap_contains (revocation_map, &hc); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - (GNUNET_NO == res) + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + (GNUNET_NO == res) ? "Received revocation check for valid key `%s' from client\n" : "Received revocation check for revoked key `%s' from client\n", GNUNET_h2s (&hc)); qrm.header.size = htons (sizeof (struct QueryResponseMessage)); qrm.header.type = htons (GNUNET_MESSAGE_TYPE_REVOCATION_QUERY_RESPONSE); qrm.is_valid = htons ((GNUNET_YES == res) ? GNUNET_NO : GNUNET_YES); - GNUNET_SERVER_notification_context_add (nc, + GNUNET_SERVER_notification_context_add (nc, client); GNUNET_SERVER_notification_context_unicast (nc, client, @@ -228,7 +228,7 @@ do_flood (void *cls, * Publicize revocation message. Stores the message locally in the * database and passes it to all connected neighbours (and adds it to * the set for future connections). - * + * * @param rm message to publicize * @return #GNUNET_OK on success, #GNUNET_NO if we encountered an error, * #GNUNET_SYSERR if the message was malformed @@ -251,12 +251,12 @@ publicize_rm (const struct RevokeMessage *rm) _("Duplicate revocation received from peer. Ignored.\n")); return GNUNET_OK; } - if (GNUNET_OK != + if (GNUNET_OK != verify_revoke_message (rm)) { GNUNET_break_op (0); return GNUNET_SYSERR; - } + } /* write to disk */ if (sizeof (struct RevokeMessage) != GNUNET_DISK_file_write (revocation_db, @@ -294,7 +294,7 @@ publicize_rm (const struct RevokeMessage *rm) return GNUNET_OK; } /* flood to neighbours */ - GNUNET_CONTAINER_multipeermap_iterate (peers, + GNUNET_CONTAINER_multipeermap_iterate (peers, &do_flood, cp); return GNUNET_OK; @@ -309,7 +309,7 @@ publicize_rm (const struct RevokeMessage *rm) * @param message the message received */ static void -handle_revoke_message (void *cls, +handle_revoke_message (void *cls, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { @@ -317,7 +317,7 @@ handle_revoke_message (void *cls, struct RevocationResponseMessage rrm; int ret; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE message from client\n"); rm = (const struct RevokeMessage *) message; if (GNUNET_SYSERR == (ret = publicize_rm (rm))) @@ -329,7 +329,7 @@ handle_revoke_message (void *cls, rrm.header.size = htons (sizeof (struct RevocationResponseMessage)); rrm.header.type = htons (GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE_RESPONSE); rrm.is_valid = htons ((GNUNET_OK == ret) ? GNUNET_NO : GNUNET_YES); - GNUNET_SERVER_notification_context_add (nc, + GNUNET_SERVER_notification_context_add (nc, client); GNUNET_SERVER_notification_context_unicast (nc, client, @@ -347,13 +347,13 @@ handle_revoke_message (void *cls, * @param peer peer identity this message is from (ignored) */ static int -handle_p2p_revoke_message (void *cls, +handle_p2p_revoke_message (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message) { const struct RevokeMessage *rm; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE message from peer\n"); rm = (const struct RevokeMessage *) message; GNUNET_break_op (GNUNET_SYSERR != publicize_rm (rm)); @@ -400,7 +400,7 @@ handle_core_connect (void *cls, * @param peer peer identity this notification is about */ static void -handle_core_disconnect (void *cls, +handle_core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) { struct PeerEntry *pos; @@ -418,7 +418,7 @@ handle_core_disconnect (void *cls, GNUNET_CONTAINER_multipeermap_remove (peers, peer, pos)); #if 0 - if (pos->transmit_task != GNUNET_SCHEDULER_NO_TASK) + if (pos->transmit_task != GNUNET_SCHEDULER_NO_TASK) { GNUNET_SCHEDULER_cancel (pos->transmit_task); pos->transmit_task = GNUNET_SCHEDULER_NO_TASK; @@ -436,7 +436,7 @@ handle_core_disconnect (void *cls, /** * Free all values in a hash map. - * + * * @param cls NULL * @param key the key * @param value value to free @@ -506,12 +506,12 @@ shutdown_task (void *cls, * @param identity the public identity of this peer */ static void -core_init (void *cls, +core_init (void *cls, const struct GNUNET_PeerIdentity *identity) { if (NULL == identity) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Connection to core FAILED!\n"); GNUNET_SCHEDULER_shutdown (); return; @@ -528,7 +528,7 @@ core_init (void *cls, * @param c configuration to use */ static void -run (void *cls, +run (void *cls, struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c) { @@ -562,7 +562,7 @@ run (void *cls, return; } cfg = c; - srv = server; + srv = server; revocation_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO); nc = GNUNET_SERVER_notification_context_create (server, 1); if (GNUNET_OK != @@ -588,7 +588,7 @@ run (void *cls, } revocation_set = GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_UNION); - + revocation_db = GNUNET_DISK_file_open (fn, GNUNET_DISK_OPEN_READWRITE | GNUNET_DISK_OPEN_CREATE, @@ -607,10 +607,10 @@ run (void *cls, } if (GNUNET_OK != GNUNET_DISK_file_size (fn, &left, GNUNET_YES, GNUNET_YES)) - left = 0; + left = 0; while (left > sizeof (struct RevokeMessage)) { - rm = GNUNET_new (struct RevokeMessage); + rm = GNUNET_new (struct RevokeMessage); if (sizeof (struct RevokeMessage) != GNUNET_DISK_file_read (revocation_db, rm, @@ -632,10 +632,10 @@ run (void *cls, GNUNET_CONTAINER_multihashmap_put (revocation_map, &hc, rm, - GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); + GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); } GNUNET_free (fn); - + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, NULL); peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); @@ -668,7 +668,7 @@ run (void *cls, * @return 0 ok, 1 on error */ int -main (int argc, +main (int argc, char *const *argv) { return (GNUNET_OK == @@ -683,7 +683,7 @@ main (int argc, /** * MINIMIZE heap size (way below 128k) since this process doesn't need much. */ -void __attribute__ ((constructor)) +void __attribute__ ((constructor)) GNUNET_ARM_memory_init () { 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 * Connection to the service. */ struct GNUNET_CLIENT_Connection *client; - + /** * Our configuration. */ @@ -196,12 +196,12 @@ GNUNET_REVOCATION_query_cancel (struct GNUNET_REVOCATION_Query *q) */ struct GNUNET_REVOCATION_Handle { - + /** * Connection to the service. */ struct GNUNET_CLIENT_Connection *client; - + /** * Our configuration. */ @@ -265,7 +265,7 @@ handle_revocation_response (void *cls, rrm = (const struct RevocationResponseMessage *) msg; h->func (h->func_cls, ntohl (rrm->is_valid)); GNUNET_REVOCATION_revoke_cancel (h); - + } @@ -337,7 +337,7 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_REVOCATION_Handle *h; unsigned long long matching_bits; - if ( (GNUNET_OK == + if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "REVOCATION", "WORKBITS", @@ -398,11 +398,11 @@ pow_hash (const void *buf, size_t buf_len, struct GNUNET_HashCode *result) { - GNUNET_break (0 == + GNUNET_break (0 == gcry_kdf_derive (buf, buf_len, GCRY_KDF_SCRYPT, 1 /* subalgo */, - "gnunet-revocation-proof-of-work", + "gnunet-revocation-proof-of-work", strlen ("gnunet-revocation-proof-of-work"), 2 /* iterations; keep cost of individual op small */, 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; /** * Callback called if we are initiating a new computation session - * + * * @param cls unused - * @param status if our job was successfully processed + * @param status if our job was successfully processed */ static void responder_callback (void *cls, @@ -110,14 +110,14 @@ responder_callback (void *cls, /** * Callback called if we are initiating a new computation session - * + * * @param cls unused * @param key unused * @param peer unused - * @param status if our job was successfully processed + * @param status if our job was successfully processed * @param size size of the msg returned * @param msg the response we got. - * @param type of the message received + * @param type of the message received */ static void requester_callback (void *cls, @@ -247,7 +247,7 @@ run (void *cls, LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Need elements to compute the vectorproduct, got none.\n")); return; } - + begin = input_elements; elements = GNUNET_malloc (sizeof (int32_t) * element_count); element_count = 0; @@ -328,7 +328,7 @@ run (void *cls, GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, NULL); - + ret = 0; } 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 /** * A scalarproduct session which tracks: - * + * * a request form the client to our final response. * or * a request from a service to us(service). @@ -93,7 +93,7 @@ struct ServiceSession */ struct GNUNET_HashCode key; - /** + /** * state of the session */ enum SessionState state; @@ -127,9 +127,9 @@ struct ServiceSession * already transferred elements (sent/received) for multipart messages, less or equal than used_element_count for */ uint32_t transferred_element_count; - + /** - * how many bytes the mask is long. + * how many bytes the mask is long. * just for convenience so we don't have to re-re-re calculate it each time */ uint32_t mask_length; @@ -158,14 +158,14 @@ struct ServiceSession * Bob's permutation p of R */ gcry_mpi_t * r; - + /** * Bob's permutation q of R */ gcry_mpi_t * r_prime; - + /** - * The computed scalar + * The computed scalar */ gcry_mpi_t product; @@ -245,27 +245,27 @@ static gcry_mpi_t my_lambda; static gcry_mpi_t my_offset; /** - * Head of our double linked list for client-requests sent to us. + * Head of our double linked list for client-requests sent to us. * for all of these elements we calculate a scalar product with a remote peer * split between service->service and client->service for simplicity */ static struct ServiceSession * from_client_head; /** - * Tail of our double linked list for client-requests sent to us. + * Tail of our double linked list for client-requests sent to us. * for all of these elements we calculate a scalar product with a remote peer * split between service->service and client->service for simplicity */ static struct ServiceSession * from_client_tail; /** - * Head of our double linked list for service-requests sent to us. + * Head of our double linked list for service-requests sent to us. * for all of these elements we help the requesting service in calculating a scalar product * split between service->service and client->service for simplicity */ static struct ServiceSession * from_service_head; /** - * Tail of our double linked list for service-requests sent to us. + * Tail of our double linked list for service-requests sent to us. * for all of these elements we help the requesting service in calculating a scalar product * split between service->service and client->service for simplicity */ @@ -306,7 +306,7 @@ generate_keyset () GNUNET_assert (0 == gcry_pk_genkey (&key, gen_params)); gcry_sexp_release (gen_params); - // get n and d of our publickey as MPI + // get n and d of our publickey as MPI tmp_sexp = gcry_sexp_find_token (key, "n", 0); GNUNET_assert (tmp_sexp); my_n = gcry_sexp_nth_mpi (tmp_sexp, 1, GCRYMPI_FMT_USG); @@ -389,7 +389,7 @@ generate_keyset () gcry_sexp_release (key); // offset has to be sufficiently small to allow computation of: - // m1+m2 mod n == (S + a) + (S + b) mod n, + // m1+m2 mod n == (S + a) + (S + b) mod n, // if we have more complex operations, this factor needs to be lowered my_offset = gcry_mpi_new (KEYBITS / 3); gcry_mpi_set_bit (my_offset, KEYBITS / 3); @@ -420,7 +420,7 @@ adjust (unsigned char *buf, size_t size, size_t target) /** * encrypts an element using the paillier crypto system - * + * * @param c ciphertext (output) * @param m plaintext * @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 /** * decrypts an element using the paillier crypto system - * + * * @param m plaintext (output) * @param c the ciphertext * @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 /** * computes the square sum over a vector of a given length. - * + * * @param vector the vector to encrypt * @param length the length of the vector * @return an MPI value containing the calculated sum, never NULL @@ -501,7 +501,7 @@ compute_square_sum (gcry_mpi_t * vector, uint32_t length) * Primitive callback for copying over a message, as they * usually are too complex to be handled in the callback itself. * clears a session-callback, if a session was handed over and the transmit handle was stored - * + * * @param cls the message object * @param size the size of the buffer we got * @param buf the buffer to copy the message to @@ -559,7 +559,7 @@ do_send_message (void *cls, size_t size, void *buf) /** * initializes a new vector with fresh MPI values (=0) of a given length - * + * * @param length of the vector to create * @return the initialized vector, never NULL */ @@ -577,7 +577,7 @@ initialize_mpi_vector (uint32_t length) /** * permutes an MPI vector according to the given permutation vector - * + * * @param vector the vector to permuted * @param perm the permutation to use * @param length the length of the vectors @@ -596,7 +596,7 @@ permute_vector (gcry_mpi_t * vector, // backup old layout memcpy (tmp, vector, length * sizeof (gcry_mpi_t)); - // permute vector according to given + // permute vector according to given for (i = 0; i < length; i++) vector[i] = tmp[perm[i]]; @@ -605,8 +605,8 @@ permute_vector (gcry_mpi_t * vector, /** - * Populate a vector with random integer values and convert them to - * + * Populate a vector with random integer values and convert them to + * * @param length the length of the vector we must generate * @return an array of MPI values with random values */ @@ -636,12 +636,12 @@ generate_random_vector (uint32_t length) /** - * Finds a not terminated client/service session in the + * Finds a not terminated client/service session in the * given DLL based on session key, element count and state. - * + * * @param tail - the tail of the DLL * @param my - the session to compare it to - * @return a pointer to a matching session, + * @return a pointer to a matching session, * else NULL */ static struct ServiceSession * @@ -702,9 +702,9 @@ free_session (struct ServiceSession * session) /** - * A client disconnected. - * - * Remove the associated session(s), release datastructures + * A client disconnected. + * + * Remove the associated session(s), release datastructures * and cancel pending outgoing transmissions to the client. * if the session has not yet completed, we also cancel Alice's request to Bob. * @@ -755,10 +755,10 @@ handle_client_disconnect (void *cls, /** * Notify the client that the session has succeeded or failed completely. - * This message gets sent to + * This message gets sent to * * alice's client if bob disconnected or to * * bob's client if the operation completed or alice disconnected - * + * * @param client_session the associated client session * @return GNUNET_NO, if we could not notify the client * GNUNET_YES if we notified it. @@ -777,7 +777,7 @@ prepare_client_end_notification (void * cls, memcpy (&msg->key, &session->key, sizeof (struct GNUNET_HashCode)); memcpy (&msg->peer, &session->peer, sizeof ( struct GNUNET_PeerIdentity)); msg->header.size = htons (sizeof (struct GNUNET_SCALARPRODUCT_client_response)); - // signal error if not signalized, positive result-range field but zero length. + // signal error if not signalized, positive result-range field but zero length. msg->product_length = htonl (0); msg->range = (session->state == FINALIZED) ? 0 : -1; @@ -807,13 +807,13 @@ prepare_client_end_notification (void * cls, /** * Bob executes: - * generates the response message to be sent to alice after computing + * generates the response message to be sent to alice after computing * the values (1), (2), S and S' * (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)})$ * (2)[]: $E_A(a_{pi'(i)}) times E_A(- r_{pi'(i)}) &= E_A(a_{pi'(i)} - r_{pi'(i)})$ * S: $S := E_A(sum (r_i + b_i)^2)$ * S': $S' := E_A(sum r_i^2)$ - * + * * @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)})$ * @param r_prime (2)[]: $E_A(a_{pi'(i)}) times E_A(- r_{pi'(i)}) &= E_A(a_{pi'(i)} - r_{pi'(i)})$ * @param s S: $S := E_A(sum (r_i + b_i)^2)$ @@ -847,7 +847,7 @@ prepare_service_response (gcry_mpi_t s, else { request->transferred_element_count = (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - msg_length) / (PAILLIER_ELEMENT_LENGTH * 2); } - + msg = GNUNET_malloc (msg_length); msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_BOB_TO_ALICE); @@ -861,7 +861,7 @@ prepare_service_response (gcry_mpi_t s, element_exported = GNUNET_malloc (PAILLIER_ELEMENT_LENGTH); // 4 times the same logics with slight variations. // doesn't really justify having 2 functions for that - // so i put it into blocks to enhance readability + // so i put it into blocks to enhance readability // convert s memset (element_exported, 0, PAILLIER_ELEMENT_LENGTH); GNUNET_assert (0 == gcry_mpi_print (GCRYMPI_FMT_USG, @@ -907,7 +907,7 @@ prepare_service_response (gcry_mpi_t s, memcpy (current, element_exported, PAILLIER_ELEMENT_LENGTH); current += PAILLIER_ELEMENT_LENGTH; } - + GNUNET_free (element_exported); for (i = 0; i < request->transferred_element_count; i++) { @@ -916,7 +916,7 @@ prepare_service_response (gcry_mpi_t s, } gcry_mpi_release (s); gcry_mpi_release (s_prime); - + request->msg = (struct GNUNET_MessageHeader *) msg; request->service_transmit_handle = GNUNET_MESH_notify_transmit_ready (request->tunnel, @@ -942,19 +942,19 @@ prepare_service_response (gcry_mpi_t s, else //singlepart request->state = FINALIZED; - + return GNUNET_OK; } /** - * executed by bob: - * compute the values + * executed by bob: + * compute the values * (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)})$ * (2)[]: $E_A(a_{\pi'(i)}) \otimes E_A(- r_{\pi'(i)}) &= E_A(a_{\pi'(i)} - r_{\pi'(i)})$ * S: $S := E_A(\sum (r_i + b_i)^2)$ * S': $S' := E_A(\sum r_i^2)$ - * + * * @param request the requesting session + bob's requesting peer * @param response the responding session + bob's client handle * @return GNUNET_SYSERR if the computation failed @@ -1063,7 +1063,7 @@ compute_service_response (struct ServiceSession * request, r = initialize_mpi_vector (count); r_prime = initialize_mpi_vector (count); - // copy the REFERNCES of a, b and r into aq and bq. we will not change + // copy the REFERNCES of a, b and r into aq and bq. we will not change // those values, thus we can work with the references memcpy (a_pi, request->a, sizeof (gcry_mpi_t) * count); memcpy (a_pi_prime, request->a, sizeof (gcry_mpi_t) * count); @@ -1080,7 +1080,7 @@ compute_service_response (struct ServiceSession * request, // encrypt the element // for the sake of readability I decided to have dedicated permutation - // vectors, which get rid of all the lookups in p/q. + // vectors, which get rid of all the lookups in p/q. // however, ap/aq are not absolutely necessary but are just abstraction // Calculate Kp = E(S + a_pi) (+) E(S - r_pi - b_pi) for (i = 0; i < count; i++) @@ -1109,7 +1109,7 @@ compute_service_response (struct ServiceSession * request, } GNUNET_free (a_pi_prime); GNUNET_free (rand_pi_prime); - + request->r = r; request->r_prime = r_prime; @@ -1157,7 +1157,7 @@ except: /** * Executed by Alice, fills in a service-request message and sends it to the given peer - * + * * @param session the session associated with this request, then also holds the CORE-handle * @return #GNUNET_SYSERR if we could not send the message * #GNUNET_NO if the message was too large @@ -1226,7 +1226,7 @@ prepare_service_request (void *cls, { if (session->transferred_element_count <= j) break; //reached end of this message, can't include more - + memset(element_exported, 0, PAILLIER_ELEMENT_LENGTH); value = session->vector[i] >= 0 ? session->vector[i] : -session->vector[i]; @@ -1287,10 +1287,10 @@ prepare_service_request (void *cls, /** - * Handler for a client request message. + * Handler for a client request message. * Can either be type A or B * A: request-initiation to compute a scalar product with a peer - * B: response role, keep the values + session and wait for a matching session or process a waiting request + * B: response role, keep the values + session and wait for a matching session or process a waiting request * * @param cls closure * @param client identification of the client @@ -1454,7 +1454,7 @@ handle_client_request (void *cls, GNUNET_SERVER_client_set_user_context (client, session); GNUNET_CONTAINER_DLL_insert (from_client_head, from_client_tail, session); - //check if service queue contains a matching request + //check if service queue contains a matching request requesting_session = find_matching_session (from_service_tail, &session->key, session->element_count, @@ -1480,7 +1480,7 @@ handle_client_request (void *cls, /** - * Function called for inbound tunnels. + * Function called for inbound tunnels. * * @param cls closure * @param tunnel new handle to the tunnel @@ -1507,8 +1507,8 @@ tunnel_incoming_handler (void *cls, /** * Function called whenever a tunnel is destroyed. Should clean up - * any associated state. - * + * any associated state. + * * It must NOT call GNUNET_MESH_tunnel_destroy on the tunnel. * * @param cls closure (set from GNUNET_MESH_connect) @@ -1561,7 +1561,7 @@ tunnel_destruction_handler (void *cls, NULL, NULL); free_session (session); - // the client has to check if it was waiting for a result + // the client has to check if it was waiting for a result // or if it was a responder, no point in adding more statefulness if (client_session && (!do_shutdown)) { @@ -1576,15 +1576,15 @@ tunnel_destruction_handler (void *cls, /** * Compute our scalar product, done by Alice - * + * * @param session - the session associated with this computation - * @param kp - (1) from the protocol definition: + * @param kp - (1) from the protocol definition: * $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)})$ - * @param kq - (2) from the protocol definition: + * @param kq - (2) from the protocol definition: * $E_A(a_{\pi'(i)}) \otimes E_A(- r_{\pi'(i)}) &= E_A(a_{\pi'(i)} - r_{\pi'(i)})$ - * @param s - S from the protocol definition: + * @param s - S from the protocol definition: * $S := E_A(\sum (r_i + b_i)^2)$ - * @param stick - S' from the protocol definition: + * @param stick - S' from the protocol definition: * $S' := E_A(\sum r_i^2)$ * @return product as MPI, never NULL */ @@ -1667,8 +1667,8 @@ compute_scalar_product (struct ServiceSession * session, /** * prepare the response we will send to alice or bobs' clients. - * in Bobs case the product will be NULL. - * + * in Bobs case the product will be NULL. + * * @param session the session associated with our client. */ static void @@ -1873,7 +1873,7 @@ handle_service_request (void *cls, current += pk_length; - //check if service queue contains a matching request + //check if service queue contains a matching request needed_state = CLIENT_RESPONSE_RECEIVED; responder_session = find_matching_session (from_client_tail, &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" #define KEYBITS 2048 /** - * When performing our crypto, we may add two encrypted values with each + * When performing our crypto, we may add two encrypted values with each * a maximal length of GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH. * thus we can receive a slightly longer element (+1 byte) */ @@ -60,7 +60,7 @@ extern "C" /////////////////////////////////////////////////////////////////////////////// /** - * Message type passed from client to service + * Message type passed from client to service * to initiate a request or responder role */ struct GNUNET_SCALARPRODUCT_client_request @@ -94,7 +94,7 @@ struct GNUNET_SCALARPRODUCT_client_request * followed by long vector[element_count] | [unsigned char mask[mask_bytes]] */ }; - + /** * Message type passed from requesting service Alice to responding service Bob * to initiate a request and make bob participate in our protocol @@ -109,12 +109,12 @@ struct GNUNET_SCALARPRODUCT_service_request { * how many elements the total message including all multipart msgs contains */ uint32_t total_element_count GNUNET_PACKED; - + /** * how many elements are actually included after the mask was applied. */ uint32_t contained_element_count GNUNET_PACKED; - + /** * how many bytes the mask has */ @@ -153,7 +153,7 @@ struct GNUNET_SCALARPRODUCT_multipart_message { * how many elements we supply within this message */ uint32_t multipart_element_count GNUNET_PACKED; - + // followed by vector[multipart_element_count] or k[i][perm] }; @@ -171,12 +171,12 @@ struct GNUNET_SCALARPRODUCT_service_response { * how many elements the session input had */ uint32_t total_element_count GNUNET_PACKED; - + /** * how many elements were included after the mask was applied including all multipart msgs. */ uint32_t used_element_count GNUNET_PACKED; - + /** * how many elements this individual message delivers */ @@ -227,7 +227,7 @@ struct GNUNET_SCALARPRODUCT_client_response * followed by product of length product_length (or nothing) */ }; - + #ifdef __cplusplus } #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 @@ * @brief API for the scalarproduct * @author Christian Fuchs * @author Gaurav Kukreja - * + * */ #include "platform.h" #include "gnunet_util_lib.h" @@ -145,9 +145,9 @@ GNUNET_SCALARPRODUCT_cancel (struct GNUNET_SCALARPRODUCT_ComputationHandle * h); /** - * Handles the RESULT received in reply of prepare_response from the + * Handles the RESULT received in reply of prepare_response from the * service - * + * * @param cls Handle to the Master Context * @param msg Pointer to the response received */ @@ -163,9 +163,9 @@ process_status_message (void *cls, /** - * Handles the RESULT received in reply of prepare_response from the + * Handles the RESULT received in reply of prepare_response from the * service - * + * * @param cls Handle to the Master Context * @param msg Pointer to the response received */ @@ -215,7 +215,7 @@ process_result_message (void *cls, * Called when a response is received from the service. After basic check * handler in qe->response_proc is called. This functions handles the response * to the client which used the API. - * + * * @param cls Pointer to the Master Context * @param msg Pointer to the data received in response */ @@ -245,7 +245,7 @@ receive_cb (void *cls, const struct GNUNET_MessageHeader *msg) status = GNUNET_SCALARPRODUCT_Status_Success; } - + if (qe->cont_datum != NULL) qe->response_proc (qe, msg, status); @@ -256,11 +256,11 @@ receive_cb (void *cls, const struct GNUNET_MessageHeader *msg) /** * Transmits the request to the VectorProduct Sevice - * + * * @param cls Closure * @param size Size of the buffer * @param buf Pointer to the buffer - * + * * @return Size of the message sent */ static size_t @@ -279,7 +279,7 @@ transmit_request (void *cls, size_t size, // notify caller about the error, done here. if (qe->cont_datum != NULL) qe->response_proc (qe, NULL, GNUNET_SCALARPRODUCT_Status_Failure); - + GNUNET_SCALARPRODUCT_cancel (cls); return 0; } @@ -307,8 +307,8 @@ transmit_request (void *cls, size_t size, /** - * Used by Bob's client to cooperate with Alice, - * + * Used by Bob's client to cooperate with Alice, + * * @param h handle to the master context * @param key Session key - unique to the requesting client * @param elements Array of elements of the vector @@ -358,7 +358,7 @@ GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle *cfg, h->response_proc = &process_status_message; h->cfg = cfg; memcpy (&h->key, key, sizeof (struct GNUNET_HashCode)); - + msg = (struct GNUNET_SCALARPRODUCT_client_request*) GNUNET_malloc (size); h->msg = msg; msg->header.size = htons (size); @@ -393,7 +393,7 @@ GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle *cfg, /** * Request by Alice's client for computing a scalar product - * + * * @param h handle to the master context * @param key Session key - unique to the requesting client * @param peer PeerID of the other peer @@ -451,7 +451,7 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg, h->response_proc = &process_result_message; h->cfg = cfg; memcpy (&h->key, key, sizeof (struct GNUNET_HashCode)); - + msg = (struct GNUNET_SCALARPRODUCT_client_request*) GNUNET_malloc (size); h->msg = msg; msg->header.size = htons (size); @@ -463,7 +463,7 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg, // copy each element over to the message for (i = 0; i < element_count; i++) vector[i] = htonl (elements[i]); - + memcpy (&msg->peer, peer, sizeof (struct GNUNET_PeerIdentity)); memcpy (&msg->key, key, sizeof (struct GNUNET_HashCode)); memcpy (&vector[element_count], mask, mask_bytes); @@ -489,7 +489,7 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg, /** * Disconnect from the scalarproduct service. - * + * * @param h a computation handle to cancel */ void 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 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/** +/** * @file scalarproduct/scalarproduct_testing.h * @brief VectorProduct testcase common declarations * @author Gaurav Kukreja @@ -32,14 +32,14 @@ #ifdef __cplusplus extern "C" { #endif - + struct GNUNET_SCALARPRODUCT_TESTING_handle { /** * Testing library system handle */ struct GNUNET_TESTING_System *tl_system; - + /** * head DLL of peers */ @@ -51,7 +51,7 @@ struct GNUNET_SCALARPRODUCT_TESTING_handle struct PeerContext *p_tail; }; -struct PeerContext +struct PeerContext { /** * Next element in the DLL @@ -72,17 +72,17 @@ struct PeerContext * Peer identity */ struct GNUNET_PeerIdentity id; - + /** * Handle for the peer's ARM process */ struct GNUNET_OS_Process *arm_proc; - + /** * Pointer to Vector Product Handle */ struct GNUNET_SCALARPRODUCT_Handle *vh; - + /** * Closure for the callbacks */ @@ -92,23 +92,23 @@ struct PeerContext * An unique number to identify the peer */ unsigned int no; - + /** * Peer's configuration */ struct GNUNET_CONFIGURATION_Handle *cfg; - + /** * Pointer to the master testing handle */ struct GNUNET_SCALARPRODUCT_TESTING_handle * vth; - + /** * Callback when two peers are connected and both have called the connect callback * to notify clients about a new peer */ void (*start_cb) (struct PeerContext * p, void *cls); - + // /** // * Pointer to function where the test occurs // */ 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 @@ */ /** - * Aim of test_scalarproduct_api : This test creates two peers. Peer1 is the + * Aim of test_scalarproduct_api : This test creates two peers. Peer1 is the * responder peer, Bob and Peer2 is the initiator peer, Alice. Both peers * connect to VectorProduct Service, and use the API to issue requests to * 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) /** * Shutdown a peer - * + * * @param cls pointer to "struct PeerData" of the peer to be disconnected * @param tc Task Context */ @@ -272,7 +272,7 @@ controller_event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) { GNUNET_assert (event->type == GNUNET_TESTBED_ET_OPERATION_FINISHED); - + switch (setup_state) { case PEER1_SCALARPRODUCT_CONNECT: @@ -366,7 +366,7 @@ requester_callback (void *cls, { LOG (GNUNET_ERROR_TYPE_INFO, "Requester Client expected response received!\n"); product_len = ntohl(msg->product_length); - + if (0 < product_len) { gcry_mpi_t result; @@ -383,7 +383,7 @@ requester_callback (void *cls, { uint16_t i = 0; - // calculate expected product + // calculate expected product gcry_mpi_t expected_result; gcry_mpi_t v1; gcry_mpi_t v2; @@ -424,7 +424,7 @@ requester_callback (void *cls, gcry_mpi_release (v1_v2_prod); } - + // compare the result if (!gcry_mpi_cmp (expected_result, result)) { @@ -453,7 +453,7 @@ requester_callback (void *cls, } /** - * Prepare the message to be sent by peer2 to its scalarproduct service, to + * Prepare the message to be sent by peer2 to its scalarproduct service, to * initiate a request to peer1. */ static struct GNUNET_SCALARPRODUCT_QueueEntry * @@ -467,9 +467,9 @@ requester_request () int32_t element; struct GNUNET_SCALARPRODUCT_QueueEntry *qe; struct GNUNET_HashCode key; - + GNUNET_assert (peer2.vh != NULL); - + GNUNET_CRYPTO_hash (input_key, strlen (input_key), &key); /* Read input_elements_peer2, and put in elements_peer2 array */ @@ -501,7 +501,7 @@ requester_request () while (!exit_loop && element_count_peer2 < max_mids); GNUNET_assert (elements_peer2 != NULL); GNUNET_assert (element_count_peer2 >= 1); - + /* Read input_mask_peer2 and read in mask_peer2 array */ mask_length = element_count_peer2 / 8 + (element_count_peer2 % 8 ? 1 : 0); mask_peer2 = GNUNET_malloc ((element_count_peer2 / 8) + 2); @@ -584,7 +584,7 @@ responder_prepare_response () int32_t element; struct GNUNET_SCALARPRODUCT_QueueEntry *qe; struct GNUNET_HashCode key; - + GNUNET_CRYPTO_hash (input_key, strlen (input_key), &key); /* Read input_elements_peer1, and put in elements_peer1 array */ @@ -638,7 +638,7 @@ responder_prepare_response () /** * Scheduler task to initiate requester client - * + * * @param cls void* to struct PeerData * @param tc Task Context */ @@ -653,7 +653,7 @@ request_task(void *cls, /** * Scheduler task to initiate responder client - * + * * @param cls void* to struct PeerData * @param tc Task Context */ @@ -661,7 +661,7 @@ static void prepare_response_task(void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) -{ +{ responder_prepare_response(); return; } @@ -672,7 +672,7 @@ prepare_response_task(void *cls, * a service. This function is called when GNUNET_TESTBED_operation_done is * called for peer->op, which holds the handle for GNUNET_TESTBED_service_connect * operation. - * + * * @param cls closure * @param op_result service handle returned from the connect adapter */ @@ -689,7 +689,7 @@ scalarproduct_da (void *cls, void *op_result) /** * Adapter function called to establish a connection to * a service. This function is called to by GNUNET_TESTBED_service_connect. - * + * * @param cls closure * @param cfg configuration of the peer to connect to; will be available until * GNUNET_TESTBED_operation_done() is called on the operation returned @@ -729,7 +729,7 @@ scalarproduct_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) GNUNET_SCHEDULER_add_now(&prepare_response_task, &peer1); GNUNET_SCHEDULER_add_now(&request_task, &peer2); } - + return peer2.vh; default: GNUNET_assert (0); @@ -814,7 +814,7 @@ test_master (void *cls, unsigned int num_peers, GNUNET_TESTBED_PIT_IDENTITY, &peerinfo_cb, NULL); setup_state = PEER1_GET_IDENTITY; - + /* Abort task for stopping test on timeout */ abort_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply @@ -842,7 +842,7 @@ main (int argc, char **argv) NUM_PEERS, event_mask, &controller_event_cb, NULL, &test_master, NULL); - + if (GNUNET_SYSERR == ok) { 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, const struct GNUNET_MessageHeader *m) { struct Set *set; - + set = set_get (client); if (NULL == set) { @@ -717,7 +717,7 @@ handle_client_add_remove (void *cls, GNUNET_SERVER_receive_done (client, GNUNET_OK); msg = (const struct GNUNET_SET_ElementMessage *) m; el.size = ntohs (m->size) - sizeof *msg; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "client ins/rem element of size %u\n", el.size); el.data = &msg[1]; if (GNUNET_MESSAGE_TYPE_SET_REMOVE == ntohs (m->type)) @@ -829,7 +829,7 @@ handle_client_iter_ack (void *cls, const struct GNUNET_MessageHeader *m) { struct Set *set; - + set = set_get (client); if (NULL == set) { @@ -1023,7 +1023,7 @@ tunnel_new_cb (void *cls, incoming->tc = GNUNET_new (struct TunnelContext);; incoming->tc->vt = &incoming_vt; incoming->tc->op = (struct OperationState *) incoming; - incoming->timeout_task = + incoming->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, incoming_timeout_cb, incoming); GNUNET_CONTAINER_DLL_insert_tail (incoming_head, incoming_tail, incoming); @@ -1057,7 +1057,7 @@ tunnel_end_cb (void *cls, /** * Functions with this signature are called whenever a message is * received. - * + * * Each time the function must call GNUNET_MESH_receive_done on the tunnel * in order to receive the next message. This doesn't need to be immediate: * can be delayed if some processing is done on the message. @@ -1066,7 +1066,7 @@ tunnel_end_cb (void *cls, * @param tunnel Connection to the other end. * @param tunnel_ctx Place to store local state associated with the tunnel. * @param message The actual message. - * + * * @return GNUNET_OK to keep the tunnel open, * GNUNET_SYSERR to close it (signal serious error). */ 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 int removed; /** - * Generation the element was removed by the client. + * Generation the element was removed by the client. * Operations of later generations will not consider the element. * Only valid if is_removed is GNUNET_YES. */ 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 * was created. */ unsigned int generation_created; - + /** * Evaluate operations are held in * a linked list. */ struct IntersectionEvaluateOperation *next; - + /** * Evaluate operations are held in * a linked list. @@ -224,7 +224,7 @@ struct ElementEntry int removed; /** - * Generation the element was removed by the client. + * Generation the element was removed by the client. * Operations of later generations will not consider the element. * Only valid if is_removed is GNUNET_YES. */ @@ -374,7 +374,7 @@ destroy_key_to_element_iter (void *cls, void *value) { struct KeyEntry *k = value; - + while (NULL != k) { struct KeyEntry *k_tmp = k; @@ -395,7 +395,7 @@ void _GSS_union_operation_destroy (struct UnionEvaluateOperation *eo) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "destroying union op\n"); - + if (NULL != eo->tunnel) { GNUNET_MESH_tunnel_destroy (eo->tunnel); @@ -457,7 +457,7 @@ fail_union_operation (struct UnionEvaluateOperation *eo) /** - * Derive the IBF key from a hash code and + * Derive the IBF key from a hash code and * a salt. * * @param src the hash code @@ -863,14 +863,14 @@ decode_and_send (struct UnionEvaluateOperation *eo) next_order++; if (next_order <= MAX_IBF_ORDER) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "decoding failed, sending larger ibf (size %u)\n", 1<ibf_buckets_received, buckets_in_message, eo->remote_ibf); eo->ibf_buckets_received += buckets_in_message; @@ -1106,7 +1106,7 @@ peer_done_sent_cb (void *cls) /** * Handle a done message from a remote peer - * + * * @param cls the union operation * @param mh the message */ @@ -1160,15 +1160,15 @@ _GSS_intersection_evaluate (struct GNUNET_SET_EvaluateMessage *m, struct Set *se eo->se = strata_estimator_dup (set->state.i->se); eo->salt = ntohs (m->salt); eo->app_id = m->app_id; - + context_msg = GNUNET_MQ_extract_nested_mh (m); if (NULL != context_msg) { eo->context_msg = GNUNET_copy_message (context_msg); } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "evaluating intersection operation, (app %s)\n", + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "evaluating intersection operation, (app %s)\n", GNUNET_h2s (&eo->app_id)); eo->tc = GNUNET_new (struct TunnelContext); @@ -1231,7 +1231,7 @@ _GSS_intersection_set_create (void) struct Set *set; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "intersection set created\n"); - + set = GNUNET_malloc (sizeof (struct Set) + sizeof (struct IntersectionState)); set->state.i = (struct IntersectionState *) &set[1]; set->operation = GNUNET_SET_OPERATION_INTERSECTION; @@ -1239,7 +1239,7 @@ _GSS_intersection_set_create (void) * want the hash map to copy them */ set->state.i->elements = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_YES); set->state.i->se = strata_estimator_create (SE_STRATA_COUNT, - SE_IBF_SIZE, SE_IBF_HASH_NUM); + SE_IBF_SIZE, SE_IBF_HASH_NUM); return set; } 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 * belongs to. */ struct Set *set; - + /** * Evaluate operations are held in * a linked list. */ struct OperationState *next; - + /** * Evaluate operations are held in * a linked list. @@ -273,7 +273,7 @@ destroy_key_to_element_iter (void *cls, void *value) { struct KeyEntry *k = value; - + while (NULL != k) { struct KeyEntry *k_tmp = k; @@ -374,7 +374,7 @@ fail_union_operation (struct OperationState *eo) /** - * Derive the IBF key from a hash code and + * Derive the IBF key from a hash code and * a salt. * * @param src the hash code @@ -788,7 +788,7 @@ decode_and_send (struct OperationState *eo) prepare_ibf (eo, eo->remote_ibf->size); diff_ibf = ibf_dup (eo->local_ibf); ibf_subtract (diff_ibf, eo->remote_ibf); - + ibf_destroy (eo->remote_ibf); eo->remote_ibf = NULL; @@ -826,14 +826,14 @@ decode_and_send (struct OperationState *eo) next_order++; if (next_order <= MAX_IBF_ORDER) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "decoding failed, sending larger ibf (size %u)\n", 1<mq, ev); @@ -930,7 +930,7 @@ handle_p2p_ibf (void *cls, const struct GNUNET_MessageHeader *mh) fail_union_operation (eo); return; } - + ibf_read_slice (&msg[1], eo->ibf_buckets_received, buckets_in_message, eo->remote_ibf); eo->ibf_buckets_received += buckets_in_message; @@ -1080,7 +1080,7 @@ handle_p2p_element_requests (void *cls, const struct GNUNET_MessageHeader *mh) /** * Handle a done message from a remote peer - * + * * @param cls the union operation * @param mh the message */ @@ -1139,8 +1139,8 @@ union_evaluate (struct OperationSpecification *spec, eo->tunnel = tunnel; eo->mq = GNUNET_MESH_mq_create (tunnel); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "evaluating union operation, (app %s)\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "evaluating union operation, (app %s)\n", GNUNET_h2s (&eo->spec->app_id)); /* we started the operation, thus we have to send the operation request */ @@ -1201,10 +1201,10 @@ union_set_create (void) struct SetState *set_state; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "union set created\n"); - + set_state = GNUNET_new (struct SetState); set_state->se = strata_estimator_create (SE_STRATA_COUNT, - SE_IBF_SIZE, SE_IBF_HASH_NUM); + SE_IBF_SIZE, SE_IBF_HASH_NUM); return set_state; } 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, for (i = 0; i <= asize + bsize; i++) { res = ibf_decode (ibf_a, &side, &ibf_key); - if (GNUNET_SYSERR == res) + if (GNUNET_SYSERR == res) { printf ("decode failed, %u/%u elements left\n", 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, info1.id = "a"; info2.id = "b"; - + info1.sent = GNUNET_CONTAINER_multihashmap_create (num_a+1, GNUNET_NO); info2.sent = GNUNET_CONTAINER_multihashmap_create (num_b+1, GNUNET_NO); 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, /** * Write buckets from an ibf to a buffer. * Exactly (IBF_BUCKET_SIZE*ibf->size) bytes are written to buf. - * + * * @param ibf the ibf to write * @param start with which bucket to start * @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 /** * Write buckets from an ibf to a buffer. * Exactly (IBF_BUCKET_SIZE*ibf->size) bytes are written to buf. - * + * * @param ibf the ibf to write * @param start with which bucket to start * @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, /** * Wait for set operation requests for the given application id - * + * * @param cfg configuration to use for connecting to * the set service, needs to be valid for the lifetime of the listen handle * @param operation operation we want to listen for @@ -650,7 +650,7 @@ GNUNET_SET_listen_cancel (struct GNUNET_SET_ListenHandle *lh) * #GNUNET_SET_listen, as the 'struct GNUNET_SET_Request' becomes invalid * afterwards. * Call #GNUNET_SET_conclude to provide the local set to use for the operation, - * and to begin the exchange with the remote peer. + * and to begin the exchange with the remote peer. * * @param request request to accept * @param result_mode specified how results will be returned, @@ -729,7 +729,7 @@ GNUNET_SET_operation_cancel (struct GNUNET_SET_OperationHandle *oh) * set information and call the result callback with the * result information. * - * @param oh handle to the set operation + * @param oh handle to the set operation * @param set the set to use for the operation * @return #GNUNET_OK on success, #GNUNET_SYSERR if the * 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 () /** * Signature of the 'main' function for a (single-peer) testcase that * is run using 'GNUNET_TESTING_peer_run'. - * + * * @param cls closure * @param cfg configuration of the peer that was started * @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 () struct StatsEntry *pos; char *fn; struct GNUNET_BIO_WriteHandle *wh; - + uint16_t size; unsigned long long total; @@ -716,7 +716,7 @@ handle_watch (void *cls, struct GNUNET_SERVER_Client *client, /** * Actually perform the shutdown. */ -static void +static void do_shutdown () { struct WatchEntry *we; @@ -726,7 +726,7 @@ do_shutdown () return; save (); GNUNET_SERVER_notification_context_destroy (nc); - nc = NULL; + nc = NULL; GNUNET_assert (NULL == client_head); while (NULL != (se = start)) { 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) GNUNET_assert (GNUNET_OK == GNUNET_STATISTICS_watch_cancel (h, subsystem, name, &printer, h)); GNUNET_STATISTICS_destroy (h, GNUNET_NO); - h = NULL; + h = NULL; } @@ -248,16 +248,16 @@ main_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * * @param cls closure with our configuration * @param result #GNUNET_YES if the resolver is running - */ + */ static void -resolver_test_task (void *cls, +resolver_test_task (void *cls, int result) { struct GNUNET_CONFIGURATION_Handle *cfg = cls; if (GNUNET_YES != result) { - FPRINTF (stderr, + FPRINTF (stderr, _("Trying to connect to remote host, but service `%s' is not running\n"), "resolver"); return; } @@ -272,13 +272,13 @@ resolver_test_task (void *cls, } else if (65535 <= remote_port) { - FPRINTF (stderr, + FPRINTF (stderr, _("A port has to be between 1 and 65535 to connect to host `%s'\n"), remote_host); return; } /* Manipulate configuration */ - GNUNET_CONFIGURATION_set_value_string (cfg, + GNUNET_CONFIGURATION_set_value_string (cfg, "statistics", "UNIXPATH", ""); GNUNET_CONFIGURATION_set_value_string (cfg, "statistics", "HOSTNAME", remote_host); @@ -312,7 +312,7 @@ run (void *cls, char *const *args, const char *cfgfile, set_value = GNUNET_YES; } if (NULL != remote_host) - GNUNET_CLIENT_service_test ("resolver", cfg, GNUNET_TIME_UNIT_SECONDS, + GNUNET_CLIENT_service_test ("resolver", cfg, GNUNET_TIME_UNIT_SECONDS, &resolver_test_task, (void *) cfg); else 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) #if HAVE_MALLINFO { struct mallinfo mi; - + mi = mallinfo(); - current_heap_size = mi.uordblks + mi.fordblks; + current_heap_size = mi.uordblks + mi.fordblks; } -#endif +#endif #if HAVE_GETRUSAGE { struct rusage ru; @@ -289,7 +289,7 @@ update_memory_statistics (struct GNUNET_STATISTICS_Handle *h) if (0 == getrusage (RUSAGE_SELF, &ru)) { current_rss = 1024LL * ru.ru_maxrss; - } + } } #endif if (current_heap_size > h->peak_heap_size) @@ -381,12 +381,12 @@ static void do_disconnect (struct GNUNET_STATISTICS_Handle *h) { struct GNUNET_STATISTICS_GetHandle *c; - + if (NULL != h->th) { GNUNET_CLIENT_notify_transmit_ready_cancel (h->th); h->th = NULL; - } + } if (NULL != h->client) { GNUNET_CLIENT_disconnect (h->client); @@ -421,10 +421,10 @@ try_connect (struct GNUNET_STATISTICS_Handle *h) return GNUNET_NO; if (NULL != h->client) return GNUNET_YES; - h->client = GNUNET_CLIENT_connect ("statistics", h->cfg); + h->client = GNUNET_CLIENT_connect ("statistics", h->cfg); if (NULL != h->client) { - gn = h->action_head; + gn = h->action_head; while (NULL != (gh = gn)) { gn = gh->next; @@ -601,8 +601,8 @@ process_watch_value (struct GNUNET_STATISTICS_Handle *h, return GNUNET_SYSERR; } w = h->watches[wid]; - if (NULL == w) - return GNUNET_NO; + if (NULL == w) + return GNUNET_NO; (void) w->proc (w->proc_cls, w->subsystem, w->name, GNUNET_ntohll (wvm->value), 0 != (ntohl (wvm->flags) & GNUNET_STATISTICS_PERSIST_BIT)); @@ -674,7 +674,7 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg) else { h->receiving = GNUNET_NO; - } + } h->current = NULL; schedule_action (h); if (NULL != c->cont) @@ -686,7 +686,7 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg) { do_disconnect (h); reconnect_later (h); - return; + return; } /* finally, look for more! */ LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -697,12 +697,12 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg) h->backoff = GNUNET_TIME_UNIT_MILLISECONDS; return; case GNUNET_MESSAGE_TYPE_STATISTICS_WATCH_VALUE: - if (GNUNET_OK != + if (GNUNET_OK != (ret = process_watch_value (h, msg))) { do_disconnect (h); if (GNUNET_NO == ret) - h->backoff = GNUNET_TIME_UNIT_MILLISECONDS; + h->backoff = GNUNET_TIME_UNIT_MILLISECONDS; reconnect_later (h); return; } @@ -710,7 +710,7 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg) GNUNET_assert (h->watches_size > 0); GNUNET_CLIENT_receive (h->client, &receive_stats, h, GNUNET_TIME_UNIT_FOREVER_REL); - return; + return; default: GNUNET_break (0); do_disconnect (h); @@ -976,7 +976,7 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first) h->current = NULL; } } - next = h->action_head; + next = h->action_head; while (NULL != (pos = next)) { next = pos->next; @@ -1018,7 +1018,7 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first) for (i = 0; i < h->watches_size; i++) { if (NULL == h->watches[i]) - continue; + continue; GNUNET_free (h->watches[i]->subsystem); GNUNET_free (h->watches[i]->name); GNUNET_free (h->watches[i]); @@ -1232,7 +1232,7 @@ GNUNET_STATISTICS_watch (struct GNUNET_STATISTICS_Handle *handle, /** - * Stop watching statistics from the peer. + * Stop watching statistics from the peer. * * @param handle identification of the statistics service * @param subsystem limit to the specified subsystem, never NULL @@ -1264,9 +1264,9 @@ GNUNET_STATISTICS_watch_cancel (struct GNUNET_STATISTICS_Handle *handle, GNUNET_free (w->name); GNUNET_free (w->subsystem); GNUNET_free (w); - handle->watches[i] = NULL; + handle->watches[i] = NULL; return GNUNET_OK; - } + } } return GNUNET_SYSERR; } @@ -1305,7 +1305,7 @@ add_setter_action (struct GNUNET_STATISTICS_Handle *h, const char *name, for (ai = h->action_head; NULL != ai; ai = ai->next) { if (! ( (0 == strcmp (ai->subsystem, h->subsystem)) && - (0 == strcmp (ai->name, name)) && + (0 == strcmp (ai->name, name)) && ( (ACTION_UPDATE == ai->type) || (ACTION_SET == ai->type) ) ) ) continue; @@ -1351,7 +1351,7 @@ add_setter_action (struct GNUNET_STATISTICS_Handle *h, const char *name, } ai->timeout = GNUNET_TIME_relative_to_absolute (SET_TRANSMIT_TIMEOUT); ai->make_persistent = make_persistent; - return; + return; } /* no existing entry matches, create a fresh one */ 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[]) NULL); binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics"); proc = - GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, + GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary, "gnunet-service-statistics", "-c", "test_statistics_api_data.conf", NULL); @@ -169,7 +169,7 @@ main (int argc, char *argv_ign[]) ok = 1; /* restart to check persistence! */ proc = - GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, + GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary, "gnunet-service-statistics", "-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[]) binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics"); proc = - GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, + GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary, "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 @@ /** * @file statistics/test_statistics_api_watch.c * @brief testcase for statistics_api.c watch functions - * @author Christian Grothoff + * @author Christian Grothoff */ #include "platform.h" #include "gnunet_util_lib.h" @@ -119,7 +119,7 @@ main (int argc, char *argv_ign[]) }; struct GNUNET_OS_Process *proc; char *binary; - + binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics"); proc = 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 @@ /** * @file testbed/gnunet-daemon-testbed-blacklist.c * @brief daemon to restrict incoming connections from other peers at the - * transport layer of a peer - * @author Sree Harsha Totakura + * transport layer of a peer + * @author Sree Harsha Totakura */ #include "platform.h" @@ -143,7 +143,7 @@ static int check_access (void *cls, const struct GNUNET_PeerIdentity * pid) { int contains; - + if (NULL != map) contains = GNUNET_CONTAINER_multipeermap_contains (map, pid); else @@ -167,7 +167,7 @@ setup_ac (const char *fname, const struct GNUNET_CONFIGURATION_Handle *cfg) uint64_t fsize; unsigned int npeers; unsigned int cnt; - + GNUNET_assert (GNUNET_OK != GNUNET_DISK_file_size (fname, &fsize, GNUNET_NO, GNUNET_YES)); 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 @@ * gnunet-service-testbed. This binary also receives configuration * from the remove controller which is put in a temporary location * with ports and paths fixed so that gnunet-service-testbed runs - * without any hurdles. - * + * without any hurdles. + * * This helper monitors for three termination events. They are: (1)The * stdin of the helper is closed for reading; (2)the helper received * SIGTERM/SIGINT; (3)the testbed crashed. In case of events 1 and 2 @@ -161,13 +161,13 @@ static int status; static void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - LOG_DEBUG ("Shutting down\n"); + LOG_DEBUG ("Shutting down\n"); shutdown_task_id = GNUNET_SCHEDULER_NO_TASK; if (NULL != testbed) { LOG_DEBUG ("Killing testbed\n"); GNUNET_break (0 == GNUNET_OS_process_kill (testbed, SIGTERM)); - } + } if (GNUNET_SCHEDULER_NO_TASK != read_task_id) { GNUNET_SCHEDULER_cancel (read_task_id); @@ -194,7 +194,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (testbed)); GNUNET_OS_process_destroy (testbed); testbed = NULL; - } + } if (NULL != test_system) { GNUNET_TESTING_system_destroy (test_system, GNUNET_YES); @@ -291,7 +291,7 @@ child_death_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_break (0); return; } - GNUNET_break (GNUNET_SYSERR != + GNUNET_break (GNUNET_SYSERR != (ret = GNUNET_OS_process_status (testbed, &type, &code))); if (GNUNET_NO != ret) { @@ -456,7 +456,7 @@ tokenizer_cb (void *cls, void *client, wc->data = reply; write_task_id = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, stdout_fd, - &write_task, wc); + &write_task, wc); child_death_task_id = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_DISK_pipe_handle (sigpipe, @@ -534,7 +534,7 @@ run (void *cls, char *const *args, const char *cfgfile, read_task_id = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, stdin_fd, &read_task, NULL); - shutdown_task_id = + shutdown_task_id = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, NULL); } @@ -576,7 +576,7 @@ main (int argc, char **argv) int ret; status = GNUNET_OK; - if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, + if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO))) { 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 @@ * @file testbed/gnunet-service-test-barriers.c * @brief Daemon acting as a service for testing testbed barriers. It is * started as a peer service and waits for a barrier to be crossed. - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #include "platform.h" @@ -81,7 +81,7 @@ barrier_wait_cb (void *cls, const char *name, int status) * * @param cls NULL * @param tc scheduler task context - * @return + * @return */ static void do_wait (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) @@ -126,7 +126,7 @@ int main (int argc, char **argv) GNUNET_GETOPT_OPTION_END }; int ret; - + ret = GNUNET_PROGRAM_run (argc, argv, "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, GNUNET_CONFIGURATION_get_value_filename (cfg, "TESTBED-LOGGER", "DIR", &dir)) { - LOG (GNUNET_ERROR_TYPE_ERROR, "Not logging directory definied. Exiting\n"); + LOG (GNUNET_ERROR_TYPE_ERROR, "Not logging directory definied. Exiting\n"); GNUNET_SCHEDULER_shutdown (); return; } @@ -272,7 +272,7 @@ main (int argc, char *const *argv) { //sleep (15); /* Debugging */ return (GNUNET_OK == - GNUNET_SERVICE_run (argc, argv, "testbed-logger", + GNUNET_SERVICE_run (argc, argv, "testbed-logger", GNUNET_SERVICE_OPTION_NONE, &logger_run, NULL)) ? 0 : 1; } 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) (void) memcpy (&slist[n - 1], &ss, \ sizeof (struct GNUNET_TESTING_SharedService)); \ } while (0) - + slist = NULL; n = 0; ss.cfg = cfg; @@ -590,7 +590,7 @@ handle_add_host (void *cls, struct GNUNET_SERVER_Client *client, username_length = ntohs (msg->username_length); hostname_length = ntohs (msg->hostname_length); /* msg must contain hostname */ - if ((msize <= (sizeof (struct GNUNET_TESTBED_AddHostMessage) + + if ((msize <= (sizeof (struct GNUNET_TESTBED_AddHostMessage) + username_length)) || (0 == hostname_length)) { @@ -731,7 +731,7 @@ void GST_clear_fopcq () { struct ForwardedOperationContext *fopc; - + while (NULL != (fopc = fopcq_head)) { GNUNET_CONTAINER_DLL_remove (fopcq_head, fopcq_tail, fopc); @@ -747,7 +747,7 @@ GST_clear_fopcq () case OP_SHUTDOWN_PEERS: { struct HandlerContext_ShutdownPeers *hc = fopc->cls; - + GNUNET_assert (0 < hc->nslaves); hc->nslaves--; if (0 == hc->nslaves) @@ -901,9 +901,9 @@ testbed_run (void *cls, struct GNUNET_SERVER_Handle *server, sizeof (struct GNUNET_TESTBED_ShutdownPeersMessage)}, {&GST_handle_peer_reconfigure, NULL, GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER, 0}, - {&GST_handle_barrier_init, NULL, + {&GST_handle_barrier_init, NULL, GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT, 0}, - {&GST_handle_barrier_cancel, NULL, + {&GST_handle_barrier_cancel, NULL, GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL, 0}, {&GST_handle_barrier_status, NULL, 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 @@ /** * @file testbed/gnunet-service-testbed_barriers.c * @brief barrier handling at the testbed controller - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #include "gnunet-service-testbed.h" @@ -200,12 +200,12 @@ struct Barrier * Identifier for the timeout task */ GNUNET_SCHEDULER_TaskIdentifier tout_task; - + /** * The status of this barrier */ enum GNUNET_TESTBED_BarrierStatus status; - + /** * Number of barriers wrapped in the above DLL */ @@ -235,7 +235,7 @@ struct Barrier * Quorum percentage to be reached */ uint8_t quorum; - + }; @@ -261,7 +261,7 @@ static struct GNUNET_SERVICE_Context *ctx; * @param buf where the callee should write the message * @return number of bytes written to buf */ -static size_t +static size_t transmit_ready_cb (void *cls, size_t size, void *buf) { struct ClientCtx *ctx = cls; @@ -276,7 +276,7 @@ transmit_ready_cb (void *cls, size_t size, void *buf) { GNUNET_assert (NULL != ctx->client); GNUNET_SERVER_client_drop (ctx->client); - ctx->client = NULL; + ctx->client = NULL; return 0; } mq = ctx->mq_head; @@ -306,7 +306,7 @@ queue_message (struct ClientCtx *ctx, struct GNUNET_MessageHeader *msg) { struct MessageQueue *mq; struct GNUNET_SERVER_Client *client = ctx->client; - + mq = GNUNET_malloc (sizeof (struct MessageQueue)); mq->msg = msg; LOG_DEBUG ("Queueing message of type %u, size %u for sending\n", @@ -328,12 +328,12 @@ static void cleanup_clientctx (struct ClientCtx *ctx) { struct MessageQueue *mq; - + if (NULL != ctx->client) { GNUNET_SERVER_client_set_user_context_ (ctx->client, NULL, 0); GNUNET_SERVER_client_drop (ctx->client); - } + } if (NULL != ctx->tx) GNUNET_SERVER_notify_transmit_ready_cancel (ctx->tx); if (NULL != (mq = ctx->mq_head)) @@ -356,7 +356,7 @@ static void remove_barrier (struct Barrier *barrier) { struct ClientCtx *ctx; - + GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (barrier_map, &barrier->hash, barrier)); @@ -397,7 +397,7 @@ cancel_wrappers (struct Barrier *barrier) * @param name the barrier name * @param status the status of the barrier * @param emsg the error message; should be non-NULL for - * status=GNUNET_TESTBED_BARRIERSTATUS_ERROR + * status=GNUNET_TESTBED_BARRIERSTATUS_ERROR */ static void send_client_status_msg (struct GNUNET_SERVER_Client *client, @@ -431,7 +431,7 @@ send_client_status_msg (struct GNUNET_SERVER_Client *client, * * @param barrier the corresponding barrier * @param emsg the error message; should be non-NULL for - * status=GNUNET_TESTBED_BARRIERSTATUS_ERROR + * status=GNUNET_TESTBED_BARRIERSTATUS_ERROR */ static void send_barrier_status_msg (struct Barrier *barrier, const char *emsg) @@ -464,7 +464,7 @@ handle_barrier_wait (void *cls, struct GNUNET_SERVER_Client *client, struct GNUNET_HashCode key; size_t name_len; uint16_t msize; - + msize = ntohs (message->size); if (msize <= sizeof (struct GNUNET_TESTBED_BarrierWait)) { @@ -500,7 +500,7 @@ handle_barrier_wait (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_SERVER_client_keep (client); client_ctx->barrier = barrier; GNUNET_CONTAINER_DLL_insert_tail (barrier->head, barrier->tail, client_ctx); - GNUNET_SERVER_client_set_user_context (client, client_ctx); + GNUNET_SERVER_client_set_user_context (client, client_ctx); } barrier->nreached++; if ((barrier->num_wbarriers_reached == barrier->num_wbarriers) @@ -525,7 +525,7 @@ static void disconnect_cb (void *cls, struct GNUNET_SERVER_Client *client) { struct ClientCtx *client_ctx; - + if (NULL == client) return; client_ctx = GNUNET_SERVER_client_get_user_context (client, struct ClientCtx); @@ -554,7 +554,7 @@ GST_barriers_init (struct GNUNET_CONFIGURATION_Handle *cfg) GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN); srv = GNUNET_SERVICE_get_server (ctx); GNUNET_SERVER_add_handlers (srv, message_handlers); - GNUNET_SERVER_disconnect_notify (srv, &disconnect_cb, NULL); + GNUNET_SERVER_disconnect_notify (srv, &disconnect_cb, NULL); } @@ -568,7 +568,7 @@ GST_barriers_init (struct GNUNET_CONFIGURATION_Handle *cfg) * iterate, * #GNUNET_NO if not. */ -static int +static int barrier_destroy_iterator (void *cls, const struct GNUNET_HashCode *key, void *value) @@ -612,7 +612,7 @@ GST_barriers_destroy () * @param emsg if the status were to be GNUNET_SYSERR, this parameter has the * error messsage */ -static void +static void wbarrier_status_cb (void *cls, const char *name, struct GNUNET_TESTBED_Barrier *b_, enum GNUNET_TESTBED_BarrierStatus status, @@ -679,7 +679,7 @@ static void fwd_tout_barrier_init (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct Barrier *barrier = cls; - + cancel_wrappers (barrier); barrier->status = GNUNET_TESTBED_BARRIERSTATUS_ERROR; send_barrier_status_msg (barrier, @@ -713,7 +713,7 @@ GST_handle_barrier_init (void *cls, struct GNUNET_SERVER_Client *client, size_t name_len; unsigned int cnt; uint16_t msize; - + if (NULL == GST_context) { GNUNET_break_op (0); @@ -741,7 +741,7 @@ GST_handle_barrier_init (void *cls, struct GNUNET_SERVER_Client *client, LOG_DEBUG ("Received BARRIER_INIT for barrier `%s'\n", name); if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (barrier_map, &hash)) { - + send_client_status_msg (client, name, GNUNET_TESTBED_BARRIERSTATUS_ERROR, "A barrier with the same name already exists"); GNUNET_free (name); @@ -821,7 +821,7 @@ GST_handle_barrier_cancel (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_break_op (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); return; - } + } if (client != GST_context->client) { GNUNET_break_op (0); @@ -850,7 +850,7 @@ GST_handle_barrier_cancel (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_assert (NULL != barrier); cancel_wrappers (barrier); remove_barrier (barrier); - GNUNET_SERVER_receive_done (client, GNUNET_OK); + GNUNET_SERVER_receive_done (client, GNUNET_OK); } @@ -868,20 +868,20 @@ GST_handle_barrier_status (void *cls, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { const struct GNUNET_TESTBED_BarrierStatusMsg *msg; - struct Barrier *barrier; + struct Barrier *barrier; struct ClientCtx *client_ctx; const char *name; struct GNUNET_HashCode key; enum GNUNET_TESTBED_BarrierStatus status; uint16_t msize; uint16_t name_len; - + if (NULL == GST_context) { GNUNET_break_op (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); return; - } + } if (client != GST_context->client) { 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 @@ /** * @file testbed/gnunet-service-testbed_barriers.h * @brief Interface for the barrier initialisation handler routine - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #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) if (NULL != entry->transport_op) { GNUNET_TESTBED_operation_done (entry->transport_op); - entry->transport_op = NULL; + entry->transport_op = NULL; } if (NULL != entry->core_op) { @@ -610,7 +610,7 @@ oprelease_get_handle_transport (void *cls) * @param my_identity ID of this peer, NULL if we failed */ static void -core_startup_cb (void *cls, +core_startup_cb (void *cls, const struct GNUNET_PeerIdentity *my_identity) { struct CacheEntry *entry = cls; @@ -836,7 +836,7 @@ cache_clear_iterator (void *cls, const struct GNUNET_HashCode *key, void *value) GNUNET_assert (NULL != entry); GNUNET_break (0 == entry->demand); LOG_DEBUG ("Clearing entry %u of %u\n", ++ncleared, cache_size); - GNUNET_assert (GNUNET_YES == + GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (cache, key, value)); close_handles (entry); 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 @@ /** * @file testbed/gnunet-service-testbed_connectionpool.c * @brief connection pooling for connections to peers' services - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #include "gnunet-service-testbed.h" @@ -268,7 +268,7 @@ destroy_pooled_connection (struct PooledConnection *entry) if (entry->in_lru) GNUNET_CONTAINER_DLL_remove (head_lru, tail_lru, entry); if (entry->in_pool) - GNUNET_assert (GNUNET_OK == + GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap32_remove (map, entry->index, entry)); @@ -466,7 +466,7 @@ transport_peer_connect_notify_cb (void *cls, const struct GNUNET_PeerIdentity *peer) { struct PooledConnection *entry = cls; - + peer_connect_notify_cb (entry, peer, GST_CONNECTIONPOOL_SERVICE_TRANSPORT); } @@ -532,7 +532,7 @@ static void core_peer_connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer) { struct PooledConnection *entry = cls; - + peer_connect_notify_cb (entry, peer, GST_CONNECTIONPOOL_SERVICE_CORE); } @@ -550,7 +550,7 @@ core_peer_connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer) * @param my_identity ID of this peer, NULL if we failed */ static void -core_startup_cb (void *cls, +core_startup_cb (void *cls, const struct GNUNET_PeerIdentity *my_identity) { struct PooledConnection *entry = cls; @@ -642,9 +642,9 @@ cleanup_iterator (void *cls, void *value) { struct PooledConnection *entry = value; - + GNUNET_assert (NULL != entry); - GNUNET_assert (GNUNET_OK == + GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap32_remove (map, key, entry)); if (entry->in_lru) GNUNET_CONTAINER_DLL_remove (head_lru, tail_lru, entry); @@ -678,7 +678,7 @@ void GST_connection_pool_destroy () { struct PooledConnection *entry; - + if (NULL != map) { GNUNET_assert (GNUNET_SYSERR != @@ -776,7 +776,7 @@ GST_connection_pool_get_handle (unsigned int peer_id, { entry = GNUNET_new (struct PooledConnection); entry->index = peer_id32; - if ((NULL != map) + if ((NULL != map) && (GNUNET_CONTAINER_multihashmap32_size (map) < max_size)) { GNUNET_assert (GNUNET_OK == @@ -859,7 +859,7 @@ GST_connection_pool_get_handle_done (struct GST_ConnectionPool_GetHandle *gh) GNUNET_CONTAINER_DLL_remove (entry->head_notify, entry->head_notify, gh); GNUNET_free (gh); gh = NULL; - GNUNET_assert (!entry->in_lru); + GNUNET_assert (!entry->in_lru); if ( (!entry->in_pool) && (NULL != map) ) { if (GNUNET_YES == GNUNET_CONTAINER_multihashmap32_contains (map, @@ -871,8 +871,8 @@ GST_connection_pool_get_handle_done (struct GST_ConnectionPool_GetHandle *gh) destroy_pooled_connection (head_lru); GNUNET_CONTAINER_DLL_remove (head_not_pooled, tail_not_pooled, entry); GNUNET_assert (GNUNET_OK == - GNUNET_CONTAINER_multihashmap32_put (map, - entry->index, + GNUNET_CONTAINER_multihashmap32_put (map, + entry->index, entry, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 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 @@ /** * @file testbed/gnunet-service-testbed_connectionpool.h * @brief Interface for connection pooling subroutines - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ @@ -78,7 +78,7 @@ GST_connection_pool_destroy (); * @param peer_id the identity of the peer. Will be NULL if ch is NULL. In other * cases, its value being NULL means that CORE connection has failed. */ -typedef void +typedef void (*GST_connection_pool_connection_ready_cb) (void *cls, struct GNUNET_CORE_Handle * ch, 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 () kc = kstat_open (); if (kc == NULL) { - GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kstat_close"); + GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kstat_close"); goto ABORT_KSTAT; } @@ -633,7 +633,7 @@ get_nproc () nproc = 0; while (NULL != (ent = readdir (dir))) { - if((*ent->d_name > '0') && (*ent->d_name <= '9')) + if((*ent->d_name > '0') && (*ent->d_name <= '9')) nproc++; } closedir (dir); @@ -669,14 +669,14 @@ sample_load_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) now = GNUNET_TIME_absolute_get (); nbs = GNUNET_asprintf (&str, "%llu %d %d %u %u\n", now.abs_value_us / 1000LL / 1000LL, ld_cpu, ld_disk, mem_usage, nproc); - if (0 < nbs) + if (0 < nbs) { GNUNET_BIO_write (bw, str, nbs); } else GNUNET_break (0); GNUNET_free (str); - + reschedule: sample_load_task_id = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, @@ -696,7 +696,7 @@ GST_stats_init (const struct GNUNET_CONFIGURATION_Handle *cfg) char *stats_dir; char *fn; size_t len; - + #if MINGW GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Load statistics logging now available for windows\n"); @@ -716,7 +716,7 @@ GST_stats_init (const struct GNUNET_CONFIGURATION_Handle *cfg) GNUNET_free (hostname); return; } - fn = NULL; + fn = NULL; (void) GNUNET_asprintf (&fn, "%s/%.*s-%jd.dat", stats_dir, len, hostname, (intmax_t) getpid()); GNUNET_free (stats_dir); @@ -740,7 +740,7 @@ GST_stats_init (const struct GNUNET_CONFIGURATION_Handle *cfg) initMachCpuStats (); #endif updateUsage (); /* initialize */ - + } 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 * The id of the operation which created this context */ uint64_t operation_id; - + /** * should the slave controller start the delegated controller? */ @@ -186,7 +186,7 @@ struct Neighbour * The controller handle */ struct GNUNET_TESTBED_Controller *controller; - + /** * Operation handle for opening a lateral connection to another controller. * Will be NULL if the slave controller is started by this controller @@ -217,11 +217,11 @@ struct Neighbour * Is the conn_op inactivated? */ unsigned int inactive; - + /** * The id of the host this controller is running on */ - uint32_t host_id; + uint32_t host_id; }; @@ -256,7 +256,7 @@ struct NeighbourConnectCtxt * The neighbour to whom connection should be made */ struct Neighbour *n; - + /** * The client requesting the connection */ @@ -379,7 +379,7 @@ void GST_route_list_clear () { unsigned int id; - + for (id = 0; id < route_list_size; id++) if (NULL != route_list[id]) GNUNET_free (route_list[id]); @@ -437,7 +437,7 @@ kill_slave (struct Slave *slave) } if (NULL != slave->rhandle) GNUNET_TESTBED_cancel_registration (slave->rhandle); - GNUNET_assert (GNUNET_SYSERR != + GNUNET_assert (GNUNET_SYSERR != GNUNET_CONTAINER_multihashmap_iterate (slave->reghost_map, reghost_free_iterator, slave)); @@ -545,7 +545,7 @@ send_controller_link_response (struct GNUNET_SERVER_Client *client, struct GNUNET_TESTBED_ControllerLinkResponse *msg; char *xconfig; size_t config_size; - size_t xconfig_size; + size_t xconfig_size; uint16_t msize; GNUNET_assert ((NULL == cfg) || (NULL == emsg)); @@ -757,7 +757,7 @@ slave_event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) GNUNET_SCHEDULER_cancel (lcf->timeout_task); if (NULL == event->details.operation_finished.emsg) send_controller_link_response (lcf->client, lcf->operation_id, - GNUNET_TESTBED_host_get_cfg_ + GNUNET_TESTBED_host_get_cfg_ (GST_host_list[lcf->delegated_host_id]), NULL); else @@ -855,17 +855,17 @@ trigger_notifications (struct Neighbour *n); * @param tc scheduler task context */ static void -neighbour_connect_notify_task (void *cls, +neighbour_connect_notify_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct Neighbour *n = cls; struct NeighbourConnectNotification *h; GNUNET_assert (NULL != (h = n->nl_head)); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != n->notify_task); + GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != n->notify_task); n->notify_task = GNUNET_SCHEDULER_NO_TASK; GNUNET_assert (NULL != n->controller); - GNUNET_CONTAINER_DLL_remove (n->nl_head, n->nl_tail, h); + GNUNET_CONTAINER_DLL_remove (n->nl_head, n->nl_tail, h); trigger_notifications (n); h->cb (h->cb_cls, n->controller); GNUNET_free (h); @@ -889,7 +889,7 @@ trigger_notifications (struct Neighbour *n) if (NULL == n->controller) return; if (GNUNET_SCHEDULER_NO_TASK != n->notify_task) - return; + return; if (1 == n->inactive) { GNUNET_assert (0 == n->reference_cnt); @@ -897,7 +897,7 @@ trigger_notifications (struct Neighbour *n) n->inactive = 0; } n->reference_cnt++; - n->notify_task = + n->notify_task = GNUNET_SCHEDULER_add_now (&neighbour_connect_notify_task, n); } @@ -913,7 +913,7 @@ static void opstart_neighbour_conn (void *cls) { struct Neighbour *n = cls; - + GNUNET_assert (NULL != n->conn_op); GNUNET_assert (NULL == n->controller); 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) { struct Neighbour *n; int cleanup_task; - + n = h->n; cleanup_task = (h == n->nl_head) ? GNUNET_YES : GNUNET_NO; GNUNET_CONTAINER_DLL_remove (n->nl_head, n->nl_tail, h); @@ -1121,7 +1121,7 @@ GST_free_nccq () * @param tc the scheduler task context */ static void -timeout_neighbour_connect (void *cls, +timeout_neighbour_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct NeighbourConnectCtxt *ncc = cls; @@ -1233,7 +1233,7 @@ GST_handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client, struct Slave *slave; struct LinkControllersContext *lcc; - + if (1 != msg->is_subordinate) { struct Neighbour *n; @@ -1253,12 +1253,12 @@ GST_handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client, ncc->n = n; ncc->op_id = op_id; ncc->client = client; - GNUNET_SERVER_client_keep (client); + GNUNET_SERVER_client_keep (client); ncc->nh = GST_neighbour_get_connection (n, neighbour_connect_cb, ncc); ncc->timeout_task = GNUNET_SCHEDULER_add_delayed (GST_timeout, &timeout_neighbour_connect, ncc); - GNUNET_CONTAINER_DLL_insert_tail (ncc_head, ncc_tail, ncc); + GNUNET_CONTAINER_DLL_insert_tail (ncc_head, ncc_tail, ncc); GNUNET_SERVER_receive_done (client, GNUNET_OK); return; } @@ -1351,7 +1351,7 @@ GST_free_lcfq () { struct LCFContextQueue *lcfq; struct LCFContext *lcf; - + if (NULL != lcfq_head) { 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 * has to be made between local peers */ OCC_TYPE_LOCAL, - + /** * Type to be used when the first peer is local and the other peer is on a slave * controller started by us @@ -109,7 +109,7 @@ enum OverlayConnectContextType * contexts */ struct LocalPeer2Context -{ +{ /** * The handle for offering the HELLO of the first peer to the second * peer. @@ -128,20 +128,20 @@ struct LocalPeer2Context * contexts */ struct RemotePeer2Context -{ +{ /** * Controller of peer 2; If OCC_TYPE_REMOTE_LATERAL is the type of overlay * connection then this can be NULL until the connection to the controller is * established */ struct GNUNET_TESTBED_Controller *p2c; - + /** * Operation context for the suboperation we start to get the identity of the * second peer */ struct OperationContext *opc; - + /** * Notification handle acquire to connect to a remote controller. Only used * if the type of overlay connection is OCC_TYPE_REMOTE_LATERAL. @@ -152,7 +152,7 @@ struct RemotePeer2Context * The neighbour handle. Only used if the type of overlay connection is * OCC_TYPE_REMOTE_LATERAL. */ - struct Neighbour *p2n; + struct Neighbour *p2n; }; /** @@ -364,7 +364,7 @@ static struct RemoteOverlayConnectCtx *roccq_tail; void GST_cleanup_focc (struct ForwardedOverlayConnectContext *focc) { - GNUNET_SERVER_client_drop (focc->client); + GNUNET_SERVER_client_drop (focc->client); GNUNET_free_non_null (focc->orig_msg); GNUNET_free (focc); } @@ -535,7 +535,7 @@ cleanup_occ (struct OverlayConnectContext *occ) if (NULL != occ->cgh_p1th) GST_cache_get_handle_done (occ->cgh_p1th); GNUNET_assert (NULL != GST_peer_list); - GNUNET_assert (occ->peer->reference_cnt > 0); + GNUNET_assert (occ->peer->reference_cnt > 0); occ->peer->reference_cnt--; if (PEER_EXPIRED (occ->peer)) GST_destroy_peer (occ->peer); @@ -776,7 +776,7 @@ occ_hello_sent_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_free_non_null (occ->emsg); GNUNET_asprintf (&occ->emsg, "0x%llx: Timeout during TRANSPORT_try_connect() " - "at peer %4s", occ->op_id, + "at peer %4s", occ->op_id, GNUNET_i2s(&occ->other_peer_identity)); lp2c->tcc.pid = &occ->peer_identity; lp2c->tcc.op_id = occ->op_id; @@ -798,10 +798,10 @@ send_hello_thru_rocc (struct OverlayConnectContext *occ) char *other_peer_str; uint16_t msize; uint16_t hello_size; - + GNUNET_assert (OCC_TYPE_LOCAL != occ->type); GNUNET_assert (NULL != occ->hello); - other_peer_str = GNUNET_strdup (GNUNET_i2s (&occ->other_peer_identity)); + other_peer_str = GNUNET_strdup (GNUNET_i2s (&occ->other_peer_identity)); LOG_DEBUG ("0x%llx: Offering HELLO of %s (size: %u) to %s via Remote " "Overlay Request\n", occ->op_id, GNUNET_i2s (&occ->peer_identity), ntohs (occ->hello->size), @@ -848,7 +848,7 @@ send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) return; } lp2c = &occ->p2ctx.local; - other_peer_str = GNUNET_strdup (GNUNET_i2s (&occ->other_peer_identity)); + other_peer_str = GNUNET_strdup (GNUNET_i2s (&occ->other_peer_identity)); LOG_DEBUG ("0x%llx: Offering HELLO of %s to %s\n", occ->op_id, GNUNET_i2s (&occ->peer_identity), other_peer_str); GNUNET_free (other_peer_str); @@ -919,7 +919,7 @@ p2_transport_connect (struct OverlayConnectContext *occ) GNUNET_assert (NULL == occ->cgh_p1th); if (OCC_TYPE_LOCAL == occ->type) { - GNUNET_assert (NULL != (peer2 = GST_peer_list[occ->other_peer_id])); + GNUNET_assert (NULL != (peer2 = GST_peer_list[occ->other_peer_id])); occ->p2ctx.local.tcc.cgh_th = GST_cache_get_handle_transport (occ->other_peer_id, peer2->details.local.cfg, @@ -1145,7 +1145,7 @@ static void host_registration_comp (void *cls, const char *emsg) { struct RegisteredHostContext *rhc = cls; - + rhc->state = RHC_DONE; GST_process_next_focc (rhc); } @@ -1217,7 +1217,7 @@ register_host (struct Slave *slave, struct GNUNET_TESTBED_Host *host) { struct GNUNET_HashCode hash; struct RegisteredHostContext *rhc; - + rhc = GNUNET_malloc (sizeof (struct RegisteredHostContext)); rhc->reg_host = host; rhc->host = GST_host_list[slave->host_id]; @@ -1290,7 +1290,7 @@ forward_overlay_connect (const struct GNUNET_TESTBED_OverlayConnectMessage *msg, route_to_peer1_host = GST_find_dest_route (peer->details.remote.remote_host_id); GNUNET_assert (NULL != route_to_peer1_host); - if ((NULL != route_to_peer2_host) && + if ((NULL != route_to_peer2_host) && (route_to_peer1_host->dest == route_to_peer2_host->dest)) goto forward; /* 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, { GNUNET_break (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); - return; + return; } forward_overlay_connect (msg, client); GNUNET_SERVER_receive_done (client, GNUNET_OK); return; } p2n = NULL; - occ = GNUNET_malloc (sizeof (struct OverlayConnectContext)); + occ = GNUNET_malloc (sizeof (struct OverlayConnectContext)); occ->type = OCC_TYPE_LOCAL; if (!VALID_PEER_ID (p2)) /* May be peer2 is on a another controller */ - { + { if (NULL == (p2n = GST_get_neighbour (peer2_host_id))) { if (!VALID_HOST_ID (peer2_host_id)) @@ -1455,7 +1455,7 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client, occ->client = client; occ->other_peer_id = p2; GST_peer_list[p1]->reference_cnt++; - occ->peer = GST_peer_list[p1]; + occ->peer = GST_peer_list[p1]; occ->op_id = operation_id; GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == occ->timeout_task); occ->timeout_task = @@ -1466,7 +1466,7 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_asprintf (&occ->emsg, "0x%llx: Timeout while acquiring connection to peer %u's " "host: %u\n", occ->op_id, occ->other_peer_id, peer2_host_id); - occ->p2ctx.remote.ncn = + occ->p2ctx.remote.ncn = GST_neighbour_get_connection (p2n, &p2_controller_connect_cb, occ); break; 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 @@ /** * @file testbed/gnunet-service-testbed_peers.c * @brief implementation of TESTBED service that deals with peer management - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #include "gnunet-service-testbed.h" @@ -70,12 +70,12 @@ struct ManageServiceContext * The client which requested to manage the peer's service */ struct GNUNET_SERVER_Client *client; - + /** * The operation id of the associated request */ uint64_t op_id; - + /** * 1 if the service at the peer has to be started; 0 if it has to be stopped */ @@ -85,7 +85,7 @@ struct ManageServiceContext * Is this context expired? Do not work on this context if it is set to * GNUNET_YES */ - uint8_t expired; + uint8_t expired; }; @@ -343,7 +343,7 @@ GST_handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client, return; } if (UINT32_MAX == peer_id) - { + { GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id), "Cannot create peer with given ID"); GNUNET_SERVER_receive_done (client, GNUNET_OK); @@ -793,7 +793,7 @@ prc_stop_cb (void *cls, struct GNUNET_TESTING_Peer *p, int success) struct PeerReconfigureContext *prc = cls; struct Peer *peer; char *emsg; - + GNUNET_assert (VALID_PEER_ID (prc->peer_id)); peer = GST_peer_list [prc->peer_id]; GNUNET_assert (GNUNET_NO == peer->is_remote); @@ -815,13 +815,13 @@ prc_stop_cb (void *cls, struct GNUNET_TESTING_Peer *p, int success) } if (GNUNET_OK != start_peer (peer)) { - + GST_send_operation_fail_msg (prc->client, prc->op_id, "Failed to start reconfigured peer"); goto cleanup; } GST_send_operation_success_msg (prc->client, prc->op_id); - + cleanup: cleanup_prc (prc); return; @@ -849,7 +849,7 @@ GST_handle_peer_reconfigure (void *cls, struct GNUNET_SERVER_Client *client, uint64_t op_id; uint32_t peer_id; uint16_t msize; - + msize = ntohs (message->size); if (msize <= sizeof (struct GNUNET_TESTBED_PeerReconfigureMessage)) { @@ -907,7 +907,7 @@ GST_handle_peer_reconfigure (void *cls, struct GNUNET_SERVER_Client *client, cfg = GNUNET_TESTBED_extract_config_ (message); if (NULL == cfg) { - GNUNET_break (0); + GNUNET_break (0); GST_send_operation_fail_msg (client, op_id, "Compression error"); GNUNET_SERVER_receive_done (client, GNUNET_OK); return; @@ -916,7 +916,7 @@ GST_handle_peer_reconfigure (void *cls, struct GNUNET_SERVER_Client *client, prc->cfg = cfg; prc->peer_id = peer_id; prc->op_id = op_id; - prc->client = client; + prc->client = client; GNUNET_SERVER_client_keep (client); GNUNET_CONTAINER_DLL_insert_tail (prc_head, prc_tail, prc); 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) * @param result result of the operation */ static void -service_manage_result_cb (void *cls, - enum GNUNET_ARM_RequestStatus rs, +service_manage_result_cb (void *cls, + enum GNUNET_ARM_RequestStatus rs, const char *service, enum GNUNET_ARM_Result result) { struct ManageServiceContext *mctx = cls; @@ -1072,7 +1072,7 @@ service_manage_result_cb (void *cls, goto ret; } /* service started successfully */ - + ret: if (NULL != emsg) { @@ -1107,17 +1107,17 @@ GST_handle_manage_peer_service (void *cls, struct GNUNET_SERVER_Client *client, uint64_t op_id; uint32_t peer_id; uint16_t msize; - + msize = ntohs (message->size); if (msize <= sizeof (struct GNUNET_TESTBED_ManagePeerServiceMessage)) { - GNUNET_break_op (0); + GNUNET_break_op (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); return; } msg = (const struct GNUNET_TESTBED_ManagePeerServiceMessage *) message; - service = (const char *) &msg[1]; + service = (const char *) &msg[1]; if ('\0' != service[msize - sizeof (struct GNUNET_TESTBED_ManagePeerServiceMessage) - 1]) { @@ -1129,7 +1129,7 @@ GST_handle_manage_peer_service (void *cls, struct GNUNET_SERVER_Client *client, { GNUNET_break_op (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); - return; + return; } peer_id = ntohl (msg->peer_id); op_id = GNUNET_ntohll (msg->operation_id); @@ -1247,7 +1247,7 @@ GST_destroy_peers () { peer = GST_peer_list[id]; if (NULL == peer) - continue; + continue; if (GNUNET_NO == peer->is_remote) { if (GNUNET_YES == peer->details.local.is_running) @@ -1288,7 +1288,7 @@ shutdown_peers_timeout_cb (void *cls, GNUNET_free (hc); hc = NULL; } - GNUNET_TESTBED_forward_operation_msg_cancel_ (fo_ctxt->opc); + GNUNET_TESTBED_forward_operation_msg_cancel_ (fo_ctxt->opc); GNUNET_SERVER_client_drop (fo_ctxt->client); GNUNET_CONTAINER_DLL_remove (fopcq_head, fopcq_tail, fo_ctxt); GNUNET_free (fo_ctxt); @@ -1309,14 +1309,14 @@ shutdown_peers_reply_cb (void *cls, { struct ForwardedOperationContext *fo_ctxt = cls; struct HandlerContext_ShutdownPeers *hc; - + hc = fo_ctxt->cls; GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != fo_ctxt->timeout_task); GNUNET_SCHEDULER_cancel (fo_ctxt->timeout_task); fo_ctxt->timeout_task = GNUNET_SCHEDULER_NO_TASK; GNUNET_assert (0 < hc->nslaves); hc->nslaves--; - if (GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS != + if (GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS != ntohs (msg->type)) hc->timeout = GNUNET_YES; if (0 == hc->nslaves) @@ -1398,5 +1398,5 @@ GST_handle_shutdown_peers (void *cls, struct GNUNET_SERVER_Client *client, GST_send_operation_success_msg (client, op_id); GNUNET_free (hc); } - GNUNET_SERVER_receive_done (client, GNUNET_OK); + GNUNET_SERVER_receive_done (client, GNUNET_OK); } 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; /** * Name of the file with the hosts to run the test over (configuration option). * It will be NULL if ENABLE_LL is set - */ + */ static char *hosts_file; /** @@ -216,7 +216,7 @@ controller_event_cb (void *cls, * @param links_failed the number of overlay link */ static void -test_run (void *cls, +test_run (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, 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; static struct GNUNET_OS_Process *child; /** - * The arguments including the binary to spawn + * The arguments including the binary to spawn */ static char **argv2; @@ -79,7 +79,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) shutdown_task_id = GNUNET_SCHEDULER_NO_TASK; if (0 != child_exit_code) { - LOG (GNUNET_ERROR_TYPE_WARNING, "Child exited with error code: %lu\n", + LOG (GNUNET_ERROR_TYPE_WARNING, "Child exited with error code: %lu\n", child_exit_code); ret = 128 + (int) child_exit_code; } @@ -101,7 +101,7 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static int hard_kill; GNUNET_assert (NULL != child); - terminate_task_id = + terminate_task_id = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &terminate_task, NULL); if (0 != hard_kill) @@ -110,7 +110,7 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { case 1: case 2: - LOG (GNUNET_ERROR_TYPE_WARNING, + LOG (GNUNET_ERROR_TYPE_WARNING, "%d more interrupts needed to send SIGKILL to the child\n", 3 - hard_kill); hard_kill++; @@ -190,7 +190,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) char *hostname; size_t hostname_len; unsigned int nhosts; - + null_cfg = GNUNET_CONFIGURATION_create (); nhosts = GNUNET_TESTBED_hosts_load_from_loadleveler (null_cfg, &hosts); if (0 == nhosts) @@ -223,7 +223,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (NULL == tmpdir) tmpdir = getenv ("TMP"); if (NULL == tmpdir) - tmpdir = getenv ("TEMP"); + tmpdir = getenv ("TEMP"); if (NULL == tmpdir) tmpdir = "/tmp"; (void) GNUNET_asprintf (&fn, "%s/gnunet-testbed-spawn.lock", tmpdir); @@ -304,7 +304,7 @@ main (int argc, char *argv[]) GNUNET_break (0); return 1; } - if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, + if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO))) { GNUNET_break (0); @@ -321,7 +321,7 @@ main (int argc, char *argv[]) argv2 = GNUNET_malloc (sizeof (char *) * argc); for (cnt = 1; cnt < argc; cnt++) argv2[cnt - 1] = argv[cnt]; - GNUNET_SCHEDULER_run (run, NULL); + GNUNET_SCHEDULER_run (run, NULL); GNUNET_free (argv2); GNUNET_SIGNAL_handler_uninstall (shc_chld); 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 () { char buf[PATH_MAX]; char *out; - + out = getcwd (buf, PATH_MAX); (void) printf ("CWD: %s\n", out); 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 cp = NULL; FAIL_TEST (0, return); return; - } + } event_mask = 0; event_mask |= (1L << GNUNET_TESTBED_ET_PEER_START); 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 @@ /** * @file testbed/test_testbed_api_barriers.c * @brief testcase binary for testing testbed barriers API - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #include "platform.h" @@ -73,7 +73,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_TESTBED_barrier_cancel (barrier); barrier = NULL; } - + GNUNET_SCHEDULER_shutdown (); } @@ -99,7 +99,7 @@ barrier_cb (void *cls, const char *emsg) { static enum GNUNET_TESTBED_BarrierStatus old_status; - + GNUNET_assert (NULL == cls); GNUNET_assert (_barrier == barrier); switch (status) @@ -109,14 +109,14 @@ barrier_cb (void *cls, old_status = status; return; case GNUNET_TESTBED_BARRIERSTATUS_ERROR: - LOG (GNUNET_ERROR_TYPE_ERROR, "Barrier initialisation failed: %s", + LOG (GNUNET_ERROR_TYPE_ERROR, "Barrier initialisation failed: %s", (NULL == emsg) ? "unknown reason" : emsg); barrier = NULL; - GNUNET_SCHEDULER_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; case GNUNET_TESTBED_BARRIERSTATUS_CROSSED: LOG (GNUNET_ERROR_TYPE_INFO, "Barrier crossed\n"); - if (old_status == GNUNET_TESTBED_BARRIERSTATUS_INITIALISED) + if (old_status == GNUNET_TESTBED_BARRIERSTATUS_INITIALISED) result = GNUNET_OK; barrier = NULL; GNUNET_SCHEDULER_shutdown (); @@ -161,7 +161,7 @@ test_master (void *cls, &barrier_cb, NULL); shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply - (GNUNET_TIME_UNIT_SECONDS, + (GNUNET_TIME_UNIT_SECONDS, 10 * (NUM_PEERS + 1)), &do_shutdown, NULL); } @@ -181,7 +181,7 @@ main (int argc, char **argv) result = GNUNET_SYSERR; event_mask = 0; cfg = GNUNET_CONFIGURATION_create (); - GNUNET_assert (GNUNET_YES == + GNUNET_assert (GNUNET_YES == GNUNET_CONFIGURATION_parse (cfg, "test_testbed_api_barriers.conf.in")); if (NULL == getcwd (pwd, PATH_MAX)) @@ -191,7 +191,7 @@ main (int argc, char **argv) GNUNET_CONFIGURATION_set_value_string (cfg, "test-barriers","BINARY", binary); GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_write (cfg, "test_testbed_api_barriers.conf")); - GNUNET_CONFIGURATION_destroy (cfg); + GNUNET_CONFIGURATION_destroy (cfg); cfg = NULL; GNUNET_free (binary); 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, { if (cnt < 3) { - GNUNET_assert (0 == strcmp ("totakura", + GNUNET_assert (0 == strcmp ("totakura", GNUNET_TESTBED_host_get_username_ (hosts[cnt]))); GNUNET_assert (NULL != GNUNET_TESTBED_host_get_hostname (hosts[cnt])); @@ -126,7 +126,7 @@ run (void *cls, char *const *args, const char *cfgfile, } if (3 == cnt) { - GNUNET_assert (0 == strcmp ("totakura", + GNUNET_assert (0 == strcmp ("totakura", GNUNET_TESTBED_host_get_username_ (hosts[cnt]))); GNUNET_assert (NULL != GNUNET_TESTBED_host_get_hostname (hosts[cnt])); @@ -134,7 +134,7 @@ run (void *cls, char *const *args, const char *cfgfile, } if (4 == cnt) { - GNUNET_assert (0 == strcmp ("totakura", + GNUNET_assert (0 == strcmp ("totakura", GNUNET_TESTBED_host_get_username_ (hosts[cnt]))); 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) case TEST_OP4_STARTED: GNUNET_TESTBED_operation_release_ (op4); break; - case TEST_OP6_RELEASED: - op8 = GNUNET_TESTBED_operation_create_ (&op8, &start_cb, &release_cb); + case TEST_OP6_RELEASED: + op8 = GNUNET_TESTBED_operation_create_ (&op8, &start_cb, &release_cb); GNUNET_TESTBED_operation_queue_insert2_ (q1, op8, 2); GNUNET_TESTBED_operation_queue_insert2_ (q2, op8, 2); result = TEST_OP8_WAITING; @@ -311,13 +311,13 @@ step (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) case TEST_OP8_INACTIVE_1: GNUNET_TESTBED_operation_activate_ (op8); result = TEST_OP8_ACTIVE; - op9 = GNUNET_TESTBED_operation_create_ (&op9, &start_cb, &release_cb); + op9 = GNUNET_TESTBED_operation_create_ (&op9, &start_cb, &release_cb); GNUNET_TESTBED_operation_queue_insert2_ (q1, op9, 1); GNUNET_TESTBED_operation_queue_insert2_ (q2, op9, 1); GNUNET_TESTBED_operation_begin_wait_ (op9); step_task = GNUNET_SCHEDULER_add_delayed (STEP_DELAY, &step, NULL); break; - case TEST_OP8_ACTIVE: + case TEST_OP8_ACTIVE: GNUNET_TESTBED_operation_inactivate_ (op8); /* op8 should be released by now due to above call */ 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 @@ * @file testbed/test_testbed_api_peer_reconfiguration.c * @brief testcase for testing GNUNET_TESTBED_peer_manage_service() * implementation - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #include "platform.h" @@ -63,7 +63,7 @@ enum { * Peers have been started */ STATE_PEER_STARTED, - + /** * Peer has been reconfigured. Test completed successfully */ @@ -97,7 +97,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Aborting\n"); abort_task = GNUNET_SCHEDULER_NO_TASK; if (NULL != op) - { + { GNUNET_TESTBED_operation_done (op); op = NULL; } @@ -128,7 +128,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) fprintf (stderr, "Operation failed: %s\n", event->details.operation_finished.emsg); GNUNET_TESTBED_operation_done (op); - op = NULL; + op = NULL; FAIL_TEST (0, return); } GNUNET_TESTBED_operation_done (op); @@ -152,7 +152,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) * failed */ static void -test_master (void *cls, +test_master (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, 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 @@ * @file testbed/test_testbed_api_peers_manage_services.c * @brief testcase for testing GNUNET_TESTBED_peer_manage_service() * implementation - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #include "platform.h" @@ -68,7 +68,7 @@ enum { * Peers have been started */ STATE_PEERS_STARTED, - + /** * statistics service went down */ @@ -111,7 +111,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Aborting\n"); abort_task = GNUNET_SCHEDULER_NO_TASK; if (NULL != op) - { + { GNUNET_TESTBED_operation_done (op); op = NULL; } 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 @@ /** * @file testbed/testbed_api_sd.c * @brief test cases for calculating standard deviation - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #include "platform.h" @@ -58,7 +58,7 @@ run (void *cls, char *const *args, const char *cfgfile, ret = 1; goto err; } - GNUNET_TESTBED_SD_add_data_ (h, 30); + GNUNET_TESTBED_SD_add_data_ (h, 30); if (GNUNET_SYSERR == GNUNET_TESTBED_SD_deviation_factor_ (h, 80, &sd)) { 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 @@ /** * @file testbed/test_testbed_api_statistics.c * @brief testcase for testing GNUNET_TESTBED_get_statistics() implementation - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #include "platform.h" @@ -95,7 +95,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Test timed out -- Aborting\n"); abort_task = GNUNET_SCHEDULER_NO_TASK; if (NULL != op) - { + { GNUNET_TESTBED_operation_done (op); op = NULL; } @@ -121,12 +121,12 @@ stats_iterator (void *cls, int is_persistent) { unsigned int cnt; - + FAIL_TEST (cls == dummy_cls, return GNUNET_SYSERR); for (cnt = 0; cnt < num_seen_peers; cnt++) FAIL_TEST (peer != seen_peers[cnt], return GNUNET_SYSERR); FAIL_TEST (NULL != subsystem, return GNUNET_SYSERR); - FAIL_TEST (NULL != name, return GNUNET_SYSERR); + FAIL_TEST (NULL != name, return GNUNET_SYSERR); GNUNET_array_append (seen_peers, num_seen_peers, (struct GNUNET_TESTBED_Peer *) peer); return GNUNET_SYSERR; @@ -151,7 +151,7 @@ op_comp_cb (void *cls, GNUNET_TESTBED_operation_done (op); op = NULL; GNUNET_SCHEDULER_cancel (abort_task); - GNUNET_SCHEDULER_shutdown (); + GNUNET_SCHEDULER_shutdown (); } 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) * failed */ static void -test_master (void *cls, +test_master (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, 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, if ((BSIZE * 2) != fs) /* The file size should be equal to what we have written */ goto iteration_cont; - + cancel = GNUNET_YES; result = GNUNET_OK; - + iteration_cont: - if ( (NULL != di) && + if ( (NULL != di) && (GNUNET_YES == GNUNET_DISK_directory_iterator_next (di, cancel)) ) return; shutdown_now (); @@ -193,7 +193,7 @@ do_write (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /** * Signature of the 'main' function for a (single-peer) testcase that * is run using 'GNUNET_TESTING_peer_run'. - * + * * @param cls closure * @param cfg configuration of the peer that was started * @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 */ struct GNUNET_TESTBED_ControllerLinkResponse { - + /** * Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT */ @@ -453,7 +453,7 @@ struct GNUNET_TESTBED_RemoteOverlayConnectMessage /** * To be followed by the HELLO message of A */ - struct GNUNET_MessageHeader hello[0]; + struct GNUNET_MessageHeader hello[0]; // FIXME: we usually do not use this gcc-hack as some // compilers / tools really get messed up by it... @@ -763,7 +763,7 @@ struct GNUNET_TESTBED_ManagePeerServiceMessage * set this to 1 to start the service; 0 to stop the service */ uint8_t start; - + /** * The NULL-terminated name of the service to start/stop follows here */ @@ -830,7 +830,7 @@ struct GNUNET_TESTBED_BarrierStatusMsg * Type is GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS */ struct GNUNET_MessageHeader header; - + /** * status. Use enumerated values of enum BarrierStatus */ @@ -840,7 +840,7 @@ struct GNUNET_TESTBED_BarrierStatusMsg * strlen of the barrier name */ uint16_t name_len GNUNET_PACKED; - + /** * the barrier name (NULL terminated) concatenated with an error message (NULL * 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) entry = GNUNET_malloc (sizeof (struct ExpireOperationEntry)); entry->op = op; - GNUNET_CONTAINER_DLL_insert_tail (exop_head, exop_tail, entry); + GNUNET_CONTAINER_DLL_insert_tail (exop_head, exop_tail, entry); } @@ -281,7 +281,7 @@ opc_search_iterator (void *cls, uint32_t key, void *value) { struct SearchContext *sc = cls; struct OperationContext *opc = value; - + GNUNET_assert (NULL != opc); GNUNET_assert (NULL == sc->opc); if (opc->id != sc->id) @@ -307,7 +307,7 @@ find_opc (const struct GNUNET_TESTBED_Controller *c, const uint64_t id) sc.id = id; sc.opc = NULL; GNUNET_assert (NULL != c->opc_map); - if (GNUNET_SYSERR != + if (GNUNET_SYSERR != GNUNET_CONTAINER_multihashmap32_get_multiple (c->opc_map, (uint32_t) id, &opc_search_iterator, &sc)) return NULL; @@ -330,7 +330,7 @@ GNUNET_TESTBED_insert_opc_ (struct GNUNET_TESTBED_Controller *c, if (NULL == c->opc_map) c->opc_map = GNUNET_CONTAINER_multihashmap32_create (256); GNUNET_assert (GNUNET_OK == - GNUNET_CONTAINER_multihashmap32_put (c->opc_map, + GNUNET_CONTAINER_multihashmap32_put (c->opc_map, (uint32_t) opc->id, opc, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); } @@ -341,7 +341,7 @@ GNUNET_TESTBED_insert_opc_ (struct GNUNET_TESTBED_Controller *c, * given controller * * @param c the controller - * @param opc the operation context to remove + * @param opc the operation context to remove */ void GNUNET_TESTBED_remove_opc_ (const struct GNUNET_TESTBED_Controller *c, @@ -465,7 +465,7 @@ handle_opsuccess (struct GNUNET_TESTBED_Controller *c, } GNUNET_TESTBED_remove_opc_ (opc->c, opc); opc->state = OPC_STATE_FINISHED; - exop_insert (event.op); + exop_insert (event.op); if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED))) { if (NULL != c->cc) @@ -611,7 +611,7 @@ handle_peer_event (struct GNUNET_TESTBED_Controller *c, if (0 != (mask & c->event_mask)) { if (NULL != c->cc) - c->cc (c->cc_cls, &event); + c->cc (c->cc_cls, &event); if (GNUNET_NO == exop_check (event.op)) return GNUNET_YES; } @@ -689,7 +689,7 @@ handle_peer_conevent (struct GNUNET_TESTBED_Controller *c, c->cc (c->cc_cls, &event); if (GNUNET_NO == exop_check (event.op)) return GNUNET_YES; - } + } if (NULL != cb) cb (cb_cls, opc->op, NULL); /* You could have marked the operation as done by now */ @@ -738,12 +738,12 @@ handle_peer_config (struct GNUNET_TESTBED_Controller *c, GNUNET_assert (NULL != peer); GNUNET_assert (ntohl (msg->peer_id) == peer->unique_id); pinfo = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerInformation)); - pinfo->pit = data->pit; + pinfo->pit = data->pit; cb = data->cb; cb_cls = data->cb_cls; GNUNET_assert (NULL != cb); GNUNET_free (data); - opc->data = NULL; + opc->data = NULL; switch (pinfo->pit) { case GNUNET_TESTBED_PIT_IDENTITY: @@ -760,7 +760,7 @@ handle_peer_config (struct GNUNET_TESTBED_Controller *c, break; } opc->data = pinfo; - GNUNET_TESTBED_remove_opc_ (opc->c, opc); + GNUNET_TESTBED_remove_opc_ (opc->c, opc); opc->state = OPC_STATE_FINISHED; cb (cb_cls, opc->op, pinfo, NULL); /* 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, case OP_FORWARDED: GNUNET_assert (0); case OP_LINK_CONTROLLERS: /* No secondary callback */ - break; + break; case OP_SHUTDOWN_PEERS: { struct ShutdownPeersData *data; @@ -1156,7 +1156,7 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg) msg); break; case GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT: - status = + status = handle_link_controllers_result (c, (const struct GNUNET_TESTBED_ControllerLinkResponse @@ -1365,7 +1365,7 @@ oprelease_link_controllers (void *cls) switch (opc->state) { case OPC_STATE_INIT: - GNUNET_free (data->msg); + GNUNET_free (data->msg); break; case OPC_STATE_STARTED: GNUNET_TESTBED_remove_opc_ (opc->c, opc); @@ -1543,7 +1543,7 @@ opc_free_iterator (void *cls, uint32_t key, void *value) GNUNET_assert (NULL != opc); GNUNET_break (0); - GNUNET_assert (GNUNET_YES == + GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap32_remove (map, key, value)); GNUNET_free (opc); return GNUNET_YES; @@ -1638,7 +1638,7 @@ GNUNET_TESTBED_compress_cfg_ (const struct GNUNET_CONFIGURATION_Handle *cfg, char *xconfig; size_t size_; size_t xsize_; - + config = GNUNET_CONFIGURATION_serialize (cfg, &size_); xsize_ = GNUNET_TESTBED_compress_config_ (config, size_, &xconfig); GNUNET_free (config); @@ -1689,7 +1689,7 @@ GNUNET_TESTBED_controller_link (void *op_cls, uint32_t slave_host_id; uint32_t delegated_host_id; uint16_t msg_size; - + GNUNET_assert (GNUNET_YES == GNUNET_TESTBED_is_host_registered_ (delegated_host, master)); slave_host_id = @@ -1875,7 +1875,7 @@ GNUNET_TESTBED_create_helper_init_msg_ (const char *trusted_ip, * cancels the operation, frees its resources and ensures the no event is * generated with respect to this operation. Note that however cancelling an * operation does NOT guarantee that the operation will be fully undone (or that - * nothing ever happened). + * nothing ever happened). * * This function MUST be called for every operation to fully remove the * operation from the operation queue. After calling this function, if @@ -1949,11 +1949,11 @@ GNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg) { const struct GNUNET_TESTBED_AddHostMessage *imsg; uint16_t osize; - + imsg = (const struct GNUNET_TESTBED_AddHostMessage *) msg; data_len = (uLong) ntohs (imsg->config_size); osize = sizeof (struct GNUNET_TESTBED_AddHostMessage) + - ntohs (imsg->username_length) + ntohs (imsg->hostname_length); + ntohs (imsg->username_length) + ntohs (imsg->hostname_length); xdata_len = ntohs (imsg->header.size) - osize; xdata = (const Bytef *) ((const void *) imsg + osize); } @@ -1961,10 +1961,10 @@ GNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg) case GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT: { const struct GNUNET_TESTBED_ControllerLinkResponse *imsg; - + imsg = (const struct GNUNET_TESTBED_ControllerLinkResponse *) msg; data_len = ntohs (imsg->config_size); - xdata_len = ntohs (imsg->header.size) - + xdata_len = ntohs (imsg->header.size) - sizeof (const struct GNUNET_TESTBED_ControllerLinkResponse); xdata = (const Bytef *) &imsg[1]; } @@ -2077,7 +2077,7 @@ opstart_shutdown_peers (void *cls) opc->state = OPC_STATE_STARTED; msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_ShutdownPeersMessage)); - msg->header.size = + msg->header.size = htons (sizeof (struct GNUNET_TESTBED_ShutdownPeersMessage)); msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS); msg->operation_id = GNUNET_htonll (opc->id); @@ -2146,7 +2146,7 @@ GNUNET_TESTBED_shutdown_peers (struct GNUNET_TESTBED_Controller *c, opc->data = data; opc->id = GNUNET_TESTBED_get_next_op_id (c); opc->type = OP_SHUTDOWN_PEERS; - opc->state = OPC_STATE_INIT; + opc->state = OPC_STATE_INIT; opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_shutdown_peers, &oprelease_shutdown_peers); 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 OP_GET_SLAVE_CONFIG, /** - * Stop and destroy all peers + * Stop and destroy all peers */ OP_SHUTDOWN_PEERS, @@ -320,7 +320,7 @@ GNUNET_TESTBED_insert_opc_ (struct GNUNET_TESTBED_Controller *c, * given controller * * @param c the controller - * @param opc the operation context to remove + * @param opc the operation context to remove */ void GNUNET_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 @@ /** * @file testbed/testbed_api_barriers.c * @brief API implementation for testbed barriers - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #include "platform.h" @@ -55,7 +55,7 @@ struct GNUNET_TESTBED_Barrier * The controller handle given while initiliasing this barrier */ struct GNUNET_TESTBED_Controller *c; - + /** * The name of the barrier */ @@ -70,7 +70,7 @@ struct GNUNET_TESTBED_Barrier * the closure for the above callback */ void *cls; - + /** * Should the barrier crossed status message be echoed back to the controller? */ @@ -125,15 +125,15 @@ GNUNET_TESTBED_handle_barrier_status_ (struct GNUNET_TESTBED_Controller *c, struct GNUNET_TESTBED_Barrier *barrier; char *emsg; const char *name; - struct GNUNET_HashCode key; + struct GNUNET_HashCode key; size_t emsg_len; int status; uint16_t msize; uint16_t name_len; - + emsg = NULL; barrier = NULL; - msize = ntohs (msg->header.size); + msize = ntohs (msg->header.size); name = msg->data; name_len = ntohs (msg->name_len); LOG_DEBUG ("Received BARRIER_STATUS msg\n"); @@ -219,7 +219,7 @@ GNUNET_TESTBED_barrier_init_ (struct GNUNET_TESTBED_Controller *controller, struct GNUNET_HashCode key; size_t name_len; uint16_t msize; - + GNUNET_assert (quorum <= 100); GNUNET_assert (NULL != cb); name_len = strlen (name); @@ -310,11 +310,11 @@ struct GNUNET_TESTBED_BarrierWaitHandle * The name of the barrier */ char *name; - + /** * Then configuration used for the client connection */ - struct GNUNET_CONFIGURATION_Handle *cfg; + struct GNUNET_CONFIGURATION_Handle *cfg; /** * The client connection @@ -376,7 +376,7 @@ receive_handler (void *cls, const struct GNUNET_MessageHeader *message) struct GNUNET_TESTBED_BarrierWaitHandle *h = cls; const struct GNUNET_TESTBED_BarrierStatusMsg *msg; uint16_t msize; - + if (NULL == message) { GNUNET_break_op (0); @@ -386,13 +386,13 @@ receive_handler (void *cls, const struct GNUNET_MessageHeader *message) { GNUNET_break_op (0); goto fail; - } + } msize = ntohs (message->size); if (msize <= sizeof (struct GNUNET_TESTBED_BarrierStatusMsg)) { GNUNET_break_op (0); goto fail; - } + } msg = (const struct GNUNET_TESTBED_BarrierStatusMsg *) message; switch (ntohs (msg->status)) { @@ -432,7 +432,7 @@ transmit_notify (void *cls, size_t size, void *buf) { struct GNUNET_TESTBED_BarrierWaitHandle *h = cls; uint16_t msize; - + h->tx = NULL; if ((0 == size) || (NULL == buf)) { @@ -507,7 +507,7 @@ GNUNET_TESTBED_barrier_wait (const char *name, msg->header.size = htons (msize); (void) memcpy (msg->name, name, name_len); h->msg = &msg->header; - h->tx = + h->tx = GNUNET_CLIENT_notify_transmit_ready (h->conn, msize, GNUNET_TIME_UNIT_FOREVER_REL, 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 @@ * @file testbed/testbed_api_barriers.h * @brief interface for barriers API function that are used internally (not * exposed as user API) - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #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, */ struct GNUNET_TESTBED_Host * GNUNET_TESTBED_host_create_with_id (uint32_t id, const char *hostname, - const char *username, + const char *username, const struct GNUNET_CONFIGURATION_Handle *cfg, uint16_t port) @@ -338,7 +338,7 @@ GNUNET_TESTBED_host_create_with_id (uint32_t id, const char *hostname, host->port = (0 == port) ? 22 : port; host->cfg = GNUNET_CONFIGURATION_dup (cfg); host->opq_parallel_overlay_connect_operations = - GNUNET_TESTBED_operation_queue_create_ (OPERATION_QUEUE_TYPE_ADAPTIVE, + GNUNET_TESTBED_operation_queue_create_ (OPERATION_QUEUE_TYPE_ADAPTIVE, UINT_MAX); new_size = host_list_size; while (id >= new_size) @@ -371,7 +371,7 @@ GNUNET_TESTBED_host_create (const char *hostname, const char *username, static uint32_t uid_generator; if (NULL == hostname) - return GNUNET_TESTBED_host_create_with_id (0, hostname, username, + return GNUNET_TESTBED_host_create_with_id (0, hostname, username, cfg, port); return GNUNET_TESTBED_host_create_with_id (++uid_generator, hostname, username, cfg, port); @@ -398,7 +398,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, //struct GNUNET_TESTBED_Host **host_array; struct GNUNET_TESTBED_Host *starting_host; char *data; - char *buf; + char *buf; char *username; char *hostname; regex_t rex; @@ -417,12 +417,12 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, } if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES)) - fs = 0; + fs = 0; if (0 == fs) { LOG (GNUNET_ERROR_TYPE_WARNING, _("Hosts file %s has no data\n"), filename); return 0; - } + } data = GNUNET_malloc (fs); if (fs != GNUNET_DISK_fn_read (filename, data, fs)) { @@ -440,9 +440,9 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, "^(([[:alnum:]]+)@)?" /* username */ "([[:alnum:]]+[-[:alnum:]_\\.]+)" /* hostname */ "(:([[:digit:]]{1,5}))?", /* port */ - REG_EXTENDED | REG_ICASE)); + REG_EXTENDED | REG_ICASE)); while (offset < (fs - 1)) - { + { offset++; if (((data[offset] == '\n')) && (buf != &data[offset])) { @@ -469,7 +469,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, } if (-1 != pmatch[5].rm_so) { - (void) SSCANF (buf + pmatch[5].rm_so, "%5hd", &port); + (void) SSCANF (buf + pmatch[5].rm_so, "%5hd", &port); } size = pmatch[3].rm_eo - pmatch[3].rm_so; hostname = GNUNET_malloc (size + 1); @@ -489,7 +489,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, (void) GNUNET_TESTBED_host_create (hostname, username, cfg, port); count++; GNUNET_free_non_null (username); - GNUNET_free (hostname); + GNUNET_free (hostname); buf = &data[offset + 1]; } else if ((data[offset] == '\n') || (data[offset] == '\0')) @@ -516,7 +516,7 @@ const char * simple_resolve (const char *host) { struct addrinfo *res; - const struct sockaddr_in *in_addr; + const struct sockaddr_in *in_addr; char *hostip; struct addrinfo hint; unsigned int rc; @@ -566,13 +566,13 @@ GNUNET_TESTBED_hosts_load_from_loadleveler (const struct struct GNUNET_TESTBED_Host ***hosts) { #if !ENABLE_LL - LOG (GNUNET_ERROR_TYPE_ERROR, + LOG (GNUNET_ERROR_TYPE_ERROR, _("The function %s is only available when compiled with (--with-ll)\n"), __func__); GNUNET_assert (0); #else const char *hostfile; - + if (NULL == (hostfile = getenv ("MP_SAVEHOSTFILE"))) { GNUNET_break (0); @@ -930,7 +930,7 @@ gen_rsh_suffix_args (const char * const *append_args) } if (NULL != append_args) { - for (append_cnt = 0; NULL != append_args[append_cnt]; append_cnt++) + for (append_cnt = 0; NULL != append_args[append_cnt]; append_cnt++) GNUNET_array_append (rshell_args, cnt, GNUNET_strdup (append_args[append_cnt])); } GNUNET_array_append (rshell_args, cnt, NULL); @@ -1070,7 +1070,7 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip, static char *const binary_argv[] = { HELPER_TESTBED_BINARY, NULL }; - + GNUNET_assert (NULL != host); GNUNET_assert (NULL != (cfg = GNUNET_TESTBED_host_get_cfg_ (host))); hostname = NULL; @@ -1118,7 +1118,7 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip, argstr = GNUNET_strdup (""); for (cnt = 0; NULL != cp->helper_argv[cnt]; cnt++) { - aux = argstr; + aux = argstr; GNUNET_assert (0 < GNUNET_asprintf (&argstr, "%s %s", aux, cp->helper_argv[cnt])); GNUNET_free (aux); } @@ -1334,7 +1334,7 @@ GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host, "HELPER_BINARY_PATH", &stat_args[1])) stat_args[1] = - GNUNET_OS_get_libexec_binary_path (HELPER_TESTBED_BINARY); + GNUNET_OS_get_libexec_binary_path (HELPER_TESTBED_BINARY); GNUNET_asprintf (&port, "%u", host->port); rsh_args = gen_rsh_args (port, hostname, host->username); GNUNET_free (port); @@ -1523,12 +1523,12 @@ GNUNET_TESTBED_cancel_registration (struct GNUNET_TESTBED_HostRegistrationHandle * * @param h the host handle * @param op the operation to queue in the given host's parally overlay connect - * queue + * queue */ void -GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h, +GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h, struct GNUNET_TESTBED_Operation *op) -{ +{ GNUNET_TESTBED_operation_queue_insert_ (h->opq_parallel_overlay_connect_operations, op); } 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, * * @param h the host handle * @param op the operation to queue in the given host's parally overlay connect - * queue + * queue */ void -GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h, +GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h, struct GNUNET_TESTBED_Operation *op); 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 * Head for DLL of time slots which are free to be allocated to operations */ struct TimeSlot *alloc_head; - + /** * Tail for DLL of time slots which are free to be allocated to operations */ @@ -131,7 +131,7 @@ struct FeedbackCtx * Number of time slots filled so far */ unsigned int tslots_filled; - + /** * Bound on the maximum number of operations which can be active */ @@ -267,7 +267,7 @@ struct ReadyQueueEntry * next ptr for DLL */ struct ReadyQueueEntry *next; - + /** * prev ptr for DLL */ @@ -407,7 +407,7 @@ remove_queue_entry (struct GNUNET_TESTBED_Operation *op, unsigned int index) { struct OperationQueue *opq; struct QueueEntry *entry; - + opq = op->queues[index]; entry = op->qentries[index]; switch (op->state) @@ -445,7 +445,7 @@ change_state (struct GNUNET_TESTBED_Operation *op, enum OperationState state) struct OperationQueue *opq; unsigned int cnt; unsigned int s; - + GNUNET_assert (OP_STATE_INIT != state); GNUNET_assert (NULL != op->queues); GNUNET_assert (NULL != op->nres); @@ -459,7 +459,7 @@ change_state (struct GNUNET_TESTBED_Operation *op, enum OperationState state) entry->op = op; entry->nres = op->nres[cnt]; s = cnt; - GNUNET_array_append (op->qentries, s, entry); + GNUNET_array_append (op->qentries, s, entry); } else { @@ -498,7 +498,7 @@ change_state (struct GNUNET_TESTBED_Operation *op, enum OperationState state) */ static void rq_remove (struct GNUNET_TESTBED_Operation *op) -{ +{ GNUNET_assert (NULL != op->rq_entry); GNUNET_CONTAINER_DLL_remove (rq_head, rq_tail, op->rq_entry); GNUNET_free (op->rq_entry); @@ -650,7 +650,7 @@ decide_capacity (struct OperationQueue *opq, } ret: - GNUNET_free_non_null (evict_entries); + GNUNET_free_non_null (evict_entries); if (NULL != ops_) *ops_ = ops; else @@ -680,12 +680,12 @@ merge_ops (struct GNUNET_TESTBED_Operation ***old, unsigned int i; unsigned int j; unsigned int n_cur; - + GNUNET_assert (NULL != old); n_cur = *n_old; cur = *old; for (i = 0; i < n_new; i++) - { + { for (j = 0; j < *n_old; j++) { if (new[i] == cur[j]) @@ -698,7 +698,7 @@ merge_ops (struct GNUNET_TESTBED_Operation ***old, *old = cur; *n_old = n_cur; } - + /** @@ -732,12 +732,12 @@ check_readiness (struct GNUNET_TESTBED_Operation *op) if (NULL == ops) continue; merge_ops (&evict_ops, &n_evict_ops, ops, n_ops); - GNUNET_free (ops); + GNUNET_free (ops); } if (NULL != evict_ops) { for (i = 0; i < n_evict_ops; i++) - GNUNET_TESTBED_operation_release_ (evict_ops[i]); + GNUNET_TESTBED_operation_release_ (evict_ops[i]); GNUNET_free (evict_ops); evict_ops = NULL; /* Evicting the operations should schedule this operation */ @@ -767,7 +767,7 @@ defer (struct GNUNET_TESTBED_Operation *op) for (i = 0; i < op->nqueues; i++) { GNUNET_assert (op->queues[i]->active >= op->nres[i]); - op->queues[i]->active -= op->nres[i]; + op->queues[i]->active -= op->nres[i]; } change_state (op, OP_STATE_WAITING); } @@ -809,7 +809,7 @@ cleanup_tslots (struct OperationQueue *queue) * Cleansup the existing timing slots and sets new timing slots in the given * queue to accommodate given number of max active operations. * - * @param queue the queue + * @param queue the queue * @param n the number of maximum active operations. If n is greater than the * maximum limit set while creating the queue, then the minimum of these two * will be selected as n @@ -820,7 +820,7 @@ adaptive_queue_set_max_active (struct OperationQueue *queue, unsigned int n) struct FeedbackCtx *fctx = queue->fctx; struct TimeSlot *tslot; unsigned int cnt; - + cleanup_tslots (queue); n = GNUNET_MIN (n ,fctx->max_active_bound); fctx->tslots_freeptr = GNUNET_malloc (n * sizeof (struct TimeSlot)); @@ -872,7 +872,7 @@ adapt_parallelism (struct OperationQueue *queue) return; } avg = GNUNET_TIME_relative_divide (avg, nvals); - if (GNUNET_SYSERR == + if (GNUNET_SYSERR == GNUNET_TESTBED_SD_deviation_factor_ (fctx->sd, (unsigned int) avg.rel_value_us, &sd)) @@ -923,14 +923,14 @@ update_tslots (struct GNUNET_TESTBED_Operation *op) struct GNUNET_TIME_Relative t; struct TimeSlot *tslot; struct FeedbackCtx *fctx; - + t = GNUNET_TIME_absolute_get_duration (op->tstart); while (NULL != (tslot = op->tslots_head)) /* update time slots */ { queue = tslot->queue; fctx = queue->fctx; GNUNET_CONTAINER_DLL_remove (op->tslots_head, op->tslots_tail, tslot); - tslot->op = NULL; + tslot->op = NULL; GNUNET_CONTAINER_DLL_insert_tail (fctx->alloc_head, fctx->alloc_tail, tslot); if (op->failed) @@ -1011,7 +1011,7 @@ void GNUNET_TESTBED_operation_queue_destroy_ (struct OperationQueue *queue) { struct FeedbackCtx *fctx; - + GNUNET_break (GNUNET_YES == is_queue_empty (queue)); if (OPERATION_QUEUE_TYPE_ADAPTIVE == queue->type) { @@ -1205,7 +1205,7 @@ GNUNET_TESTBED_operation_activate_ (struct GNUNET_TESTBED_Operation *op) void GNUNET_TESTBED_operation_release_ (struct GNUNET_TESTBED_Operation *op) { - struct QueueEntry *entry; + struct QueueEntry *entry; struct OperationQueue *opq; unsigned int i; @@ -1221,19 +1221,19 @@ GNUNET_TESTBED_operation_release_ (struct GNUNET_TESTBED_Operation *op) if (OP_STATE_ACTIVE == op->state) update_tslots (op); GNUNET_assert (NULL != op->queues); - GNUNET_assert (NULL != op->qentries); + GNUNET_assert (NULL != op->qentries); for (i = 0; i < op->nqueues; i++) { entry = op->qentries[i]; remove_queue_entry (op, i); opq = op->queues[i]; switch (op->state) - { + { case OP_STATE_INIT: case OP_STATE_INACTIVE: GNUNET_assert (0); break; - case OP_STATE_WAITING: + case OP_STATE_WAITING: break; case OP_STATE_ACTIVE: case OP_STATE_READY: @@ -1242,7 +1242,7 @@ GNUNET_TESTBED_operation_release_ (struct GNUNET_TESTBED_Operation *op) opq->active -= entry->nres; recheck_waiting (opq); break; - } + } GNUNET_free (entry); } 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) size_t xc_size; uint16_t msize; - GNUNET_assert (OP_PEER_CREATE == opc->type); + GNUNET_assert (OP_PEER_CREATE == opc->type); GNUNET_assert (NULL != data); GNUNET_assert (NULL != data->peer); opc->state = OPC_STATE_STARTED; @@ -464,7 +464,7 @@ opstart_peer_reconfigure (void *cls) char *xconfig; size_t xc_size; uint16_t msize; - + opc->state = OPC_STATE_STARTED; GNUNET_assert (NULL != data); xc_size = GNUNET_TESTBED_compress_config_ (data->config, data->cfg_size, @@ -472,7 +472,7 @@ opstart_peer_reconfigure (void *cls) GNUNET_free (data->config); data->config = NULL; GNUNET_assert (xc_size <= UINT16_MAX); - msize = (uint16_t) xc_size + + msize = (uint16_t) xc_size + sizeof (struct GNUNET_TESTBED_PeerReconfigureMessage); msg = GNUNET_realloc (xconfig, msize); (void) memmove (&msg[1], msg, xc_size); @@ -498,7 +498,7 @@ oprelease_peer_reconfigure (void *cls) { struct OperationContext *opc = cls; struct PeerReconfigureData *data = opc->data; - + switch (opc->state) { case OPC_STATE_INIT: @@ -508,7 +508,7 @@ oprelease_peer_reconfigure (void *cls) case OPC_STATE_STARTED: GNUNET_TESTBED_remove_opc_ (opc->c, opc); break; - case OPC_STATE_FINISHED: + case OPC_STATE_FINISHED: break; } GNUNET_free (opc); @@ -874,15 +874,15 @@ opstart_manage_service (void *cls) struct OperationContext *opc = cls; struct ManageServiceData *data = opc->data; struct GNUNET_TESTBED_ManagePeerServiceMessage *msg; - - GNUNET_assert (NULL != data); + + GNUNET_assert (NULL != data); msg = GNUNET_malloc (data->msize); msg->header.size = htons (data->msize); msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE); msg->peer_id = htonl (data->peer->unique_id); msg->operation_id = GNUNET_htonll (opc->id); msg->start = (uint8_t) data->start; - (void) memcpy (&msg[1], data->service_name, data->msize + (void) memcpy (&msg[1], data->service_name, data->msize - sizeof (struct GNUNET_TESTBED_ManagePeerServiceMessage)); GNUNET_free (data->service_name); 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 struct ManageServiceData { GNUNET_TESTBED_OperationCompletionCallback cb; - + void *cb_cls; - + struct GNUNET_TESTBED_Peer *peer; char *service_name; - + unsigned int start; 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 @@ /** * @file testbed/testbed_api_sd.c * @brief functions to calculate standard deviation - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #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 @@ /** * @file testbed/testbed_api_sd.h * @brief functions to calculate standard deviation - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #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 * The task for calling the continuation callback */ GNUNET_SCHEDULER_TaskIdentifier call_completion_task_id; - + /** * The number of peers present in the peers array. This number also * 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) sc = peer_sc->sc; peer_sc->op_done_task_id = GNUNET_SCHEDULER_NO_TASK; - op = &sc->ops[peer_sc->peer_index]; + op = &sc->ops[peer_sc->peer_index]; GNUNET_assert (NULL != *op); GNUNET_TESTBED_operation_done (*op); *op = NULL; @@ -202,7 +202,7 @@ iteration_completion_cb (void *cls, int success) GNUNET_break (GNUNET_OK == success); sc = peer_sc->sc; - peer_sc->get_handle = NULL; + peer_sc->get_handle = NULL; sc->num_completed++; peer_sc->op_done_task_id = GNUNET_SCHEDULER_add_now (&op_done_task, peer_sc); if (sc->num_completed == sc->num_peers) @@ -239,7 +239,7 @@ iterator_cb (void *cls, const char *subsystem, LOG_DEBUG ("Peer %u: [%s,%s] -> %lu\n", peer_sc->peer_index, subsystem, name, (unsigned long) value); ret = sc->proc (sc->cb_cls, peer, - subsystem, name, value, is_persistent); + subsystem, name, value, is_persistent); if (GNUNET_SYSERR == ret) LOG_DEBUG ("Aborting iteration for peer %u\n", peer_sc->peer_index); return ret; @@ -283,11 +283,11 @@ service_connect_comp (void *cls, * from GNUNET_TESTBED_service_connect() * @return service handle to return in 'op_result', NULL on error */ -static void * +static void * statistics_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) { struct PeerGetStatsContext *peer_sc = cls; - + LOG_DEBUG ("Connecting to statistics service of peer %u\n", peer_sc->peer_index); return GNUNET_STATISTICS_create ("", cfg); @@ -300,7 +300,7 @@ statistics_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) * @param cls the PeerGetStatsContext * @param op_result service handle returned from the connect adapter */ -static void +static void statistics_da (void *cls, void *op_result) { struct PeerGetStatsContext *peer_sc = cls; @@ -331,7 +331,7 @@ opstart_get_stats (void *cls) unsigned int peer; LOG_DEBUG ("Starting get_statistics operation\n"); - sc->ops = GNUNET_malloc (sc->num_peers * + sc->ops = GNUNET_malloc (sc->num_peers * sizeof (struct GNUNET_TESTBED_Operation *)); for (peer = 0; peer < sc->num_peers; peer++) { @@ -343,7 +343,7 @@ opstart_get_stats (void *cls) peer_sc = GNUNET_malloc (sizeof (struct PeerGetStatsContext)); peer_sc->sc = sc; peer_sc->peer_index = peer; - sc->ops[peer] = + sc->ops[peer] = GNUNET_TESTBED_service_connect (sc, sc->peers[peer], "statistics", &service_connect_comp, peer_sc, @@ -364,7 +364,7 @@ oprelease_get_stats (void *cls) { struct GetStatsContext *sc = cls; unsigned int peer; - + LOG_DEBUG ("Cleaning up get_statistics operation\n"); if (GNUNET_SCHEDULER_NO_TASK != sc->call_completion_task_id) GNUNET_SCHEDULER_cancel (sc->call_completion_task_id); @@ -383,7 +383,7 @@ oprelease_get_stats (void *cls) GNUNET_free_non_null (sc->subsystem); GNUNET_free_non_null (sc->name); GNUNET_free (sc); - if (GNUNET_YES == + if (GNUNET_YES == GNUNET_TESTBED_operation_queue_destroy_empty_ (no_wait_queue)) no_wait_queue = NULL; } @@ -415,7 +415,7 @@ GNUNET_TESTBED_get_statistics (unsigned int num_peers, GNUNET_assert (NULL != proc); GNUNET_assert (NULL != cont); if (NULL == no_wait_queue) - no_wait_queue = GNUNET_TESTBED_operation_queue_create_ + no_wait_queue = GNUNET_TESTBED_operation_queue_create_ (OPERATION_QUEUE_TYPE_FIXED, UINT_MAX); sc = GNUNET_malloc (sizeof (struct GetStatsContext)); 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 */ static uint32_t rcop_key (void *rcop) -{ +{ return * ((uint32_t *) &rcop); } @@ -397,10 +397,10 @@ static struct RunContextOperation * search_rcop (struct GNUNET_TESTBED_RunHandle *rc, struct GNUNET_TESTBED_Operation *op) { struct SearchContext sc; - + sc.query = op; sc.result = NULL; - if (GNUNET_SYSERR == + if (GNUNET_SYSERR == GNUNET_CONTAINER_multihashmap32_get_multiple (rc->rcop_map, rcop_key (op), &search_iterator, @@ -481,7 +481,7 @@ cleanup (void *cls) /** - * Iterator for cleaning up elements from rcop_map + * Iterator for cleaning up elements from rcop_map * * @param cls the RunContext * @param key the 32-bit key @@ -546,7 +546,7 @@ rc_cleanup_operations (struct GNUNET_TESTBED_RunHandle *rc) rc->topology_operation = NULL; } /* cancel any exiting operations */ - GNUNET_assert (GNUNET_SYSERR != + GNUNET_assert (GNUNET_SYSERR != GNUNET_CONTAINER_multihashmap32_iterate (rc->rcop_map, &rcop_cleanup_iterator, rc)); @@ -568,7 +568,7 @@ cancel_interrupt_task (struct GNUNET_TESTBED_RunHandle *rc) /** * This callback will be called when all the operations are completed - * (done/cancelled) + * (done/cancelled) * * @param cls run context */ @@ -624,9 +624,9 @@ interrupt (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /* reschedule */ rc->interrupt_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &interrupt, rc); - rc_cleanup_operations (rc); + rc_cleanup_operations (rc); if ( (GNUNET_NO == rc->shutdown) - && (NULL != c) + && (NULL != c) && (0 != (size = GNUNET_CONTAINER_multihashmap32_size (c->opc_map)))) { LOG (GNUNET_ERROR_TYPE_WARNING, "Shutdown postponed as there are " @@ -917,7 +917,7 @@ call_cc: { unsigned long long number; unsigned int cap; - GNUNET_assert (GNUNET_OK == + GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (rc->cfg, TESTBED_CONFIG_SECTION, SCALE_FREE_CAP, &number)); @@ -1199,7 +1199,7 @@ static void timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_TESTBED_RunHandle *rc = cls; - + rc->timeout_task = GNUNET_SCHEDULER_NO_TASK; LOG (GNUNET_ERROR_TYPE_ERROR, _("Shutting down testbed due to timeout while setup.\n")); GNUNET_SCHEDULER_shutdown (); @@ -1246,7 +1246,7 @@ GNUNET_TESTBED_run (const char *host_filename, { struct GNUNET_TESTBED_RunHandle *rc; char *topology; - struct CompatibilityCheckContext *hc; + struct CompatibilityCheckContext *hc; struct GNUNET_TIME_Relative timeout; unsigned long long number; 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 * the prev pointer for the DLL */ struct RetryListEntry *prev; - + /** * The link to be retired */ @@ -136,7 +136,7 @@ struct TopologyContext * DLL tail for retry list */ struct RetryListEntry *rl_tail; - + /** * The number of peers */ @@ -292,7 +292,7 @@ overlay_link_completed (void *cls, struct GNUNET_TESTBED_Operation *op, tc->nlinks = 0; while (NULL != (retry_entry = tc->rl_head)) { - link = retry_entry->link; + link = retry_entry->link; link->op = GNUNET_TESTBED_overlay_connect (tc->op_cls, &overlay_link_completed, link, tc->peers[link->A], @@ -609,7 +609,7 @@ gen_scale_free (struct TopologyContext *tc, uint16_t cap, uint8_t m) unsigned int redo_threshold; links = 0; - etaboff = 0; + etaboff = 0; tc->link_array_size = tc->num_peers * m; tc->link_array = GNUNET_malloc_large (sizeof (struct OverlayLink) * tc->link_array_size); @@ -657,7 +657,7 @@ gen_scale_free (struct TopologyContext *tc, uint16_t cap, uint8_t m) goto redo; make_link (&tc->link_array[links + cnt], random_peer, peer, tc); deg[random_peer]++; - deg[peer]++; + deg[peer]++; used[cnt] = random_peer; } 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) GNUNET_free (deg); GNUNET_assert (links <= tc->link_array_size); tc->link_array_size = links; - tc->link_array = + tc->link_array = GNUNET_realloc (tc->link_array, sizeof (struct OverlayLink) * tc->link_array_size); } @@ -982,7 +982,7 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, { uint16_t cap; uint8_t m; - + cap = (uint16_t) va_arg (va, unsigned int); m = (uint8_t) va_arg (va, unsigned int); gen_scale_free (tc, cap, m); @@ -1074,7 +1074,7 @@ GNUNET_TESTBED_overlay_configure_topology (void *op_cls, GNUNET_assert (topo < GNUNET_TESTBED_TOPOLOGY_OPTION_END); va_start (vargs, topo); op = GNUNET_TESTBED_overlay_configure_topology_va (op_cls, num_peers, peers, - max_connections, + max_connections, comp_cb, comp_cb_cls, topo, 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 @@ /** * @file testbed/testbed_logger_api.c * @brief Client-side routines for communicating with the tesbted logger service - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #include "platform.h" @@ -158,7 +158,7 @@ static void cancel_timeout_flush (struct GNUNET_TESTBED_LOGGER_Handle *h) { GNUNET_SCHEDULER_cancel (h->timeout_flush_task); - h->timeout_flush_task = GNUNET_SCHEDULER_NO_TASK; + h->timeout_flush_task = GNUNET_SCHEDULER_NO_TASK; } @@ -310,7 +310,7 @@ dispatch_buffer (struct GNUNET_TESTBED_LOGGER_Handle *h) msg = GNUNET_realloc (h->buf, msize); h->buf = NULL; memmove (&msg[1], msg, h->bs); - h->bs = 0; + h->bs = 0; msg->type = htons (GNUNET_MESSAGE_TYPE_TESTBED_LOGGER_MSG); msg->size = htons (msize); queue_message (h, msg); @@ -329,7 +329,7 @@ GNUNET_TESTBED_LOGGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) { struct GNUNET_TESTBED_LOGGER_Handle *h; struct GNUNET_CLIENT_Connection *client; - + client = GNUNET_CLIENT_connect ("testbed-logger", cfg); if (NULL == client) return NULL; @@ -374,7 +374,7 @@ GNUNET_TESTBED_LOGGER_disconnect (struct GNUNET_TESTBED_LOGGER_Handle *h) void GNUNET_TESTBED_LOGGER_write (struct GNUNET_TESTBED_LOGGER_Handle *h, const void *data, size_t size) -{ +{ size_t fit_size; GNUNET_assert (0 != size); @@ -445,7 +445,7 @@ GNUNET_TESTBED_LOGGER_flush (struct GNUNET_TESTBED_LOGGER_Handle *h, h->cb = cb; h->cb_cls = cb_cls; GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->timeout_flush_task); - h->timeout_flush_task = + h->timeout_flush_task = GNUNET_SCHEDULER_add_delayed (timeout, &timeout_flush, h); if (NULL == h->buf) { 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) * Removes the temporary file. * * @param cls unused - * @param tc scheduler context + * @param tc scheduler context */ static void cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) @@ -221,10 +221,10 @@ cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /** - * Called whenever we can read stdin non-blocking + * Called whenever we can read stdin non-blocking * * @param cls unused - * @param tc scheduler context + * @param tc scheduler context */ static void stdin_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) @@ -259,7 +259,7 @@ stdin_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) break; } tid = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, fh, - &stdin_cb, NULL); + &stdin_cb, NULL); } @@ -282,7 +282,7 @@ testing_main (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_SCHEDULER_shutdown (); return; } - if (GNUNET_SYSERR == + if (GNUNET_SYSERR == GNUNET_CONFIGURATION_write ((struct GNUNET_CONFIGURATION_Handle *) cfg, tmpfilename)) { @@ -322,7 +322,7 @@ run_no_scheduler (void *cls, char *const *args, const char *cfgfile, { if (create_no > 0) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating %u configuration files based on template `%s'\n", create_no, create_cfg_template); ret = create_unique_cfgs (create_cfg_template, create_no); } 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 @@ /** * @file testing/test_testing_new_peerstartup.c * @brief test case for testing peer startup and shutdown using new testing - * library + * library * @author Sree Harsha Totakura */ @@ -46,7 +46,7 @@ struct TestingContext * The testing system */ struct GNUNET_TESTING_System *system; - + /** * The peer which has been started by the testing system */ @@ -69,7 +69,7 @@ static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct TestingContext *test_ctx = cls; - + GNUNET_assert (NULL != test_ctx); if (NULL != test_ctx->peer) { @@ -96,14 +96,14 @@ run (void *cls, char *const *args, const char *cfgfile, struct GNUNET_PeerIdentity id; test_ctx = GNUNET_malloc (sizeof (struct TestingContext)); - test_ctx->system = + test_ctx->system = GNUNET_TESTING_system_create ("test-gnunet-testing", "127.0.0.1", NULL, NULL); emsg = NULL; if (NULL == test_ctx->system) goto end; test_ctx->cfg = GNUNET_CONFIGURATION_dup (cfg); - test_ctx->peer = + test_ctx->peer = GNUNET_TESTING_peer_configure (test_ctx->system, test_ctx->cfg, 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 @@ /** * @file testing/test_testing_new_peerstartup.c * @brief test case for testing peer startup and shutdown using new testing - * library + * library * @author Sree Harsha Totakura */ @@ -42,7 +42,7 @@ } \ } \ } while (0) \ - + /** * The status of the test @@ -58,7 +58,7 @@ struct TestingContext * The testing system */ struct GNUNET_TESTING_System *system; - + /** * The peer which has been started by the testing system */ @@ -94,7 +94,7 @@ do_shutdown2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (NULL != test_ctx->system) GNUNET_TESTING_system_destroy (test_ctx->system, GNUNET_YES); GNUNET_free (test_ctx); - + } @@ -143,7 +143,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_assert (NULL != test_ctx); if (NULL != test_ctx->peer) { - FAIL_TEST (GNUNET_OK == + FAIL_TEST (GNUNET_OK == GNUNET_TESTING_peer_stop_async (test_ctx->peer, &peer_status_cb, test_ctx)); @@ -165,14 +165,14 @@ run (void *cls, char *const *args, const char *cfgfile, struct GNUNET_PeerIdentity id; test_ctx = GNUNET_malloc (sizeof (struct TestingContext)); - test_ctx->system = + test_ctx->system = GNUNET_TESTING_system_create ("test-gnunet-testing", "127.0.0.1", NULL, NULL); emsg = NULL; if (NULL == test_ctx->system) goto end; test_ctx->cfg = GNUNET_CONFIGURATION_dup (cfg); - test_ctx->peer = + test_ctx->peer = GNUNET_TESTING_peer_configure (test_ctx->system, test_ctx->cfg, 0, &id, &emsg); @@ -185,7 +185,7 @@ run (void *cls, char *const *args, const char *cfgfile, if (GNUNET_OK != GNUNET_TESTING_peer_start (test_ctx->peer)) goto end; test_ctx->state = PEER_STARTED; - FAIL_TEST (GNUNET_OK == + FAIL_TEST (GNUNET_OK == GNUNET_TESTING_peer_stop_async (test_ctx->peer, &peer_status_cb, test_ctx)); @@ -193,7 +193,7 @@ run (void *cls, char *const *args, const char *cfgfile, GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown, test_ctx); return; - + end: FAIL_TEST (0); 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 @@ /** * @file testing/test_testing_sharedservices.c * @brief test case for testing service sharing among peers started by testing - * @author Sree Harsha Totakura + * @author Sree Harsha Totakura */ #include "platform.h" @@ -47,7 +47,7 @@ struct TestingContext * The testing system */ struct GNUNET_TESTING_System *system; - + /** * The peer which has been started by the testing system */ @@ -81,7 +81,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) continue; (void) GNUNET_TESTING_peer_stop (peer); GNUNET_TESTING_peer_destroy (peer); - } + } if (NULL != test_ctx->cfg) GNUNET_CONFIGURATION_destroy (test_ctx->cfg); if (NULL != test_ctx->system) @@ -108,7 +108,7 @@ run (void *cls, char *const *args, const char *cfgfile, unsigned int cnt; test_ctx = GNUNET_malloc (sizeof (struct TestingContext)); - test_ctx->system = + test_ctx->system = GNUNET_TESTING_system_create ("test-gnunet-testing", "127.0.0.1", NULL, ss); 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 * by one for each configured peer. Even if peers are destroyed, * we never re-use path counters. */ - uint32_t path_counter; + uint32_t path_counter; /** * The number of hostkeys @@ -185,13 +185,13 @@ struct GNUNET_TESTING_Peer /** * Binary to be executed during 'GNUNET_TESTING_peer_start'. - * Typically 'gnunet-service-arm' (but can be set to a + * Typically 'gnunet-service-arm' (but can be set to a * specific service by 'GNUNET_TESTING_service_run' if * necessary). - */ + */ char *main_binary; char *args; - + /** * Handle to the running binary of the service, NULL if the * peer/service is currently not running. @@ -215,14 +215,14 @@ struct GNUNET_TESTING_Peer /** * The callback to call asynchronously when a peer is stopped - */ + */ GNUNET_TESTING_PeerStopCallback cb; - + /** * The closure for the above callback */ void *cb_cls; - + /** * The cached identity of this peer. Will be populated on call to * GNUNET_TESTING_peer_get_identity() @@ -260,7 +260,7 @@ struct GNUNET_TESTING_Peer static int hostkeys_load (struct GNUNET_TESTING_System *system) { - uint64_t fs; + uint64_t fs; char *data_dir; char *filename; struct GNUNET_DISK_FileHandle *fd; @@ -268,7 +268,7 @@ hostkeys_load (struct GNUNET_TESTING_System *system) GNUNET_assert (NULL == system->hostkeys_data); data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); GNUNET_asprintf (&filename, "%s/testing_hostkeys.ecc", data_dir); - GNUNET_free (data_dir); + GNUNET_free (data_dir); if (GNUNET_YES != GNUNET_DISK_file_test (filename)) { @@ -278,7 +278,7 @@ hostkeys_load (struct GNUNET_TESTING_System *system) return GNUNET_SYSERR; } /* Check hostkey file size, read entire thing into memory */ - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES)) fs = 0; if (0 == fs) @@ -558,7 +558,7 @@ GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system, * @param system system to use for reservation tracking * @return 0 if no free port was available */ -uint16_t +uint16_t GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system) { struct GNUNET_NETWORK_Handle *socket; @@ -576,7 +576,7 @@ GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system) /* FIXME: Instead of using getaddrinfo we should try to determine the port status by the following heurestics. - + On systems which support both IPv4 and IPv6, only ports open on both address families are considered open. 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, * faster peer startup. This function can be used to * access the n-th key of those pre-created hostkeys; note * that these keys are ONLY useful for testing and not - * secure as the private keys are part of the public + * secure as the private keys are part of the public * GNUnet source code. * * This is primarily a helper function used internally @@ -699,9 +699,9 @@ struct GNUNET_CRYPTO_EccPrivateKey * GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, uint32_t key_number, struct GNUNET_PeerIdentity *id) -{ +{ struct GNUNET_CRYPTO_EccPrivateKey *private_key; - + if ((NULL == id) || (NULL == system->hostkeys_data)) return NULL; if (key_number >= system->total_hostkeys) @@ -709,13 +709,13 @@ GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, LOG (GNUNET_ERROR_TYPE_ERROR, _("Key number %u does not exist\n"), key_number); return NULL; - } + } private_key = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey); memcpy (private_key, system->hostkeys_data + (key_number * GNUNET_TESTING_HOSTKEYFILESIZE), GNUNET_TESTING_HOSTKEYFILESIZE); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (private_key, + GNUNET_CRYPTO_ecc_key_get_public_for_signature (private_key, &id->public_key); return private_key; } @@ -731,7 +731,7 @@ struct UpdateContext * The system for which we are building configurations */ struct GNUNET_TESTING_System *system; - + /** * The configuration we are building */ @@ -865,7 +865,7 @@ static void update_config_sections (void *cls, const char *section) { - struct UpdateContext *uc = cls; + struct UpdateContext *uc = cls; char **ikeys; char *val; char *ptr; @@ -874,7 +874,7 @@ update_config_sections (void *cls, char *ACCEPT_FROM_key; uint16_t ikeys_cnt; uint16_t key; - + ikeys_cnt = 0; val = NULL; /* Ignore certain options from sections. See @@ -882,8 +882,8 @@ update_config_sections (void *cls, if (GNUNET_YES == GNUNET_CONFIGURATION_have_value (uc->cfg, section, "TESTING_IGNORE_KEYS")) { - GNUNET_assert - (GNUNET_YES == + GNUNET_assert + (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (uc->cfg, section, "TESTING_IGNORE_KEYS", &val)); ptr = val; @@ -915,10 +915,10 @@ update_config_sections (void *cls, (GNUNET_YES == GNUNET_CONFIGURATION_have_value (uc->cfg, section, "ADVERTISED_PORT"))) { - if (GNUNET_OK == + if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (uc->cfg, section, "PORT", &ptr)) { - GNUNET_CONFIGURATION_set_value_string (uc->cfg, section, + GNUNET_CONFIGURATION_set_value_string (uc->cfg, section, "ADVERTISED_PORT", ptr); GNUNET_free (ptr); } @@ -935,11 +935,11 @@ update_config_sections (void *cls, GNUNET_free (ikeys); } GNUNET_free_non_null (val); - ACCEPT_FROM_key = "ACCEPT_FROM"; - if ((NULL != uc->system->trusted_ip) && + ACCEPT_FROM_key = "ACCEPT_FROM"; + if ((NULL != uc->system->trusted_ip) && (NULL != strstr (uc->system->trusted_ip, ":"))) /* IPv6 in use */ ACCEPT_FROM_key = "ACCEPT_FROM6"; - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (uc->cfg, section, ACCEPT_FROM_key, &orig_allowed_hosts)) { @@ -953,7 +953,7 @@ update_config_sections (void *cls, GNUNET_free (orig_allowed_hosts); GNUNET_CONFIGURATION_set_value_string (uc->cfg, section, ACCEPT_FROM_key, allowed_hosts); - GNUNET_free (allowed_hosts); + GNUNET_free (allowed_hosts); } static struct SharedServiceInstance * @@ -969,9 +969,9 @@ associate_shared_service (struct GNUNET_TESTING_System *system, ss->n_peers++; if ( ((0 == ss->share) && (NULL == ss->instances)) || - ( (0 != ss->share) + ( (0 != ss->share) && (ss->n_instances < ((ss->n_peers + ss->share - 1) / ss->share)) ) ) - { + { i = GNUNET_malloc (sizeof (struct SharedServiceInstance)); i->ss = ss; (void) GNUNET_asprintf (&service_home, "%s/shared/%s/%u", @@ -1009,7 +1009,7 @@ associate_shared_service (struct GNUNET_TESTING_System *system, GNUNET_assert (0 < ss->n_instances); i = ss->instances[ss->n_instances - 1]; } - GNUNET_CONFIGURATION_iterate_section_values(ss->cfg, ss->sname, + GNUNET_CONFIGURATION_iterate_section_values(ss->cfg, ss->sname, &cfg_copy_iterator, cfg); GNUNET_CONFIGURATION_set_value_string (cfg, ss->sname, "UNIXPATH", i->unix_sock); @@ -1044,7 +1044,7 @@ GNUNET_TESTING_configuration_create_ (struct GNUNET_TESTING_System *system, unsigned int *nports) { struct UpdateContext uc; - char *default_config; + char *default_config; uc.system = system; uc.cfg = cfg; @@ -1066,7 +1066,7 @@ GNUNET_TESTING_configuration_create_ (struct GNUNET_TESTING_System *system, /* allow connections to services from system trusted_ip host */ GNUNET_CONFIGURATION_iterate_sections (cfg, &update_config_sections, &uc); /* enable loopback-based connections between peers */ - GNUNET_CONFIGURATION_set_value_string (cfg, + GNUNET_CONFIGURATION_set_value_string (cfg, "nat", "USE_LOCALADDR", "YES"); GNUNET_free (uc.service_home); @@ -1107,14 +1107,14 @@ GNUNET_TESTING_configuration_create (struct GNUNET_TESTING_System *system, /** * Configure a GNUnet peer. GNUnet must be installed on the local - * system and available in the PATH. + * system and available in the PATH. * * @param system system to use to coordinate resource usage * @param cfg configuration to use; will be UPDATED (to reflect needed * changes in port numbers and paths) * @param key_number number of the hostkey to use for the peer * @param id identifier for the daemon, will be set, can be NULL - * @param emsg set to freshly allocated error message (set to NULL on success), + * @param emsg set to freshly allocated error message (set to NULL on success), * can be NULL * @return handle to the peer, NULL on error */ @@ -1136,7 +1136,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, struct SharedService *ss; struct SharedServiceInstance **ss_instances; unsigned int cnt; - unsigned int nports; + unsigned int nports; ports = NULL; nports = 0; @@ -1147,7 +1147,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, { GNUNET_asprintf (&emsg_, _("You attempted to create a testbed with more than %u hosts. Please precompute more hostkeys first.\n"), - (unsigned int) system->total_hostkeys); + (unsigned int) system->total_hostkeys); goto err_ret; } pk = NULL; @@ -1158,13 +1158,13 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, _("Failed to initialize hostkey for peer %u\n"), (unsigned int) key_number); goto err_ret; - } + } if (NULL != pk) GNUNET_free (pk); - if (GNUNET_NO == + if (GNUNET_NO == GNUNET_CONFIGURATION_have_value (cfg, "PEER", "PRIVATE_KEY")) { - GNUNET_asprintf (&emsg_, + GNUNET_asprintf (&emsg_, _("PRIVATE_KEY option in PEER section missing in configuration\n")); goto err_ret; } @@ -1182,13 +1182,13 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, "(not enough free ports?)\n")); goto err_ret; } - GNUNET_assert (GNUNET_OK == + GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_get_value_filename (cfg, "PEER", "PRIVATE_KEY", &hostkey_filename)); fd = GNUNET_DISK_file_open (hostkey_filename, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, - GNUNET_DISK_PERM_USER_READ + GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); if (NULL == fd) { @@ -1199,7 +1199,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, } GNUNET_free (hostkey_filename); if (GNUNET_TESTING_HOSTKEYFILESIZE != - GNUNET_DISK_file_write (fd, system->hostkeys_data + GNUNET_DISK_file_write (fd, system->hostkeys_data + (key_number * GNUNET_TESTING_HOSTKEYFILESIZE), GNUNET_TESTING_HOSTKEYFILESIZE)) { @@ -1219,17 +1219,17 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, ss_instances[cnt] = associate_shared_service (system, ss, cfg); if (NULL == ss_instances[cnt]) goto err_ret; - } + } GNUNET_assert (GNUNET_OK == - GNUNET_CONFIGURATION_get_value_string - (cfg, "PATHS", "DEFAULTCONFIG", &config_filename)); + GNUNET_CONFIGURATION_get_value_string + (cfg, "PATHS", "DEFAULTCONFIG", &config_filename)); if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg, config_filename)) { GNUNET_asprintf (&emsg_, _("Failed to write configuration file `%s' for peer %u: %s\n"), config_filename, (unsigned int) key_number, - STRERROR (errno)); + STRERROR (errno)); GNUNET_free (config_filename); goto err_ret; } @@ -1289,7 +1289,7 @@ GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer, /** - * Start the peer. + * Start the peer. * * @param peer peer to start * @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) { GNUNET_break (0); return GNUNET_SYSERR; - } + } GNUNET_assert (NULL != peer->cfgfile); for (cnt = 0; cnt < peer->system->n_shared_services; cnt++) { @@ -1314,7 +1314,7 @@ GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer) return GNUNET_SYSERR; i->n_refs++; } - peer->main_process = GNUNET_OS_start_process (PIPE_CONTROL, + peer->main_process = GNUNET_OS_start_process (PIPE_CONTROL, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, peer->main_binary, @@ -1377,7 +1377,7 @@ GNUNET_TESTING_peer_service_start (struct GNUNET_TESTING_Peer *peer, * @return GNUNET_OK upon successfully queuing the service stop request; * GNUNET_SYSERR upon error */ -int +int GNUNET_TESTING_peer_service_stop (struct GNUNET_TESTING_Peer *peer, const char *service_name, struct GNUNET_TIME_Relative timeout, @@ -1386,13 +1386,13 @@ GNUNET_TESTING_peer_service_stop (struct GNUNET_TESTING_Peer *peer, { if (NULL == peer->ah) return GNUNET_SYSERR; - GNUNET_ARM_request_service_stop (peer->ah, + GNUNET_ARM_request_service_stop (peer->ah, service_name, timeout, cont, cont_cls); return GNUNET_OK; } - + /** * Sends SIGTERM to the peer's main process @@ -1451,7 +1451,7 @@ GNUNET_TESTING_peer_wait (struct GNUNET_TESTING_Peer *peer) /** - * Stop the peer. + * Stop the peer. * * @param peer peer to stop * @return GNUNET_OK on success, GNUNET_SYSERR on error @@ -1475,7 +1475,7 @@ GNUNET_TESTING_peer_stop (struct GNUNET_TESTING_Peer *peer) * GNUNET_SYSERR on error. */ static void -disconn_status (void *cls, +disconn_status (void *cls, int connected) { struct GNUNET_TESTING_Peer *peer = cls; @@ -1514,7 +1514,7 @@ GNUNET_TESTING_peer_stop_async (struct GNUNET_TESTING_Peer *peer, void *cb_cls) { if (NULL == peer->main_process) - return GNUNET_SYSERR; + return GNUNET_SYSERR; peer->ah = GNUNET_ARM_connect (peer->cfg, &disconn_status, peer); if (NULL == peer->ah) return GNUNET_SYSERR; @@ -1535,7 +1535,7 @@ GNUNET_TESTING_peer_stop_async (struct GNUNET_TESTING_Peer *peer, */ void GNUNET_TESTING_peer_stop_async_cancel (struct GNUNET_TESTING_Peer *peer) -{ +{ GNUNET_assert (NULL != peer->ah); GNUNET_ARM_disconnect_and_free (peer->ah); peer->ah = NULL; @@ -1618,7 +1618,7 @@ struct ServiceContext * Callback to signal service startup */ GNUNET_TESTING_TestMain tm; - + /** * The peer in which the service is run. */ @@ -1719,7 +1719,7 @@ GNUNET_TESTING_service_run (const char *testdir, GNUNET_free (libexec_binary); GNUNET_free (binary); if (GNUNET_OK != GNUNET_TESTING_peer_start (peer)) - { + { GNUNET_TESTING_peer_destroy (peer); GNUNET_CONFIGURATION_destroy (cfg); GNUNET_TESTING_system_destroy (system, GNUNET_YES); @@ -1749,14 +1749,14 @@ GNUNET_TESTING_service_run (const char *testdir, * Sometimes we use the binary name to determine which specific * test to run. In those cases, the string after the last "_" * in 'argv[0]' specifies a string that determines the configuration - * file or plugin to use. + * file or plugin to use. * * This function returns the respective substring, taking care * of issues such as binaries ending in '.exe' on W32. * * @param argv0 the name of the binary * @return string between the last '_' and the '.exe' (or the end of the string), - * NULL if argv0 has no '_' + * NULL if argv0 has no '_' */ char * GNUNET_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 @@ /** * For how long do we blacklist anyone under any cirumstances at most after a failed connection - * attempt? This is the absolute maximum, regardless of what the calculation based on + * attempt? This is the absolute maximum, regardless of what the calculation based on * exponential back-off returns. */ #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, * @param my_id ID of this peer, NULL if we failed */ static void -core_init (void *cls, +core_init (void *cls, const struct GNUNET_PeerIdentity *my_id) { if (NULL == my_id) @@ -993,10 +993,10 @@ core_init (void *cls, return; } my_identity = *my_id; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "I am peer `%s'\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "I am peer `%s'\n", GNUNET_i2s (my_id)); - peerinfo_notify = GNUNET_PEERINFO_notify (cfg, GNUNET_NO, + peerinfo_notify = GNUNET_PEERINFO_notify (cfg, GNUNET_NO, &process_peer, NULL); } 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; static void -notify_connect_complete (void *cls, +notify_connect_complete (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg) { @@ -63,7 +63,7 @@ notify_connect_complete (void *cls, static void do_connect (void *cls, - struct GNUNET_TESTBED_RunHandle *h, + struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, 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 @@ #include #include #include - #include + #include #include #include #include @@ -82,7 +82,7 @@ UINT8 mac[MAC_ADDR_SIZE]; }; - /** + /** * The UUID used for the SDP service. * {31191E56-FA7E-4517-870E-71B86BBCC52F} */ @@ -110,7 +110,7 @@ struct HardwareInfos #ifdef MINGW /** * socket handle - */ + */ struct GNUNET_NETWORK_Handle *handle; /** @@ -127,7 +127,7 @@ struct HardwareInfos * MAC address of our own bluetooth interface. */ struct GNUNET_TRANSPORT_WLAN_MacAddress pl_mac; - + /** * SDP session */ @@ -151,7 +151,7 @@ struct SendBuffer * destination? Always smaller than 'size'. */ size_t pos; - + /** * Buffered data; twice the maximum allowed message size as we add some * headers. @@ -161,13 +161,13 @@ struct SendBuffer #ifdef LINUX /** - * Devices buffer used to keep a list with all the discoverable devices in + * Devices buffer used to keep a list with all the discoverable devices in * order to send them HELLO messages one by one when it receive a broadcast message. - */ + */ struct BroadcastMessages { /* List with the discoverable devices' addresses */ - bdaddr_t devices[MAX_PORTS]; + bdaddr_t devices[MAX_PORTS]; /* List with the open sockets */ int fds[MAX_PORTS]; @@ -175,7 +175,7 @@ struct SendBuffer /* The number of the devices */ int size; - + /* The current position */ int pos; @@ -207,7 +207,7 @@ static struct SendBuffer write_pout; static struct SendBuffer write_std; -/* ****** this are the same functions as the ones used in gnunet-helper-transport-wlan.c ****** */ +/* ****** this are the same functions as the ones used in gnunet-helper-transport-wlan.c ****** */ /** * To what multiple do we align messages? 8 byte should suffice for everyone @@ -228,7 +228,7 @@ static struct SendBuffer write_std; * @param cls closure * @param message the actual message */ -typedef void (*MessageTokenizerCallback) (void *cls, +typedef void (*MessageTokenizerCallback) (void *cls, const struct GNUNET_MessageHeader * message); @@ -301,7 +301,7 @@ mst_create (MessageTokenizerCallback cb, ret->cb = cb; ret->cb_cls = cb_cls; ret->pos = 0; - + return ret; } @@ -602,7 +602,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) if (((crc) & 0xFF) == buf[0] && ((crc >> 8) & 0xFF) == buf[1] && ((crc >> 16) & 0xFF) == buf[2] && ((crc >> 24) & 0xFF) == buf[3]) return 0; - return 1; + return 1; } @@ -613,7 +613,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) /** * Function used to get the code of last error and to print the type of error. */ - static void + static void print_last_error() { LPVOID lpMsgBuf = NULL; @@ -644,9 +644,9 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) /** * Function used to convert the GUID. * @param bytes the GUID represented as a char array - * @param uuid pointer to the GUID + * @param uuid pointer to the GUID */ - static void + static void convert_guid(char *bytes, GUID * uuid) { int i; @@ -664,16 +664,16 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) #ifdef LINUX /** * Function for assigning a port number - * + * * @param socket the socket used to bind * @param addr pointer to the rfcomm address - * @return 0 on success - */ + * @return 0 on success + */ static int bind_socket (int socket, struct sockaddr_rc *addr) { int port, status; - + /* Bind every possible port (from 0 to 30) and stop when binding doesn't fail */ //FIXME : it should start from port 1, but on my computer it doesn't work :) for (port = 3; port <= 30; port++) @@ -683,8 +683,8 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) if (status == 0) return 0; } - - return -1; + + return -1; } #endif @@ -696,7 +696,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) * @return 0 on success */ static int - register_service (struct HardwareInfos *dev) + register_service (struct HardwareInfos *dev) { /* advertise the service */ CSADDR_INFO addr_info; @@ -746,7 +746,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) wqs.lpcsaBuffer = &addr_info ; wqs.lpBlob = 0; - if (SOCKET_ERROR == WSASetService (&wqs , RNRSERVICE_REGISTER, 0)) + if (SOCKET_ERROR == WSASetService (&wqs , RNRSERVICE_REGISTER, 0)) { fprintf (stderr, "Failed to register the SDP service: "); print_last_error(); @@ -768,7 +768,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) * @return 0 on success */ static int - register_service (struct HardwareInfos *dev, int rc_channel) + register_service (struct HardwareInfos *dev, int rc_channel) { /** * 1. initializations @@ -779,17 +779,17 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) * 6. register the service record to the local SDP server * 7. cleanup */ - uint8_t svc_uuid_int[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + uint8_t svc_uuid_int[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, dev->pl_mac.mac[5], dev->pl_mac.mac[4], dev->pl_mac.mac[3], dev->pl_mac.mac[2], dev->pl_mac.mac[1], dev->pl_mac.mac[0]}; const char *service_dsc = "Bluetooth plugin services"; - const char *service_prov = "GNUnet provider"; - uuid_t root_uuid, rfcomm_uuid, svc_uuid; + const char *service_prov = "GNUnet provider"; + uuid_t root_uuid, rfcomm_uuid, svc_uuid; sdp_list_t *root_list = 0, *rfcomm_list = 0, *proto_list = 0, *access_proto_list = 0, *svc_list = 0; sdp_record_t *record = 0; sdp_data_t *channel = 0; - + record = sdp_record_alloc(); /* Set the general service ID */ @@ -799,8 +799,8 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) sdp_set_service_id (record, svc_uuid); /* Make the service record publicly browsable */ - sdp_uuid16_create (&root_uuid, PUBLIC_BROWSE_GROUP); - root_list = sdp_list_append (0, &root_uuid); + sdp_uuid16_create (&root_uuid, PUBLIC_BROWSE_GROUP); + root_list = sdp_list_append (0, &root_uuid); sdp_set_browse_groups (record, root_list); /* Register the RFCOMM channel */ @@ -816,10 +816,10 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) /* Set the name, provider, and description */ sdp_set_info_attr (record, dev->iface, service_prov, service_dsc); - + /* Connect to the local SDP server */ dev->session = sdp_connect (BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY); - + if (!dev->session) { 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) //FIXME exit? return 1; } - + /* Register the service record */ if (sdp_record_register (dev->session, record, 0) < 0) { @@ -836,23 +836,23 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) //FIXME exit? return 1; } - + /* Cleanup */ - sdp_data_free (channel); + sdp_data_free (channel); sdp_list_free (root_list, 0); sdp_list_free (rfcomm_list, 0); sdp_list_free (proto_list, 0); sdp_list_free (access_proto_list, 0); sdp_list_free (svc_list, 0); sdp_record_free (record); - + return 0; } #endif #ifdef MINGW /** - * Function for searching and browsing for a service. This will return the + * Function for searching and browsing for a service. This will return the * port number on which the service is running. * * @param dest target address @@ -869,16 +869,16 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) GUID guid; unsigned char uuid[] = GNUNET_BLUETOOTH_SDP_UUID; convert_guid ((char *) uuid, &guid); - + wqs = (WSAQUERYSET*)malloc (wqs_len); ZeroMemory (wqs, wqs_len); - + wqs->dwSize = sizeof (WSAQUERYSET) ; wqs->lpServiceClassId = &guid; wqs->dwNameSpace = NS_BTH; wqs->dwNumberOfCsAddrs = 0; wqs->lpszContext = (LPSTR)dest; - + if (SOCKET_ERROR == WSALookupServiceBegin (wqs, LUP_FLUSHCACHE | LUP_RETURN_ALL, &h)) { if (GetLastError() == WSASERVICE_NOT_FOUND) @@ -894,14 +894,14 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) return -1; } } - + /* search the sdp service */ while (!done) { if (SOCKET_ERROR == WSALookupServiceNext (h, LUP_FLUSHCACHE | LUP_RETURN_ALL, &wqs_len, wqs)) { int error = WSAGetLastError(); - + switch (error) { case WSAEFAULT: @@ -927,15 +927,15 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) channel = ((SOCKADDR_BTH*)wqs->lpcsaBuffer->RemoteAddr.lpSockaddr)->port; } } - + free (wqs) ; WSALookupServiceEnd (h); - + return channel; } #else /** - * Function used for searching and browsing for a service. This will return the + * Function used for searching and browsing for a service. This will return the * port number on which the service is running. * * @param dev pointer to the device struct @@ -943,17 +943,17 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) * @return channel */ static int - get_channel(struct HardwareInfos *dev, bdaddr_t dest) + get_channel(struct HardwareInfos *dev, bdaddr_t dest) { /** * 1. detect all nearby devices * 2. for each device: * 2.1. connect to the SDP server running * 2.2. get a list of service records with the specific UUID - * 2.3. for each service record get a list of the protocol sequences and get + * 2.3. for each service record get a list of the protocol sequences and get * the port number */ - uint8_t svc_uuid_int[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + uint8_t svc_uuid_int[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, dest.b[5], dest.b[4], dest.b[3], dest.b[2], dest.b[1], dest.b[0]}; sdp_session_t *session = 0; @@ -961,21 +961,21 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) uuid_t svc_uuid; uint32_t range = 0x0000ffff; uint8_t channel = -1; - + /* Connect to the local SDP server */ - session = sdp_connect (BDADDR_ANY, &dest, 0); + session = sdp_connect (BDADDR_ANY, &dest, 0); if (!session) { fprintf (stderr, "Failed to connect to the SDP server on interface `%.*s': %s\n", IFNAMSIZ, dev->iface, strerror (errno)); return -1; } - + sdp_uuid128_create (&svc_uuid, &svc_uuid_int); search_list = sdp_list_append (0, &svc_uuid); attrid_list = sdp_list_append (0, &range); - - if (sdp_service_search_attr_req (session, search_list, + + if (sdp_service_search_attr_req (session, search_list, SDP_ATTR_REQ_RANGE, attrid_list, &response_list) == 0) { for (it = response_list; it; it = it->next) @@ -990,24 +990,24 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) sdp_record_free (record); } } - + sdp_list_free (search_list, 0); sdp_list_free (attrid_list, 0); sdp_list_free (response_list, 0); - + sdp_close (session); - + if (channel == -1) fprintf (stderr, "Failed to find the listening channel for interface `%.*s': %s\n", IFNAMSIZ, dev->iface, strerror (errno)); - + return channel; } #endif /** * Read from the socket and put the result into the buffer for transmission to 'stdout'. - * + * * @param sock file descriptor for reading * @param buf buffer to read to; first bytes will be the 'struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame', * followed by the actual payload @@ -1015,18 +1015,18 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) * @param ri where to write radiotap_rx info * @return number of bytes written to 'buf' */ -static ssize_t -read_from_the_socket (void *sock, +static ssize_t +read_from_the_socket (void *sock, unsigned char *buf, size_t buf_size, struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *ri) { unsigned char tmpbuf[buf_size]; ssize_t count; - + #ifdef MINGW count = GNUNET_NETWORK_socket_recv ((struct GNUNET_NETWORK_Handle *)sock, tmpbuf, buf_size); #else - count = read (*((int *)sock), tmpbuf, buf_size); + count = read (*((int *)sock), tmpbuf, buf_size); #endif if (0 > count) @@ -1041,11 +1041,11 @@ read_from_the_socket (void *sock, return -1; } - + #ifdef LINUX /* Get the channel used */ int len; - struct sockaddr_rc rc_addr = { 0 }; + struct sockaddr_rc rc_addr = { 0 }; memset (&rc_addr, 0, sizeof (rc_addr)); len = sizeof (rc_addr); @@ -1064,9 +1064,9 @@ read_from_the_socket (void *sock, { count -= sizeof(uint32_t); } - + memcpy (buf, tmpbuf, count); - + return count; } @@ -1078,7 +1078,7 @@ read_from_the_socket (void *sock, */ static int open_device (struct HardwareInfos *dev) -{ +{ #ifdef MINGW SOCKADDR_BTH addr; @@ -1113,30 +1113,30 @@ open_device (struct HardwareInfos *dev) fprintf (stderr, "Failed to register a service: "); print_last_error(); return 1; - } + } #else int i, dev_id = -1, fd_hci; - struct + struct { struct hci_dev_list_req list; struct hci_dev_req dev[HCI_MAX_DEV]; } request; //used for detecting the local devices struct sockaddr_rc rc_addr = { 0 }; //used for binding - + /* Initialize the neighbour structure */ neighbours.dev_id = -1; for (i = 0; i < MAX_PORTS; i++) neighbours.fds[i] = -1; - + /* Open a HCI socket */ fd_hci = socket (AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); - if (fd_hci < 0) + if (fd_hci < 0) { fprintf (stderr, "Failed to create HCI socket: %s\n", strerror (errno)); return -1; } - + memset (&request, 0, sizeof(request)); request.list.dev_num = HCI_MAX_DEV; @@ -1146,7 +1146,7 @@ open_device (struct HardwareInfos *dev) IFNAMSIZ, dev->iface, strerror (errno)); return 1; } - + /* Search for a device with dev->iface name */ for (i = 0; i < request.list.dev_num; i++) { @@ -1155,23 +1155,23 @@ open_device (struct HardwareInfos *dev) memset (&dev_info, 0, sizeof(struct hci_dev_info)); dev_info.dev_id = request.dev[i].dev_id; strncpy (dev_info.name, dev->iface, IFNAMSIZ); - + if (ioctl (fd_hci, HCIGETDEVINFO, (void *) &dev_info)) { fprintf (stderr, "ioctl(HCIGETDEVINFO) on interface `%.*s' failed: %s\n", IFNAMSIZ, dev->iface, strerror (errno)); return 1; } - + if (strcmp (dev_info.name, dev->iface) == 0) { - + dev_id = dev_info.dev_id; //the device was found /** * Copy the MAC address to the device structure */ memcpy (&dev->pl_mac, &dev_info.bdaddr, sizeof (bdaddr_t)); - + /* Check if the interface is up */ if (hci_test_bit (HCI_UP, (void *) &dev_info.flags) == 0) { @@ -1183,55 +1183,55 @@ open_device (struct HardwareInfos *dev) return 1; } } - + /* Check if the device is discoverable */ if (hci_test_bit (HCI_PSCAN, (void *) &dev_info.flags) == 0 || hci_test_bit (HCI_ISCAN, (void *) &dev_info.flags) == 0) { /* Set interface Page Scan and Inqury Scan ON */ struct hci_dev_req dev_req; - + memset (&dev_req, 0, sizeof (dev_req)); dev_req.dev_id = dev_info.dev_id; dev_req.dev_opt = SCAN_PAGE | SCAN_INQUIRY; - + if (ioctl (fd_hci, HCISETSCAN, (unsigned long) &dev_req)) - { + { fprintf (stderr, "ioctl(HCISETSCAN) on interface `%.*s' failed: %s\n", IFNAMSIZ, dev->iface, strerror (errno)); return 1; } - + } break; } - + } - + /* Check if the interface was not found */ if (dev_id == -1) { fprintf (stderr, "The interface %s was not found\n", dev->iface); return 1; } - + /* Close the hci socket */ (void) close(fd_hci); - - - + + + /* Bind the rfcomm socket to the interface */ - memset (&rc_addr, 0, sizeof (rc_addr)); + memset (&rc_addr, 0, sizeof (rc_addr)); rc_addr.rc_family = AF_BLUETOOTH; rc_addr.rc_bdaddr = *BDADDR_ANY; - + if (bind_socket (dev->fd_rfcomm, &rc_addr) != 0) { fprintf (stderr, "Failed to bind interface `%.*s': %s\n", IFNAMSIZ, dev->iface, strerror (errno)); return 1; } - + /* Register a SDP service */ if (register_service (dev, rc_addr.rc_channel) != 0) { @@ -1239,7 +1239,7 @@ open_device (struct HardwareInfos *dev) dev->iface, strerror (errno)); return 1; } - + /* Switch socket in listening mode */ if (listen (dev->fd_rfcomm, 5) == -1) //FIXME: probably we need a bigger number { @@ -1247,7 +1247,7 @@ open_device (struct HardwareInfos *dev) dev->iface, strerror (errno)); return 1; } - + #endif return 0; @@ -1266,7 +1266,7 @@ static void mac_set (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *taIeeeHeader, const struct HardwareInfos *dev) { - taIeeeHeader->frame_control = htons (IEEE80211_FC0_TYPE_DATA); + taIeeeHeader->frame_control = htons (IEEE80211_FC0_TYPE_DATA); taIeeeHeader->addr3 = mac_bssid_gnunet; #ifdef MINGW @@ -1292,13 +1292,13 @@ mac_set (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *taIeeeHeader, struct stat sbuf; int ret; - ret = snprintf (strbuf, sizeof (strbuf), + ret = snprintf (strbuf, sizeof (strbuf), "/sys/class/bluetooth/%s/subsystem", iface); if ((ret < 0) || (ret >= sizeof (strbuf)) || (0 != stat (strbuf, &sbuf))) { - fprintf (stderr, - "Did not find 802.15.1 interface `%s'. Exiting.\n", + fprintf (stderr, + "Did not find 802.15.1 interface `%s'. Exiting.\n", iface); exit (1); } @@ -1354,12 +1354,12 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) sendsize = ntohs (hdr->size); if ( (sendsize < sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)) || - (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)) ) + (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)) ) { fprintf (stderr, "Received malformed message\n"); exit (1); } - sendsize -= (sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) - + sendsize -= (sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame)); if (MAXLINE < sendsize) { @@ -1373,7 +1373,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) /* payload contains MAC address, but we don't trust it, so we'll * overwrite it with OUR MAC address to prevent mischief */ mac_set (blueheader, dev); - memcpy (&blueheader->addr1, &header->frame.addr1, + memcpy (&blueheader->addr1, &header->frame.addr1, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); write_pout.size = sendsize; } @@ -1386,19 +1386,19 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) * @param dev pointer to the socket which was added to the set * @return 0 on success */ - static int - send_broadcast (struct HardwareInfos *dev, int *sendsocket) + static int + send_broadcast (struct HardwareInfos *dev, int *sendsocket) { int new_device = 0; int loops = 0; search_for_devices: - if ((neighbours.size == neighbours.pos && new_device == 1) || neighbours.size == 0) - { + if ((neighbours.size == neighbours.pos && new_device == 1) || neighbours.size == 0) + { inquiry_devices: //skip the conditions and force a inquiry for new devices { - /** - * It means that I sent HELLO messages to all the devices from the list and I should search + /** + * It means that I sent HELLO messages to all the devices from the list and I should search * for new ones or that this is the first time when I do a search. */ inquiry_info *devices = NULL; @@ -1415,17 +1415,17 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) if (neighbours.dev_id == -1) { char addr[19] = { 0 }; //the device MAC address - - ba2str ((bdaddr_t *) &dev->pl_mac, addr); + + ba2str ((bdaddr_t *) &dev->pl_mac, addr); neighbours.dev_id = hci_devid (addr); if (neighbours.dev_id < 0) - { + { fprintf (stderr, "Failed to get the device id for interface %.*s : %s\n", IFNAMSIZ, dev->iface, strerror (errno)); return 1; } } - + devices = malloc (max_responses * sizeof (inquiry_info)); if (devices == NULL) { @@ -1433,23 +1433,23 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) dev->iface); return 1; } - + responses = hci_inquiry (neighbours.dev_id, 8, max_responses, NULL, &devices, IREQ_CACHE_FLUSH); if (responses < 0) { fprintf (stderr, "Failed to inquiry on interface %.*s\n", IFNAMSIZ, dev->iface); return 1; } - + fprintf (stderr, "LOG : Found %d devices\n", responses); //FIXME delete it after debugging stage - + if (responses == 0) { fprintf (stderr, "LOG : No devices discoverable\n"); return 1; } - - for (i = 0; i < responses; i++) + + for (i = 0; i < responses; i++) { int j; int found = 0; @@ -1461,11 +1461,11 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) dev->iface); return 2; } - + /* Search if the address already exists on the list */ for (j = 0; j < neighbours.size; j++) { - if (memcmp (&(devices + i)->bdaddr, &(neighbours.devices[j]), sizeof (bdaddr_t)) == 0) + if (memcmp (&(devices + i)->bdaddr, &(neighbours.devices[j]), sizeof (bdaddr_t)) == 0) { found = 1; 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) fprintf (stderr, "LOG : %s was added to the list\n", addr); //FIXME debugging message memcpy (&(neighbours.devices[neighbours.size++]), &(devices + i)->bdaddr, sizeof (bdaddr_t)); } - } - + } + free (devices); } } - + int connection_successful = 0; struct sockaddr_rc addr_rc = { 0 }; int errno_copy = 0; @@ -1501,9 +1501,9 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) memset (&addr_rc.rc_bdaddr, 0, sizeof (addr_rc.rc_bdaddr)); memcpy (&addr_rc.rc_bdaddr, &(neighbours.devices[neighbours.pos]), sizeof (addr_rc.rc_bdaddr)); - + addr_rc.rc_channel = get_channel (dev, addr_rc.rc_bdaddr); - + *sendsocket = socket (AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); if (connect (*sendsocket, (struct sockaddr *)&addr_rc, sizeof (addr_rc)) == 0) { @@ -1549,7 +1549,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) neighbours.pos += 1; } } - + /* Cycle on the list */ if (neighbours.pos == neighbours.size) { @@ -1564,14 +1564,14 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) } } /* If a new device wasn't found, search an old one */ - if (connection_successful == 0) + if (connection_successful == 0) { int loop_check = neighbours.pos; while (neighbours.fds[neighbours.pos] == -1) { if (neighbours.pos == neighbours.size) neighbours.pos = 0; - + if (neighbours.pos == loop_check) { if (errno_copy == ECONNREFUSED) @@ -1599,7 +1599,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) /** * Main function of the helper. This code accesses a bluetooth interface - * forwards traffic in both directions between the bluetooth interface and + * forwards traffic in both directions between the bluetooth interface and * stdin/stdout of this process. Error messages are written to stderr. * * @param argc number of arguments, must be 2 @@ -1611,7 +1611,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) int main (int argc, char *argv[]) { -#ifdef LINUX +#ifdef LINUX struct HardwareInfos dev; char readbuf[MAXLINE]; int maxfd; @@ -1632,7 +1632,7 @@ main (int argc, char *argv[]) return 254; } #else - if (0 != seteuid (0)) + if (0 != seteuid (0)) { fprintf (stderr, "Failed to seteuid back to root: %s\n", strerror (errno)); return 254; @@ -1710,15 +1710,15 @@ main (int argc, char *argv[]) memcpy (write_std.buf, &macmsg, sizeof (macmsg)); write_std.size = sizeof (macmsg); } - - - stdin_mst = mst_create (&stdin_send_hw, &dev); + + + stdin_mst = mst_create (&stdin_send_hw, &dev); stdin_open = 1; - + /** - * TODO : I should make the time out of a mac endpoint smaller and check if the rate + * TODO : I should make the time out of a mac endpoint smaller and check if the rate * from get_wlan_header (plugin_transport_bluetooth.c) is correct. - */ + */ while (1) { maxfd = -1; @@ -1737,7 +1737,7 @@ main (int argc, char *argv[]) maxfd = MAX (maxfd, dev.fd_rfcomm); } - for (i = 0; i < crt_rfds; i++) // it can receive messages from multiple devices + for (i = 0; i < crt_rfds; i++) // it can receive messages from multiple devices { FD_SET (rfds_list[i], &rfds); maxfd = MAX (maxfd, rfds_list[i]); @@ -1749,22 +1749,22 @@ main (int argc, char *argv[]) maxfd = MAX (maxfd, STDOUT_FILENO); } if (0 < write_pout.size) //it can send messages only to one device per loop - { + { struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *frame; /* Get the destination address */ frame = (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) write_pout.buf; - - if (memcmp (&frame->addr1, &dev.pl_mac, + + if (memcmp (&frame->addr1, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)) == 0) { broadcast = 1; - memset (&write_pout, 0, sizeof (write_pout)); //clear the buffer - } - else if (memcmp (&frame->addr1, &broadcast_address, + memset (&write_pout, 0, sizeof (write_pout)); //clear the buffer + } + else if (memcmp (&frame->addr1, &broadcast_address, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)) == 0) { fprintf (stderr, "LOG : %s has a broadcast message (pos %d, size %d)\n", dev.iface, neighbours.pos, neighbours.size); //FIXME: debugging message - + if (send_broadcast(&dev, &sendsocket) != 0) //if the searching wasn't successful don't get stuck on the select stage { broadcast = 1; @@ -1776,15 +1776,15 @@ main (int argc, char *argv[]) FD_SET (sendsocket, &wfds); maxfd = MAX (maxfd, sendsocket); } - } - else + } + else { int found = 0; int pos = 0; /* Search if the address already exists on the list */ for (i = 0; i < neighbours.size; i++) { - if (memcmp (&frame->addr1, &(neighbours.devices[i]), sizeof (bdaddr_t)) == 0) + if (memcmp (&frame->addr1, &(neighbours.devices[i]), sizeof (bdaddr_t)) == 0) { pos = i; if (neighbours.fds[i] != -1) @@ -1802,24 +1802,24 @@ main (int argc, char *argv[]) { int status; struct sockaddr_rc addr = { 0 }; - - 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, + + 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, frame->addr1.mac[5], frame->addr1.mac[4], frame->addr1.mac[3], - frame->addr1.mac[2], frame->addr1.mac[1], frame->addr1.mac[0]); //FIXME: debugging message - + frame->addr1.mac[2], frame->addr1.mac[1], frame->addr1.mac[0]); //FIXME: debugging message + sendsocket = socket (AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); - - if (sendsocket < 0) + + if (sendsocket < 0) { - fprintf (stderr, "Failed to create a RFCOMM socket (sending stage): %s\n", + fprintf (stderr, "Failed to create a RFCOMM socket (sending stage): %s\n", strerror (errno)); return -1; } - + memcpy (&addr.rc_bdaddr, &frame->addr1, sizeof (bdaddr_t)); addr.rc_family = AF_BLUETOOTH; addr.rc_channel = get_channel (&dev, addr.rc_bdaddr); - + int tries = 0; connect_retry: status = connect (sendsocket, (struct sockaddr *) &addr, sizeof (addr)); @@ -1843,7 +1843,7 @@ main (int argc, char *argv[]) memset (&write_pout, 0, sizeof (write_pout)); broadcast = 1; } - + } else { @@ -1902,19 +1902,19 @@ main (int argc, char *argv[]) write_std.size = 0; } fprintf (stderr, "LOG : %s sends a message to STDOUT\n", dev.iface); //FIXME: debugging message - - } + + } if (sendsocket != -1) { if (FD_ISSET (sendsocket , &wfds)) { ssize_t ret = - write (sendsocket, write_pout.buf + write_std.pos, + write (sendsocket, write_pout.buf + write_std.pos, write_pout.size - write_pout.pos); if (0 > ret) //FIXME should I first check the error type? { fprintf (stderr, "Failed to write to bluetooth device: %s. Closing the socket!\n", - strerror (errno)); + strerror (errno)); for (i = 0; i < neighbours.size; i++) { if (neighbours.fds[i] == sendsocket) @@ -1925,7 +1925,7 @@ main (int argc, char *argv[]) } } /* Remove the message */ - memset (&write_pout.buf + write_std.pos, 0, (write_pout.size - write_pout.pos)); + memset (&write_pout.buf + write_std.pos, 0, (write_pout.size - write_pout.pos)); write_pout.pos = 0 ; write_pout.size = 0; } @@ -1940,7 +1940,7 @@ main (int argc, char *argv[]) (unsigned int) write_pout.size); break; } - + if (write_pout.pos == write_pout.size) { write_pout.pos = 0; @@ -1956,14 +1956,14 @@ main (int argc, char *argv[]) { if (i == STDIN_FILENO) { - ssize_t ret = + ssize_t ret = read (i, readbuf, sizeof (readbuf)); if (0 > ret) { fprintf (stderr, "Read error from STDIN: %s\n", strerror (errno)); - break; + break; } if (0 == ret) { @@ -1975,18 +1975,18 @@ main (int argc, char *argv[]) mst_receive (stdin_mst, readbuf, ret); fprintf (stderr, "LOG : %s receives a message from STDIN\n", dev.iface); //FIXME: debugging message } - } - else if (i == dev.fd_rfcomm) + } + else if (i == dev.fd_rfcomm) { int readsocket; struct sockaddr_rc addr = { 0 }; unsigned int opt = sizeof (addr); - + readsocket = accept (dev.fd_rfcomm, (struct sockaddr *) &addr, &opt); fprintf(stderr, "LOG : %s accepts a message\n", dev.iface); //FIXME: debugging message if (readsocket == -1) { - fprintf (stderr, "Failed to accept a connection on interface: %.*s\n", IFNAMSIZ, + fprintf (stderr, "Failed to accept a connection on interface: %.*s\n", IFNAMSIZ, strerror (errno)); break; } @@ -1994,7 +1994,7 @@ main (int argc, char *argv[]) { FD_SET (readsocket, &rfds); maxfd = MAX (maxfd, readsocket); - + if (crt_rfds < MAX_PORTS) rfds_list[crt_rfds++] = readsocket; else @@ -2004,19 +2004,19 @@ main (int argc, char *argv[]) break; } } - - } - else + + } + else { struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *rrm; ssize_t ret; - fprintf (stderr, "LOG : %s reads something from the socket\n", dev.iface);//FIXME : debugging message + fprintf (stderr, "LOG : %s reads something from the socket\n", dev.iface);//FIXME : debugging message rrm = (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) write_std.buf; ret = read_from_the_socket ((void *)&i, (unsigned char *) &rrm->frame, - sizeof (write_std.buf) - - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) - + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame), + sizeof (write_std.buf) + - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) + + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame), rrm); if (0 >= ret) { @@ -2041,8 +2041,8 @@ main (int argc, char *argv[]) } if ((0 < ret) && (0 == mac_test (&rrm->frame, &dev))) { - write_std.size = ret - + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) + write_std.size = ret + + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame); rrm->header.size = htons (write_std.size); rrm->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER); @@ -2058,7 +2058,7 @@ main (int argc, char *argv[]) sdp_close (dev.session); (void) close (dev.fd_rfcomm); (void) close (sendsocket); - + for (i = 0; i < crt_rfds; i++) (void) close (rfds_list[i]); @@ -2079,13 +2079,13 @@ main (int argc, char *argv[]) struct MessageStreamTokenizer *stdin_mst; /* check the handles */ - if (stdin_handle == INVALID_HANDLE_VALUE) + if (stdin_handle == INVALID_HANDLE_VALUE) { fprintf (stderr, "Failed to get the stdin handle\n"); ExitProcess (2); } - if (stdout_handle == INVALID_HANDLE_VALUE) + if (stdout_handle == INVALID_HANDLE_VALUE) { fprintf (stderr, "Failed to get the stdout handle\n"); ExitProcess (2); @@ -2111,7 +2111,7 @@ main (int argc, char *argv[]) } - if (open_device (&dev) == -1) + if (open_device (&dev) == -1) { fprintf (stderr, "Failed to open the device\n"); print_last_error(); @@ -2121,21 +2121,21 @@ main (int argc, char *argv[]) print_last_error(); } ExitProcess (2); - } + } if (GNUNET_OK != GNUNET_NETWORK_socket_set_blocking (dev.handle, 1) ) { fprintf (stderr, "Failed to change the socket mode\n"); ExitProcess (2); } - + memset (&write_std, 0, sizeof (write_std)); - memset (&write_pout, 0, sizeof (write_pout)); + memset (&write_pout, 0, sizeof (write_pout)); stdin_open = 1; rfds = GNUNET_NETWORK_fdset_create (); wfds = GNUNET_NETWORK_fdset_create (); - + /* Send MAC address of the bluetooth interface to STDOUT first */ { struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg; @@ -2146,9 +2146,9 @@ main (int argc, char *argv[]) memcpy (write_std.buf, &macmsg, sizeof (macmsg)); write_std.size = sizeof (macmsg); } - - - stdin_mst = mst_create (&stdin_send_hw, &dev); + + + stdin_mst = mst_create (&stdin_send_hw, &dev); stdin_open = 1; int pos = 0; @@ -2161,13 +2161,13 @@ main (int argc, char *argv[]) stdin_pos = -1; stdout_pos = -1; sendsocket = NULL; //FIXME ???memleaks - - GNUNET_NETWORK_fdset_zero (rfds); + + GNUNET_NETWORK_fdset_zero (rfds); if ((0 == write_pout.size) && (1 == stdin_open)) { stdin_pos = pos; pos +=1; - GNUNET_NETWORK_fdset_handle_set (rfds, (struct GNUNET_DISK_FileHandle*) &stdin_handle); + GNUNET_NETWORK_fdset_handle_set (rfds, (struct GNUNET_DISK_FileHandle*) &stdin_handle); } if (0 == write_std.size) @@ -2175,7 +2175,7 @@ main (int argc, char *argv[]) pos += 1; GNUNET_NETWORK_fdset_set (rfds, dev.handle); } - + for (i = 0; i < crt_rfds; i++) { pos += 1; @@ -2189,34 +2189,34 @@ main (int argc, char *argv[]) GNUNET_NETWORK_fdset_handle_set (wfds, (struct GNUNET_DISK_FileHandle*) &stdout_handle); // printf ("%s\n", write_std.buf); // memset (write_std.buf, 0, write_std.size); - // write_std.size = 0; + // write_std.size = 0; } if (0 < write_pout.size) - { + { if (strcmp (argv[1], "ff:ff:ff:ff:ff:ff") == 0) { fprintf(stderr, "LOG: BROADCAST! Skipping the message\n"); // skip the message broadcast = 1; memset (write_pout.buf, 0, write_pout.size); write_pout.size = 0; - } - else + } + else { SOCKADDR_BTH addr; fprintf (stderr, "LOG : has a new message for %s\n", argv[1]); sendsocket = GNUNET_NETWORK_socket_create (AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM); - - if (sendsocket == NULL) + + if (sendsocket == NULL) { fprintf (stderr, "Failed to create RFCOMM socket: \n"); print_last_error(); ExitProcess (2); } - + memset (&addr, 0, sizeof (addr)); //addr.addressFamily = AF_BTH; - if (SOCKET_ERROR == + if (SOCKET_ERROR == WSAStringToAddress (argv[1], AF_BTH, NULL, (LPSOCKADDR) &addr, &addr_len)) { fprintf (stderr, "Failed to translate the address: "); @@ -2250,7 +2250,7 @@ main (int argc, char *argv[]) } } } - + if (broadcast == 0) { int retval = GNUNET_NETWORK_socket_select (rfds, wfds, NULL, GNUNET_TIME_relative_get_forever_()); @@ -2279,7 +2279,7 @@ main (int argc, char *argv[]) fprintf (stderr, "Failed to write to STDOUT\n"); ExitProcess (2); } - + write_std.pos += ret; if (write_std.pos == write_std.size) { @@ -2292,9 +2292,9 @@ main (int argc, char *argv[]) if (GNUNET_NETWORK_fdset_isset (wfds, sendsocket)) { ssize_t ret; - ret = GNUNET_NETWORK_socket_send (sendsocket, write_pout.buf + write_pout.pos, + ret = GNUNET_NETWORK_socket_send (sendsocket, write_pout.buf + write_pout.pos, write_pout.size - write_pout.pos); - + if (GNUNET_SYSERR == ret) { fprintf (stderr, "Failed to send to the socket. Closing the socket. Error: \n"); @@ -2317,22 +2317,22 @@ main (int argc, char *argv[]) (unsigned int) write_pout.size); break; } - + if (write_pout.pos == write_pout.size) { write_pout.pos = 0; write_pout.size = 0; - + } fprintf(stderr, "LOG : sends a message to a DEVICE\n"); //FIXME: debugging message } } } - + //if (GNUNET_NETWORK_fdset_isset (rfds, (struct GNUNET_NETWORK_Handle*)&stdin_handle)) if (retval == stdin_pos) { - //ssize_t ret; + //ssize_t ret; //ret = GNUNET_NETWORK_socket_recv ((struct GNUNET_NETWORK_Handle *)&stdin_handle, readbuf, sizeof (write_pout.buf)); //ret = read (STDIN_FILENO, readbuf, sizeof (readbuf)); DWORD ret; @@ -2356,7 +2356,7 @@ main (int argc, char *argv[]) { fprintf (stderr, "LOG: accepting connection\n"); struct GNUNET_NETWORK_Handle *readsocket; - readsocket = GNUNET_NETWORK_socket_accept (dev.handle, (LPSOCKADDR)&acc_addr, &addr_len); + readsocket = GNUNET_NETWORK_socket_accept (dev.handle, (LPSOCKADDR)&acc_addr, &addr_len); if (readsocket == NULL) { fprintf (stderr, "Accept error %d: ", GetLastError()); @@ -2386,14 +2386,14 @@ main (int argc, char *argv[]) { if (GNUNET_NETWORK_fdset_isset (rfds, rfds_list[i])) { - struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *rrm; + struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *rrm; ssize_t ret; fprintf (stderr, "LOG: reading something from the socket\n");//FIXME : debugging message rrm = (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) write_std.buf; ret = read_from_the_socket (rfds_list[i], (unsigned char *) &rrm->frame, - sizeof (write_std.buf) - - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) - + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame), + sizeof (write_std.buf) + - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) + + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame), rrm); if (0 >= ret) { @@ -2408,22 +2408,22 @@ main (int argc, char *argv[]) fprintf (stderr, "Read error from raw socket: "); print_last_error(); break; - + } if ((0 < ret) && (0 == mac_test (&rrm->frame, &dev))) { - write_std.size = ret - + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) + write_std.size = ret + + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame); rrm->header.size = htons (write_std.size); rrm->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER); } break; } - } + } } } - + mst_destroy (stdin_mst); stdin_mst = NULL; 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[]) erg = mkfifo (FIFO_FILE1, 0666); if ( (0 != erg) && (EEXIST != errno) ) FPRINTF (stderr, "Error in mkfifo(%s): %s\n", FIFO_FILE1, - strerror (errno)); + strerror (errno)); } } 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 @@ #include "plugin_transport_wlan.h" /** - * Packet format type for the messages we receive from + * Packet format type for the messages we receive from * the kernel. This is for Ethernet 10Mbps format (no * performance information included). */ -#define ARPHRD_ETHER 1 +#define ARPHRD_ETHER 1 /** - * Packet format type for the messages we receive from + * Packet format type for the messages we receive from * the kernel. This is for plain messages (with no * performance information included). */ @@ -156,13 +156,13 @@ /** - * Packet format type for the messages we receive from + * Packet format type for the messages we receive from * the kernel. This is for the PRISM format. */ #define ARPHRD_IEEE80211_PRISM 802 /** - * Packet format type for the messages we receive from + * Packet format type for the messages we receive from * the kernel. This is for messages with a * 'struct Ieee80211RadiotapHeader' (see below). */ @@ -195,35 +195,35 @@ * Drivers appear to use a 64bit counter to hold mactime internal * the then fill the prism header with the lower 32 bits */ -#define PRISM_DID_MACTIME 0x2041 +#define PRISM_DID_MACTIME 0x2041 /** * Channel element */ -#define PRISM_DID_CHANNEL 0x3041 +#define PRISM_DID_CHANNEL 0x3041 /** * Signal element. Should be the signal strength in dbm, some people * suggest that instead "100 - (strength in dbm)" is used (to make this * a positive integer). */ -#define PRISM_DID_SIGNAL 0x6041 +#define PRISM_DID_SIGNAL 0x6041 /** * Noise element */ -#define PRISM_DID_NOISE 0x7041 +#define PRISM_DID_NOISE 0x7041 /** * Rate element, in units/multiples of 500Khz */ -#define PRISM_DID_RATE 0x8041 +#define PRISM_DID_RATE 0x8041 /** * Value is set (supplied) */ -#define PRISM_STATUS_OK 0 +#define PRISM_STATUS_OK 0 /** * Value not supplied. @@ -240,24 +240,24 @@ struct PrismValue * This has a different ID for each parameter, see * PRISM_DID_* constants. */ - uint32_t did; - + uint32_t did; + /** * See PRISM_STATUS_*-constants. Note that they are unusual: 0 = set; 1 = not set */ - uint16_t status; - + uint16_t status; + /** * length of data (which is always a uint32_t, but presumably this can be used * to specify that fewer bytes are used (with values in 'len' from 0-4). We * ignore this field. */ - uint16_t len; + uint16_t len; /** * The data value */ - uint32_t data; + uint32_t data; } __attribute__ ((packed)); @@ -271,11 +271,11 @@ struct PrismHeader * We expect this to be a PRISM_MSGCODE_*. */ uint32_t msgcode; - + /** * The length of the entire header. */ - uint32_t msglen; + uint32_t msglen; /** * Name of the device that captured the packet. @@ -402,7 +402,7 @@ enum RadiotapType */ IEEE80211_RADIOTAP_DBM_TX_POWER = 10, - /** + /** * IEEE80211_RADIOTAP_ANTENNA uint8_t antenna index * * Unitless indication of the Rx/Tx antenna for this packet. @@ -433,10 +433,10 @@ enum RadiotapType */ IEEE80211_RADIOTAP_RX_FLAGS = 14, - /** + /** * IEEE80211_RADIOTAP_TX_FLAGS __le16 bitmap * - * Properties of transmitted frames. See flags defined below. + * Properties of transmitted frames. See flags defined below. */ IEEE80211_RADIOTAP_TX_FLAGS = 15, @@ -462,7 +462,7 @@ enum RadiotapType }; /** - * Bitmask indicating an extension of the bitmask is used. + * Bitmask indicating an extension of the bitmask is used. * (Mask corresponding to IEEE80211_RADIOTAP_EXT). */ #define IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK (1 << IEEE80211_RADIOTAP_EXT) @@ -487,7 +487,7 @@ enum RadiotapType * * Frame was sent/received with short preamble */ -#define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 +#define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /** * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get @@ -497,7 +497,7 @@ enum RadiotapType * * Frame was sent/received with WEP encryption */ -#define IEEE80211_RADIOTAP_F_WEP 0x04 +#define IEEE80211_RADIOTAP_F_WEP 0x04 /** * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get @@ -507,7 +507,7 @@ enum RadiotapType * * Frame was sent/received with fragmentation */ -#define IEEE80211_RADIOTAP_F_FRAG 0x08 +#define IEEE80211_RADIOTAP_F_FRAG 0x08 /** * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get @@ -517,7 +517,7 @@ enum RadiotapType * * Frame includes FCS (CRC at the end that needs to be removeD). */ -#define IEEE80211_RADIOTAP_F_FCS 0x10 +#define IEEE80211_RADIOTAP_F_FCS 0x10 /** * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get @@ -528,32 +528,32 @@ enum RadiotapType * Frame has padding between 802.11 header and payload * (to 32-bit boundary) */ -#define IEEE80211_RADIOTAP_F_DATAPAD 0x20 +#define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /** * For IEEE80211_RADIOTAP_RX_FLAGS: * frame failed crc check */ -#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 +#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 /** * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct RadiotapTransmissionHeader'): * failed due to excessive retries */ -#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 +#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /** * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct RadiotapTransmissionHeader'): * used cts 'protection' */ -#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 +#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /** * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct RadiotapTransmissionHeader'): - * used rts/cts handshake + * used rts/cts handshake */ -#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 +#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /** * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct RadiotapTransmissionHeader'): @@ -563,7 +563,7 @@ enum RadiotapType /** * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct RadiotapTransmissionHeader'): - * sequence number handled by userspace + * sequence number handled by userspace */ #define IEEE80211_RADIOTAP_F_TX_NOSEQ 0x0010 @@ -591,7 +591,7 @@ struct Ieee80211RadiotapHeader uint8_t it_version; /** - * Padding. Set to 0. + * Padding. Set to 0. */ uint8_t it_pad; @@ -611,7 +611,7 @@ struct Ieee80211RadiotapHeader /** - * Format of the header we need to prepend to messages to be sent to the + * Format of the header we need to prepend to messages to be sent to the * Kernel. */ struct RadiotapTransmissionHeader @@ -752,7 +752,7 @@ struct SendBuffer * destination? Always smaller than 'size'. */ size_t pos; - + /** * Buffered data; twice the maximum allowed message size as we add some * headers. @@ -794,7 +794,7 @@ static struct SendBuffer write_std; * @param cls closure * @param message the actual message */ -typedef void (*MessageTokenizerCallback) (void *cls, +typedef void (*MessageTokenizerCallback) (void *cls, const struct GNUNET_MessageHeader * message); @@ -1059,7 +1059,7 @@ mst_destroy (struct MessageStreamTokenizer *mst) */ static int ieee80211_radiotap_iterator_init (struct Ieee80211RadiotapHeaderIterator *iterator, - const struct Ieee80211RadiotapHeader *radiotap_header, + const struct Ieee80211RadiotapHeader *radiotap_header, size_t max_length) { if ( (iterator == NULL) || @@ -1204,26 +1204,26 @@ ieee80211_radiotap_iterator_next (struct Ieee80211RadiotapHeaderIterator *iterat /* need padding (by 'wanted_alignment - unalignment') */ iterator->arg_index += wanted_alignment - unalignment; } - + /* * this is what we will return to user, but we need to * move on first so next call has something fresh to test - */ + */ iterator->this_arg_index = iterator->arg_index; iterator->this_arg = iterator->arg; /* internally move on the size of this arg (using lower nybble from - the table) */ + the table) */ iterator->arg += rt_sizes[iterator->arg_index] & 0x0f; - + /* * check for insanity where we are given a bitmap that * claims to have more arg content than the length of the * radiotap section. We will normally end up equalling this * max_length on the last arg, never exceeding it. - */ + */ if ((((void *) iterator->arg) - ((void *) iterator->rtheader)) > iterator->max_length) - return -1; + return -1; } /* Now, move on to next bit / next entry */ @@ -1245,7 +1245,7 @@ ieee80211_radiotap_iterator_next (struct Ieee80211RadiotapHeaderIterator *iterat } } else - { + { /* just try the next bit (while loop will move on) */ iterator->bitmap_shifter >>= 1; } @@ -1364,7 +1364,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) if (((crc) & 0xFF) == buf[0] && ((crc >> 8) & 0xFF) == buf[1] && ((crc >> 16) & 0xFF) == buf[2] && ((crc >> 24) & 0xFF) == buf[3]) return 0; - return 1; + return 1; } @@ -1431,7 +1431,7 @@ linux_get_channel (const struct HardwareInfos *dev) * @return number of bytes written to 'buf' */ static ssize_t -linux_read (struct HardwareInfos *dev, +linux_read (struct HardwareInfos *dev, unsigned char *buf, size_t buf_size, struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *ri) { @@ -1452,7 +1452,7 @@ linux_read (struct HardwareInfos *dev, return -1; } - memset (ri, 0, sizeof (*ri)); + memset (ri, 0, sizeof (*ri)); switch (dev->arptype_in) { case ARPHRD_IEEE80211_PRISM: @@ -1511,7 +1511,7 @@ linux_read (struct HardwareInfos *dev, break; } } - } + } if ( (n < 8) || (n >= caplen) ) return 0; /* invalid format */ } @@ -1540,7 +1540,7 @@ linux_read (struct HardwareInfos *dev, if (!got_signal) { ri->ri_power = * ((int8_t*) iterator.this_arg); - got_signal = 1; + got_signal = 1; } break; case IEEE80211_RADIOTAP_DB_ANTSIGNAL: @@ -1594,7 +1594,7 @@ linux_read (struct HardwareInfos *dev, break; } /* end of 'switch' */ } /* end of the 'while' loop */ - } + } break; case ARPHRD_IEEE80211: n = 0; /* no header */ @@ -1607,7 +1607,7 @@ linux_read (struct HardwareInfos *dev, tmpbuf + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame), caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4 /* 4 byte FCS */); return caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4; - } + } default: errno = ENOTSUP; /* unsupported format */ return -1; @@ -1617,8 +1617,8 @@ linux_read (struct HardwareInfos *dev, ri->ri_channel = linux_get_channel (dev); /* detect CRC32 at the end, even if the flag wasn't set and remove it */ - if ( (0 == fcs_removed) && - (0 == check_crc_buf_osdep (tmpbuf + n, caplen - sizeof (uint32_t))) ) + if ( (0 == fcs_removed) && + (0 == check_crc_buf_osdep (tmpbuf + n, caplen - sizeof (uint32_t))) ) { /* NOTE: this heuristic can of course fail if there happens to be a matching checksum at the end. Would be good to have @@ -1751,9 +1751,9 @@ open_device_raw (struct HardwareInfos *dev) setsockopt (dev->fd_raw, SOL_PACKET, PACKET_ADD_MEMBERSHIP, &mr, sizeof (mr))) { - fprintf (stderr, + fprintf (stderr, "Failed to enable promiscuous mode on interface `%.*s'\n", - IFNAMSIZ, + IFNAMSIZ, dev->iface); return 1; } @@ -1775,13 +1775,13 @@ test_wlan_interface (const char *iface) struct stat sbuf; int ret; - ret = snprintf (strbuf, sizeof (strbuf), + ret = snprintf (strbuf, sizeof (strbuf), "/sys/class/net/%s/phy80211/subsystem", iface); if ((ret < 0) || (ret >= sizeof (strbuf)) || (0 != stat (strbuf, &sbuf))) { - fprintf (stderr, - "Did not find 802.11 interface `%s'. Exiting.\n", + fprintf (stderr, + "Did not find 802.11 interface `%s'. Exiting.\n", iface); exit (1); } @@ -1852,7 +1852,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) sendsize = ntohs (hdr->size); if ( (sendsize < sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)) || - (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)) ) + (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)) ) { fprintf (stderr, "Received malformed message\n"); exit (1); @@ -1870,10 +1870,10 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) case ARPHRD_IEEE80211_FULL: case ARPHRD_IEEE80211: rtheader.header.it_version = 0; - rtheader.header.it_pad = 0; + rtheader.header.it_pad = 0; rtheader.header.it_len = GNUNET_htole16 (sizeof (rtheader)); rtheader.header.it_present = GNUNET_htole16 (IEEE80211_RADIOTAP_OUR_TRANSMISSION_HEADER_MASK); - rtheader.rate = header->rate; + rtheader.rate = header->rate; rtheader.pad1 = 0; rtheader.txflags = GNUNET_htole16 (IEEE80211_RADIOTAP_F_TX_NOACK | IEEE80211_RADIOTAP_F_TX_NOSEQ); memcpy (write_pout.buf, &rtheader, sizeof (rtheader)); @@ -1934,7 +1934,7 @@ main (int argc, char *argv[]) return 254; } #else - if (0 != seteuid (0)) + if (0 != seteuid (0)) { fprintf (stderr, "Failed to seteuid back to root: %s\n", strerror (errno)); return 254; @@ -2012,9 +2012,9 @@ main (int argc, char *argv[]) memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); memcpy (write_std.buf, &macmsg, sizeof (macmsg)); write_std.size = sizeof (macmsg); - } + } - stdin_mst = mst_create (&stdin_send_hw, &dev); + stdin_mst = mst_create (&stdin_send_hw, &dev); stdin_open = 1; while (1) { @@ -2071,7 +2071,7 @@ main (int argc, char *argv[]) if (FD_ISSET (dev.fd_raw, &wfds)) { ssize_t ret = - write (dev.fd_raw, write_pout.buf + write_std.pos, + write (dev.fd_raw, write_pout.buf + write_std.pos, write_pout.size - write_pout.pos); if (0 > ret) { @@ -2097,7 +2097,7 @@ main (int argc, char *argv[]) if (FD_ISSET (STDIN_FILENO, &rfds)) { - ssize_t ret = + ssize_t ret = read (STDIN_FILENO, readbuf, sizeof (readbuf)); if (0 > ret) { @@ -2120,9 +2120,9 @@ main (int argc, char *argv[]) rrm = (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) write_std.buf; ret = linux_read (&dev, (unsigned char *) &rrm->frame, - sizeof (write_std.buf) - - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) - + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame), + sizeof (write_std.buf) + - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) + + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame), rrm); if (0 > ret) { @@ -2131,8 +2131,8 @@ main (int argc, char *argv[]) } if ((0 < ret) && (0 == mac_test (&rrm->frame, &dev))) { - write_std.size = ret - + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) + write_std.size = ret + + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame); rrm->header.size = htons (write_std.size); 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, end: GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Allowing receive from peer %s to continue in %s\n", - GNUNET_i2s (peer), + GNUNET_i2s (peer), GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES)); return ret; } 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) * @param option name of the option * @param value value of the option */ -static void +static void blacklist_cfg_iter (void *cls, const char *section, const char *option, const char *value) @@ -255,10 +255,10 @@ blacklist_cfg_iter (void *cls, const char *section, char *pos; if (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (option, - strlen (option), + strlen (option), &peer.public_key)) return; - + if ((NULL == value) || (0 == strcmp(value, ""))) { /* Blacklist whole peer */ @@ -295,9 +295,9 @@ read_blacklist_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg, char cfg_sect[512]; unsigned int res = 0; - GNUNET_snprintf (cfg_sect, + GNUNET_snprintf (cfg_sect, sizeof (cfg_sect), - "transport-blacklist-%s", + "transport-blacklist-%s", GNUNET_i2s_full (my_id)); GNUNET_CONFIGURATION_iterate_section_values (cfg, cfg_sect, &blacklist_cfg_iter, &res); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -636,7 +636,7 @@ GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer, blacklist = GNUNET_CONTAINER_multipeermap_create (TRANSPORT_BLACKLIST_HT_SIZE, GNUNET_NO); - + GNUNET_CONTAINER_multipeermap_put (blacklist, peer, transport, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); @@ -653,7 +653,7 @@ GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer, * @return #GNUNET_OK if the entry does not match, #GNUNET_NO if it matches */ static int -test_blacklisted (void *cls, +test_blacklisted (void *cls, const struct GNUNET_PeerIdentity *key, void *value) { 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, setup_monitoring_client (client, &msg->peer); else GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0, - GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE); + GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE); GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL); } 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) friend_only = GNUNET_HELLO_is_friend_only (our_hello); GNUNET_free (our_hello); our_hello = GNUNET_HELLO_create (&GST_my_identity.public_key, - &address_generator, + &address_generator, &gc, friend_only); GNUNET_assert (NULL != our_hello); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -215,7 +215,7 @@ GST_hello_start (int friend_only, GST_HelloCallback cb, void *cb_cls) { hello_cb = cb; hello_cb_cls = cb_cls; - our_hello = GNUNET_HELLO_create (&GST_my_identity.public_key, + our_hello = GNUNET_HELLO_create (&GST_my_identity.public_key, NULL, NULL, friend_only); GNUNET_assert (NULL != our_hello); 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, tmp->metrics[c][c2] = UINT32_MAX; } } - GNUNET_CONTAINER_multipeermap_put (man_handle.peers, + GNUNET_CONTAINER_multipeermap_put (man_handle.peers, &tm->peer, tmp, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); } @@ -581,64 +581,64 @@ GST_manipulation_init (const struct GNUNET_CONFIGURATION_Handle *GST_cfg) { unsigned long long tmp; struct GNUNET_TIME_Relative delay; - + if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg, "transport", "MANIPULATE_DISTANCE_IN", - &tmp)) && + &tmp)) && (tmp > 0) ) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Setting inbound distance_in to %llu\n", (unsigned long long) tmp); set_metric (&man_handle.general, TM_RECEIVE, GNUNET_ATS_QUALITY_NET_DISTANCE, tmp); } - + if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg, - "transport", + "transport", "MANIPULATE_DISTANCE_OUT", &tmp)) && (tmp > 0) ) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Setting outbound distance_in to %llu\n", (unsigned long long) tmp); - set_metric (&man_handle.general, TM_SEND, + set_metric (&man_handle.general, TM_SEND, GNUNET_ATS_QUALITY_NET_DISTANCE, tmp); } - + if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (GST_cfg, "transport", "MANIPULATE_DELAY_IN", - &delay)) && + &delay)) && (delay.rel_value_us > 0) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Delaying inbound traffic for %s\n", GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); set_metric (&man_handle.general, TM_RECEIVE, - GNUNET_ATS_QUALITY_NET_DELAY, + GNUNET_ATS_QUALITY_NET_DELAY, delay.rel_value_us); } if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (GST_cfg, "transport", "MANIPULATE_DELAY_OUT", - &delay)) && + &delay)) && (delay.rel_value_us > 0) ) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Delaying outbound traffic for %s\n", GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); - set_metric (&man_handle.general, + set_metric (&man_handle.general, TM_SEND, - GNUNET_ATS_QUALITY_NET_DELAY, + GNUNET_ATS_QUALITY_NET_DELAY, delay.rel_value_us); - } + } man_handle.peers = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); } -static int +static int free_tmps (void *cls, const struct GNUNET_PeerIdentity *key, 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 @@ #define SETUP_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15) /** - * How long are we willing to wait for a successful reconnect if + * How long are we willing to wait for a successful reconnect if * an existing connection went down? Much shorter than the * usual SETUP_CONNECTION_TIMEOUT as we do not inform the * higher layers about the disconnect during this period. @@ -271,7 +271,7 @@ GNUNET_NETWORK_STRUCT_BEGIN * setup a connection/session for data exchange. A 'SESSION_CONNECT' * should be answered with a 'SESSION_CONNECT_ACK' with the same body * to confirm. A 'SESSION_CONNECT_ACK' should then be followed with - * a 'SESSION_ACK'. Once the 'SESSION_ACK' is received, both peers + * a 'SESSION_ACK'. Once the 'SESSION_ACK' is received, both peers * should be connected. */ struct SessionConnectMessage @@ -298,7 +298,7 @@ struct SessionConnectMessage /** * Message we send to the other peer to notify him that we intentionally - * are disconnecting (to reduce timeouts). This is just a friendly + * are disconnecting (to reduce timeouts). This is just a friendly * notification, peers must not rely on always receiving disconnect * messages. */ @@ -448,8 +448,8 @@ struct MessageQueue * and set the 'send_connect_ack' to 2. If we then receive a * 'SESSION_ACK', we go to 'S_CONNECTED' (and reset 'send_connect_ack' * to 0). - * - */ + * + */ enum State { /** @@ -525,7 +525,7 @@ enum State */ S_CONNECTED_SWITCHING_BLACKLIST, - /** + /** * We have some primary connection, but ATS suggested we switch * to some alternative; we now sent a CONNECT message for the * alternative session to the other peer and waiting for a @@ -589,7 +589,7 @@ struct NeighbourAddress * Did we tell ATS that this is our 'active' address? */ int ats_active; - + }; @@ -644,7 +644,7 @@ struct NeighbourMapEntry struct GNUNET_TIME_Absolute keep_alive_time; /** - * At what time did we sent the last keep-alive message? Used + * At what time did we sent the last keep-alive message? Used * to calculate round-trip time ("latency"). */ struct GNUNET_TIME_Absolute last_keep_alive_time; @@ -713,7 +713,7 @@ struct NeighbourMapEntry */ struct BlackListCheckContext { - + /** * We keep blacklist checks in a DLL. */ @@ -954,7 +954,7 @@ set_address (struct NeighbourAddress *na, int is_active) { struct GNUNET_TRANSPORT_PluginFunctions *papi; - if (NULL == (papi = GST_plugins_find (address->transport_name))) + if (NULL == (papi = GST_plugins_find (address->transport_name))) { GNUNET_break (0); return; @@ -976,17 +976,17 @@ set_address (struct NeighbourAddress *na, /* FIXME: is this the right place to set quotas? */ GST_neighbours_set_incoming_quota (&address->peer, bandwidth_in); send_outbound_quota (&address->peer, bandwidth_out); - } + } return; } free_address (na); if (NULL == session) - session = papi->get_session (papi->cls, address); + session = papi->get_session (papi->cls, address); if (NULL == session) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to obtain new session for peer `%s' and address '%s'\n", - GNUNET_i2s (&address->peer), GST_plugins_a2s (address)); + GNUNET_i2s (&address->peer), GST_plugins_a2s (address)); GNUNET_ATS_address_destroyed (GST_ats, address, NULL); return; } @@ -1037,8 +1037,8 @@ free_neighbour (struct NeighbourMapEntry *n, int keep_sessions) least internally we need to get clean... */ if (GNUNET_YES == test_connected (n)) { - GNUNET_STATISTICS_set (GST_stats, - gettext_noop ("# peers connected"), + GNUNET_STATISTICS_set (GST_stats, + gettext_noop ("# peers connected"), --neighbours_connected, GNUNET_NO); disconnect_notify_cb (callback_cls, &n->id); @@ -1226,7 +1226,7 @@ send_disconnect (struct NeighbourMapEntry *n) static void disconnect_neighbour (struct NeighbourMapEntry *n) { - /* depending on state, notify neighbour and/or upper layers of this peer + /* depending on state, notify neighbour and/or upper layers of this peer about disconnect */ switch (n->state) { @@ -1238,7 +1238,7 @@ disconnect_neighbour (struct NeighbourMapEntry *n) free_neighbour (n, GNUNET_NO); return; case S_CONNECT_SENT: - send_disconnect (n); + send_disconnect (n); n->state = S_DISCONNECT; break; case S_CONNECT_RECV_BLACKLIST_INBOUND: @@ -1250,9 +1250,9 @@ disconnect_neighbour (struct NeighbourMapEntry *n) return; case S_CONNECT_RECV_ACK: /* we DID ACK the other peer's request, must send DISCONNECT */ - send_disconnect (n); + send_disconnect (n); n->state = S_DISCONNECT; - break; + break; case S_CONNECTED: case S_RECONNECT_BLACKLIST: case S_RECONNECT_SENT: @@ -1261,8 +1261,8 @@ disconnect_neighbour (struct NeighbourMapEntry *n) /* we are currently connected, need to send disconnect and do internal notifications and update statistics */ send_disconnect (n); - GNUNET_STATISTICS_set (GST_stats, - gettext_noop ("# peers connected"), + GNUNET_STATISTICS_set (GST_stats, + gettext_noop ("# peers connected"), --neighbours_connected, GNUNET_NO); disconnect_notify_cb (callback_cls, &n->id); @@ -1326,7 +1326,7 @@ transmit_send_continuation (void *cls, n->is_active = NULL; if (GNUNET_SCHEDULER_NO_TASK != n->task) GNUNET_SCHEDULER_cancel (n->task); - n->task = GNUNET_SCHEDULER_add_now (&master_task, n); + n->task = GNUNET_SCHEDULER_add_now (&master_task, n); } if (bytes_in_send_queue < mq->message_buf_size) { @@ -1355,7 +1355,7 @@ transmit_send_continuation (void *cls, gettext_noop ("# transmission failures for messages to other peers"), 1, GNUNET_NO); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending message to `%s' of type %u was a %s\n", GNUNET_i2s (receiver), ntohs (((struct GNUNET_MessageHeader *) mq->message_buf)->type), @@ -1389,7 +1389,7 @@ try_transmission_to_peer (struct NeighbourMapEntry *n) GNUNET_break (0); return; } - if ((0 == n->primary_address.address->address_length) && + if ((0 == n->primary_address.address->address_length) && (NULL == n->primary_address.session)) { /* no address, why are we here? */ @@ -1399,7 +1399,7 @@ try_transmission_to_peer (struct NeighbourMapEntry *n) if (NULL != n->is_active) { /* transmission already pending */ - return; + return; } /* timeout messages from the queue that are past their due date */ @@ -1535,7 +1535,7 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour) n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Latency for peer `%s' is %s\n", - GNUNET_i2s (&n->id), + GNUNET_i2s (&n->id), GNUNET_STRINGS_relative_time_to_string (n->latency, GNUNET_YES)); /* append latency */ @@ -1570,7 +1570,7 @@ GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity { struct NeighbourMapEntry *n; struct GNUNET_TIME_Relative ret; - + if (NULL == neighbours) { *do_forward = GNUNET_NO; @@ -1634,7 +1634,7 @@ GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES)); GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# ms throttling suggested"), - (int64_t) ret.rel_value_us / 1000LL, + (int64_t) ret.rel_value_us / 1000LL, GNUNET_NO); } return ret; @@ -1708,13 +1708,13 @@ send_session_connect (struct NeighbourAddress *na) struct GNUNET_TRANSPORT_PluginFunctions *papi; struct SessionConnectMessage connect_msg; - if (NULL == (papi = GST_plugins_find (na->address->transport_name))) + if (NULL == (papi = GST_plugins_find (na->address->transport_name))) { GNUNET_break (0); return; } if (NULL == na->session) - na->session = papi->get_session (papi->cls, na->address); + na->session = papi->get_session (papi->cls, na->address); if (NULL == na->session) { GNUNET_break (0); @@ -1750,13 +1750,13 @@ send_session_connect_ack_message (const struct GNUNET_HELLO_Address *address, struct GNUNET_TRANSPORT_PluginFunctions *papi; struct SessionConnectMessage connect_msg; - if (NULL == (papi = GST_plugins_find (address->transport_name))) + if (NULL == (papi = GST_plugins_find (address->transport_name))) { GNUNET_break (0); return; } if (NULL == session) - session = papi->get_session (papi->cls, address); + session = papi->get_session (papi->cls, address); if (NULL == session) { GNUNET_break (0); @@ -1788,7 +1788,7 @@ setup_neighbour (const struct GNUNET_PeerIdentity *peer) struct NeighbourMapEntry *n; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Creating new neighbour entry for `%s'\n", + "Creating new neighbour entry for `%s'\n", GNUNET_i2s (peer)); n = MEMDEBUG_malloc (sizeof (struct NeighbourMapEntry), __LINE__); n->id = *peer; @@ -1842,7 +1842,7 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target) { struct NeighbourMapEntry *n; - if (NULL == neighbours) + if (NULL == neighbours) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asked to connect to peer `%s' during shutdown\n", @@ -1881,7 +1881,7 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target) "Ignoring request to try to connect to `%s', already trying!\n", GNUNET_i2s (target)); return; /* already trying */ - case S_CONNECTED: + case S_CONNECTED: case S_RECONNECT_ATS: case S_RECONNECT_BLACKLIST: case S_RECONNECT_SENT: @@ -1896,8 +1896,8 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target) free_neighbour (n, GNUNET_NO); break; case S_DISCONNECT_FINISHED: - /* should not be possible */ - GNUNET_assert (0); + /* should not be possible */ + GNUNET_assert (0); default: GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state)); GNUNET_break (0); @@ -1905,8 +1905,8 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target) break; } } - n = setup_neighbour (target); - n->state = S_INIT_ATS; + n = setup_neighbour (target); + n->state = S_INIT_ATS; n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT); GNUNET_ATS_reset_backoff (GST_ats, target); @@ -1988,7 +1988,7 @@ handle_test_blacklist_cont (void *cls, n->primary_address.session, n->connect_ack_timestamp); } - break; + break; case S_CONNECT_RECV_BLACKLIST_INBOUND: if (GNUNET_OK == result) GST_ats_add_address (bcc->na.address, bcc->na.session); @@ -2011,7 +2011,7 @@ handle_test_blacklist_cont (void *cls, send_session_connect_ack_message (bcc->na.address, bcc->na.session, n->connect_ack_timestamp); - if (1 == n->send_connect_ack) + if (1 == n->send_connect_ack) n->send_connect_ack = 2; } else @@ -2038,13 +2038,13 @@ handle_test_blacklist_cont (void *cls, n->primary_address.session, n->connect_ack_timestamp); } - break; + break; case S_CONNECTED: /* already connected, don't care about blacklist */ break; case S_RECONNECT_ATS: /* still waiting on ATS suggestion, don't care about blacklist */ - break; + break; case S_RECONNECT_BLACKLIST: if ( (GNUNET_OK == result) && (1 == n->send_connect_ack) ) @@ -2083,7 +2083,7 @@ handle_test_blacklist_cont (void *cls, n->primary_address.session, n->connect_ack_timestamp); } - break; + break; case S_CONNECTED_SWITCHING_BLACKLIST: if (GNUNET_YES != address_matches (&bcc->na, &n->alternative_address)) break; /* result for an address we currently don't care about */ @@ -2111,7 +2111,7 @@ handle_test_blacklist_cont (void *cls, n->primary_address.session, n->connect_ack_timestamp); } - break; + break; case S_DISCONNECT: /* Nothing to do here, ATS will already do what can be done */ break; @@ -2163,10 +2163,10 @@ check_blacklist (const struct GNUNET_PeerIdentity *peer, GNUNET_CONTAINER_DLL_insert (bc_head, bc_tail, bcc); - if (NULL != (bc = GST_blacklist_test_allowed (peer, + if (NULL != (bc = GST_blacklist_test_allowed (peer, address->transport_name, &handle_test_blacklist_cont, bcc))) - bcc->bc = bc; + bcc->bc = bc; /* if NULL == bc, 'cont' was already called and 'bcc' already free'd, so we must only store 'bc' if 'bc' is non-NULL... */ } @@ -2193,7 +2193,7 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, struct GNUNET_TIME_Absolute ts; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Received CONNECT message from peer `%s'\n", + "Received CONNECT message from peer `%s'\n", GNUNET_i2s (peer)); if (ntohs (message->size) != sizeof (struct SessionConnectMessage)) @@ -2213,7 +2213,7 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, n->connect_ack_timestamp = ts; switch (n->state) - { + { case S_NOT_CONNECTED: n->state = S_CONNECT_RECV_BLACKLIST_INBOUND; /* Do a blacklist check for the new address */ @@ -2229,7 +2229,7 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, case S_CONNECT_RECV_ATS: case S_CONNECT_RECV_BLACKLIST: case S_CONNECT_RECV_ACK: - /* It can never hurt to have an alternative address in the above cases, + /* It can never hurt to have an alternative address in the above cases, see if it is allowed */ check_blacklist (peer, ts, address, session); break; @@ -2247,7 +2247,7 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, case S_RECONNECT_ATS: case S_RECONNECT_BLACKLIST: case S_RECONNECT_SENT: - /* It can never hurt to have an alternative address in the above cases, + /* It can never hurt to have an alternative address in the above cases, see if it is allowed */ check_blacklist (peer, ts, address, session); break; @@ -2286,7 +2286,7 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, /** * For an existing neighbour record, set the active connection to - * use the given address. + * use the given address. * * @param peer identity of the peer to switch the address for * @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, { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to obtain new session for peer `%s' and address '%s'\n", - GNUNET_i2s (&address->peer), GST_plugins_a2s (address)); + GNUNET_i2s (&address->peer), GST_plugins_a2s (address)); GNUNET_ATS_address_destroyed (GST_ats, address, NULL); return; } @@ -2529,7 +2529,7 @@ master_task (void *cls, struct GNUNET_TIME_Relative delay; n->task = GNUNET_SCHEDULER_NO_TASK; - delay = GNUNET_TIME_absolute_get_remaining (n->timeout); + delay = GNUNET_TIME_absolute_get_remaining (n->timeout); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Master task runs for neighbour `%s' in state %s with timeout in %s\n", GNUNET_i2s (&n->id), @@ -2698,11 +2698,11 @@ master_task (void *cls, default: GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state)); GNUNET_break (0); - break; + break; } if ( (S_CONNECTED_SWITCHING_CONNECT_SENT == n->state) || (S_CONNECTED_SWITCHING_BLACKLIST == n->state) || - (S_CONNECTED == n->state) ) + (S_CONNECTED == n->state) ) { /* if we are *now* in one of these three states, we're sending keep alive messages, so we need to consider the keepalive @@ -2789,14 +2789,14 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, gettext_noop ("# unexpected CONNECT_ACK messages (not ready)"), 1, GNUNET_NO); - break; + break; case S_CONNECT_SENT: if (ts.abs_value_us != n->primary_address.connect_timestamp.abs_value_us) break; /* ACK does not match our original CONNECT message */ n->state = S_CONNECTED; n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); - GNUNET_STATISTICS_set (GST_stats, - gettext_noop ("# peers connected"), + GNUNET_STATISTICS_set (GST_stats, + gettext_noop ("# peers connected"), ++neighbours_connected, GNUNET_NO); connect_notify_cb (callback_cls, &n->id, @@ -2858,7 +2858,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, GNUNET_YES); free_address (&n->alternative_address); send_session_ack_message (n); - break; + break; case S_DISCONNECT: GNUNET_STATISTICS_update (GST_stats, gettext_noop @@ -2871,7 +2871,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, default: GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state)); GNUNET_break (0); - break; + break; } } @@ -2945,7 +2945,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer, n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, &n->id); break; case S_CONNECT_RECV_BLACKLIST_INBOUND: - case S_CONNECT_RECV_ATS: + case S_CONNECT_RECV_ATS: case S_CONNECT_RECV_BLACKLIST: case S_CONNECT_RECV_ACK: /* error on inbound session; free neighbour entirely */ @@ -2972,7 +2972,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer, break; case S_CONNECTED_SWITCHING_BLACKLIST: /* primary went down while we were checking secondary against - blacklist, adopt secondary as primary */ + blacklist, adopt secondary as primary */ free_address (&n->primary_address); n->primary_address = n->alternative_address; memset (&n->alternative_address, 0, sizeof (struct NeighbourAddress)); @@ -2981,7 +2981,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer, break; case S_CONNECTED_SWITCHING_CONNECT_SENT: /* primary went down while we were waiting for CONNECT_ACK on secondary; - secondary as primary */ + secondary as primary */ free_address (&n->primary_address); n->primary_address = n->alternative_address; memset (&n->alternative_address, 0, sizeof (struct NeighbourAddress)); @@ -3026,7 +3026,7 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, { struct NeighbourMapEntry *n; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received SESSION_ACK message from peer `%s'\n", GNUNET_i2s (peer)); if (ntohs (message->size) != sizeof (struct GNUNET_MessageHeader)) @@ -3049,8 +3049,8 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, } n->state = S_CONNECTED; n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); - GNUNET_STATISTICS_set (GST_stats, - gettext_noop ("# peers connected"), + GNUNET_STATISTICS_set (GST_stats, + gettext_noop ("# peers connected"), ++neighbours_connected, GNUNET_NO); connect_notify_cb (callback_cls, &n->id, @@ -3263,7 +3263,7 @@ GST_neighbours_iterate (GST_NeighbourIterator cb, void *cb_cls) { struct IteratorContext ic; - if (NULL == neighbours) + if (NULL == neighbours) return; /* can happen during shutdown */ ic.cb = cb; ic.cb_cls = cb_cls; @@ -3296,7 +3296,7 @@ GST_neighbours_force_disconnect (const struct GNUNET_PeerIdentity *target) * Obtain current latency information for the given neighbour. * * @param peer to get the latency for - * @return observed latency of the address, FOREVER if the + * @return observed latency of the address, FOREVER if the * the connection is not up */ struct GNUNET_TIME_Relative @@ -3305,7 +3305,7 @@ GST_neighbour_get_latency (const struct GNUNET_PeerIdentity *peer) struct NeighbourMapEntry *n; n = lookup_neighbour (peer); - if (NULL == n) + if (NULL == n) return GNUNET_TIME_UNIT_FOREVER_REL; switch (n->state) { @@ -3332,7 +3332,7 @@ GST_neighbour_get_latency (const struct GNUNET_PeerIdentity *peer) GNUNET_break (0); break; } - return GNUNET_TIME_UNIT_FOREVER_REL; + return GNUNET_TIME_UNIT_FOREVER_REL; } @@ -3388,13 +3388,13 @@ GST_neighbours_start (void *cls, * @return GNUNET_OK (continue to iterate) */ static int -disconnect_all_neighbours (void *cls, - const struct GNUNET_PeerIdentity *key, +disconnect_all_neighbours (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { struct NeighbourMapEntry *n = value; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting peer `%4s', %s\n", GNUNET_i2s (&n->id), "SHUTDOWN_TASK"); n->state = S_DISCONNECT_FINISHED; @@ -3411,7 +3411,7 @@ GST_neighbours_stop () { if (NULL == neighbours) return; - GNUNET_CONTAINER_multipeermap_iterate (neighbours, + GNUNET_CONTAINER_multipeermap_iterate (neighbours, &disconnect_all_neighbours, NULL); 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) validations_fast_start_threshold = (max_fds / 2); validations_running = 0; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Validation uses a fast start threshold of %u connections and a delay between of %s\n ", - validations_fast_start_threshold, + validations_fast_start_threshold, GNUNET_STRINGS_relative_time_to_string (validation_delay, GNUNET_YES)); validation_map = GNUNET_CONTAINER_multipeermap_create (VALIDATION_MAP_SIZE, @@ -855,7 +855,7 @@ GST_validation_stop () */ static void multicast_pong (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *public_key, + const struct GNUNET_CRYPTO_EccPublicSignKey *public_key, struct GNUNET_TIME_Absolute valid_until, struct GNUNET_TIME_Absolute validation_block, const struct GNUNET_HELLO_Address *address) @@ -1075,7 +1075,7 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, pong->expiration = GNUNET_TIME_absolute_hton (*sig_cache_exp); } pong->signature = *sig_cache; - + GNUNET_assert (sender_address != NULL); /* 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 @@ static void -removecerts (const char *file1, +removecerts (const char *file1, const char *file2) { if (GNUNET_YES == GNUNET_DISK_file_test (file1)) @@ -55,7 +55,7 @@ main (int argc, char **argv) if (3 != argc) { - fprintf (stderr, + fprintf (stderr, "Invalid arguments.\n"); return 1; } @@ -68,7 +68,7 @@ main (int argc, char **argv) "-out", argv[1], "1024", NULL); if (NULL == openssl) { - fprintf (stderr, + fprintf (stderr, "Failed to run openssl. Is openssl installed?\n"); return 2; } @@ -83,7 +83,7 @@ main (int argc, char **argv) "-new", "-x509", "-key", argv[1], NULL); if (NULL == openssl) { - fprintf (stderr, + fprintf (stderr, "Failed to create self-signed certificate with openssl.\n"); return 3; } 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[]) /* Setup communication pipeline first */ if (pipe (commpipe)) { - fprintf (stderr, + fprintf (stderr, "Failed to create pipe: %s\n", STRERROR (errno)); exit (1); @@ -62,8 +62,8 @@ main (int argc, char *argv[]) /* Attempt to fork and check for errors */ if ((pid = fork ()) == -1) { - fprintf (stderr, "Failed to fork: %s\n", - STRERROR (errno)); + fprintf (stderr, "Failed to fork: %s\n", + STRERROR (errno)); exit (1); } @@ -90,7 +90,7 @@ main (int argc, char *argv[]) { bytes_per_s = count / (akt - start); bytes_per_s /= 1024; - printf ("recv %f kb/s\n", bytes_per_s); + printf ("recv %f kb/s\n", bytes_per_s); start = akt; count = 0; } 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, * @return GNUNET_YES if there was no error */ static int -getWlanHeader (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *Header, +getWlanHeader (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *Header, const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr, const struct GNUNET_TRANSPORT_WLAN_MacAddress *mac, unsigned int size) { @@ -148,14 +148,14 @@ main (int argc, char *argv[]) /* Setup communication pipeline first */ if (pipe (commpipe)) { - fprintf (stderr, + fprintf (stderr, "Failed to create pipe: %s\n", STRERROR (errno)); exit (1); } if (pipe (macpipe)) { - fprintf (stderr, + fprintf (stderr, "Failed to create pipe: %s\n", STRERROR (errno)); exit (1); @@ -164,8 +164,8 @@ main (int argc, char *argv[]) /* Attempt to fork and check for errors */ if ((pid = fork ()) == -1) { - fprintf (stderr, "Failed to fork: %s\n", - STRERROR (errno)); + fprintf (stderr, "Failed to fork: %s\n", + STRERROR (errno)); exit (1); } memset (msg_buf, 0x42, sizeof (msg_buf)); @@ -183,12 +183,12 @@ main (int argc, char *argv[]) "Failed to close fd: %s\n", strerror (errno)); if (sizeof (hcm) != read (macpipe[0], &hcm, sizeof (hcm))) - fprintf (stderr, + fprintf (stderr, "Failed to read hcm...\n"); fprintf (stderr, - "Got MAC %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\n", + "Got MAC %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\n", hcm.mac.mac[0], hcm.mac.mac[1], - hcm.mac.mac[2], hcm.mac.mac[3], hcm.mac.mac[4], hcm.mac.mac[5]); + hcm.mac.mac[2], hcm.mac.mac[3], hcm.mac.mac[4], hcm.mac.mac[5]); radiotap = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) msg_buf; getRadiotapHeader (radiotap, WLAN_MTU); getWlanHeader (&radiotap->frame, &outmac, &inmac, @@ -212,7 +212,7 @@ main (int argc, char *argv[]) printf ("send %f kbytes/s\n", bytes_per_s); start = akt; count = 0; - } + } } } 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) if (try_connect) { /* all done, terminate instantly */ - FPRINTF (stdout, - _("Successfully connected to `%s'\n"), + FPRINTF (stdout, + _("Successfully connected to `%s'\n"), GNUNET_i2s_full (peer)); ret = 0; @@ -803,12 +803,12 @@ testservice_task (void *cls, if (GNUNET_YES != result) { - FPRINTF (stderr, + FPRINTF (stderr, _("Service `%s' is not running\n"), "transport"); return; } - if ( (NULL != cpid) && + if ( (NULL != cpid) && (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (cpid, strlen (cpid), &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 /** * Header for messages which need fragmentation. This is the format of * a message we obtain AFTER defragmentation. We then need to check - * the CRC and then tokenize the payload and pass it to the + * the CRC and then tokenize the payload and pass it to the * 'receive' callback. */ struct WlanHeader @@ -397,7 +397,7 @@ struct Plugin /** * Handle to helper process for priviledged operations. - */ + */ struct GNUNET_HELPER_Handle *suid_helper; /** @@ -559,7 +559,7 @@ get_radiotap_header (struct MacEndpoint *endpoint, static void get_wlan_header (struct Plugin *plugin, struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *header, - const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr, + const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr, unsigned int size) { const int rate = 11000000; @@ -599,12 +599,12 @@ send_ack (void *cls, uint32_t msg_id, GNUNET_break (0); return; } - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending ACK to helper\n"); radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf; get_radiotap_header (endpoint, radio_header, size); get_wlan_header (endpoint->plugin, - &radio_header->frame, + &radio_header->frame, &endpoint->addr.mac, size); memcpy (&radio_header[1], hdr, msize); @@ -612,7 +612,7 @@ send_ack (void *cls, uint32_t msg_id, GNUNET_HELPER_send (endpoint->plugin->suid_helper, &radio_header->header, GNUNET_NO /* dropping ACKs is bad */, - NULL, NULL)) + NULL, NULL)) GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# Bluetooth ACKs sent"), 1, GNUNET_NO); } @@ -636,7 +636,7 @@ bluetooth_data_message_handler (void *cls, const struct GNUNET_MessageHeader *hd GNUNET_NO); mas.session = NULL; mas.endpoint = endpoint; - (void) GNUNET_SERVER_mst_receive (plugin->fragment_data_tokenizer, + (void) GNUNET_SERVER_mst_receive (plugin->fragment_data_tokenizer, &mas, (const char *) hdr, ntohs (hdr->size), @@ -654,7 +654,7 @@ free_session (struct Session *session) { struct MacEndpoint *endpoint = session->mac; struct PendingMessage *pm; - + endpoint->plugin->env->session_end (endpoint->plugin->env->cls, &session->target, session); @@ -670,7 +670,7 @@ free_session (struct Session *session) GNUNET_free (pm->msg); GNUNET_free (pm); } - GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head, + GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head, endpoint->sessions_tail, session); if (session->timeout_task != GNUNET_SCHEDULER_NO_TASK) @@ -698,7 +698,7 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) session->timeout_task = GNUNET_SCHEDULER_NO_TASK; timeout = GNUNET_TIME_absolute_get_remaining (session->timeout); - if (0 == timeout.rel_value_us) + if (0 == timeout.rel_value_us) { free_session (session); return; @@ -739,7 +739,7 @@ create_session (struct MacEndpoint *endpoint, session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); session->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, &session_timeout, session); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Created new session for peer `%s' with endpoint %s\n", GNUNET_i2s (peer), mac_to_string (&endpoint->addr.mac)); @@ -752,7 +752,7 @@ create_session (struct MacEndpoint *endpoint, * message to the SUID helper process and we are thus ready for * the next fragment. * - * @param cls the 'struct FragmentMessage' + * @param cls the 'struct FragmentMessage' * @param result result of the operation (GNUNET_OK on success, GNUNET_NO if the helper died, GNUNET_SYSERR * if the helper was stopped) */ @@ -772,7 +772,7 @@ fragment_transmission_done (void *cls, * Transmit a fragment of a message. * * @param cls 'struct FragmentMessage' this fragment message belongs to - * @param hdr pointer to the start of the fragment message + * @param hdr pointer to the start of the fragment message */ static void transmit_fragment (void *cls, @@ -792,7 +792,7 @@ transmit_fragment (void *cls, radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf; get_radiotap_header (endpoint, radio_header, size); get_wlan_header (endpoint->plugin, - &radio_header->frame, + &radio_header->frame, &endpoint->addr.mac, size); memcpy (&radio_header[1], hdr, msize); @@ -827,7 +827,7 @@ free_fragment_message (struct FragmentMessage *fm) { struct MacEndpoint *endpoint = fm->macendpoint; - GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# Bluetooth messages pending (with fragmentation)"), + GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# Bluetooth messages pending (with fragmentation)"), -1, GNUNET_NO); GNUNET_CONTAINER_DLL_remove (endpoint->sending_messages_head, endpoint->sending_messages_tail, fm); @@ -887,7 +887,7 @@ fragmentmessage_timeout (void *cls, static void send_with_fragmentation (struct MacEndpoint *endpoint, struct GNUNET_TIME_Relative timeout, - const struct GNUNET_PeerIdentity *target, + const struct GNUNET_PeerIdentity *target, const struct GNUNET_MessageHeader *msg, size_t payload_size, GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) @@ -914,7 +914,7 @@ send_with_fragmentation (struct MacEndpoint *endpoint, msg, &transmit_fragment, fm); fm->timeout_task = - GNUNET_SCHEDULER_add_delayed (timeout, + GNUNET_SCHEDULER_add_delayed (timeout, &fragmentmessage_timeout, fm); GNUNET_CONTAINER_DLL_insert_tail (endpoint->sending_messages_head, endpoint->sending_messages_tail, @@ -924,7 +924,7 @@ send_with_fragmentation (struct MacEndpoint *endpoint, /** * Free a MAC endpoint. - * + * * @param endpoint pointer to the MacEndpoint to free */ static void @@ -940,8 +940,8 @@ free_macendpoint (struct MacEndpoint *endpoint) free_session (session); while (NULL != (fm = endpoint->sending_messages_head)) free_fragment_message (fm); - GNUNET_CONTAINER_DLL_remove (plugin->mac_head, - plugin->mac_tail, + GNUNET_CONTAINER_DLL_remove (plugin->mac_head, + plugin->mac_tail, endpoint); if (NULL != endpoint->defrag) @@ -974,7 +974,7 @@ macendpoint_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK; timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout); - if (0 == timeout.rel_value_us) + if (0 == timeout.rel_value_us) { free_macendpoint (endpoint); return; @@ -1000,14 +1000,14 @@ create_macendpoint (struct Plugin *plugin, for (pos = plugin->mac_head; NULL != pos; pos = pos->next) if (0 == memcmp (addr, &pos->addr, sizeof (struct WlanAddress))) - return pos; + return pos; pos = GNUNET_malloc (sizeof (struct MacEndpoint)); pos->addr = *addr; pos->plugin = plugin; pos->defrag = GNUNET_DEFRAGMENT_context_create (plugin->env->stats, WLAN_MTU, MESSAGES_IN_DEFRAG_QUEUE_PER_MAC, - pos, + pos, &bluetooth_data_message_handler, &send_ack); @@ -1022,7 +1022,7 @@ create_macendpoint (struct Plugin *plugin, plugin->mac_count++; GNUNET_STATISTICS_update (plugin->env->stats, _("# Bluetooth MAC endpoints allocated"), 1, GNUNET_NO); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "New MAC endpoint `%s'\n", bluetooth_plugin_address_to_string(NULL, addr, sizeof (struct WlanAddress))); return pos; @@ -1142,7 +1142,7 @@ bluetooth_plugin_send (void *cls, size_t size = msgbuf_size + sizeof (struct WlanHeader); char buf[size] GNUNET_ALIGN; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting %u bytes of payload to peer `%s' (starting with %u byte message of type %u)\n", msgbuf_size, GNUNET_i2s (&session->target), @@ -1202,7 +1202,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) switch (ntohs (hdr->type)) { case GNUNET_MESSAGE_TYPE_HELLO: - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) hdr, &tmpsource)) { GNUNET_break_op (0); @@ -1217,9 +1217,9 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) GNUNET_STATISTICS_update (plugin->env->stats, _("# HELLO messages received via Bluetooth"), 1, GNUNET_NO); - plugin->env->receive (plugin->env->cls, + plugin->env->receive (plugin->env->cls, &tmpsource, - hdr, + hdr, mas->session, (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr, (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) GNUNET_break (0); break; } - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing %u bytes of FRAGMENT from MAC %s\n", (unsigned int) msize, 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) ret = GNUNET_FRAGMENT_process_ack (fm->fragcontext, hdr); if (GNUNET_OK == ret) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Got last ACK, finished message transmission to `%s' (%p)\n", bluetooth_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress)), fm); @@ -1273,13 +1273,13 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) } if (GNUNET_NO == ret) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Got an ACK, message transmission to `%s' not yet finished\n", bluetooth_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress))); break; } } - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "ACK not matched against any active fragmentation with MAC `%s'\n", bluetooth_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress))); break; @@ -1293,13 +1293,13 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) { GNUNET_break (0); break; - } + } wlanheader = (const struct WlanHeader *) hdr; if (0 != memcmp (&wlanheader->target, plugin->env->my_identity, sizeof (struct GNUNET_PeerIdentity))) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Bluetooth data for `%s', not for me, ignoring\n", GNUNET_i2s (&wlanheader->target)); break; @@ -1314,15 +1314,15 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) } xmas.endpoint = mas->endpoint; xmas.session = create_session (mas->endpoint, &wlanheader->sender); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing %u bytes of BLUETOOTH DATA from peer `%s'\n", (unsigned int) msize, GNUNET_i2s (&wlanheader->sender)); - (void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer, + (void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer, &xmas, (const char *) &wlanheader[1], msize - sizeof (struct WlanHeader), - GNUNET_YES, GNUNET_NO); + GNUNET_YES, GNUNET_NO); break; default: if (NULL == mas->endpoint) @@ -1340,9 +1340,9 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) (unsigned int) msize, (unsigned int) ntohs (hdr->type), GNUNET_i2s (&mas->session->target)); - plugin->env->receive (plugin->env->cls, + plugin->env->receive (plugin->env->cls, &mas->session->target, - hdr, + hdr, mas->session, (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr, (mas->endpoint == NULL) ? 0 : sizeof (struct WlanAddress)); @@ -1416,7 +1416,7 @@ handle_helper_message (void *cls, void *client, "bluetooth"); break; case GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER: - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Got data message from helper with %u bytes\n", msize); GNUNET_STATISTICS_update (plugin->env->stats, @@ -1453,7 +1453,7 @@ handle_helper_message (void *cls, void *client, /* packet is FROM us, thus not FOR us */ break; } - + GNUNET_STATISTICS_update (plugin->env->stats, _("# Bluetooth DATA messages processed"), 1, GNUNET_NO); @@ -1465,7 +1465,7 @@ handle_helper_message (void *cls, void *client, wa.options = htonl (0); mas.endpoint = create_macendpoint (plugin, &wa); mas.session = NULL; - (void) GNUNET_SERVER_mst_receive (plugin->helper_payload_tokenizer, + (void) GNUNET_SERVER_mst_receive (plugin->helper_payload_tokenizer, &mas, (const char*) &rxinfo[1], msize - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage), @@ -1473,7 +1473,7 @@ handle_helper_message (void *cls, void *client, break; default: GNUNET_break (0); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Unexpected message of type %u (%u bytes)", ntohs (hdr->type), ntohs (hdr->size)); break; @@ -1506,7 +1506,7 @@ send_hello_beacon (void *cls, { char buf[size] GNUNET_ALIGN; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending %u byte HELLO beacon\n", (unsigned int) size); radioHeader = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage*) buf; @@ -1550,13 +1550,13 @@ bluetooth_plugin_address_suggested (void *cls, const void *addr, size_t addrlen) struct WlanAddress *wa = (struct WlanAddress *) addr; if (addrlen != sizeof (struct WlanAddress)) - { + { GNUNET_break_op (0); return GNUNET_SYSERR; } if (GNUNET_YES != plugin->have_mac) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Rejecting MAC `%s': I don't know my MAC!\n", mac_to_string (addr)); return GNUNET_NO; /* don't know my MAC */ @@ -1565,7 +1565,7 @@ bluetooth_plugin_address_suggested (void *cls, const void *addr, size_t addrlen) &plugin->mac_address, sizeof (wa->mac))) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Rejecting MAC `%s': not my MAC!\n", mac_to_string (addr)); return GNUNET_NO; /* not my MAC */ @@ -1643,7 +1643,7 @@ bluetooth_plugin_address_pretty_printer (void *cls, const char *type, /** - * Exit point from the plugin. + * Exit point from the plugin. * * @param cls pointer to the api struct */ @@ -1799,7 +1799,7 @@ libgnunet_plugin_transport_bluetooth_init (void *cls) testmode = 0; /* check configuration */ - if ( (GNUNET_YES == + if ( (GNUNET_YES == GNUNET_CONFIGURATION_have_value (env->cfg, "transport-bluetooth", "TESTMODE")) && ( (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-bluetooth", @@ -1828,7 +1828,7 @@ libgnunet_plugin_transport_bluetooth_init (void *cls) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "transport-bluetooth", "INTERFACE"); - return NULL; + return NULL; } plugin = GNUNET_malloc (sizeof (struct Plugin)); @@ -1844,7 +1844,7 @@ libgnunet_plugin_transport_bluetooth_init (void *cls) plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); - plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon, + plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon, plugin); plugin->options = 0; @@ -1852,7 +1852,7 @@ libgnunet_plugin_transport_bluetooth_init (void *cls) /* some compilers do not like switch on 'long long'... */ switch ((unsigned int) testmode) { - case 0: /* normal */ + case 0: /* normal */ plugin->helper_argv[0] = (char *) "gnunet-helper-transport-bluetooth"; plugin->helper_argv[1] = interface; plugin->helper_argv[2] = NULL; @@ -1899,7 +1899,7 @@ libgnunet_plugin_transport_bluetooth_init (void *cls) api->address_to_string = &bluetooth_plugin_address_to_string;; api->string_to_address = &bluetooth_string_to_address; api->get_network = &bluetooth_get_network; - + return api; } 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, * @param added length of created address * @return GNUNET_OK on success, GNUNET_SYSERR on failure */ -int +int http_string_to_address (void *cls, const char *addr, uint16_t addrlen, @@ -363,7 +363,7 @@ lookup_session_old (struct Plugin *plugin, const struct GNUNET_PeerIdentity *tar e_peer = GNUNET_YES; if ( (addrlen == t->addrlen) && (0 == memcmp (addr, t->addr, addrlen)) ) - e_addr = GNUNET_YES; + e_addr = GNUNET_YES; if ( (t == session) && (t->addrlen == session->addrlen) && (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; /** * A connection handle - * + * */ struct ConnectionHandle { /** - * The curl easy handle + * The curl easy handle */ CURL *easyhandle; - + /** - * The related session + * The related session */ struct Session *s; }; @@ -363,7 +363,7 @@ client_schedule (struct HTTP_Client_Plugin *plugin, int now); /** - * Connect a HTTP put connection + * Connect a HTTP put connection * * @param s the session to connect * @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) * @return always 0 */ static int -client_log (CURL *curl, curl_infotype type, +client_log (CURL *curl, curl_infotype type, const char *data, size_t size, void *cls) { struct ConnectionHandle *ch = cls; @@ -755,7 +755,7 @@ http_client_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *targ /** * Check if a sessions exists for an specific address - * + * * @param plugin the plugin * @param address the address * @return the session or NULL @@ -946,7 +946,7 @@ client_receive_mst_cb (void *cls, void *client, "Client: peer `%s' address `%s' next read delayed for %s\n", GNUNET_i2s (&s->target), http_common_plugin_address_to_string (NULL, - s->plugin->protocol, + s->plugin->protocol, s->addr, s->addrlen), GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); @@ -1002,7 +1002,7 @@ client_receive (void *stream, size_t size, size_t nmemb, void *cls) GNUNET_TIME_absolute_get_difference (now, s->next_receive); GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name, "Session %p / connection %p: No inbound bandwidth available! Next read was delayed for %s\n", - s, s->client_get, + s, s->client_get, GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_YES)); if (s->recv_wakeup_task != GNUNET_SCHEDULER_NO_TASK) @@ -1231,7 +1231,7 @@ client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /** * Connect GET connection for a session - * + * * @param s the session to connect * @return GNUNET_OK on success, GNUNET_SYSERR otherwise */ @@ -1306,7 +1306,7 @@ client_connect_get (struct Session *s) } /** - * Connect a HTTP put connection + * Connect a HTTP put connection * * @param s the session to connect * @return GNUNET_SYSERR for hard failure, GNUNET_OK for ok @@ -1383,7 +1383,7 @@ client_connect_put (struct Session *s) /** * Connect both PUT and GET connection for a session - * + * * @param s the session to connect * @return GNUNET_OK on success, GNUNET_SYSERR otherwise */ @@ -1627,7 +1627,7 @@ client_start_session_timeout (struct Session *s) s); GNUNET_log (TIMEOUT_LOG, "Timeout for session %p set to %s\n", - s, + s, GNUNET_STRINGS_relative_time_to_string (CLIENT_SESSION_TIMEOUT, GNUNET_YES)); } 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) * @param to timeout in seconds */ static void -server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin, +server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin, struct Session *s, unsigned int to) { @@ -925,7 +925,7 @@ server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin, static int server_parse_url (struct HTTP_Server_Plugin *plugin, const char *url, - struct GNUNET_PeerIdentity *target, + struct GNUNET_PeerIdentity *target, uint32_t *tag) { char * tag_start = NULL; @@ -1012,7 +1012,7 @@ server_parse_url (struct HTTP_Server_Plugin *plugin, if (DEBUG_URL_PARSE) GNUNET_break (0); return GNUNET_SYSERR; } - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (target_start, hash_length, &target->public_key)) @@ -1021,9 +1021,9 @@ server_parse_url (struct HTTP_Server_Plugin *plugin, if (DEBUG_URL_PARSE) GNUNET_break (0); return GNUNET_SYSERR; } - GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, - "Found target `%s' in URL\n", + "Found target `%s' in URL\n", GNUNET_i2s_full (target)); return GNUNET_OK; } @@ -1181,7 +1181,7 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin, if ((NULL == s->server_recv) || (NULL == s->server_send)) { to = (HTTP_SERVER_NOT_VALIDATED_TIMEOUT.rel_value_us / 1000LL / 1000LL); - MHD_set_connection_option (mhd_connection, + MHD_set_connection_option (mhd_connection, MHD_CONNECTION_OPTION_TIMEOUT, to); server_reschedule (plugin, sc->mhd_daemon, GNUNET_NO); } @@ -2902,7 +2902,7 @@ server_session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc s->timeout_task = GNUNET_SCHEDULER_NO_TASK; GNUNET_log (TIMEOUT_LOG, "Session %p was idle for %s, disconnecting\n", - s, + s, GNUNET_STRINGS_relative_time_to_string (SERVER_SESSION_TIMEOUT, GNUNET_YES)); 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); static unsigned int sessions; -static void +static void inc_sessions (struct Plugin *plugin, struct Session *session, int line) { sessions++; @@ -471,7 +471,7 @@ inc_sessions (struct Plugin *plugin, struct Session *session, int line) } -static void +static void dec_sessions (struct Plugin *plugin, struct Session *session, int line) { GNUNET_assert (sessions > 0); @@ -607,7 +607,7 @@ tcp_address_to_string (void *cls, const void *addr, size_t addrlen) memcpy (&a6, &t6->ipv6_addr, sizeof (a6)); sb = &a6; break; - case sizeof (struct IPv4TcpAddress): + case sizeof (struct IPv4TcpAddress): t4 = addr; af = AF_INET; port = ntohs (t4->t4_port); @@ -724,7 +724,7 @@ tcp_string_to_address (void *cls, const char *addr, uint16_t addrlen, *added = sizeof (struct IPv4TcpAddress); return GNUNET_OK; } - case AF_INET6: + case AF_INET6: { struct IPv6TcpAddress *t6; struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) &socket_address; @@ -749,7 +749,7 @@ struct SessionClientCtx }; -static int +static int session_lookup_by_client_it (void *cls, const struct GNUNET_PeerIdentity *key, void *value) @@ -810,7 +810,7 @@ create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target, else GNUNET_assert (NULL == client); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Creating new session for peer `%4s'\n", GNUNET_i2s (target)); session = GNUNET_malloc (sizeof (struct Session)); @@ -886,7 +886,7 @@ do_transmit (void *cls, size_t size, void *buf) plugin = session->plugin; if (NULL == buf) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Timeout trying to transmit to peer `%4s', discarding message queue.\n", GNUNET_i2s (&session->target)); /* timeout; cancel all messages that have already expired */ @@ -940,7 +940,7 @@ do_transmit (void *cls, size_t size, void *buf) GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, session->pending_messages_tail, pos); GNUNET_assert (size >= pos->message_size); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting message of type %u\n", ntohs (((struct GNUNET_MessageHeader *) pos->msg)->type)); /* FIXME: this memcpy can be up to 7% of our total runtime */ @@ -1017,7 +1017,7 @@ disconnect_session (struct Session *session) struct PendingMessage *pm; struct Plugin * plugin = session->plugin; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting session of peer `%s' address `%s'\n", GNUNET_i2s (&session->target), tcp_address_to_string (NULL, session->addr, session->addrlen)); @@ -1050,7 +1050,7 @@ disconnect_session (struct Session *session) while (NULL != (pm = session->pending_messages_head)) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, pm->transmit_cont != NULL ? "Could not deliver message to `%4s'.\n" : "Could not deliver message to `%4s', notifying.\n", @@ -1094,7 +1094,7 @@ struct FindSessionContext }; -static int +static int session_it (void *cls, const struct GNUNET_PeerIdentity * key, void *value) @@ -1190,12 +1190,12 @@ tcp_plugin_send (void *cls, pm->transmit_cont = cont; pm->transmit_cont_cls = cont_cls; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to transmit %u bytes to `%s', added message to list.\n", msgbuf_size, GNUNET_i2s (&session->target)); - if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap, - &session->target, + if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap, + &session->target, session)) { GNUNET_assert (session->client != NULL); @@ -1215,7 +1215,7 @@ tcp_plugin_send (void *cls, } else if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains_value(plugin->nat_wait_conns, &session->target, session)) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "This NAT WAIT session for peer `%s' is not yet ready!\n", GNUNET_i2s (&session->target)); reschedule_session_timeout (session); @@ -1249,7 +1249,7 @@ struct SessionItCtx }; -static int +static int session_lookup_it (void *cls, const struct GNUNET_PeerIdentity *key, void *value) @@ -1340,14 +1340,14 @@ tcp_plugin_get_session (void *cls, GNUNET_assert (plugin != NULL); GNUNET_assert (address != NULL); addrlen = address->address_length; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Trying to get session for `%s' address of peer `%s'\n", tcp_address_to_string(NULL, address->address, address->address_length), GNUNET_i2s (&address->peer)); /* look for existing session */ - if (GNUNET_YES == - GNUNET_CONTAINER_multipeermap_contains (plugin->sessionmap, + if (GNUNET_YES == + GNUNET_CONTAINER_multipeermap_contains (plugin->sessionmap, &address->peer)) { struct SessionItCtx si_ctx; @@ -1357,8 +1357,8 @@ tcp_plugin_get_session (void *cls, si_ctx.result = NULL; - GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap, - &address->peer, + GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap, + &address->peer, &session_lookup_it, &si_ctx); if (si_ctx.result != NULL) { @@ -1447,7 +1447,7 @@ tcp_plugin_get_session (void *cls, GNUNET_CONTAINER_multipeermap_contains (plugin->nat_wait_conns, &address->peer))) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Found valid IPv4 NAT address (creating session)!\n") ; session = create_session (plugin, &address->peer, NULL, GNUNET_YES); session->addrlen = 0; @@ -1458,12 +1458,12 @@ tcp_plugin_get_session (void *cls, session); GNUNET_assert (session != NULL); GNUNET_assert (GNUNET_OK == - GNUNET_CONTAINER_multipeermap_put (plugin->nat_wait_conns, - &session->target, + GNUNET_CONTAINER_multipeermap_put (plugin->nat_wait_conns, + &session->target, session, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Created NAT WAIT connection to `%4s' at `%s'\n", GNUNET_i2s (&session->target), GNUNET_a2s (sb, sbs)); @@ -1471,7 +1471,7 @@ tcp_plugin_get_session (void *cls, return session; else { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Running NAT client for `%4s' at `%s' failed\n", GNUNET_i2s (&session->target), GNUNET_a2s (sb, sbs)); disconnect_session (session); @@ -1484,7 +1484,7 @@ tcp_plugin_get_session (void *cls, sa = GNUNET_CONNECTION_create_from_sockaddr (af, sb, sbs); if (sa == NULL) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to create connection to `%4s' at `%s'\n", GNUNET_i2s (&address->peer), GNUNET_a2s (sb, sbs)); return NULL; @@ -1506,8 +1506,8 @@ tcp_plugin_get_session (void *cls, session->addrlen = addrlen; session->ats_address_network_type = ats.value; - GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, - &session->target, + GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, + &session->target, session, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); inc_sessions (plugin, session, __LINE__); LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -1522,7 +1522,7 @@ tcp_plugin_get_session (void *cls, } -static int +static int session_disconnect_it (void *cls, const struct GNUNET_PeerIdentity *key, void *value) @@ -1559,9 +1559,9 @@ tcp_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target) { struct Plugin *plugin = cls; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting peer `%4s'\n", GNUNET_i2s (target)); - GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap, target, + GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap, target, &session_disconnect_it, plugin); GNUNET_CONTAINER_multipeermap_get_multiple (plugin->nat_wait_conns, target, &session_disconnect_it, plugin); @@ -1944,12 +1944,12 @@ handle_tcp_nat_probe (void *cls, struct GNUNET_SERVER_Client *client, clientIdentity); if (session == NULL) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Did NOT find session for NAT probe!\n"); GNUNET_SERVER_receive_done (client, GNUNET_OK); return; } - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Found session for NAT probe!\n"); if (session->nat_connection_timeout != GNUNET_SCHEDULER_NO_TASK) @@ -1970,11 +1970,11 @@ handle_tcp_nat_probe (void *cls, struct GNUNET_SERVER_Client *client, &tcp_nat_probe->clientIdentity, session) == GNUNET_YES); GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, - &session->target, session, - GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); + &session->target, session, + GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); session->last_activity = GNUNET_TIME_absolute_get (); session->inbound = GNUNET_NO; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Found address `%s' for incoming connection\n", GNUNET_a2s (vaddr, alen)); switch (((const struct sockaddr *) vaddr)->sa_family) @@ -1999,7 +1999,7 @@ handle_tcp_nat_probe (void *cls, struct GNUNET_SERVER_Client *client, break; default: GNUNET_break_op (0); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Bad address for incoming connection!\n"); GNUNET_free (vaddr); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); @@ -2124,7 +2124,7 @@ handle_tcp_welcome (void *cls, struct GNUNET_SERVER_Client *client, } else { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Did not obtain TCP socket address for incoming connection\n"); GNUNET_break (0); } @@ -2207,9 +2207,9 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client, /* No inbound session found */ void *vaddr; size_t alen; - + GNUNET_SERVER_client_get_address (client, &vaddr, &alen); - LOG (GNUNET_ERROR_TYPE_ERROR, + LOG (GNUNET_ERROR_TYPE_ERROR, "Received unexpected %u bytes of type %u from `%s'\n", (unsigned int) ntohs (message->size), (unsigned int) ntohs (message->type), @@ -2226,7 +2226,7 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client, size_t alen; GNUNET_SERVER_client_get_address (client, &vaddr, &alen); - LOG (GNUNET_ERROR_TYPE_ERROR, + LOG (GNUNET_ERROR_TYPE_ERROR, "Received unexpected %u bytes of type %u from `%s'\n", (unsigned int) ntohs (message->size), (unsigned int) ntohs (message->type), @@ -2238,7 +2238,7 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client, } session->last_activity = GNUNET_TIME_absolute_get (); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Passing %u bytes of type %u from `%4s' to transport service.\n", (unsigned int) ntohs (message->size), (unsigned int) ntohs (message->type), @@ -2277,7 +2277,7 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client, } else { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Throttling receiving from `%s' for %s\n", GNUNET_i2s (&session->target), GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); @@ -2450,7 +2450,7 @@ start_session_timeout (struct Session *s) s); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Timeout for session %p set to %s\n", - s, + s, GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, GNUNET_YES)); } @@ -2471,7 +2471,7 @@ reschedule_session_timeout (struct Session *s) s); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Timeout rescheduled for session %p set to %s\n", - s, + s, GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, GNUNET_YES)); } @@ -2571,7 +2571,7 @@ libgnunet_plugin_transport_tcp_init (void *cls) "ADVERTISED-PORT", &aport)) && (aport > 65535))) { - LOG (GNUNET_ERROR_TYPE_ERROR, + LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Require valid port number for service `%s' in configuration!\n"), "transport-tcp"); @@ -2613,7 +2613,7 @@ libgnunet_plugin_transport_tcp_init (void *cls) { for (ret = ret_s-1; ret >= 0; ret--) LOG (GNUNET_ERROR_TYPE_INFO, - "Binding to address `%s'\n", + "Binding to address `%s'\n", GNUNET_a2s (addrs[ret], addrlens[ret])); plugin->nat = GNUNET_NAT_register (env->cfg, GNUNET_YES, aport, (unsigned int) ret_s, @@ -2679,14 +2679,14 @@ libgnunet_plugin_transport_tcp_init (void *cls) GNUNET_SERVER_disconnect_notify (plugin->server, &disconnect_notify, plugin); plugin->nat_wait_conns = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES); if (bport != 0) - LOG (GNUNET_ERROR_TYPE_INFO, + LOG (GNUNET_ERROR_TYPE_INFO, _("TCP transport listening on port %llu\n"), bport); else - LOG (GNUNET_ERROR_TYPE_INFO, + LOG (GNUNET_ERROR_TYPE_INFO, _ ("TCP transport not listening on any port (client only)\n")); if (aport != bport) - LOG (GNUNET_ERROR_TYPE_INFO, + LOG (GNUNET_ERROR_TYPE_INFO, _ ("TCP transport advertises itself as being on port %llu\n"), 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) * @return the network type in HBO or GNUNET_SYSERR */ static enum GNUNET_ATS_Network_Type -template_plugin_get_network (void *cls, +template_plugin_get_network (void *cls, struct Session *session) { 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 * DLL */ struct PrettyPrinterContext *next; - + /** * DLL */ @@ -502,7 +502,7 @@ schedule_select (struct Plugin *plugin) for (udpw = plugin->ipv4_queue_head; NULL != udpw; udpw = udpw->next) min_delay = GNUNET_TIME_relative_min (min_delay, GNUNET_TIME_absolute_get_remaining (udpw->session->flow_delay_from_other_peer)); - + if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK) GNUNET_SCHEDULER_cancel(plugin->select_task); @@ -514,7 +514,7 @@ schedule_select (struct Plugin *plugin) (0 == min_delay.rel_value_us) ? GNUNET_TIME_UNIT_FOREVER_REL : min_delay, plugin->rs_v4, (0 == min_delay.rel_value_us) ? plugin->ws_v4 : NULL, - &udp_plugin_select, plugin); + &udp_plugin_select, plugin); } if ((GNUNET_YES == plugin->enable_ipv6) && (NULL != plugin->sockv6)) { @@ -522,7 +522,7 @@ schedule_select (struct Plugin *plugin) for (udpw = plugin->ipv6_queue_head; NULL != udpw; udpw = udpw->next) min_delay = GNUNET_TIME_relative_min (min_delay, GNUNET_TIME_absolute_get_remaining (udpw->session->flow_delay_from_other_peer)); - + if (GNUNET_SCHEDULER_NO_TASK != plugin->select_task_v6) GNUNET_SCHEDULER_cancel(plugin->select_task_v6); plugin->select_task_v6 = @@ -589,7 +589,7 @@ udp_address_to_string (void *cls, const void *addr, size_t addrlen) } inet_ntop (af, sb, buf, INET6_ADDRSTRLEN); - GNUNET_snprintf (rbuf, sizeof (rbuf), + GNUNET_snprintf (rbuf, sizeof (rbuf), (af == AF_INET6) ? "%s.%u.[%s]:%u" : "%s.%u.%s:%u", PLUGIN_NAME, options, buf, port); return rbuf; @@ -1150,11 +1150,11 @@ fragmented_message_done (struct UDP_FragmentationContext *fc, int result) struct UDP_MessageWrapper dummy; struct Session *s = fc->session; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "%p : Fragmented message removed with result %s\n", fc, (result == GNUNET_SYSERR) ? "FAIL" : "SUCCESS"); - + /* Call continuation for fragmented message */ memset (&dummy, 0, sizeof (dummy)); dummy.msg_type = MSG_FRAGMENTED_COMPLETE; @@ -1376,7 +1376,7 @@ reschedule_session_timeout (struct Session *s) s); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Timeout rescheduled for session %p set to %s\n", - s, + s, GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, GNUNET_YES)); } @@ -1478,7 +1478,7 @@ session_cmp_it (void *cls, LOG (GNUNET_ERROR_TYPE_DEBUG, "Comparing address %s <-> %s\n", - udp_address_to_string (NULL, (void *) address->address, + udp_address_to_string (NULL, (void *) address->address, address->address_length), GNUNET_a2s (s->sock_addr, s->addrlen)); if (s->inbound != cctx->inbound) @@ -1524,7 +1524,7 @@ session_cmp_it (void *cls, * @return the network type in HBO or GNUNET_SYSERR */ static enum GNUNET_ATS_Network_Type -udp_get_network (void *cls, +udp_get_network (void *cls, struct Session *session) { return ntohl (session->ats.value); @@ -1589,8 +1589,8 @@ udp_plugin_lookup_session (void *cls, cctx.res = NULL; cctx.inbound = inbound; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Looking for existing session for peer `%s' `%s' \n", - GNUNET_i2s (&address->peer), + "Looking for existing session for peer `%s' `%s' \n", + GNUNET_i2s (&address->peer), udp_address_to_string(NULL, address->address, address->address_length)); GNUNET_CONTAINER_multipeermap_get_multiple(plugin->sessions, &address->peer, session_cmp_it, &cctx); if (cctx.res != NULL) @@ -1666,7 +1666,7 @@ udp_plugin_get_session (void *cls, } -static void +static void enqueue (struct Plugin *plugin, struct UDP_MessageWrapper * udpw) { if (plugin->bytes_in_buffer + udpw->msg_size > INT64_MAX) @@ -1708,7 +1708,7 @@ send_next_fragment (void *cls, { struct UDP_MessageWrapper *udpw = cls; - GNUNET_FRAGMENT_context_transmission_done (udpw->frag_ctx->frag); + GNUNET_FRAGMENT_context_transmission_done (udpw->frag_ctx->frag); } @@ -1728,8 +1728,8 @@ enqueue_fragment (void *cls, const struct GNUNET_MessageHeader *msg) struct Plugin *plugin = frag_ctx->plugin; struct UDP_MessageWrapper * udpw; size_t msg_len = ntohs (msg->size); - - LOG (GNUNET_ERROR_TYPE_DEBUG, + + LOG (GNUNET_ERROR_TYPE_DEBUG, "Enqueuing fragment with %u bytes\n", msg_len); frag_ctx->fragments_used ++; udpw = GNUNET_malloc (sizeof (struct UDP_MessageWrapper) + msg_len); @@ -1862,11 +1862,11 @@ udp_plugin_send (void *cls, frag_ctx->frag = GNUNET_FRAGMENT_context_create (plugin->env->stats, UDP_MTU, &plugin->tracker, - s->last_expected_msg_delay, - s->last_expected_ack_delay, + s->last_expected_msg_delay, + s->last_expected_ack_delay, &udp->header, &enqueue_fragment, - frag_ctx); + frag_ctx); s->frag_ctx = frag_ctx; GNUNET_STATISTICS_update (plugin->env->stats, "# UDP, fragmented msgs, messages, pending", @@ -2138,8 +2138,8 @@ struct LookupContext static int -lookup_session_by_addr_it (void *cls, - const struct GNUNET_PeerIdentity *key, +lookup_session_by_addr_it (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { struct LookupContext *l_ctx = cls; @@ -2223,7 +2223,7 @@ ack_proc (void *cls, uint32_t id, const struct GNUNET_MessageHeader *msg) } -static void +static void read_process_msg (struct Plugin *plugin, const struct GNUNET_MessageHeader *msg, const char *addr, @@ -2239,7 +2239,7 @@ read_process_msg (struct Plugin *plugin, } -static void +static void read_process_ack (struct Plugin *plugin, const struct GNUNET_MessageHeader *msg, char *addr, @@ -2273,7 +2273,7 @@ read_process_ack (struct Plugin *plugin, flow_delay.rel_value_us = (uint64_t) ntohl (udp_ack->delay); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "We received a sending delay of %s\n", GNUNET_STRINGS_relative_time_to_string (flow_delay, GNUNET_YES)); @@ -2310,7 +2310,7 @@ read_process_ack (struct Plugin *plugin, } -static void +static void read_process_fragment (struct Plugin *plugin, const struct GNUNET_MessageHeader *msg, char *addr, @@ -2350,7 +2350,7 @@ read_process_fragment (struct Plugin *plugin, GNUNET_CONTAINER_heap_insert (plugin->defrag_ctxs, d_ctx, (GNUNET_CONTAINER_HeapCostType) now.abs_value_us); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Created new defragmentation context for %u-byte fragment from `%s'\n", (unsigned int) ntohs (msg->size), GNUNET_a2s ((const struct sockaddr *) addr, fromlen)); @@ -2571,7 +2571,7 @@ remove_timeout_messages_and_select (struct UDP_MessageWrapper *head, if (GNUNET_TIME_UNIT_ZERO.rel_value_us == remaining.rel_value_us) { /* this message is not delayed */ - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Message for peer `%s' (%u bytes) is not delayed \n", GNUNET_i2s(&udpw->session->target), udpw->payload_size); break; /* Found message to send, break */ @@ -2581,7 +2581,7 @@ remove_timeout_messages_and_select (struct UDP_MessageWrapper *head, /* Message is delayed, try next */ LOG (GNUNET_ERROR_TYPE_DEBUG, "Message for peer `%s' (%u bytes) is delayed for %s\n", - GNUNET_i2s(&udpw->session->target), udpw->payload_size, + GNUNET_i2s(&udpw->session->target), udpw->payload_size, GNUNET_STRINGS_relative_time_to_string (remaining, GNUNET_YES)); udpw = udpw->next; @@ -2719,10 +2719,10 @@ udp_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) (GNUNET_NETWORK_fdset_isset (tc->read_ready, plugin->sockv4)) ) udp_select_read (plugin, plugin->sockv4); if ( (0 != (tc->reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) && - (NULL != plugin->sockv4) && + (NULL != plugin->sockv4) && (NULL != plugin->ipv4_queue_head) && (GNUNET_NETWORK_fdset_isset (tc->write_ready, plugin->sockv4)) ) - udp_select_send (plugin, plugin->sockv4); + udp_select_send (plugin, plugin->sockv4); schedule_select (plugin); } @@ -2749,7 +2749,7 @@ udp_plugin_select_v6 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) udp_select_read (plugin, plugin->sockv6); if ( (0 != (tc->reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) && (NULL != plugin->sockv6) && (plugin->ipv6_queue_head != NULL) && - (GNUNET_NETWORK_fdset_isset (tc->write_ready, plugin->sockv6)) ) + (GNUNET_NETWORK_fdset_isset (tc->write_ready, plugin->sockv6)) ) udp_select_send (plugin, plugin->sockv6); schedule_select (plugin); } @@ -2760,7 +2760,7 @@ udp_plugin_select_v6 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @return number of sockets that were successfully bound */ static int -setup_sockets (struct Plugin *plugin, +setup_sockets (struct Plugin *plugin, const struct sockaddr_in6 *bind_v6, const struct sockaddr_in *bind_v4) { @@ -2869,23 +2869,23 @@ setup_sockets (struct Plugin *plugin, serverAddrv4.sin_addr = bind_v4->sin_addr; else serverAddrv4.sin_addr.s_addr = INADDR_ANY; - + if (0 == plugin->port) /* autodetect */ serverAddrv4.sin_port = htons (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, 33537) + 32000); else serverAddrv4.sin_port = htons (plugin->port); - - + + addrlen = sizeof (struct sockaddr_in); serverAddr = (struct sockaddr *) &serverAddrv4; - + tries = 0; while (tries < 10) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Binding to IPv4 `%s'\n", GNUNET_a2s (serverAddr, addrlen)); - + /* binding */ if (GNUNET_OK == GNUNET_NETWORK_socket_bind (plugin->sockv4, serverAddr, addrlen, 0)) @@ -2896,19 +2896,19 @@ setup_sockets (struct Plugin *plugin, tries = 10; /* fail */ break; /* bind failed on specific port */ } - + /* autodetect */ serverAddrv4.sin_port = htons (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, 33537) + 32000); tries ++; } - + if (tries >= 10) { GNUNET_NETWORK_socket_close (plugin->sockv4); plugin->enable_ipv4 = GNUNET_NO; plugin->sockv4 = NULL; } - + if (plugin->sockv4 != NULL) { LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -2918,13 +2918,13 @@ setup_sockets (struct Plugin *plugin, sockets_created++; } else - { + { LOG (GNUNET_ERROR_TYPE_ERROR, "Failed to bind UDP socket to %s: %s\n", GNUNET_a2s (serverAddr, addrlen), STRERROR (eno)); } } - + if (0 == sockets_created) { 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 * @param value a session * @return GNUNET_YES if not found (continue looking), GNUNET_NO on success */ -static int +static int lookup_session_it (void *cls, const struct GNUNET_PeerIdentity * key, void *value) @@ -486,8 +486,8 @@ lookup_session_it (void *cls, * @return NULL if session was not found */ static struct Session * -lookup_session (struct Plugin *plugin, - const struct GNUNET_PeerIdentity *sender, +lookup_session (struct Plugin *plugin, + const struct GNUNET_PeerIdentity *sender, const struct UnixAddress *ua, size_t ua_len) { struct LookupCtx lctx; @@ -498,7 +498,7 @@ lookup_session (struct Plugin *plugin, lctx.s = NULL; lctx.ua = ua; lctx.ua_len = ua_len; - GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map, + GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map, sender, &lookup_session_it, &lctx); return lctx.s; @@ -520,9 +520,9 @@ disconnect_session (struct Session *s) struct UNIXMessageWrapper *next; int removed; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting session for peer `%s' `%s'\n", - GNUNET_i2s (&s->target), + GNUNET_i2s (&s->target), s->addr); plugin->env->session_end (plugin->env->cls, &s->target, s); removed = GNUNET_NO; @@ -539,11 +539,11 @@ disconnect_session (struct Session *s) msgw->payload, 0); GNUNET_free (msgw->msg); GNUNET_free (msgw); - removed = GNUNET_YES; + removed = GNUNET_YES; } GNUNET_assert (GNUNET_YES == - GNUNET_CONTAINER_multipeermap_remove (plugin->session_map, - &s->target, + GNUNET_CONTAINER_multipeermap_remove (plugin->session_map, + &s->target, s)); GNUNET_STATISTICS_set (plugin->env->stats, "# UNIX sessions active", @@ -671,7 +671,7 @@ resend: LOG (GNUNET_ERROR_TYPE_DEBUG, "UNIX transmit %u-byte message to %s (%d: %s)\n", - (unsigned int) msgbuf_size, + (unsigned int) msgbuf_size, GNUNET_a2s ((const struct sockaddr *)un, un_len), (int) sent, (sent < 0) ? STRERROR (errno) : "ok"); @@ -684,7 +684,7 @@ resend: * Closure for 'get_session_it'. */ struct GetSessionIteratorContext -{ +{ /** * Location to store the session, if found. */ @@ -711,8 +711,8 @@ struct GetSessionIteratorContext * @return GNUNET_YES if not found (continue looking), GNUNET_NO on success */ static int -get_session_it (void *cls, - const struct GNUNET_PeerIdentity *key, +get_session_it (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { struct GetSessionIteratorContext *gsi = cls; @@ -735,11 +735,11 @@ get_session_it (void *cls, * @param tc scheduler context */ static void -session_timeout (void *cls, +session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct Session *s = cls; - + s->timeout_task = GNUNET_SCHEDULER_NO_TASK; LOG (GNUNET_ERROR_TYPE_DEBUG, "Session %p was idle for %s, disconnecting\n", @@ -758,7 +758,7 @@ session_timeout (void *cls, * @return the network type in HBO or GNUNET_SYSERR */ static enum GNUNET_ATS_Network_Type -unix_get_network (void *cls, +unix_get_network (void *cls, struct Session *session) { GNUNET_assert (NULL != session); @@ -818,12 +818,12 @@ unix_plugin_get_session (void *cls, gsi.address = (const char *) address->address; gsi.addrlen = address->address_length; gsi.res = NULL; - GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map, - &address->peer, + GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map, + &address->peer, &get_session_it, &gsi); if (NULL != gsi.res) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Found existing session\n"); return gsi.res; } @@ -893,23 +893,23 @@ unix_plugin_send (void *cls, struct UNIXMessageWrapper *wrapper; struct UNIXMessage *message; int ssize; - + GNUNET_assert (NULL != plugin); GNUNET_assert (NULL != session); - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_CONTAINER_multipeermap_contains_value (plugin->session_map, &session->target, session)) { - LOG (GNUNET_ERROR_TYPE_ERROR, + LOG (GNUNET_ERROR_TYPE_ERROR, "Invalid session for peer `%s' `%s'\n", GNUNET_i2s (&session->target), (const char *) session->addr); GNUNET_break (0); return GNUNET_SYSERR; } - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending %u bytes with session for peer `%s' `%s'\n", msgbuf_size, GNUNET_i2s (&session->target), @@ -931,13 +931,13 @@ unix_plugin_send (void *cls, wrapper->cont = cont; wrapper->cont_cls = cont_cls; wrapper->session = session; - GNUNET_CONTAINER_DLL_insert (plugin->msg_head, + GNUNET_CONTAINER_DLL_insert (plugin->msg_head, plugin->msg_tail, wrapper); plugin->bytes_in_queue += ssize; GNUNET_STATISTICS_set (plugin->env->stats, "# bytes currently in UNIX buffers", - plugin->bytes_in_queue, + plugin->bytes_in_queue, GNUNET_NO); if (GNUNET_NO == plugin->with_ws) reschedule_select (plugin); @@ -1101,25 +1101,25 @@ unix_plugin_select_write (struct Plugin *plugin) break; /* Message is ready for sending */ /* Message has a timeout */ LOG (GNUNET_ERROR_TYPE_DEBUG, - "Timeout for message with %u bytes \n", + "Timeout for message with %u bytes \n", (unsigned int) msgw->msgsize); GNUNET_CONTAINER_DLL_remove (plugin->msg_head, plugin->msg_tail, msgw); plugin->bytes_in_queue -= msgw->msgsize; - GNUNET_STATISTICS_set (plugin->env->stats, + GNUNET_STATISTICS_set (plugin->env->stats, "# bytes currently in UNIX buffers", - plugin->bytes_in_queue, GNUNET_NO); + plugin->bytes_in_queue, GNUNET_NO); GNUNET_STATISTICS_update (plugin->env->stats, "# UNIX bytes discarded", msgw->msgsize, GNUNET_NO); if (NULL != msgw->cont) msgw->cont (msgw->cont_cls, - &msgw->session->target, - GNUNET_SYSERR, - msgw->payload, - 0); + &msgw->session->target, + GNUNET_SYSERR, + msgw->payload, + 0); GNUNET_free (msgw->msg); - GNUNET_free (msgw); + GNUNET_free (msgw); } if (NULL == msgw) return; /* Nothing to send at the moment */ @@ -1153,7 +1153,7 @@ unix_plugin_select_write (struct Plugin *plugin) GNUNET_assert (plugin->bytes_in_queue >= msgw->msgsize); plugin->bytes_in_queue -= msgw->msgsize; - GNUNET_STATISTICS_set (plugin->env->stats, + GNUNET_STATISTICS_set (plugin->env->stats, "# bytes currently in UNIX buffers", plugin->bytes_in_queue, GNUNET_NO); GNUNET_STATISTICS_update (plugin->env->stats, @@ -1167,9 +1167,9 @@ unix_plugin_select_write (struct Plugin *plugin) } /* successfully sent bytes */ GNUNET_break (sent > 0); - GNUNET_CONTAINER_DLL_remove (plugin->msg_head, - plugin->msg_tail, - msgw); + GNUNET_CONTAINER_DLL_remove (plugin->msg_head, + plugin->msg_tail, + msgw); GNUNET_assert (plugin->bytes_in_queue >= msgw->msgsize); plugin->bytes_in_queue -= msgw->msgsize; GNUNET_STATISTICS_set (plugin->env->stats, @@ -1179,12 +1179,12 @@ unix_plugin_select_write (struct Plugin *plugin) GNUNET_STATISTICS_update (plugin->env->stats, "# bytes transmitted via UNIX", msgw->msgsize, - GNUNET_NO); + GNUNET_NO); if (NULL != msgw->cont) - msgw->cont (msgw->cont_cls, &msgw->session->target, + msgw->cont (msgw->cont_cls, &msgw->session->target, GNUNET_OK, - msgw->payload, - msgw->msgsize); + msgw->payload, + msgw->msgsize); GNUNET_free (msgw->msg); GNUNET_free (msgw); } @@ -1553,8 +1553,8 @@ reschedule_session_timeout (struct Session *s) * @return GNUNET_YES (always, continue to iterate) */ static int -get_session_delete_it (void *cls, - const struct GNUNET_PeerIdentity *key, +get_session_delete_it (void *cls, + const struct GNUNET_PeerIdentity *key, void *value) { struct Session *s = value; @@ -1572,14 +1572,14 @@ get_session_delete_it (void *cls, * @return #GNUNET_OK on success, #GNUNET_SYSERR if the operation failed */ static void -unix_disconnect (void *cls, +unix_disconnect (void *cls, const struct GNUNET_PeerIdentity *target) { struct Plugin *plugin = cls; GNUNET_assert (plugin != NULL); GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map, - target, + target, &get_session_delete_it, plugin); } @@ -1618,7 +1618,7 @@ libgnunet_plugin_transport_unix_init (void *cls) plugin = GNUNET_malloc (sizeof (struct Plugin)); plugin->port = port; plugin->env = env; - GNUNET_asprintf (&plugin->unix_socket_path, + GNUNET_asprintf (&plugin->unix_socket_path, "/tmp/unix-plugin-sock.%d", plugin->port); 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 /** * Header for messages which need fragmentation. This is the format of * a message we obtain AFTER defragmentation. We then need to check - * the CRC and then tokenize the payload and pass it to the + * the CRC and then tokenize the payload and pass it to the * 'receive' callback. */ struct WlanHeader @@ -398,7 +398,7 @@ struct Plugin /** * Handle to helper process for priviledged operations. - */ + */ struct GNUNET_HELPER_Handle *suid_helper; /** @@ -560,7 +560,7 @@ get_radiotap_header (struct MacEndpoint *endpoint, static void get_wlan_header (struct Plugin *plugin, struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *header, - const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr, + const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr, unsigned int size) { const int rate = 11000000; @@ -606,12 +606,12 @@ send_ack (void *cls, uint32_t msg_id, GNUNET_break (0); return; } - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending ACK to helper\n"); radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf; get_radiotap_header (endpoint, radio_header, size); get_wlan_header (endpoint->plugin, - &radio_header->frame, + &radio_header->frame, &endpoint->addr.mac, size); memcpy (&radio_header[1], hdr, msize); @@ -619,7 +619,7 @@ send_ack (void *cls, uint32_t msg_id, GNUNET_HELPER_send (endpoint->plugin->suid_helper, &radio_header->header, GNUNET_NO /* dropping ACKs is bad */, - NULL, NULL)) + NULL, NULL)) GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# WLAN ACKs sent"), 1, GNUNET_NO); } @@ -643,7 +643,7 @@ wlan_data_message_handler (void *cls, const struct GNUNET_MessageHeader *hdr) GNUNET_NO); mas.session = NULL; mas.endpoint = endpoint; - (void) GNUNET_SERVER_mst_receive (plugin->fragment_data_tokenizer, + (void) GNUNET_SERVER_mst_receive (plugin->fragment_data_tokenizer, &mas, (const char *) hdr, ntohs (hdr->size), @@ -661,7 +661,7 @@ free_session (struct Session *session) { struct MacEndpoint *endpoint = session->mac; struct PendingMessage *pm; - + endpoint->plugin->env->session_end (endpoint->plugin->env->cls, &session->target, session); @@ -677,7 +677,7 @@ free_session (struct Session *session) GNUNET_free (pm->msg); GNUNET_free (pm); } - GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head, + GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head, endpoint->sessions_tail, session); if (session->timeout_task != GNUNET_SCHEDULER_NO_TASK) @@ -705,7 +705,7 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) session->timeout_task = GNUNET_SCHEDULER_NO_TASK; timeout = GNUNET_TIME_absolute_get_remaining (session->timeout); - if (0 == timeout.rel_value_us) + if (0 == timeout.rel_value_us) { free_session (session); return; @@ -800,7 +800,7 @@ get_session (struct MacEndpoint *endpoint, * message to the SUID helper process and we are thus ready for * the next fragment. * - * @param cls the 'struct FragmentMessage' + * @param cls the 'struct FragmentMessage' * @param result result of the operation (GNUNET_OK on success, GNUNET_NO if the helper died, GNUNET_SYSERR * if the helper was stopped) */ @@ -820,7 +820,7 @@ fragment_transmission_done (void *cls, * Transmit a fragment of a message. * * @param cls 'struct FragmentMessage' this fragment message belongs to - * @param hdr pointer to the start of the fragment message + * @param hdr pointer to the start of the fragment message */ static void transmit_fragment (void *cls, @@ -846,7 +846,7 @@ transmit_fragment (void *cls, radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf; get_radiotap_header (endpoint, radio_header, size); get_wlan_header (endpoint->plugin, - &radio_header->frame, + &radio_header->frame, &endpoint->addr.mac, size); memcpy (&radio_header[1], hdr, msize); @@ -881,7 +881,7 @@ free_fragment_message (struct FragmentMessage *fm) { struct MacEndpoint *endpoint = fm->macendpoint; - GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# WLAN messages pending (with fragmentation)"), + GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# WLAN messages pending (with fragmentation)"), -1, GNUNET_NO); GNUNET_CONTAINER_DLL_remove (endpoint->sending_messages_head, endpoint->sending_messages_tail, fm); @@ -941,7 +941,7 @@ fragmentmessage_timeout (void *cls, static void send_with_fragmentation (struct MacEndpoint *endpoint, struct GNUNET_TIME_Relative timeout, - const struct GNUNET_PeerIdentity *target, + const struct GNUNET_PeerIdentity *target, const struct GNUNET_MessageHeader *msg, size_t payload_size, GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) @@ -968,7 +968,7 @@ send_with_fragmentation (struct MacEndpoint *endpoint, msg, &transmit_fragment, fm); fm->timeout_task = - GNUNET_SCHEDULER_add_delayed (timeout, + GNUNET_SCHEDULER_add_delayed (timeout, &fragmentmessage_timeout, fm); GNUNET_CONTAINER_DLL_insert_tail (endpoint->sending_messages_head, endpoint->sending_messages_tail, @@ -978,7 +978,7 @@ send_with_fragmentation (struct MacEndpoint *endpoint, /** * Free a MAC endpoint. - * + * * @param endpoint pointer to the MacEndpoint to free */ static void @@ -994,8 +994,8 @@ free_macendpoint (struct MacEndpoint *endpoint) free_session (session); while (NULL != (fm = endpoint->sending_messages_head)) free_fragment_message (fm); - GNUNET_CONTAINER_DLL_remove (plugin->mac_head, - plugin->mac_tail, + GNUNET_CONTAINER_DLL_remove (plugin->mac_head, + plugin->mac_tail, endpoint); if (NULL != endpoint->defrag) @@ -1028,7 +1028,7 @@ macendpoint_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK; timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout); - if (0 == timeout.rel_value_us) + if (0 == timeout.rel_value_us) { free_macendpoint (endpoint); return; @@ -1054,14 +1054,14 @@ create_macendpoint (struct Plugin *plugin, for (pos = plugin->mac_head; NULL != pos; pos = pos->next) if (0 == memcmp (addr, &pos->addr, sizeof (struct WlanAddress))) - return pos; + return pos; pos = GNUNET_malloc (sizeof (struct MacEndpoint)); pos->addr = *addr; pos->plugin = plugin; pos->defrag = GNUNET_DEFRAGMENT_context_create (plugin->env->stats, WLAN_MTU, MESSAGES_IN_DEFRAG_QUEUE_PER_MAC, - pos, + pos, &wlan_data_message_handler, &send_ack); @@ -1076,7 +1076,7 @@ create_macendpoint (struct Plugin *plugin, plugin->mac_count++; GNUNET_STATISTICS_update (plugin->env->stats, _("# WLAN MAC endpoints allocated"), 1, GNUNET_NO); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "New MAC endpoint `%s'\n", wlan_plugin_address_to_string(NULL, addr, sizeof (struct WlanAddress))); return pos; @@ -1091,7 +1091,7 @@ create_macendpoint (struct Plugin *plugin, * @return the network type in HBO or GNUNET_SYSERR */ static enum GNUNET_ATS_Network_Type -wlan_get_network (void *cls, +wlan_get_network (void *cls, struct Session *session) { GNUNET_assert (NULL != session); @@ -1196,7 +1196,7 @@ wlan_plugin_send (void *cls, size_t size = msgbuf_size + sizeof (struct WlanHeader); char buf[size] GNUNET_ALIGN; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting %u bytes of payload to peer `%s' (starting with %u byte message of type %u)\n", msgbuf_size, GNUNET_i2s (&session->target), @@ -1256,7 +1256,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) switch (ntohs (hdr->type)) { case GNUNET_MESSAGE_TYPE_HELLO: - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) hdr, &tmpsource)) { GNUNET_break_op (0); @@ -1271,9 +1271,9 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) GNUNET_STATISTICS_update (plugin->env->stats, _("# HELLO messages received via WLAN"), 1, GNUNET_NO); - plugin->env->receive (plugin->env->cls, + plugin->env->receive (plugin->env->cls, &tmpsource, - hdr, + hdr, mas->session, (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr, (mas->endpoint == NULL) ? 0 : sizeof (struct WlanAddress)); @@ -1290,7 +1290,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) GNUNET_break (0); break; } - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing %u bytes of FRAGMENT from MAC %s\n", (unsigned int) msize, 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) ret = GNUNET_FRAGMENT_process_ack (fm->fragcontext, hdr); if (GNUNET_OK == ret) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Got last ACK, finished message transmission to `%s' (%p)\n", wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress)), fm); @@ -1327,13 +1327,13 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) } if (GNUNET_NO == ret) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Got an ACK, message transmission to `%s' not yet finished\n", wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress))); break; } } - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "ACK not matched against any active fragmentation with MAC `%s'\n", wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress))); break; @@ -1347,13 +1347,13 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) { GNUNET_break (0); break; - } + } wlanheader = (const struct WlanHeader *) hdr; if (0 != memcmp (&wlanheader->target, plugin->env->my_identity, sizeof (struct GNUNET_PeerIdentity))) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "WLAN data for `%s', not for me, ignoring\n", GNUNET_i2s (&wlanheader->target)); break; @@ -1380,11 +1380,11 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) "Processing %u bytes of WLAN DATA from peer `%s'\n", (unsigned int) msize, GNUNET_i2s (&wlanheader->sender)); - (void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer, + (void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer, &xmas, (const char *) &wlanheader[1], msize - sizeof (struct WlanHeader), - GNUNET_YES, GNUNET_NO); + GNUNET_YES, GNUNET_NO); break; default: if (NULL == mas->endpoint) @@ -1402,9 +1402,9 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) (unsigned int) msize, (unsigned int) ntohs (hdr->type), GNUNET_i2s (&mas->session->target)); - plugin->env->receive (plugin->env->cls, + plugin->env->receive (plugin->env->cls, &mas->session->target, - hdr, + hdr, mas->session, (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr, (mas->endpoint == NULL) ? 0 : sizeof (struct WlanAddress)); @@ -1478,7 +1478,7 @@ handle_helper_message (void *cls, void *client, "wlan"); break; case GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER: - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Got data message from helper with %u bytes\n", msize); GNUNET_STATISTICS_update (plugin->env->stats, @@ -1515,7 +1515,7 @@ handle_helper_message (void *cls, void *client, /* packet is FROM us, thus not FOR us */ break; } - + GNUNET_STATISTICS_update (plugin->env->stats, _("# WLAN DATA messages processed"), 1, GNUNET_NO); @@ -1527,7 +1527,7 @@ handle_helper_message (void *cls, void *client, wa.options = htonl (0); mas.endpoint = create_macendpoint (plugin, &wa); mas.session = NULL; - (void) GNUNET_SERVER_mst_receive (plugin->helper_payload_tokenizer, + (void) GNUNET_SERVER_mst_receive (plugin->helper_payload_tokenizer, &mas, (const char*) &rxinfo[1], msize - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage), @@ -1535,7 +1535,7 @@ handle_helper_message (void *cls, void *client, break; default: GNUNET_break (0); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Unexpected message of type %u (%u bytes)", ntohs (hdr->type), ntohs (hdr->size)); break; @@ -1568,7 +1568,7 @@ send_hello_beacon (void *cls, { char buf[size] GNUNET_ALIGN; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending %u byte HELLO beacon\n", (unsigned int) size); radioHeader = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage*) buf; @@ -1612,13 +1612,13 @@ wlan_plugin_address_suggested (void *cls, const void *addr, size_t addrlen) struct WlanAddress *wa = (struct WlanAddress *) addr; if (addrlen != sizeof (struct WlanAddress)) - { + { GNUNET_break_op (0); return GNUNET_SYSERR; } if (GNUNET_YES != plugin->have_mac) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Rejecting MAC `%s': I don't know my MAC!\n", mac_to_string (addr)); return GNUNET_NO; /* don't know my MAC */ @@ -1627,7 +1627,7 @@ wlan_plugin_address_suggested (void *cls, const void *addr, size_t addrlen) &plugin->mac_address, sizeof (wa->mac))) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Rejecting MAC `%s': not my MAC!\n", mac_to_string (addr)); return GNUNET_NO; /* not my MAC */ @@ -1705,7 +1705,7 @@ wlan_plugin_address_pretty_printer (void *cls, const char *type, /** - * Exit point from the plugin. + * Exit point from the plugin. * * @param cls pointer to the api struct */ @@ -1861,7 +1861,7 @@ libgnunet_plugin_transport_wlan_init (void *cls) testmode = 0; /* check configuration */ - if ( (GNUNET_YES == + if ( (GNUNET_YES == GNUNET_CONFIGURATION_have_value (env->cfg, "transport-wlan", "TESTMODE")) && ( (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-wlan", @@ -1890,7 +1890,7 @@ libgnunet_plugin_transport_wlan_init (void *cls) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "transport-wlan", "INTERFACE"); - return NULL; + return NULL; } plugin = GNUNET_malloc (sizeof (struct Plugin)); @@ -1906,7 +1906,7 @@ libgnunet_plugin_transport_wlan_init (void *cls) plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); - plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon, + plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon, plugin); plugin->options = 0; @@ -1914,7 +1914,7 @@ libgnunet_plugin_transport_wlan_init (void *cls) /* some compilers do not like switch on 'long long'... */ switch ((unsigned int) testmode) { - case 0: /* normal */ + case 0: /* normal */ plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan"; plugin->helper_argv[1] = interface; 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 @@ /** * Value for "Management" in the 'frame_control' field of the - * struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame. + * struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame. */ #define IEEE80211_FC0_TYPE_MGT 0x00 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 () } -static void +static void env_session_end (void *cls, const struct GNUNET_PeerIdentity *peer, 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[]) return ret; } -#else +#else /* cannot setrlimit */ 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 () ok = disconnects; GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Had %u disconnects while waiting %s\n", - disconnects, + disconnects, GNUNET_STRINGS_relative_time_to_string (WAIT, GNUNET_YES)); } @@ -223,7 +223,7 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) shutdown_flag = GNUNET_NO; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Waiting for %s\n", GNUNET_STRINGS_relative_time_to_string (WAIT, 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, * GNUNET_NO if not. */ static int -neighbour_delete (void *cls, +neighbour_delete (void *cls, const struct GNUNET_PeerIdentity *key, void *value) { struct GNUNET_TRANSPORT_Handle *handle = cls; @@ -1341,7 +1341,7 @@ GNUNET_TRANSPORT_check_neighbour_connected (struct GNUNET_TRANSPORT_Handle *hand { GNUNET_assert (NULL != handle); GNUNET_assert (NULL != peer); - + if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (handle->neighbours, peer)) return GNUNET_YES; else @@ -1364,7 +1364,7 @@ call_hello_update_cb_async (void *cls, GNUNET_assert (NULL != ghh->handle->my_hello); GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != ghh->notify_task); ghh->notify_task = GNUNET_SCHEDULER_NO_TASK; - ghh->rec (ghh->rec_cls, + ghh->rec (ghh->rec_cls, (const struct GNUNET_MessageHeader *) ghh->handle->my_hello); } @@ -1564,7 +1564,7 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle, delay.rel_value_us = 0; /* notify immediately (with failure) */ LOG (GNUNET_ERROR_TYPE_DEBUG, "Bandwidth tracker allows next transmission to peer %s in %s\n", - GNUNET_i2s (target), + GNUNET_i2s (target), GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); n->hn = GNUNET_CONTAINER_heap_insert (handle->ready_heap, n, delay.rel_value_us); 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 * Backoff for reconnect. */ struct GNUNET_TIME_Relative backoff; - + /** * Task ID for reconnect. */ @@ -116,7 +116,7 @@ send_request (struct GNUNET_TRANSPORT_PeerIterateContext *pal_ctx) msg.timeout = GNUNET_TIME_absolute_hton (pal_ctx->timeout); msg.peer = pal_ctx->peer; GNUNET_assert (GNUNET_OK == - GNUNET_CLIENT_transmit_and_get_response (pal_ctx->client, + GNUNET_CLIENT_transmit_and_get_response (pal_ctx->client, &msg.header, GNUNET_TIME_absolute_get_remaining (pal_ctx->timeout), GNUNET_YES, @@ -126,7 +126,7 @@ send_request (struct GNUNET_TRANSPORT_PeerIterateContext *pal_ctx) /** * Task run to re-establish the connection. - * + * * @param cls our 'struct GNUNET_TRANSPORT_PeerAddressLookupContext*' * @param tc scheduler context, unused */ @@ -329,7 +329,7 @@ GNUNET_TRANSPORT_peer_get_active_addresses (const struct pal_ctx->timeout = GNUNET_TIME_relative_to_absolute (timeout); if (NULL != peer) pal_ctx->peer = *peer; - pal_ctx->one_shot = one_shot; + pal_ctx->one_shot = one_shot; pal_ctx->client = client; send_request (pal_ctx); 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 iptobinstr (const int af, const void *addr, char *str) { int i; - + switch (af) { case AF_INET: { uint32_t b = htonl (((struct in_addr *) addr)->s_addr); - + str[32] = '\0'; str += 31; for (i = 31; i >= 0; i--) @@ -60,7 +60,7 @@ iptobinstr (const int af, const void *addr, char *str) case AF_INET6: { struct in6_addr b = *(const struct in6_addr *) addr; - + str[128] = '\0'; str += 127; for (i = 127; i >= 0; i--) @@ -88,7 +88,7 @@ ipv4netmasktoprefixlen (const char *netmask) struct in_addr a; unsigned int len; uint32_t t; - + if (1 != inet_pton (AF_INET, netmask, &a)) return 0; len = 32; @@ -111,7 +111,7 @@ GNUNET_TUN_ipv4toregexsearch (const struct in_addr *ip, const char *netmask, char *rxstr) { unsigned int pfxlen; - + pfxlen = ipv4netmasktoprefixlen (netmask); iptobinstr (AF_INET, ip, rxstr); 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, pll); if (crc != ntohs (udp.crc)) { - fprintf (stderr, "Got CRC: %u, wanted: %u\n", + fprintf (stderr, "Got CRC: %u, wanted: %u\n", ntohs (udp.crc), crc); 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, ip->header_length = sizeof (struct GNUNET_TUN_IPv4Header) / 4; ip->version = 4; ip->total_length = htons (sizeof (struct GNUNET_TUN_IPv4Header) + payload_length); - ip->identification = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, + ip->identification = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 65536); ip->ttl = FRESH_TTL; ip->protocol = protocol; @@ -89,7 +89,7 @@ GNUNET_TUN_initialize_ipv6_header (struct GNUNET_TUN_IPv6Header *ip, ip->payload_length = htons ((uint16_t) payload_length); ip->hop_limit = FRESH_TTL; ip->destination_address = *dst; - ip->source_address = *src; + ip->source_address = *src; } @@ -116,7 +116,7 @@ GNUNET_TUN_calculate_tcp4_checksum (const struct GNUNET_TUN_IPv4Header *ip, GNUNET_assert (IPPROTO_TCP == ip->protocol); tcp->crc = 0; - sum = GNUNET_CRYPTO_crc16_step (0, + sum = GNUNET_CRYPTO_crc16_step (0, &ip->source_address, sizeof (struct in_addr) * 2); tmp = htons (IPPROTO_TCP); @@ -186,21 +186,21 @@ GNUNET_TUN_calculate_udp4_checksum (const struct GNUNET_TUN_IPv4Header *ip, GNUNET_assert (IPPROTO_UDP == ip->protocol); udp->crc = 0; /* technically optional, but we calculate it anyway, just to be sure */ - sum = GNUNET_CRYPTO_crc16_step (0, + sum = GNUNET_CRYPTO_crc16_step (0, &ip->source_address, sizeof (struct in_addr) * 2); tmp = htons (IPPROTO_UDP); - sum = GNUNET_CRYPTO_crc16_step (sum, - &tmp, + sum = GNUNET_CRYPTO_crc16_step (sum, + &tmp, sizeof (uint16_t)); tmp = htons (sizeof (struct GNUNET_TUN_UdpHeader) + payload_length); - sum = GNUNET_CRYPTO_crc16_step (sum, - &tmp, + sum = GNUNET_CRYPTO_crc16_step (sum, + &tmp, sizeof (uint16_t)); - sum = GNUNET_CRYPTO_crc16_step (sum, - udp, + sum = GNUNET_CRYPTO_crc16_step (sum, + udp, sizeof (struct GNUNET_TUN_UdpHeader)); - sum = GNUNET_CRYPTO_crc16_step (sum, + sum = GNUNET_CRYPTO_crc16_step (sum, payload, payload_length); 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, if (av->available_bytes_per_s__ == 0) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Tracker %p delay is infinity\n", av); return GNUNET_TIME_UNIT_FOREVER_REL; } @@ -270,9 +270,9 @@ GNUNET_BANDWIDTH_tracker_get_delay (struct GNUNET_BANDWIDTH_Tracker *av, ret.rel_value_us = (1000LL * 1000LL * bytes_needed) / (unsigned long long) av->available_bytes_per_s__; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Tracker %p delay for %u bytes is %s\n", - av, (unsigned int) size, + av, (unsigned int) size, GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES)); return ret; } @@ -321,7 +321,7 @@ GNUNET_BANDWIDTH_tracker_update_quota (struct GNUNET_BANDWIDTH_Tracker *av, uint32_t new_limit; new_limit = ntohl (bytes_per_second_limit.value__); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Tracker %p bandwidth changed to %u Bps\n", av, (unsigned int) new_limit); 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 @@ /** * Size for I/O buffers. - */ + */ #define BIO_BUFFER_SIZE 65536 /** @@ -135,7 +135,7 @@ GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure */ int -GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, +GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, const char *what, void *result, size_t len) { @@ -175,7 +175,7 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, if (0 == ret) { GNUNET_asprintf (&h->emsg, - _("Error reading `%s': %s"), + _("Error reading `%s': %s"), what, _("End of file")); return GNUNET_SYSERR; @@ -199,10 +199,10 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure */ int -GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, - const char *file, +GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, + const char *file, int line, - void *result, + void *result, size_t len) { char what[1024]; @@ -225,7 +225,7 @@ GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, int GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, const char *what, - char **result, + char **result, size_t max_length) { char *buf; @@ -272,7 +272,7 @@ GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure */ int -GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, +GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, const char *what, struct GNUNET_CONTAINER_MetaData **result) { @@ -345,9 +345,9 @@ GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, const char *file, * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ int -GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, +GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, const char *file, - int line, + int line, int64_t *i) { int64_t big; @@ -368,7 +368,7 @@ struct GNUNET_BIO_WriteHandle * Underlying file handle. */ struct GNUNET_DISK_FileHandle *fd; - + /** * I/O buffer. Do not free, allocated at the end of the struct. */ @@ -504,7 +504,7 @@ GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer, * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ int -GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, +GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, const char *s) { uint32_t slen; @@ -562,7 +562,7 @@ GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ int -GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, +GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, int32_t i) { int32_t big; @@ -580,7 +580,7 @@ GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ int -GNUNET_BIO_write_int64 (struct GNUNET_BIO_WriteHandle *h, +GNUNET_BIO_write_int64 (struct GNUNET_BIO_WriteHandle *h, int64_t i) { 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, struct sockaddr_un s_un; unixpath = NULL; - if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) && - (0 < strlen (unixpath))) + if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) && + (0 < strlen (unixpath))) { /* We have a non-NULL unixpath, need to validate it */ if (strlen (unixpath) >= sizeof (s_un.sun_path)) @@ -299,8 +299,8 @@ test_service_configuration (const char *service_name, #if AF_UNIX char *unixpath = NULL; - if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) && - (0 < strlen (unixpath))) + if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) && + (0 < strlen (unixpath))) ret = GNUNET_OK; GNUNET_free_non_null (unixpath); #endif @@ -308,7 +308,7 @@ test_service_configuration (const char *service_name, if ( (GNUNET_YES == GNUNET_CONFIGURATION_have_value (cfg, service_name, "PORT")) && (GNUNET_OK == - GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "PORT", &port)) && + GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "PORT", &port)) && (port <= 65535) && (0 != port) && (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "HOSTNAME", @@ -406,7 +406,7 @@ GNUNET_CLIENT_connect (const char *service_name, struct GNUNET_CLIENT_Connection *client; struct GNUNET_CONNECTION_Handle *connection; - if (GNUNET_OK != + if (GNUNET_OK != test_service_configuration (service_name, cfg)) return NULL; @@ -629,7 +629,7 @@ GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *client, /** * Handle for a test to check if a service is running. */ -struct GNUNET_CLIENT_TestHandle +struct GNUNET_CLIENT_TestHandle { /** * Function to call with the result of the test. @@ -643,7 +643,7 @@ struct GNUNET_CLIENT_TestHandle /** * Client connection we are using for the test, if any. - */ + */ struct GNUNET_CLIENT_Connection *client; /** @@ -707,7 +707,7 @@ report_result (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_CLIENT_TestHandle *th = cls; - + th->task = GNUNET_SCHEDULER_NO_TASK; th->cb (th->cb_cls, th->result); GNUNET_CLIENT_service_test_cancel (th); @@ -726,7 +726,7 @@ service_test_report (struct GNUNET_CLIENT_TestHandle *th, { th->result = result; th->task = GNUNET_SCHEDULER_add_now (&report_result, - th); + th); } @@ -775,18 +775,18 @@ write_test (void *cls, size_t size, void *buf) th->th = NULL; if (size < sizeof (struct GNUNET_MessageHeader)) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to transmit TEST request.\n"); service_test_report (th, GNUNET_NO); return 0; /* client disconnected */ } - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Transmitting `%s' request.\n", + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Transmitting `%s' request.\n", "TEST"); msg = (struct GNUNET_MessageHeader *) buf; msg->type = htons (GNUNET_MESSAGE_TYPE_TEST); msg->size = htons (sizeof (struct GNUNET_MessageHeader)); - GNUNET_CLIENT_receive (th->client, + GNUNET_CLIENT_receive (th->client, &confirm_handler, th, GNUNET_TIME_absolute_get_remaining (th->test_deadline)); @@ -822,7 +822,7 @@ GNUNET_CLIENT_service_test (const char *service, th->cb = cb; th->cb_cls = cb_cls; th->test_deadline = GNUNET_TIME_relative_to_absolute (timeout); - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Testing if service `%s' is running.\n", service); #ifdef AF_UNIX @@ -874,7 +874,7 @@ GNUNET_CLIENT_service_test (const char *service, service_test_report (th, GNUNET_YES); return th; } - (void) GNUNET_NETWORK_socket_close (sock); + (void) GNUNET_NETWORK_socket_close (sock); /* let's try IP */ } } @@ -1026,7 +1026,7 @@ client_delayed_retry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_CLIENT_TransmitHandle *th = cls; struct GNUNET_TIME_Relative delay; - + th->reconnect_task = GNUNET_SCHEDULER_NO_TASK; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { @@ -1116,7 +1116,7 @@ client_notify (void *cls, size_t size, void *buf) { GNUNET_CONNECTION_receive_cancel (client->connection); client->in_receive = GNUNET_NO; - } + } GNUNET_CONNECTION_destroy (client->connection); client->connection = NULL; 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) { const uint64_t baadfood = GNUNET_ntohll (0xBAADF00DBAADF00DLL); uint64_t *base = ptr; - size_t s = M_SIZE (ptr); + size_t s = M_SIZE (ptr); size_t i; - + for (i=0;i - BULK_DELAY_THRESHOLD) || + BULK_DELAY_THRESHOLD) || (last_bulk_repeat > BULK_REPEAT_THRESHOLD) ) flush_bulk (date); return; @@ -983,7 +983,7 @@ mylog (enum GNUNET_ErrorType kind, * @param ... arguments for format string */ void -GNUNET_log_nocheck (enum GNUNET_ErrorType kind, +GNUNET_log_nocheck (enum GNUNET_ErrorType kind, const char *message, ...) { va_list va; @@ -1199,7 +1199,7 @@ GNUNET_a2s (const struct sockaddr *addr, socklen_t addrlen) * @param option name of missing option */ void -GNUNET_log_config_missing (enum GNUNET_ErrorType kind, +GNUNET_log_config_missing (enum GNUNET_ErrorType kind, const char *section, const char *option) { @@ -1219,7 +1219,7 @@ GNUNET_log_config_missing (enum GNUNET_ErrorType kind, * @param required what is required that is invalid about the option */ void -GNUNET_log_config_invalid (enum GNUNET_ErrorType kind, +GNUNET_log_config_invalid (enum GNUNET_ErrorType kind, const char *section, const char *option, const char *required) @@ -1240,7 +1240,7 @@ void __attribute__ ((constructor)) GNUNET_util_cl_init () GNInitWinEnv (NULL); #endif #if WINDOWS - if (!InitializeCriticalSectionAndSpinCount (&output_message_cs, 0x00000400)) + if (!InitializeCriticalSectionAndSpinCount (&output_message_cs, 0x00000400)) GNUNET_abort (); #endif } 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, if (NULL == pos) { line_orig = GNUNET_strndup (&mem[r_bytes], line_size = to_read); - r_bytes += line_size; + r_bytes += line_size; } else { @@ -220,10 +220,10 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, continue; /* handle special "@INLINE@" directive */ - if (0 == strncasecmp (line, + if (0 == strncasecmp (line, "@INLINE@ ", strlen ("@INLINE@ "))) - { + { /* @INLINE@ value */ value = &line[strlen ("@INLINE@ ")]; if (GNUNET_YES == allow_inline) @@ -250,19 +250,19 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, value = &line[1]; GNUNET_free (section); section = GNUNET_strdup (value); - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Config section `%s'\n", + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Config section `%s'\n", section); continue; } if (NULL != (eq = strchr (line, '='))) { /* tag = value */ - tag = GNUNET_strndup (line, eq - line); + tag = GNUNET_strndup (line, eq - line); /* remove tailing whitespace */ for (i = strlen (tag) - 1; (i >= 1) && (isspace ((unsigned char) tag[i]));i--) tag[i] = '\0'; - + /* Strip whitespace */ value = eq + 1; while (isspace ((unsigned char) value[0])) @@ -285,14 +285,14 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, } /* parse error */ LOG (GNUNET_ERROR_TYPE_WARNING, - _("Syntax error while deserializing in line %u\n"), + _("Syntax error while deserializing in line %u\n"), nr); ret = GNUNET_SYSERR; break; } LOG (GNUNET_ERROR_TYPE_DEBUG, "Finished deserializing config\n"); GNUNET_free_non_null (line_orig); - GNUNET_free (section); + GNUNET_free (section); GNUNET_assert ( (GNUNET_OK != ret) || (r_bytes == size) ); return ret; } @@ -323,7 +323,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, if (fn == NULL) return GNUNET_SYSERR; dirty = cfg->dirty; /* back up value! */ - if (GNUNET_SYSERR == + if (GNUNET_SYSERR == GNUNET_DISK_file_size (fn, &fs64, GNUNET_YES, GNUNET_YES)) { LOG (GNUNET_ERROR_TYPE_WARNING, @@ -349,7 +349,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, } LOG (GNUNET_ERROR_TYPE_DEBUG, "Deserializing contents of file `%s'\n", fn); GNUNET_free (fn); - ret = GNUNET_CONFIGURATION_deserialize (cfg, mem, fs, GNUNET_YES); + ret = GNUNET_CONFIGURATION_deserialize (cfg, mem, fs, GNUNET_YES); GNUNET_free (mem); /* restore dirty flag - anything we set in the meantime * came from disk */ @@ -425,7 +425,7 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, mem = GNUNET_malloc (m_size); sec = cfg->sections; c_size = 0; - *size = c_size; + *size = c_size; while (NULL != sec) { len = GNUNET_asprintf (&cbuf, "[%s]\n", sec->name); @@ -487,9 +487,9 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, } cfg_buf = GNUNET_CONFIGURATION_serialize (cfg, &size); if (size != GNUNET_DISK_fn_write (fn, cfg_buf, size, - GNUNET_DISK_PERM_USER_READ + GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE - | GNUNET_DISK_PERM_GROUP_READ + | GNUNET_DISK_PERM_GROUP_READ | GNUNET_DISK_PERM_GROUP_WRITE)) { GNUNET_free (fn); @@ -1090,7 +1090,7 @@ GNUNET_CONFIGURATION_get_value_filename (const struct const char *option, char **value) { char *tmp; - + LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to retrieve filename `%s' in section `%s'\n", option, section); if (GNUNET_OK != 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, connection->addr = uaddr; connection->addrlen = addrlen; connection->sock = sock; - LOG (GNUNET_ERROR_TYPE_INFO, + LOG (GNUNET_ERROR_TYPE_INFO, _("Accepting connection from `%s': %p\n"), GNUNET_a2s (uaddr, addrlen), connection); return connection; @@ -473,7 +473,7 @@ signal_receive_error (struct GNUNET_CONNECTION_Handle *connection, int errcode) GNUNET_CONNECTION_Receiver receiver; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Receive encounters error (%s), connection closed (%p)\n", + "Receive encounters error (%s), connection closed (%p)\n", STRERROR (errcode), connection); GNUNET_assert (NULL != (receiver = connection->receiver)); @@ -608,14 +608,14 @@ receive_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); static void connect_success_continuation (struct GNUNET_CONNECTION_Handle *connection) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection to `%s' succeeded! (%p)\n", GNUNET_a2s (connection->addr, connection->addrlen), connection); /* trigger jobs that waited for the connection */ if (NULL != connection->receiver) { LOG (GNUNET_ERROR_TYPE_DEBUG, - "Connection succeeded, starting with receiving data (%p)\n", + "Connection succeeded, starting with receiving data (%p)\n", connection); GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->read_task); connection->read_task = @@ -989,10 +989,10 @@ GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *connection) if ( (NULL != connection->sock) && (GNUNET_YES != connection->persist) ) { - if ((GNUNET_YES != GNUNET_NETWORK_socket_shutdown (connection->sock, SHUT_RDWR)) && - (ENOTCONN != errno) && + if ((GNUNET_YES != GNUNET_NETWORK_socket_shutdown (connection->sock, SHUT_RDWR)) && + (ENOTCONN != errno) && (ECONNRESET != errno) ) - LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "shutdown"); + LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "shutdown"); } if (NULL != connection->sock) { @@ -1286,7 +1286,7 @@ transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) return; } GNUNET_assert (NULL != connection->sock); - if (NULL == tc->write_ready) + if (NULL == tc->write_ready) { /* special circumstances (in particular, PREREQ_DONE after * 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 connection->nth.notify_size = size; connection->nth.transmit_timeout = GNUNET_TIME_relative_to_absolute (timeout); GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->nth.timeout_task); - if ((NULL == connection->sock) && + if ((NULL == connection->sock) && (NULL == connection->ap_head) && (NULL == connection->dns_active)) { 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, } bf->bitArraySize = size; bf->addressesPerElement = k; - if (GNUNET_YES != must_read) - return bf; /* already done! */ + if (GNUNET_YES != must_read) + return bf; /* already done! */ /* Read from the file what bits we can */ rbuff = GNUNET_malloc (BUFFSIZE); 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) uncompress ((Bytef *) output, &olen, (const Bytef *) input, inputSize)) return output; GNUNET_free (output); - return NULL; + return NULL; } 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 * If there is a hash collision, we create a linked list. */ struct SmallMapEntry *next; - + /** * Key for the entry. */ @@ -162,10 +162,10 @@ struct GNUNET_CONTAINER_MultiHashMapIterator * @param len initial size (map will grow as needed) * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default; * GNUNET_YES means that on 'put', the 'key' does not have - * to be copied as the destination of the pointer is + * to be copied as the destination of the pointer is * guaranteed to be life as long as the value is stored in - * the hashmap. This can significantly reduce memory - * consumption, but of course is also a recipie for + * the hashmap. This can significantly reduce memory + * consumption, but of course is also a recipie for * heap corruption if the assumption is not true. Only * use this if (1) memory use is important in this case and * (2) you have triple-checked that the invariant holds @@ -331,7 +331,7 @@ GNUNET_CONTAINER_multihashmap_iterate (const struct struct SmallMapEntry *sme; struct SmallMapEntry *nxt; - nxt = me.sme; + nxt = me.sme; while (NULL != (sme = nxt)) { nxt = sme->next; @@ -348,7 +348,7 @@ GNUNET_CONTAINER_multihashmap_iterate (const struct struct BigMapEntry *bme; struct BigMapEntry *nxt; - nxt = me.bme; + nxt = me.bme; while (NULL != (bme = nxt)) { nxt = bme->next; @@ -379,7 +379,7 @@ GNUNET_CONTAINER_multihashmap_iterate (const struct */ int GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map, - const struct GNUNET_HashCode *key, + const struct GNUNET_HashCode *key, const void *value) { union MapEntry me; @@ -390,7 +390,7 @@ GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map, i = idx_of (map, key); me = map->map[i]; if (map->use_small_entries) - { + { struct SmallMapEntry *sme; struct SmallMapEntry *p; @@ -459,7 +459,7 @@ GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap i = idx_of (map, key); me = map->map[i]; if (map->use_small_entries) - { + { struct SmallMapEntry *sme; struct SmallMapEntry *p; @@ -668,7 +668,7 @@ grow (struct GNUNET_CONTAINER_MultiHashMap *map) */ int GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, - const struct GNUNET_HashCode *key, + const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt) { @@ -684,7 +684,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, { struct SmallMapEntry *sme; - for (sme = me.sme; NULL != sme; sme = sme->next) + for (sme = me.sme; NULL != sme; sme = sme->next) if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_HashCode))) { if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) @@ -697,7 +697,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, { struct BigMapEntry *bme; - for (bme = me.bme; NULL != bme; bme = bme->next) + for (bme = me.bme; NULL != bme; bme = bme->next) if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_HashCode))) { if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) @@ -715,7 +715,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, if (map->use_small_entries) { struct SmallMapEntry *sme; - + sme = GNUNET_new (struct SmallMapEntry); sme->key = key; sme->value = value; @@ -725,7 +725,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, else { struct BigMapEntry *bme; - + bme = GNUNET_new (struct BigMapEntry); bme->key = *key; bme->value = value; @@ -761,9 +761,9 @@ GNUNET_CONTAINER_multihashmap_get_multiple (const struct me = map->map[idx_of (map, key)]; if (map->use_small_entries) { - struct SmallMapEntry *sme; + struct SmallMapEntry *sme; struct SmallMapEntry *nxt; - + nxt = me.sme; while (NULL != (sme = nxt)) { @@ -777,9 +777,9 @@ GNUNET_CONTAINER_multihashmap_get_multiple (const struct } else { - struct BigMapEntry *bme; + struct BigMapEntry *bme; struct BigMapEntry *nxt; - + nxt = me.bme; while (NULL != (bme = nxt)) { 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 int GNUNET_CONTAINER_multihashmap32_contains_value (const struct GNUNET_CONTAINER_MultiHashMap32 - *map, + *map, uint32_t key, const void *value) { @@ -470,7 +470,7 @@ int GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, - GNUNET_CONTAINER_HashMapIterator32 + GNUNET_CONTAINER_HashMapIterator32 it, void *it_cls) { 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 * If there is a hash collision, we create a linked list. */ struct SmallMapEntry *next; - + /** * Key for the entry. */ @@ -162,10 +162,10 @@ struct GNUNET_CONTAINER_MultiPeerMapIterator * @param len initial size (map will grow as needed) * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default; * GNUNET_YES means that on 'put', the 'key' does not have - * to be copied as the destination of the pointer is + * to be copied as the destination of the pointer is * guaranteed to be life as long as the value is stored in - * the hashmap. This can significantly reduce memory - * consumption, but of course is also a recipie for + * the hashmap. This can significantly reduce memory + * consumption, but of course is also a recipie for * heap corruption if the assumption is not true. Only * use this if (1) memory use is important in this case and * (2) you have triple-checked that the invariant holds @@ -331,7 +331,7 @@ GNUNET_CONTAINER_multipeermap_iterate (const struct struct SmallMapEntry *sme; struct SmallMapEntry *nxt; - nxt = me.sme; + nxt = me.sme; while (NULL != (sme = nxt)) { nxt = sme->next; @@ -348,7 +348,7 @@ GNUNET_CONTAINER_multipeermap_iterate (const struct struct BigMapEntry *bme; struct BigMapEntry *nxt; - nxt = me.bme; + nxt = me.bme; while (NULL != (bme = nxt)) { nxt = bme->next; @@ -379,7 +379,7 @@ GNUNET_CONTAINER_multipeermap_iterate (const struct */ int GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map, - const struct GNUNET_PeerIdentity *key, + const struct GNUNET_PeerIdentity *key, const void *value) { union MapEntry me; @@ -390,7 +390,7 @@ GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map, i = idx_of (map, key); me = map->map[i]; if (map->use_small_entries) - { + { struct SmallMapEntry *sme; struct SmallMapEntry *p; @@ -459,7 +459,7 @@ GNUNET_CONTAINER_multipeermap_remove_all (struct GNUNET_CONTAINER_MultiPeerMap i = idx_of (map, key); me = map->map[i]; if (map->use_small_entries) - { + { struct SmallMapEntry *sme; struct SmallMapEntry *p; @@ -668,7 +668,7 @@ grow (struct GNUNET_CONTAINER_MultiPeerMap *map) */ int GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map, - const struct GNUNET_PeerIdentity *key, + const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt) { @@ -684,7 +684,7 @@ GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map, { struct SmallMapEntry *sme; - for (sme = me.sme; NULL != sme; sme = sme->next) + for (sme = me.sme; NULL != sme; sme = sme->next) if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_PeerIdentity))) { if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) @@ -697,7 +697,7 @@ GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map, { struct BigMapEntry *bme; - for (bme = me.bme; NULL != bme; bme = bme->next) + for (bme = me.bme; NULL != bme; bme = bme->next) if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_PeerIdentity))) { if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) @@ -715,7 +715,7 @@ GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map, if (map->use_small_entries) { struct SmallMapEntry *sme; - + sme = GNUNET_new (struct SmallMapEntry); sme->key = key; sme->value = value; @@ -725,7 +725,7 @@ GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map, else { struct BigMapEntry *bme; - + bme = GNUNET_new (struct BigMapEntry); bme->key = *key; bme->value = value; @@ -760,9 +760,9 @@ GNUNET_CONTAINER_multipeermap_get_multiple (const struct GNUNET_CONTAINER_MultiP me = map->map[idx_of (map, key)]; if (map->use_small_entries) { - struct SmallMapEntry *sme; + struct SmallMapEntry *sme; struct SmallMapEntry *nxt; - + nxt = me.sme; while (NULL != (sme = nxt)) { @@ -776,9 +776,9 @@ GNUNET_CONTAINER_multipeermap_get_multiple (const struct GNUNET_CONTAINER_MultiP } else { - struct BigMapEntry *bme; + struct BigMapEntry *bme; struct BigMapEntry *nxt; - + nxt = me.bme; while (NULL != (bme = nxt)) { 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 @@ #include #include "gnunet_util_lib.h" -#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS +#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS /** * Name of the curve we are using. Note that we have hard-coded * structs that use 256 bits, so using a bigger curve will require * changes that break stuff badly. The name of the curve given here * must be agreed by all peers and be supported by libgcrypt. - * + * * NOTE: this will change to Curve25519 before GNUnet 0.10.0. */ #define CURVE "NIST P-256" @@ -73,13 +73,13 @@ key_from_sexp (gcry_mpi_t * array, gcry_sexp_t sexp, const char *topname, unsigned int idx; list = gcry_sexp_find_token (sexp, topname, 0); - if (! list) - return 1; + if (! list) + return 1; l2 = gcry_sexp_cadr (list); gcry_sexp_release (list); list = l2; - if (! list) - return 2; + if (! list) + return 2; idx = 0; for (s = elems; *s; s++, idx++) @@ -136,7 +136,7 @@ adjust (unsigned char *buf, /** * Output the given MPI value to the given buffer. - * + * * @param buf where to output to * @param size number of bytes in @a buf * @param val value to write to @a buf @@ -171,7 +171,7 @@ mpi_scan (gcry_mpi_t *result, int rc; if (0 != (rc = gcry_mpi_scan (result, - GCRYMPI_FMT_USG, + GCRYMPI_FMT_USG, data, size, &size))) { LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_scan", rc); @@ -203,7 +203,7 @@ decode_private_key (const struct GNUNET_CRYPTO_EccPrivateKey *priv) gcry_mpi_release (d); if (0 != rc) { - LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc); + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc); GNUNET_assert (0); } #if EXTRA_CHECKS @@ -224,7 +224,7 @@ decode_private_key (const struct GNUNET_CRYPTO_EccPrivateKey *priv) * @param q point on curve * @param pub public key struct to initialize * @param ctx context to use for ECC operations - */ + */ static void point_to_public_sign_key (gcry_mpi_point_t q, gcry_ctx_t ctx, @@ -232,7 +232,7 @@ point_to_public_sign_key (gcry_mpi_point_t q, { gcry_mpi_t q_x; gcry_mpi_t q_y; - + q_x = gcry_mpi_new (256); q_y = gcry_mpi_new (256); 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, * @param q point on curve * @param pub public key struct to initialize * @param ctx context to use for ECC operations - */ + */ static void point_to_public_encrypt_key (gcry_mpi_point_t q, gcry_ctx_t ctx, @@ -263,7 +263,7 @@ point_to_public_encrypt_key (gcry_mpi_point_t q, { gcry_mpi_t q_x; gcry_mpi_t q_y; - + q_x = gcry_mpi_new (256); q_y = gcry_mpi_new (256); 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 keylen += 5 - keylen % 5; keylen /= 5; pubkeybuf = GNUNET_malloc (keylen + 1); - end = GNUNET_STRINGS_data_to_string ((unsigned char *) pub, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), - pubkeybuf, + end = GNUNET_STRINGS_data_to_string ((unsigned char *) pub, + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + pubkeybuf, keylen); if (NULL == end) { @@ -369,7 +369,7 @@ GNUNET_CRYPTO_ecc_public_sign_key_to_string (const struct GNUNET_CRYPTO_EccPubli * @return #GNUNET_OK on success */ int -GNUNET_CRYPTO_ecc_public_sign_key_from_string (const char *enc, +GNUNET_CRYPTO_ecc_public_sign_key_from_string (const char *enc, size_t enclen, struct GNUNET_CRYPTO_EccPublicSignKey *pub) { @@ -408,7 +408,7 @@ decode_public_sign_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub) mpi_scan (&q_x, pub->q_x, sizeof (pub->q_x)); mpi_scan (&q_y, pub->q_y, sizeof (pub->q_y)); q = gcry_mpi_point_new (256); - gcry_mpi_point_set (q, q_x, q_y, GCRYMPI_CONST_ONE); + gcry_mpi_point_set (q, q_x, q_y, GCRYMPI_CONST_ONE); gcry_mpi_release (q_x); gcry_mpi_release (q_y); @@ -426,7 +426,7 @@ decode_public_sign_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub) /** * @ingroup crypto - * Clear memory that was used to store a private key. + * Clear memory that was used to store a private key. * * @param pk location of the key */ @@ -503,8 +503,8 @@ GNUNET_CRYPTO_ecc_key_get_anonymous () if (once) return &anonymous; - mpi_print (anonymous.d, - sizeof (anonymous.d), + mpi_print (anonymous.d, + sizeof (anonymous.d), GCRYMPI_CONST_ONE); once = 1; return &anonymous; @@ -700,7 +700,7 @@ GNUNET_CRYPTO_ecc_key_create_from_configuration (const struct GNUNET_CONFIGURATI struct GNUNET_CRYPTO_EccPrivateKey *priv; char *fn; - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "PEER", "PRIVATE_KEY", &fn)) return NULL; priv = GNUNET_CRYPTO_ecc_key_create_from_file (fn); @@ -865,7 +865,7 @@ GNUNET_CRYPTO_ecc_verify (uint32_t purpose, /* build s-expression for signature */ mpi_scan (&r, sig->r, sizeof (sig->r)); mpi_scan (&s, sig->s, sizeof (sig->s)); - if (0 != (rc = gcry_sexp_build (&sig_sexpr, NULL, + if (0 != (rc = gcry_sexp_build (&sig_sexpr, NULL, "(sig-val(ecdsa(r %m)(s %m)))", r, s))) { @@ -917,7 +917,7 @@ decode_public_encrypt_key (const struct GNUNET_CRYPTO_EccPublicEncryptKey *pub) mpi_scan (&q_x, pub->q_x, sizeof (pub->q_x)); mpi_scan (&q_y, pub->q_y, sizeof (pub->q_y)); q = gcry_mpi_point_new (256); - gcry_mpi_point_set (q, q_x, q_y, GCRYMPI_CONST_ONE); + gcry_mpi_point_set (q, q_x, q_y, GCRYMPI_CONST_ONE); gcry_mpi_release (q_x); gcry_mpi_release (q_y); @@ -945,7 +945,7 @@ int GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv, const struct GNUNET_CRYPTO_EccPublicEncryptKey *pub, struct GNUNET_HashCode *key_material) -{ +{ gcry_mpi_point_t result; gcry_mpi_point_t q; gcry_mpi_t d; @@ -993,7 +993,7 @@ GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv, /** - * Derive the 'h' value for key derivation, where + * Derive the 'h' value for key derivation, where * 'h = H(l,P)'. * * @param pub public key for deriviation @@ -1001,8 +1001,8 @@ GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv, * @param context additional context to use for HKDF of 'h'; * typically the name of the subsystem/application * @return h value - */ -static gcry_mpi_t + */ +static gcry_mpi_t derive_h (const struct GNUNET_CRYPTO_EccPublicSignKey *pub, const char *label, const char *context) @@ -1090,7 +1090,7 @@ GNUNET_CRYPTO_ecc_public_key_derive (const struct GNUNET_CRYPTO_EccPublicSignKey gcry_mpi_point_t v; GNUNET_assert (0 == gcry_mpi_ec_new (&ctx, NULL, CURVE)); - + /* obtain point 'q' from original public key */ mpi_scan (&q_x, pub->q_x, sizeof (pub->q_x)); 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, /** * @ingroup hash - * + * * Compute the distance between 2 hashcodes. The computation must be * fast, not involve bits[0] or bits[4] (they're used elsewhere), and be * 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, * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2. */ int -GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode *h1, +GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode *h1, const struct GNUNET_HashCode *h2) { unsigned int *i1; @@ -543,8 +543,8 @@ GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key, const void *salt, size_t salt_len, va_list argp) { - GNUNET_CRYPTO_kdf_v (key->key, sizeof (key->key), - salt, salt_len, + GNUNET_CRYPTO_kdf_v (key->key, sizeof (key->key), + salt, salt_len, rkey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), argp); } 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, LOG (GNUNET_ERROR_TYPE_INFO, _("Starting `%s' process to generate entropy\n"), "find"); genproc = - GNUNET_OS_start_process (GNUNET_NO, 0, + GNUNET_OS_start_process (GNUNET_NO, 0, NULL, NULL, "sh", "sh", "-c", "exec find / -mount -type f -exec cp {} /dev/null \\; 2>/dev/null", NULL); @@ -298,7 +298,7 @@ killfind () } -void __attribute__ ((constructor)) +void __attribute__ ((constructor)) GNUNET_CRYPTO_random_init () { gcry_error_t rc; @@ -319,7 +319,7 @@ GNUNET_CRYPTO_random_init () if ((rc = gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0))) FPRINTF (stderr, "Failed to set libgcrypt option %s: %s\n", "ENABLE_QUICK_RANDOM", gcry_strerror (rc)); - + #ifdef GCRYCTL_INITIALIZATION_FINISHED gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); #endif @@ -334,7 +334,7 @@ GNUNET_CRYPTO_random_init () } -void __attribute__ ((destructor)) +void __attribute__ ((destructor)) GNUNET_CRYPTO_random_fini () { 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 @@ void GNUNET_CRYPTO_symmetric_create_session_key (struct GNUNET_CRYPTO_SymmetricSessionKey *key) { - gcry_randomize (key->aes_key, + gcry_randomize (key->aes_key, GNUNET_CRYPTO_AES_KEY_LENGTH, GCRY_STRONG_RANDOM); - gcry_randomize (key->twofish_key, + gcry_randomize (key->twofish_key, GNUNET_CRYPTO_AES_KEY_LENGTH, GCRY_STRONG_RANDOM); } @@ -66,12 +66,12 @@ setup_cipher_aes (gcry_cipher_hd_t *handle, GNUNET_assert (0 == gcry_cipher_open (handle, GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CFB, 0)); - rc = gcry_cipher_setkey (*handle, - sessionkey->aes_key, + rc = gcry_cipher_setkey (*handle, + sessionkey->aes_key, sizeof (sessionkey->aes_key)); GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); - rc = gcry_cipher_setiv (*handle, - iv->aes_iv, + rc = gcry_cipher_setiv (*handle, + iv->aes_iv, sizeof (iv->aes_iv)); GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); return GNUNET_OK; @@ -94,13 +94,13 @@ setup_cipher_twofish (gcry_cipher_hd_t *handle, int rc; GNUNET_assert (0 == - gcry_cipher_open (handle, GCRY_CIPHER_TWOFISH, + gcry_cipher_open (handle, GCRY_CIPHER_TWOFISH, GCRY_CIPHER_MODE_CFB, 0)); - rc = gcry_cipher_setkey (*handle, - sessionkey->twofish_key, + rc = gcry_cipher_setkey (*handle, + sessionkey->twofish_key, sizeof (sessionkey->twofish_key)); GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); - rc = gcry_cipher_setiv (*handle, + rc = gcry_cipher_setiv (*handle, iv->twofish_iv, sizeof (iv->twofish_iv)); GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); @@ -121,7 +121,7 @@ setup_cipher_twofish (gcry_cipher_hd_t *handle, * @returns the size of the encrypted block, -1 for errors */ ssize_t -GNUNET_CRYPTO_symmetric_encrypt (const void *block, +GNUNET_CRYPTO_symmetric_encrypt (const void *block, size_t len, const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, @@ -157,7 +157,7 @@ GNUNET_CRYPTO_symmetric_encrypt (const void *block, ssize_t GNUNET_CRYPTO_symmetric_decrypt (const void *block, size_t size, const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, - const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, + const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, void *result) { gcry_cipher_hd_t handle; @@ -219,13 +219,13 @@ GNUNET_CRYPTO_symmetric_derive_iv_v (struct GNUNET_CRYPTO_SymmetricInitializatio memcpy (&aes_salt[salt_len], "AES!", 4); memcpy (twofish_salt, salt, salt_len); memcpy (&twofish_salt[salt_len], "FISH", 4); - GNUNET_CRYPTO_kdf_v (iv->aes_iv, sizeof (iv->aes_iv), - aes_salt, salt_len + 4, - skey->aes_key, sizeof (skey->aes_key), + GNUNET_CRYPTO_kdf_v (iv->aes_iv, sizeof (iv->aes_iv), + aes_salt, salt_len + 4, + skey->aes_key, sizeof (skey->aes_key), argp); GNUNET_CRYPTO_kdf_v (iv->twofish_iv, sizeof (iv->twofish_iv), - twofish_salt, salt_len + 4, - skey->twofish_key, sizeof (skey->twofish_key), + twofish_salt, salt_len + 4, + skey->twofish_key, sizeof (skey->twofish_key), argp); } 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) if (NULL == tmpdir) tmpdir = getenv ("TMP"); if (NULL == tmpdir) - tmpdir = getenv ("TEMP"); + tmpdir = getenv ("TEMP"); if (NULL == tmpdir) tmpdir = "/tmp"; GNUNET_asprintf (&tmpl, "%s/%s%s", tmpdir, t, "XXXXXX"); @@ -522,7 +522,7 @@ GNUNET_DISK_file_backup (const char *fil) GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "rename", fil); - GNUNET_free (target); + GNUNET_free (target); } @@ -795,7 +795,7 @@ GNUNET_DISK_directory_create_for_file (const char *filename) * @return the number of bytes read on success, #GNUNET_SYSERR on failure */ ssize_t -GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, +GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, void *result, size_t len) { @@ -850,7 +850,7 @@ GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, */ ssize_t GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle *h, - void *result, + void *result, size_t len) { if (NULL == h) @@ -921,8 +921,8 @@ GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle *h, * @return number of bytes read, #GNUNET_SYSERR on failure */ ssize_t -GNUNET_DISK_fn_read (const char *fn, - void *result, +GNUNET_DISK_fn_read (const char *fn, + void *result, size_t len) { struct GNUNET_DISK_FileHandle *fh; @@ -1033,7 +1033,7 @@ GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle * h, */ ssize_t GNUNET_DISK_file_write_blocking (const struct GNUNET_DISK_FileHandle * h, - const void *buffer, + const void *buffer, size_t n) { if (NULL == h) @@ -1152,7 +1152,7 @@ GNUNET_DISK_directory_scan (const char *dir_name, } if (!S_ISDIR (istat.st_mode)) { - LOG (GNUNET_ERROR_TYPE_WARNING, + LOG (GNUNET_ERROR_TYPE_WARNING, _("Expected `%s' to be a directory!\n"), dir_name); GNUNET_free (dname); @@ -1413,7 +1413,7 @@ GNUNET_DISK_directory_remove (const char *filename) * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ int -GNUNET_DISK_file_copy (const char *src, +GNUNET_DISK_file_copy (const char *src, const char *dst) { char *buf; @@ -1684,7 +1684,7 @@ GNUNET_DISK_file_open (const char *fn, mode = translate_unix_perms (perm); } - fd = open (expfn, oflags + fd = open (expfn, oflags #if O_CLOEXEC | O_CLOEXEC #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; * @param option name of the option * @param value value of the option */ -static void +static void print_option (void *cls, const char *section, const char *option, const char *value) { - fprintf (stdout, + fprintf (stdout, "%s = %s\n", option, value); } @@ -136,11 +136,11 @@ run (void *cls, char *const *args, const char *cfgfile, } out = GNUNET_CONFIGURATION_dup (cfg); GNUNET_CONFIGURATION_set_value_string (out, section, option, value); - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_CONFIGURATION_write (out, cfgfile)) ret = 2; GNUNET_CONFIGURATION_destroy (out); - return; + return; } } 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) _("Generating %u keys, please wait"), make_keys); while (0 < make_keys--) - { + { fprintf (stderr, "."); if (NULL == (pk = GNUNET_CRYPTO_ecc_key_create ())) @@ -74,7 +74,7 @@ create_keys (const char *fn) GNUNET_break (0); break; } - if (GNUNET_TESTING_HOSTKEYFILESIZE != + if (GNUNET_TESTING_HOSTKEYFILESIZE != fwrite (pk, 1, GNUNET_TESTING_HOSTKEYFILESIZE, f)) { @@ -140,7 +140,7 @@ run (void *cls, char *const *args, const char *cfgfile, GNUNET_CRYPTO_ecc_key_get_public_for_signature (pk, &pub); str = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pub); - fprintf (stdout, + fprintf (stdout, "%s\n", str); 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, socklen_t salen; struct sockaddr_in v4; struct sockaddr_in6 v6; - + if (args[0] == NULL) return; if (! reverse) @@ -92,7 +92,7 @@ run (void *cls, char *const *args, const char *cfgfile, GNUNET_RESOLVER_ip_get (args[0], AF_UNSPEC, GET_TIMEOUT, &print_sockaddr, NULL); return; } - + sa = NULL; memset (&v4, 0, sizeof (v4)); v4.sin_family = AF_INET; @@ -120,7 +120,7 @@ run (void *cls, char *const *args, const char *cfgfile, } if (NULL == sa) { - fprintf (stderr, + fprintf (stderr, "`%s' is not a valid IP: %s\n", args[0], 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, next = cache_head; while ( (NULL != (pos = next)) && ( (pos->af != af) || - (pos->ip_len != ip_len) || + (pos->ip_len != ip_len) || (0 != memcmp (pos->ip, ip, ip_len))) ) { next = pos->next; @@ -323,7 +323,7 @@ getaddrinfo_resolve (struct GNUNET_SERVER_TransmitContext *tc, default: /* unsupported, skip */ break; - } + } pos = pos->ai_next; } freeaddrinfo (result); @@ -364,15 +364,15 @@ gethostbyname2_resolve (struct GNUNET_SERVER_TransmitContext *tc, { case AF_INET: GNUNET_assert (hp->h_length == sizeof (struct in_addr)); - GNUNET_SERVER_transmit_context_append_data (tc, - hp->h_addr_list[0], + GNUNET_SERVER_transmit_context_append_data (tc, + hp->h_addr_list[0], hp->h_length, GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); break; case AF_INET6: GNUNET_assert (hp->h_length == sizeof (struct in6_addr)); - GNUNET_SERVER_transmit_context_append_data (tc, - hp->h_addr_list[0], + GNUNET_SERVER_transmit_context_append_data (tc, + hp->h_addr_list[0], hp->h_length, GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); break; @@ -406,7 +406,7 @@ gethostbyname_resolve (struct GNUNET_SERVER_TransmitContext *tc, return GNUNET_SYSERR; } GNUNET_assert (hp->h_length == sizeof (struct in_addr)); - GNUNET_SERVER_transmit_context_append_data (tc, + GNUNET_SERVER_transmit_context_append_data (tc, hp->h_addr_list[0], hp->h_length, GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); @@ -482,7 +482,7 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client, { /* IP from hostname */ const char *hostname; - + hostname = (const char *) &msg[1]; if (hostname[size - 1] != '\0') { @@ -521,12 +521,12 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client, } { char buf[INET6_ADDRSTRLEN]; - + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Resolver asked to look up IP address `%s'.\n", + "Resolver asked to look up IP address `%s'.\n", inet_ntop (af, ip, buf, sizeof (buf))); } - get_ip_as_string (client, af, ip); + get_ip_as_string (client, af, ip); } 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, rt = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ), - &maint_child_death, NULL); + &maint_child_death, NULL); p = GNUNET_OS_start_process (GNUNET_NO, 0, NULL, NULL, program, program, - args[0], + args[0], NULL); GNUNET_free (program); if (NULL == p) @@ -176,7 +176,7 @@ main (int argc, char *const *argv) GNUNET_SIGNAL_handler_uninstall (shc_chld); shc_chld = NULL; GNUNET_DISK_pipe_close (sigpipe); - sigpipe = NULL; + sigpipe = NULL; GNUNET_free ((void *) argv); return (GNUNET_OK == ret) ? 0 : 1; } 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 * Message to transmit (allocated at the end of this struct) */ const struct GNUNET_MessageHeader *msg; - + /** * The handle to a helper process. */ struct GNUNET_HELPER_Handle *h; - + /** * Function to call upon completion. */ @@ -83,22 +83,22 @@ struct GNUNET_HELPER_Handle * PipeHandle to receive data from the helper */ struct GNUNET_DISK_PipeHandle *helper_in; - + /** * PipeHandle to send data to the helper */ struct GNUNET_DISK_PipeHandle *helper_out; - + /** * FileHandle to receive data from the helper */ const struct GNUNET_DISK_FileHandle *fh_from_helper; - + /** * FileHandle to send data to the helper */ const struct GNUNET_DISK_FileHandle *fh_to_helper; - + /** * The process id of the helper */ @@ -138,7 +138,7 @@ struct GNUNET_HELPER_Handle * NULL-terminated list of command-line arguments. */ char **binary_argv; - + /** * Task to read from the helper. */ @@ -172,7 +172,7 @@ struct GNUNET_HELPER_Handle * @return #GNUNET_OK on success; #GNUNET_SYSERR on error */ int -GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h, +GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h, int soft_kill) { struct GNUNET_HELPER_SendHandle *sh; @@ -200,7 +200,7 @@ GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h, if (NULL == h->helper_proc) return GNUNET_SYSERR; if (GNUNET_YES == soft_kill) - { + { /* soft-kill only possible with pipes */ GNUNET_assert (NULL != h->helper_in); ret = GNUNET_DISK_pipe_close (h->helper_in); @@ -281,7 +281,7 @@ GNUNET_HELPER_wait (struct GNUNET_HELPER_Handle *h) * stdin; #GNUNET_NO to signal termination by sending SIGTERM to helper */ static void -stop_helper (struct GNUNET_HELPER_Handle *h, +stop_helper (struct GNUNET_HELPER_Handle *h, int soft_kill) { if (GNUNET_SCHEDULER_NO_TASK != h->restart_task) @@ -352,9 +352,9 @@ helper_read (void *cls, } if (0 == t) { - /* this happens if the helper is shut down via a + /* this happens if the helper is shut down via a signal, so it is not a "hard" error */ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got 0 bytes from helper `%s' (EOF)\n", h->binary_name); if (NULL != h->exp_cb) @@ -370,7 +370,7 @@ helper_read (void *cls, &restart_task, h); return; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got %u bytes from helper `%s'\n", (unsigned int) t, h->binary_name); @@ -379,7 +379,7 @@ helper_read (void *cls, if (GNUNET_SYSERR == GNUNET_SERVER_mst_receive (h->mst, NULL, buf, t, GNUNET_NO, GNUNET_NO)) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Failed to parse inbound message from helper `%s'\n"), h->binary_name); if (NULL != h->exp_cb) @@ -387,7 +387,7 @@ helper_read (void *cls, h->exp_cb (h->cb_cls); GNUNET_HELPER_stop (h, GNUNET_NO); return; - } + } stop_helper (h, GNUNET_NO); /* Restart the helper */ h->restart_task = @@ -414,7 +414,7 @@ start_helper (struct GNUNET_HELPER_Handle *h) stop_helper (h, GNUNET_NO); h->restart_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, - &restart_task, h); + &restart_task, h); return; } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -425,7 +425,7 @@ start_helper (struct GNUNET_HELPER_Handle *h) h->fh_to_helper = GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE); h->helper_proc = - GNUNET_OS_start_process_vap (h->with_control_pipe, GNUNET_OS_INHERIT_STD_ERR, + GNUNET_OS_start_process_vap (h->with_control_pipe, GNUNET_OS_INHERIT_STD_ERR, h->helper_in, h->helper_out, h->binary_name, h->binary_argv); @@ -435,15 +435,15 @@ start_helper (struct GNUNET_HELPER_Handle *h) stop_helper (h, GNUNET_NO); h->restart_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, - &restart_task, h); + &restart_task, h); return; } GNUNET_DISK_pipe_close_end (h->helper_out, GNUNET_DISK_PIPE_END_WRITE); GNUNET_DISK_pipe_close_end (h->helper_in, GNUNET_DISK_PIPE_END_READ); if (NULL != h->mst) h->read_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, - h->fh_from_helper, - &helper_read, + h->fh_from_helper, + &helper_read, h); } @@ -558,7 +558,7 @@ GNUNET_HELPER_destroy (struct GNUNET_HELPER_Handle *h) * stdin; #GNUNET_NO to signal termination by sending SIGTERM to helper */ void -GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h, +GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h, int soft_kill) { h->exp_cb = NULL; @@ -591,7 +591,7 @@ helper_write (void *cls, h->write_task = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, h->fh_to_helper, &helper_write, h); return; - } + } if (NULL == (sh = h->sh_head)) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -600,7 +600,7 @@ helper_write (void *cls, } buf = (const char*) sh->msg; t = GNUNET_DISK_file_write (h->fh_to_helper, - &buf[sh->wpos], + &buf[sh->wpos], ntohs (sh->msg->size) - sh->wpos); if (-1 == t) { @@ -640,8 +640,8 @@ helper_write (void *cls, } if (NULL != h->sh_head) h->write_task = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, - h->fh_to_helper, - &helper_write, + h->fh_to_helper, + &helper_write, h); } @@ -655,12 +655,12 @@ helper_write (void *cls, * @param cont continuation to run once the message is out (#GNUNET_OK on succees, #GNUNET_NO * if the helper process died, #GNUNET_SYSERR during #GNUNET_HELPER_destroy). * @param cont_cls closure for @a cont - * @return NULL if the message was dropped, + * @return NULL if the message was dropped, * otherwise handle to cancel *cont* (actual transmission may * not be abortable) */ struct GNUNET_HELPER_SendHandle * -GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h, +GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h, const struct GNUNET_MessageHeader *msg, int can_drop, GNUNET_HELPER_Continuation cont, @@ -686,10 +686,10 @@ GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h, sh); if (GNUNET_SCHEDULER_NO_TASK == h->write_task) h->write_task = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, - h->fh_to_helper, - &helper_write, + h->fh_to_helper, + &helper_write, h); - + return sh; } 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 handled = GNUNET_YES; } } - + if (GNUNET_NO == handled) LOG (GNUNET_ERROR_TYPE_WARNING, "no handler for message of type %d\n", ntohs (mh->type)); } @@ -233,7 +233,7 @@ GNUNET_MQ_discard (struct GNUNET_MQ_Envelope *mqm) /** * Send a message with the give message queue. * May only be called once per message. - * + * * @param mq message queue * @param ev the envelope with the message to send. */ @@ -242,7 +242,7 @@ GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev) { GNUNET_assert (NULL != mq); GNUNET_assert (NULL == ev->parent_queue); - + /* is the implementation busy? queue it! */ if (NULL != mq->current_envelope) { @@ -465,7 +465,7 @@ server_client_destroy_impl (struct GNUNET_MQ_Handle *mq, void *impl_state) { struct ServerClientSocketState *state = impl_state; - + GNUNET_assert (NULL != mq); GNUNET_assert (NULL != state); GNUNET_SERVER_client_drop (state->client); @@ -483,7 +483,7 @@ server_client_send_impl (struct GNUNET_MQ_Handle *mq, GNUNET_MQ_impl_send_commit (mq); - state->th = + state->th = GNUNET_SERVER_notify_transmit_ready (state->client, ntohs (msg->size), GNUNET_TIME_UNIT_FOREVER_REL, &transmit_queued, mq); @@ -522,7 +522,7 @@ handle_client_message (void *cls, struct ClientConnectionState *state; state = mq->impl_state; - + if (NULL == msg) { GNUNET_MQ_inject_error (mq, GNUNET_MQ_ERROR_READ); @@ -600,8 +600,8 @@ connection_client_send_impl (struct GNUNET_MQ_Handle *mq, GNUNET_MQ_impl_send_commit (mq); - state->th = - GNUNET_CLIENT_notify_transmit_ready (state->connection, ntohs (msg->size), + state->th = + GNUNET_CLIENT_notify_transmit_ready (state->connection, ntohs (msg->size), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_NO, &connection_client_transmit_queued, mq); } 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) struct GNUNET_CRYPTO_HashAsciiEncoded ae; size_t upm; - upm = sizeof (dummy.sun_path); + upm = sizeof (dummy.sun_path); slen = strlen (unixpath); if (slen < upm) return unixpath; /* no shortening required */ @@ -243,7 +243,7 @@ socket_set_nosigpipe (const struct GNUNET_NETWORK_Handle *h) int abs_value = 1; if (0 != - setsockopt (h->fd, SOL_SOCKET, SO_NOSIGPIPE, + setsockopt (h->fd, SOL_SOCKET, SO_NOSIGPIPE, (const void *) &abs_value, sizeof (abs_value))) LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt"); @@ -270,7 +270,7 @@ socket_set_nodelay (const struct GNUNET_NETWORK_Handle *h) const char *abs_value = "1"; if (0 != - setsockopt (h->fd, IPPROTO_TCP, TCP_NODELAY, + setsockopt (h->fd, IPPROTO_TCP, TCP_NODELAY, (const void *) abs_value, sizeof (abs_value))) LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt"); @@ -325,7 +325,7 @@ initialize_network_handle (struct GNUNET_NETWORK_Handle *h, #ifdef DARWIN socket_set_nosigpipe (h); #endif - if ( (type == SOCK_STREAM) + if ( (type == SOCK_STREAM) #ifdef AF_UNIX && (af != AF_UNIX) #endif @@ -345,7 +345,7 @@ initialize_network_handle (struct GNUNET_NETWORK_Handle *h, */ struct GNUNET_NETWORK_Handle * GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc, - struct sockaddr *address, + struct sockaddr *address, socklen_t *address_len) { struct GNUNET_NETWORK_Handle *ret; @@ -358,7 +358,7 @@ GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc, int gsn = getsockname (desc->fd, &name, &namelen); if (gsn == 0) - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Accepting connection on `%s'\n", GNUNET_a2s (&name, namelen)); } @@ -414,8 +414,8 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc, const int on = 1; if (desc->af == AF_INET6) - if (setsockopt (desc->fd, IPPROTO_IPV6, IPV6_V6ONLY, - (const void *) &on, + if (setsockopt (desc->fd, IPPROTO_IPV6, IPV6_V6ONLY, + (const void *) &on, sizeof (on))) LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt"); } @@ -424,9 +424,9 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc, #ifndef WINDOWS { const int on = 1; - + /* This is required here for TCP sockets, but only on UNIX */ - if ((SOCK_STREAM == desc->type) + if ((SOCK_STREAM == desc->type) && (0 != setsockopt (desc->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)))) LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt"); } @@ -1437,7 +1437,7 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, tv.tv_usec = (timeout.rel_value_us - (tv.tv_sec * GNUNET_TIME_UNIT_SECONDS.rel_value_us)); - return select (nfds, + return select (nfds, (NULL != rfds) ? &rfds->sds : NULL, (NULL != wfds) ? &wfds->sds : NULL, (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 char parameters[512]; PROCESS_INFORMATION proc; DWORD exit_value; - - GNUNET_snprintf (parameters, - sizeof (parameters), + + GNUNET_snprintf (parameters, + sizeof (parameters), "-d %s", params); memset (&start, 0, sizeof (start)); start.cb = sizeof (start); memset (&proc, 0, sizeof (proc)); - - // Start the child process. + + // Start the child process. if ( ! (CreateProcess( p, // current windows (2k3 and up can handle / instead of \ in paths)) parameters, // execute dryrun/priviliege checking mode NULL, // Process handle not inheritable @@ -758,12 +758,12 @@ GNUNET_OS_check_helper_binary (const char *binary, int check_suid, const char *p FALSE, // Set handle inheritance to FALSE CREATE_DEFAULT_ERROR_MODE, // No creation flags NULL, // Use parent's environment block - NULL, // Use parent's starting directory + NULL, // Use parent's starting directory &start, // Pointer to STARTUPINFO structure &proc ) // Pointer to PROCESS_INFORMATION structure - )) + )) { - LOG (GNUNET_ERROR_TYPE_ERROR, + LOG (GNUNET_ERROR_TYPE_ERROR, _("CreateProcess failed for binary %s (%d).\n"), p, GetLastError()); return GNUNET_SYSERR; @@ -771,17 +771,17 @@ GNUNET_OS_check_helper_binary (const char *binary, int check_suid, const char *p // Wait until child process exits. WaitForSingleObject( proc.hProcess, INFINITE ); - + if ( ! GetExitCodeProcess (proc.hProcess, &exit_value)){ - LOG (GNUNET_ERROR_TYPE_ERROR, - _("GetExitCodeProcess failed for binary %s (%d).\n"), + LOG (GNUNET_ERROR_TYPE_ERROR, + _("GetExitCodeProcess failed for binary %s (%d).\n"), p, GetLastError() ); return GNUNET_SYSERR; } - // Close process and thread handles. + // Close process and thread handles. CloseHandle( proc.hProcess ); CloseHandle( proc.hThread ); - + if (!exit_value) return GNUNET_YES; #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, pass_netmask = (struct sockaddr *) &netmask6; } - + if (GNUNET_OK != proc (proc_cls, ifc, 0 == strcmp (ifc, GNUNET_DEFAULT_INTERFACE), (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, char sig; char *pipe_fd; ssize_t ret; - + LOG (GNUNET_ERROR_TYPE_DEBUG, "`%s' invoked because of %d\n", __FUNCTION__, tc->reason); if (0 != (tc->reason & @@ -275,7 +275,7 @@ GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig) #else LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending signal %d to pid: %u via system call\n", sig, proc->pid); return PLIBC_KILL (proc->pid, sig); -#endif +#endif } } @@ -753,7 +753,7 @@ start_process (int pipe_control, if (GNUNET_SYSERR == GNUNET_OS_check_helper_binary (filename, GNUNET_NO, NULL)) return NULL; /* not executable */ - + /* Search in prefix dir (hopefully - the directory from which * the current module was loaded), bindir and libdir, then in PATH */ @@ -902,7 +902,7 @@ start_process (int pipe_control, else SetHandleInformation (stdih, HANDLE_FLAG_INHERIT, 0); } - + stdoh = GetStdHandle (STD_OUTPUT_HANDLE); GetHandleInformation (stdoh, &stdof); @@ -1054,7 +1054,7 @@ start_process (int pipe_control, if ((NULL == pipe_stdin) && (stdih)) SetHandleInformation (stdih, HANDLE_FLAG_INHERIT, stdif); - + if ((NULL == pipe_stdout) && (stdoh)) SetHandleInformation (stdoh, HANDLE_FLAG_INHERIT, stdof); @@ -1116,7 +1116,7 @@ start_process (int pipe_control, wrote = GNUNET_DISK_file_write (lsocks_write_fd, &count, sizeof (count)); if (sizeof (count) != wrote) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to write %u count bytes to the child: %u\n", sizeof (count), GetLastError ()); break; @@ -1127,8 +1127,8 @@ start_process (int pipe_control, /* Get a socket duplication info */ if (SOCKET_ERROR == WSADuplicateSocketA (lsocks[i], gnunet_proc->pid, &pi)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to duplicate an socket[%llu]: %u\n", i, + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to duplicate an socket[%llu]: %u\n", i, GetLastError ()); break; } @@ -1144,8 +1144,8 @@ start_process (int pipe_control, wrote = GNUNET_DISK_file_write (lsocks_write_fd, &size, sizeof (size)); if (sizeof (size) != wrote) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to write %u size[%llu] bytes to the child: %u\n", + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to write %u size[%llu] bytes to the child: %u\n", sizeof (size), i, GetLastError ()); break; } @@ -1153,8 +1153,8 @@ start_process (int pipe_control, wrote = GNUNET_DISK_file_write (lsocks_write_fd, &pi, sizeof (pi)); if (sizeof (pi) != wrote) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to write %u socket[%llu] bytes to the child: %u\n", + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to write %u socket[%llu] bytes to the child: %u\n", sizeof (pi), i, GetLastError ()); break; } @@ -1207,7 +1207,7 @@ GNUNET_OS_start_process_vap (int pipe_control, enum GNUNET_OS_InheritStdioFlags std_inheritance, struct GNUNET_DISK_PipeHandle *pipe_stdin, struct GNUNET_DISK_PipeHandle *pipe_stdout, - const char *filename, + const char *filename, char *const argv[]) { return start_process (pipe_control, @@ -1328,7 +1328,7 @@ GNUNET_OS_start_process_v (int pipe_control, /** * Retrieve the status of a process, waiting on him if dead. * Nonblocking version. - * + * * @param proc process ID * @param type status type * @param code return code/signal number @@ -1441,7 +1441,7 @@ GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc) while ( (pid != (ret = waitpid (pid, NULL, 0))) && (EINTR == errno) ) ; - if (pid != ret) + if (pid != ret) { LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "waitpid"); 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) table[ret]->rc = 1; table[ret]->pid = ret; GNUNET_break (GNUNET_OK == - GNUNET_CONTAINER_multipeermap_put (map, + GNUNET_CONTAINER_multipeermap_put (map, &table[ret]->id, table[ret], 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 @@ #include "gnunet_util_lib.h" #include -static uint64_t +static uint64_t perfMalloc () { 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) struct GNUNET_RESOLVER_RequestHandle *rh = cls; uint16_t size; - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving response from DNS service\n"); if (NULL == msg) { @@ -920,7 +920,7 @@ GNUNET_RESOLVER_hostname_resolve (int af, return NULL; } LOG (GNUNET_ERROR_TYPE_DEBUG, - "Resolving our hostname `%s'\n", + "Resolving our hostname `%s'\n", hostname); return GNUNET_RESOLVER_ip_get (hostname, af, timeout, callback, cls); } 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, reason |= GNUNET_SCHEDULER_REASON_WRITE_READY; if (reason == 0) return GNUNET_NO; /* not ready */ - reason |= GNUNET_SCHEDULER_REASON_PREREQ_DONE; + reason |= GNUNET_SCHEDULER_REASON_PREREQ_DONE; task->reason = reason; return GNUNET_YES; } @@ -442,7 +442,7 @@ check_ready (const struct GNUNET_NETWORK_FDSet *rs, pos = pending; while (pos != NULL) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Checking readiness of task: %llu / %p\n", pos->id, pos->callback_cls); next = pos->next; @@ -568,7 +568,7 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws) if (GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value_us > DELAY_THRESHOLD.rel_value_us) { - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Task %llu took %s to be scheduled\n", (unsigned long long) pos->id, 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) (pos->write_fd != -1) && (!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd))) GNUNET_abort (); // added to ready in previous select loop! - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Running task: %llu / %p\n", pos->id, pos->callback_cls); pos->callback (pos->callback_cls, &tc); @@ -1052,7 +1052,7 @@ GNUNET_SCHEDULER_TaskIdentifier GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, GNUNET_SCHEDULER_Task task, void *task_cls) { - return GNUNET_SCHEDULER_add_select (prio, + return GNUNET_SCHEDULER_add_select (prio, GNUNET_TIME_UNIT_ZERO, NULL, NULL, task, task_cls); } @@ -1175,7 +1175,7 @@ GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, * to run) might get to run first. Just as with delays, clients must * not rely on any particular order of execution between tasks * scheduled concurrently. - * + * * The task will be run with the DEFAULT priority. * * @param task main function of the task @@ -1250,7 +1250,7 @@ GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, */ #ifndef MINGW static GNUNET_SCHEDULER_TaskIdentifier -add_without_sets (struct GNUNET_TIME_Relative delay, +add_without_sets (struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, int rfd, int wfd, GNUNET_SCHEDULER_Task task, void *task_cls) @@ -1396,7 +1396,7 @@ GNUNET_SCHEDULER_add_read_net_with_priority (struct GNUNET_TIME_Relative delay, GNUNET_NETWORK_fdset_destroy (rs); return ret; #else - return add_without_sets (delay, + return add_without_sets (delay, priority, GNUNET_NETWORK_get_fd (rfd), -1, task, task_cls); @@ -1441,7 +1441,7 @@ GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, return ret; #else GNUNET_assert (GNUNET_NETWORK_get_fd (wfd) >= 0); - return add_without_sets (delay, + return add_without_sets (delay, GNUNET_SCHEDULER_PRIORITY_DEFAULT, -1, GNUNET_NETWORK_get_fd (wfd), task, task_cls); @@ -1486,7 +1486,7 @@ GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay, int fd; GNUNET_DISK_internal_file_handle_ (rfd, &fd, sizeof (int)); - return add_without_sets (delay, + return add_without_sets (delay, GNUNET_SCHEDULER_PRIORITY_DEFAULT, fd, -1, task, task_cls); @@ -1532,7 +1532,7 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay, GNUNET_DISK_internal_file_handle_ (wfd, &fd, sizeof (int)); GNUNET_assert (fd >= 0); - return add_without_sets (delay, + return add_without_sets (delay, GNUNET_SCHEDULER_PRIORITY_DEFAULT, -1, fd, task, task_cls); 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, * @param ptr pointer to user context * @param size number of bytes in user context struct (for verification only) */ -void +void GNUNET_SERVER_client_set_user_context_ (struct GNUNET_SERVER_Client *client, void *ptr, size_t size) @@ -977,7 +977,7 @@ GNUNET_SERVER_inject (struct GNUNET_SERVER_Handle *server, (GNUNET_SCHEDULER_NO_TASK == sender->warn_task) ) { GNUNET_break (0 != type); /* type should never be 0 here, as we don't use 0 */ - sender->warn_start = GNUNET_TIME_absolute_get (); + sender->warn_start = GNUNET_TIME_absolute_get (); sender->warn_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, &warn_no_receive_done, sender); @@ -1061,7 +1061,7 @@ process_mst (struct GNUNET_SERVER_Client *client, int ret) } LOG (GNUNET_ERROR_TYPE_DEBUG, "Server leaves instant processing loop: ret = %d, server = %p, shutdown = %d, suspended = %u\n", - ret, client->server, + ret, client->server, client->shutdown_now, client->suspended); if (GNUNET_NO == ret) @@ -1367,7 +1367,7 @@ GNUNET_SERVER_disconnect_notify (struct GNUNET_SERVER_Handle *server, */ void GNUNET_SERVER_connect_notify (struct GNUNET_SERVER_Handle *server, - GNUNET_SERVER_ConnectCallback callback, + GNUNET_SERVER_ConnectCallback callback, void *callback_cls) { struct NotifyList *n; @@ -1419,7 +1419,7 @@ GNUNET_SERVER_disconnect_notify_cancel (struct GNUNET_SERVER_Handle *server, */ void GNUNET_SERVER_connect_notify_cancel (struct GNUNET_SERVER_Handle *server, - GNUNET_SERVER_ConnectCallback callback, + GNUNET_SERVER_ConnectCallback callback, void *callback_cls) { struct NotifyList *pos; @@ -1453,7 +1453,7 @@ destroy_connection (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_CONNECTION_Handle *connection = cls; - + GNUNET_CONNECTION_destroy (connection); } @@ -1489,7 +1489,7 @@ GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client) GNUNET_CONNECTION_receive_cancel (client->connection); client->receive_pending = GNUNET_NO; } - client->shutdown_now = GNUNET_YES; + client->shutdown_now = GNUNET_YES; client->reference_count++; /* make sure nobody else clean up client... */ if ( (NULL != client->mst) && (NULL != server) ) @@ -1656,7 +1656,7 @@ GNUNET_SERVER_client_persist_ (struct GNUNET_SERVER_Client *client) * serious error) */ void -GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, +GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, int success) { 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 for (cl = nc->clients_head; NULL != cl; cl = cl->next) if (cl->client == client) - return; /* already present */ + return; /* already present */ cl = GNUNET_malloc (sizeof (struct ClientList)); GNUNET_CONTAINER_DLL_insert (nc->clients_head, 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); * with a semicolon). The network must be given in dotted-decimal * notation. The netmask can be given in CIDR notation (/16) or * in dotted-decimal (/255.255.0.0). - * + * * @param routeList a string specifying the forbidden networks * @return the converted list, NULL if the synatx is flawed */ @@ -254,7 +254,7 @@ parse_ipv4_specification (const char *routeList) * with a semicolon). The network must be given in colon-hex * notation. The netmask must be given in CIDR notation (/16) or * can be omitted to specify a single host. - * + * * @param routeListX a string specifying the forbidden networks * @return the converted list, NULL if the synatx is flawed */ @@ -659,18 +659,18 @@ check_access (void *cls, const struct GNUNET_CONNECTION_Credentials *uc, #ifndef WINDOWS case AF_UNIX: ret = GNUNET_OK; /* always OK for now */ - if (GNUNET_YES == sctx->match_uid) + if (GNUNET_YES == sctx->match_uid) { /* UID match required */ ret = (NULL != uc) && ( (0 == uc->uid) || (uc->uid == geteuid ()) ); } else if ( (GNUNET_YES == sctx->match_gid) && - ( (NULL == uc) || + ( (NULL == uc) || ( (0 != uc->uid) && (uc->uid != geteuid ()) ) ) ) { /* group match required and UID does not match */ - if (NULL == uc) + if (NULL == uc) { /* no credentials, group match not possible */ ret = GNUNET_NO; @@ -718,7 +718,7 @@ check_access (void *cls, const struct GNUNET_CONNECTION_Credentials *uc, if (GNUNET_OK != ret) { LOG (GNUNET_ERROR_TYPE_WARNING, - _("Access from `%s' denied to service `%s'\n"), + _("Access from `%s' denied to service `%s'\n"), GNUNET_a2s (addr, addrlen), sctx->service_name); } @@ -750,9 +750,9 @@ get_pid_file_name (struct GNUNET_SERVICE_Context *sctx) * Parse an IPv4 access control list. * * @param ret location where to write the ACL (set) - * @param sctx service context to use to get the configuration + * @param sctx service context to use to get the configuration * @param option name of the ACL option to parse - * @return GNUNET_SYSERR on parse error, GNUNET_OK on success (including + * @return GNUNET_SYSERR on parse error, GNUNET_OK on success (including * no ACL configured) */ static int @@ -763,7 +763,7 @@ process_acl4 (struct IPv4NetworkSet **ret, struct GNUNET_SERVICE_Context *sctx, if (!GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->service_name, option)) { - *ret = NULL; + *ret = NULL; return GNUNET_OK; } GNUNET_break (GNUNET_OK == @@ -787,9 +787,9 @@ process_acl4 (struct IPv4NetworkSet **ret, struct GNUNET_SERVICE_Context *sctx, * Parse an IPv6 access control list. * * @param ret location where to write the ACL (set) - * @param sctx service context to use to get the configuration + * @param sctx service context to use to get the configuration * @param option name of the ACL option to parse - * @return GNUNET_SYSERR on parse error, GNUNET_OK on success (including + * @return GNUNET_SYSERR on parse error, GNUNET_OK on success (including * no ACL configured) */ static int @@ -1825,7 +1825,7 @@ shutdown: #if HAVE_MALLINFO { char *counter; - + if ( (GNUNET_YES == GNUNET_CONFIGURATION_have_value (sctx.cfg, service_name, "GAUGER_HEAP")) && @@ -1835,11 +1835,11 @@ shutdown: &counter)) ) { struct mallinfo mi; - + mi = mallinfo (); GAUGER (service_name, counter, mi.usmblks, "blocks"); GNUNET_free (counter); - } + } } #endif GNUNET_SPEEDUP_stop_ (); @@ -1944,7 +1944,7 @@ GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Context *sctx) #if HAVE_MALLINFO { char *counter; - + if ( (GNUNET_YES == GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->service_name, "GAUGER_HEAP")) && @@ -1954,11 +1954,11 @@ GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Context *sctx) &counter)) ) { struct mallinfo mi; - + mi = mallinfo (); GAUGER (sctx->service_name, counter, mi.usmblks, "blocks"); GNUNET_free (counter); - } + } } #endif 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 do_speedup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { static long long current_offset; - + speedup_task = GNUNET_SCHEDULER_NO_TASK; if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; current_offset += delta.rel_value_us; GNUNET_TIME_set_offset (current_offset); - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Speeding up execution time by %s\n", + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Speeding up execution time by %s\n", GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_NO)); speedup_task = GNUNET_SCHEDULER_add_delayed (interval, &do_speedup, NULL); } @@ -95,7 +95,7 @@ GNUNET_SPEEDUP_stop_ ( ) GNUNET_SCHEDULER_cancel (speedup_task); speedup_task = GNUNET_SCHEDULER_NO_TASK; } - if ( (0 != interval.rel_value_us) && + if ( (0 != interval.rel_value_us) && (0 != delta.rel_value_us) ) LOG (GNUNET_ERROR_TYPE_DEBUG, "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, */ char * GNUNET_STRINGS_conv (const char *input, - size_t len, - const char *input_charset, + size_t len, + const char *input_charset, const char *output_charset) { char *ret; @@ -391,10 +391,10 @@ GNUNET_STRINGS_conv (const char *input, size_t u8_string_length; size_t encoded_string_length; - u8_string = u8_conv_from_encoding (input_charset, - iconveh_error, - input, len, - NULL, NULL, + u8_string = u8_conv_from_encoding (input_charset, + iconveh_error, + input, len, + NULL, NULL, &u8_string_length); if (NULL == u8_string) { @@ -409,9 +409,9 @@ GNUNET_STRINGS_conv (const char *input, free (u8_string); return ret; } - encoded_string = u8_conv_to_encoding (output_charset, iconveh_error, - u8_string, u8_string_length, - NULL, NULL, + encoded_string = u8_conv_to_encoding (output_charset, iconveh_error, + u8_string, u8_string_length, + NULL, NULL, &encoded_string_length); free (u8_string); if (NULL == encoded_string) @@ -644,14 +644,14 @@ GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta, return _("forever"); if (0 == delta.rel_value_us) return _("0 ms"); - if ( ( (GNUNET_YES == do_round) && - (dval > 5 * 1000) ) || + if ( ( (GNUNET_YES == do_round) && + (dval > 5 * 1000) ) || (0 == (dval % 1000) )) { dval = dval / 1000; unit = _( /* time unit */ "ms"); - if ( ( (GNUNET_YES == do_round) && - (dval > 5 * 1000) ) || + if ( ( (GNUNET_YES == do_round) && + (dval > 5 * 1000) ) || (0 == (dval % 1000) )) { dval = dval / 1000; @@ -663,7 +663,7 @@ GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta, dval = dval / 60; unit = _( /* time unit */ "m"); if ( ( (GNUNET_YES == do_round) && - (dval > 5 * 60) ) || + (dval > 5 * 60) ) || (0 == (dval % 60) )) { dval = dval / 60; @@ -756,7 +756,7 @@ getValue__ (unsigned char a) * Convert binary data to ASCII encoding. The ASCII encoding is rather * GNUnet specific. It was chosen such that it only uses characters * in [0-9A-V], can be produced without complex arithmetics and uses a - * small number of characters. + * small number of characters. * Does not append 0-terminator, but returns a pointer to the place where * it should be placed, if needed. * @@ -771,7 +771,7 @@ char * GNUNET_STRINGS_data_to_string (const void *data, size_t size, char *out, size_t out_size) { /** - * 32 characters for encoding + * 32 characters for encoding */ static char *encTable__ = "0123456789ABCDEFGHIJKLMNOPQRSTUV"; unsigned int wpos; @@ -1040,7 +1040,7 @@ GNUNET_STRINGS_path_is_absolute (const char *filename, int can_be_uri, /** * Perform 'checks' on 'filename' - * + * * @param filename file to check * @param checks checks to perform * @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, /** * Tries to convert 'zt_addr' string to an IPv6 address. * The string is expected to have the format "[ABCD::01]:80". - * + * * @param zt_addr 0-terminated string. May be mangled by the function. * @param addrlen length of zt_addr (not counting 0-terminator). * @param r_buf a buffer to fill. Initially gets filled with zeroes, @@ -1090,7 +1090,7 @@ GNUNET_STRINGS_check_filename (const char *filename, * case the contents of r_buf are undefined. */ int -GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, +GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, uint16_t addrlen, struct sockaddr_in6 *r_buf) { @@ -1100,7 +1100,7 @@ GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, unsigned int port; if (addrlen < 6) - return GNUNET_SYSERR; + return GNUNET_SYSERR; memcpy (zbuf, zt_addr, addrlen); if ('[' != zbuf[0]) { @@ -1152,7 +1152,7 @@ GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, /** * Tries to convert 'zt_addr' string to an IPv4 address. * The string is expected to have the format "1.2.3.4:80". - * + * * @param zt_addr 0-terminated string. May be mangled by the function. * @param addrlen length of zt_addr (not counting 0-terminator). * @param r_buf a buffer to fill. @@ -1191,7 +1191,7 @@ GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr, uint16_t addrlen, /** * Tries to convert 'addr' string to an IP (v4 or v6) address. * Will automatically decide whether to treat 'addr' as v4 or v6 address. - * + * * @param addr a string, may not be 0-terminated. * @param addrlen number of bytes in addr (if addr is 0-terminated, * 0-terminator should not be counted towards addrlen). @@ -1200,7 +1200,7 @@ GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr, uint16_t addrlen, * case the contents of r_buf are undefined. */ int -GNUNET_STRINGS_to_address_ip (const char *addr, +GNUNET_STRINGS_to_address_ip (const char *addr, uint16_t addrlen, struct sockaddr_storage *r_buf) { 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) static char * read_output_line (int phase_from1, int phase_to1, int phase_from2, int phase_to2, char c, const char *expect_level, - long delay_morethan, long delay_lessthan, int phase, + long delay_morethan, long delay_lessthan, int phase, char *p, int *len, long *delay, char level[8]) { 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 ADD_NEW_ENTRY, REMOVE_SECTION, REMOVE_ENTRY, - COMPARE, + COMPARE, PRINT }; @@ -236,14 +236,14 @@ checkDiffs (struct GNUNET_CONFIGURATION_Handle *cfgDefault, int option) GNUNET_CONFIGURATION_iterate (cfg, diffsCallBack, &cbData); if (1 == (ret = cbData.status)) { - FPRINTF (stderr, "%s", + FPRINTF (stderr, "%s", "Incorrect Configuration Diffs: Diffs may contain data not actually edited\n"); goto housekeeping; } cbData.cfgDiffs = cfg; GNUNET_CONFIGURATION_iterate (cfgDiffs, diffsCallBack, &cbData); if ((ret = cbData.status) == 1) - FPRINTF (stderr, "%s", + FPRINTF (stderr, "%s", "Incorrect Configuration Diffs: Data may be missing in diffs\n"); housekeeping: 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 () return GNUNET_SYSERR; } if (GNUNET_SYSERR == - GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_TEST, + GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_TEST, &purp, &sig, &dpub)) { @@ -117,7 +117,7 @@ testDeriveSignVerify () return GNUNET_SYSERR; } if (GNUNET_SYSERR != - GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_TEST, + GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_TEST, &purp, &sig, &pkey)) { @@ -280,7 +280,7 @@ main (int argc, char *argv[]) if (0 != failure_count) { fprintf (stderr, - "\n\n%d TESTS FAILED!\n\n", + "\n\n%d TESTS FAILED!\n\n", failure_count); return -1; } 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 () }; unsigned char encrresult[] = { - 155, 88, 106, 174, 124, 172, 47, 149, 85, 15, 208, 176, 65, 124, 155, - 74, 215, 25, 177, 231, 162, 109, 165, 4, 133, 165, 93, 44, 213, 77, + 155, 88, 106, 174, 124, 172, 47, 149, 85, 15, 208, 176, 65, 124, 155, + 74, 215, 25, 177, 231, 162, 109, 165, 4, 133, 165, 93, 44, 213, 77, 206, 204, 1 }; @@ -109,7 +109,7 @@ verifyCrypto () GNUNET_CRYPTO_symmetric_encrypt (plain, GNUNET_CRYPTO_AES_KEY_LENGTH, &key, (const struct GNUNET_CRYPTO_SymmetricInitializationVector *) - "testtesttesttesttesttesttesttest", + "testtesttesttesttesttesttesttest", result)) { 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 () { struct GNUNET_MQ_Envelope *mqm; struct MyMessage *mm; - + mm = NULL; mqm = NULL; 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; static struct GNUNET_OS_Process *proc; /** - * Pipe to write to started processes stdin (on write end) + * Pipe to write to started processes stdin (on write end) */ static struct GNUNET_DISK_PipeHandle *hello_pipe_stdin; /** - * Pipe to read from started processes stdout (on read end) + * Pipe to read from started processes stdout (on read end) */ static struct GNUNET_DISK_PipeHandle *hello_pipe_stdout; @@ -204,7 +204,7 @@ check_kill () fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); proc = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn, - "gnunet-service-resolver", "-", NULL); + "gnunet-service-resolver", "-", NULL); sleep (1); /* give process time to start, so we actually use the pipe-kill mechanism! */ GNUNET_free (fn); if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) @@ -235,7 +235,7 @@ check_instant_kill () fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); proc = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn, - "gnunet-service-resolver", "-", NULL); + "gnunet-service-resolver", "-", NULL); if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) { 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 () for (i = 0; i < NUMBER_OF_PEERS; i++) { gcry_randomize (&pidArr[i], - sizeof (struct GNUNET_PeerIdentity), + sizeof (struct GNUNET_PeerIdentity), GCRY_STRONG_RANDOM); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "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[]) ret = GNUNET_PLUGIN_load ("libgnunet_plugin_test", "in"); if (ret == NULL) return 1; - if (0 != strcmp (ret, "Hello")) + if (0 != strcmp (ret, "Hello")) return 2; ret = GNUNET_PLUGIN_unload ("libgnunet_plugin_test", "out"); 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[]) int ok = 1 + 2 + 4 + 8; char *fn; struct GNUNET_OS_Process *proc; - char *const argvx[] = { + char *const argvx[] = { "test-resolver-api", "-c", "test_resolver_api_data.conf", NULL }; struct GNUNET_GETOPT_CommandLineOption options[] = @@ -363,9 +363,9 @@ main (int argc, char *argv[]) "WARNING", NULL); fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); - proc = GNUNET_OS_start_process (GNUNET_YES, - GNUNET_OS_INHERIT_STD_OUT_AND_ERR, - NULL, NULL, fn, + proc = GNUNET_OS_start_process (GNUNET_YES, + GNUNET_OS_INHERIT_STD_OUT_AND_ERR, + NULL, NULL, fn, "gnunet-service-resolver", "-c", "test_resolver_api_data.conf", NULL); 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[]) GNUNET_log_setup ("test-scheduler-delay", "WARNING", NULL); target = GNUNET_TIME_absolute_get (); GNUNET_SCHEDULER_run (&test_task, NULL); - FPRINTF (stdout, + FPRINTF (stdout, "Sleep precision: %llu microseconds (average delta). ", cumDelta / (MAXV / INCR)); 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[]) msg[0].size = htons (sizeof (msg)); msg[0].type = htons (sizeof (GNUNET_MESSAGE_TYPE_DUMMY)); mst = GNUNET_SERVER_mst_create(mst_cb, NULL); - GNUNET_SERVER_mst_receive (mst, &id, - (const char *) &msg, 2 * sizeof (msg), + GNUNET_SERVER_mst_receive (mst, &id, + (const char *) &msg, 2 * sizeof (msg), GNUNET_NO, GNUNET_NO); /* If we reach this line, it did not crash */ 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 () static void -ready6 (void *cls, +ready6 (void *cls, int result) { const struct GNUNET_CONFIGURATION_Handle *cfg = cls; @@ -236,7 +236,7 @@ check_start_stop () GNUNET_assert (GNUNET_OK == GNUNET_PROGRAM_run (3, argv, "test-service-program", "no help", options, &start_stop_main, &ret)); - + GNUNET_break (0 == ret); return ret; } 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) } end = GNUNET_TIME_absolute_get(); fprintf (stderr, "\n"); - fflush(stdout); + fflush(stdout); } /** * */ -static void +static void check (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle * @@ -90,7 +90,7 @@ main (int argc, char *argv[]) time_t start_real; time_t end_real; struct GNUNET_TIME_Relative delta; - + start_real = time (NULL); start = GNUNET_TIME_absolute_get(); GNUNET_PROGRAM_run ((sizeof (argvn) / sizeof (char *)) - 1, argvn, "test-speedup", @@ -101,19 +101,19 @@ main (int argc, char *argv[]) if (delta.rel_value_us > ((end_real - start_real) * 1500LL * 1000LL)) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Execution time in GNUnet time: %s\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Execution time in GNUnet time: %s\n", GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_YES)); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Execution time in system time: %llu ms\n", + "Execution time in system time: %llu ms\n", (unsigned long long) ((end_real - start_real) * 1000LL)); return 0; } - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Execution time in GNUnet time: %s\n", + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Execution time in GNUnet time: %s\n", GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_YES)); - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Execution time in system time: %llu ms\n", + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Execution time in system time: %llu ms\n", (unsigned long long) ((end_real - start_real) * 1000LL)); return 1; } 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[]) } b = GNUNET_STRINGS_to_utf8 ("TEST", 4, "ASCII"); WANT ("TEST", b); - + at = GNUNET_TIME_UNIT_FOREVER_ABS; bc = GNUNET_STRINGS_absolute_time_to_string (at); 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[]) char dst[128]; unsigned int i; int ret = 0; - + GNUNET_log_setup ("util", "DEBUG", NULL); for (i=0;ifacility_state) { case IOSTATE_READY: - { + { if (! ResetEvent (input_facility->overlapped.hEvent)) { return FALSE; @@ -906,9 +906,9 @@ attempt_read_tap (struct io_facility * input_facility, /* reset event manually*/ if (! SetEvent (input_facility->overlapped.hEvent)) return FALSE; - + fprintf (stderr, "DEBUG: tap read succeeded immediately\n"); - + /* we successfully read something from the TAP and now need to * send it our via STDOUT. Is that possible at the moment? */ if ((IOSTATE_READY == output_facility->facility_state || @@ -917,7 +917,7 @@ attempt_read_tap (struct io_facility * input_facility, { /* hand over this buffers content and apply message header for gnunet */ hdr = (struct GNUNET_MessageHeader *) output_facility->buffer; size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader); - + memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader), input_facility->buffer, input_facility->buffer_size); @@ -964,7 +964,7 @@ attempt_read_tap (struct io_facility * input_facility, return FALSE; fprintf (stderr, "DEBUG: tap read succeeded delayed\n"); - + /* we successfully read something from the TAP and now need to * send it our via STDOUT. Is that possible at the moment? */ if ((IOSTATE_READY == output_facility->facility_state || @@ -973,7 +973,7 @@ attempt_read_tap (struct io_facility * input_facility, { /* hand over this buffers content and apply message header for gnunet */ hdr = (struct GNUNET_MessageHeader *) output_facility->buffer; size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader); - + memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader), input_facility->buffer, input_facility->buffer_size); @@ -1026,26 +1026,26 @@ attempt_read_tap (struct io_facility * input_facility, /** * Attempts to read off an input facility (tap or named pipe) in overlapped mode. - * - * 1. + * + * 1. * If the input facility is in IOSTATE_READY, it will issue a new read operation to the - * input handle. Then it goes into IOSTATE_QUEUED state. + * input handle. Then it goes into IOSTATE_QUEUED state. * In case the read succeeded instantly the input facility enters 3. - * - * 2. + * + * 2. * If the input facility is in IOSTATE_QUEUED state, it will check if the queued read has finished already. * If it has finished, go to state 3. * If it has failed, set IOSTATE_FAILED - * + * * 3. * If the facility is finished with ready * The read-buffer is copied to the output buffer, except for the GNUNET_MessageHeader. * The input facility enters state IOSTATE_READY * The output facility enters state IOSTATE_READY * If the output facility is in state IOSTATE_QUEUED, the input facility enters IOSTATE_WAITING - * + * * IOSTATE_WAITING is reset by the output facility, once it has completed. - * + * * @param input_facility input named pipe or file to work with. * @param output_facility output pipe or file to hand over data to. * @return false if an event reset was impossible (OS error), else true @@ -1055,17 +1055,17 @@ attempt_read_stdin (struct io_facility * input_facility, struct io_facility * output_facility) { struct GNUNET_MessageHeader * hdr; - + switch (input_facility->facility_state) { case IOSTATE_READY: { input_facility->buffer_size = 0; - + partial_read_iostate_ready: if (! ResetEvent (input_facility->overlapped.hEvent)) return FALSE; - + /* Check how the task is handled */ if (ReadFile (input_facility->handle, input_facility->buffer + input_facility->buffer_size, @@ -1113,7 +1113,7 @@ partial_read_iostate_ready: input_facility->facility_state = IOSTATE_WAITING; else /* we read nothing */ input_facility->facility_state = IOSTATE_READY; - } + } else /* operation was either queued or failed*/ { int err = GetLastError (); @@ -1141,13 +1141,13 @@ partial_read_iostate_ready: FALSE)) {/* successful return for a queued operation */ hdr = (struct GNUNET_MessageHeader *) input_facility->buffer; - + if (! ResetEvent (input_facility->overlapped.hEvent)) return FALSE; - + fprintf (stderr, "DEBUG: stdin read succeeded delayed\n"); input_facility->buffer_size += input_facility->buffer_size_processed; - + if ((ntohs (hdr->type) != GNUNET_MESSAGE_TYPE_VPN_HELPER) || (ntohs (hdr->size) > sizeof (input_facility->buffer))) { @@ -1209,7 +1209,7 @@ partial_read_iostate_ready: * Attempts to write to an output facility (tap or named pipe) in overlapped mode. * * TODO: high level description - * + * * @param output_facility output pipe or file to hand over data to. * @param input_facility input named pipe or file to work with. * @return false if an event reset was impossible (OS error), else true @@ -1222,7 +1222,7 @@ attempt_write (struct io_facility * output_facility, { case IOSTATE_READY: output_facility->buffer_size_written = 0; - + continue_partial_write: if (! ResetEvent (output_facility->overlapped.hEvent)) return FALSE; @@ -1237,7 +1237,7 @@ continue_partial_write: fprintf (stderr, "DEBUG: write succeeded immediately\n"); output_facility->buffer_size_written += output_facility->buffer_size_processed; - + /* reset event manually*/ if (! SetEvent (output_facility->overlapped.hEvent)) return FALSE; @@ -1245,7 +1245,7 @@ continue_partial_write: /* partial write */ if (output_facility->buffer_size_written < output_facility->buffer_size) goto continue_partial_write; - + /* we are now waiting for our buffer to be filled*/ output_facility->facility_state = IOSTATE_WAITING; @@ -1272,7 +1272,7 @@ continue_partial_write: return TRUE; case IOSTATE_QUEUED: // there was an operation going on already, check if that has completed now. - + if (GetOverlappedResult (output_facility->handle, &output_facility->overlapped, &output_facility->buffer_size_processed, @@ -1280,17 +1280,17 @@ continue_partial_write: {/* successful return for a queued operation */ if (! ResetEvent (output_facility->overlapped.hEvent)) return FALSE; - + fprintf (stderr, "DEBUG: write succeeded delayed\n"); output_facility->buffer_size_written += output_facility->buffer_size_processed; - + /* partial write */ if (output_facility->buffer_size_written < output_facility->buffer_size) goto continue_partial_write; - + /* we are now waiting for our buffer to be filled*/ output_facility->facility_state = IOSTATE_WAITING; - + /* we successfully wrote something and now need to reset our reader */ if (IOSTATE_WAITING == input_facility->facility_state) input_facility->facility_state = IOSTATE_RESUME; @@ -1307,7 +1307,7 @@ continue_partial_write: fprintf (stderr, "FATAL: Write to handle failed, exiting\n"); } } - default: + default: return TRUE; } } @@ -1315,7 +1315,7 @@ continue_partial_write: /** * Initialize a overlapped structure - * + * * @param elem the element to initilize * @param initial_state the initial state for this instance * @param signaled if the hEvent created should default to signaled or not @@ -1361,7 +1361,7 @@ run (HANDLE tap_handle) /* tun up: */ /* we do this HERE and not beforehand (in init_tun()), in contrast to openvpn * to remove the need to flush the arp cache, handle DHCP and wrong IPs. - * + * * DHCP and such are all features we will never use in gnunet afaik. * But for openvpn those are essential. */ @@ -1383,12 +1383,12 @@ run (HANDLE tap_handle) /* Debug output to console STDIN/STDOUT*/ std_in.handle = parent_std_in_handle; std_out.handle = parent_std_out_handle; - + #else fprintf (stderr, "DEBUG: reopening stdin/out for overlapped IO\n"); - /* - * Find out the types of our handles. - * This part is a problem, because in windows we need to handle files, + /* + * Find out the types of our handles. + * This part is a problem, because in windows we need to handle files, * pipes and the console differently. */ if ((FILE_TYPE_PIPE != GetFileType (parent_std_in_handle)) || @@ -1472,16 +1472,16 @@ main (int argc, char **argv) int global_ret = 0; BOOL have_ip4 = FALSE; BOOL have_ip6 = FALSE; - + if (argc > 1 && 0 != strcmp (argv[1], "-d")){ privilege_testing = TRUE; - fprintf (stderr, + fprintf (stderr, "%s", "DEBUG: Running binary in privilege testing mode."); argv++; argc--; } - + if (6 != argc) { fprintf (stderr, @@ -1493,9 +1493,9 @@ main (int argc, char **argv) strncpy (hwid, argv[1], LINE_LEN); hwid[LINE_LEN - 1] = '\0'; - /* - * We use our PID for finding/resolving the control-panel name of our virtual - * device. PIDs are (of course) unique at runtime, thus we can safely use it + /* + * We use our PID for finding/resolving the control-panel name of our virtual + * device. PIDs are (of course) unique at runtime, thus we can safely use it * as additional hardware-id for our device. */ 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) set_address4 (dev, address, mask); } - + uid_t uid = getuid (); #ifdef HAVE_SETRESUID 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 @@ * @file vpn/gnunet-service-vpn.c * @brief service that opens a virtual interface and allows its clients * to allocate IPs on the virtual interface and to then redirect - * IP traffic received on those IPs via the GNUnet mesh + * IP traffic received on those IPs via the GNUnet mesh * @author Philipp Toelke * @author Christian Grothoff * @@ -150,14 +150,14 @@ struct DestinationEntry } service_destination; - struct + struct { - + /** * Address family used (AF_INET or AF_INET6). */ int af; - + /** * IP address of the ultimate destination (only used for exit tunnels). */ @@ -177,7 +177,7 @@ struct DestinationEntry } exit_destination; } details; - + }; @@ -195,7 +195,7 @@ struct TunnelMessageQueueEntry * This is a doubly-linked list. */ struct TunnelMessageQueueEntry *prev; - + /** * Number of bytes in 'msg'. */ @@ -244,7 +244,7 @@ struct TunnelState /** * Tail of list of messages scheduled for transmission. */ - struct TunnelMessageQueueEntry *tmq_tail; + struct TunnelMessageQueueEntry *tmq_tail; /** * Destination entry that has a pointer to this tunnel state; @@ -284,7 +284,7 @@ struct TunnelState * Address if af is AF_INET. */ struct in_addr v4; - + /** * Address if af is AF_INET6. */ @@ -302,7 +302,7 @@ struct TunnelState * Address if af is AF_INET. */ struct in_addr v4; - + /** * Address if af is AF_INET6. */ @@ -506,7 +506,7 @@ send_client_reply (struct GNUNET_SERVER_Client *client, switch (result_af) { case AF_INET: - rlen = sizeof (struct in_addr); + rlen = sizeof (struct in_addr); break; case AF_INET6: rlen = sizeof (struct in6_addr); @@ -632,8 +632,8 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf) ret = tnq->len; GNUNET_free (tnq); if (NULL != (tnq = ts->tmq_head)) - ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, - GNUNET_NO /* cork */, + ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, + GNUNET_NO /* cork */, GNUNET_TIME_UNIT_FOREVER_REL, tnq->len, &send_to_peer_notify_callback, @@ -678,12 +678,12 @@ send_to_tunnel (struct TunnelMessageQueueEntry *tnq, ts->th = NULL; GNUNET_STATISTICS_update (stats, gettext_noop ("# Bytes dropped in mesh queue (overflow)"), - dq->len, + dq->len, GNUNET_NO); GNUNET_free (dq); } if (NULL == ts->th) - ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, + ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, GNUNET_NO /* cork */, GNUNET_TIME_UNIT_FOREVER_REL, tnq->len, @@ -803,7 +803,7 @@ create_tunnel_to_destination (struct DestinationTunnel *dt, char address[GNUNET_TUN_IPV4_REGEXLEN]; GNUNET_TUN_ipv4toregexsearch (&dt->destination->details.exit_destination.ip.v4, - "255.255.255.255", + "255.255.255.255", address); GNUNET_asprintf (&policy, "%s%s%s:%u", GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, @@ -815,7 +815,7 @@ create_tunnel_to_destination (struct DestinationTunnel *dt, case AF_INET6: { char address[GNUNET_TUN_IPV6_REGEXLEN]; - + GNUNET_TUN_ipv6toregexsearch (&dt->destination->details.exit_destination.ip.v6, 128, address); GNUNET_asprintf (&policy, "%s%s%s:%u", @@ -862,7 +862,7 @@ expire_tunnel (struct TunnelState *except) /** - * Route a packet via mesh to the given destination. + * Route a packet via mesh to the given destination. * * @param destination description of the destination * @param af address family on this end (AF_INET or AF_INET6) @@ -930,7 +930,7 @@ route_packet (struct DestinationEntry *destination, /* blame kernel? */ GNUNET_break (0); return; - } + } udp = NULL; /* make compiler happy */ icmp = NULL; /* make compiler happy */ tcp = payload; @@ -950,8 +950,8 @@ route_packet (struct DestinationEntry *destination, &key); } break; - case IPPROTO_ICMP: - case IPPROTO_ICMPV6: + case IPPROTO_ICMP: + case IPPROTO_ICMPV6: { if ( (AF_INET == af) ^ (protocol == IPPROTO_ICMP) ) { @@ -986,7 +986,7 @@ route_packet (struct DestinationEntry *destination, } alen = 0; if (! destination->is_service) - { + { switch (destination->details.exit_destination.af) { case AF_INET: @@ -1003,7 +1003,7 @@ route_packet (struct DestinationEntry *destination, char sbuf[INET6_ADDRSTRLEN]; char dbuf[INET6_ADDRSTRLEN]; char xbuf[INET6_ADDRSTRLEN]; - + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Routing %s packet from %s:%u -> %s:%u to destination %s:%u\n", (protocol == IPPROTO_TCP) ? "TCP" : "UDP", @@ -1025,7 +1025,7 @@ route_packet (struct DestinationEntry *destination, { char sbuf[INET6_ADDRSTRLEN]; char dbuf[INET6_ADDRSTRLEN]; - + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Routing %s packet from %s:%u -> %s:%u to service %s at peer %s\n", (protocol == IPPROTO_TCP) ? "TCP" : "UDP", @@ -1066,7 +1066,7 @@ route_packet (struct DestinationEntry *destination, ts->destination_container = NULL; /* no longer 'contained' */ /* now bind existing "unbound" tunnel to our IP/port tuple */ ts->protocol = protocol; - ts->af = af; + ts->af = af; if (AF_INET == af) { ts->source_ip.v4 = * (const struct in_addr *) source_ip; @@ -1086,7 +1086,7 @@ route_packet (struct DestinationEntry *destination, GNUNET_CONTAINER_multihashmap_put (tunnel_map, &key, ts, - GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); + GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); GNUNET_STATISTICS_update (stats, gettext_noop ("# Active tunnels"), 1, GNUNET_NO); @@ -1096,12 +1096,12 @@ route_packet (struct DestinationEntry *destination, else { is_new = GNUNET_NO; - GNUNET_CONTAINER_heap_update_cost (tunnel_heap, + GNUNET_CONTAINER_heap_update_cost (tunnel_heap, ts->heap_node, GNUNET_TIME_absolute_get ().abs_value_us); } GNUNET_assert (NULL != ts->tunnel); - + /* send via tunnel */ switch (protocol) { @@ -1110,7 +1110,7 @@ route_packet (struct DestinationEntry *destination, { struct GNUNET_EXIT_UdpServiceMessage *usm; - mlen = sizeof (struct GNUNET_EXIT_UdpServiceMessage) + + mlen = sizeof (struct GNUNET_EXIT_UdpServiceMessage) + payload_length - sizeof (struct GNUNET_TUN_UdpHeader); if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) { @@ -1139,7 +1139,7 @@ route_packet (struct DestinationEntry *destination, struct in6_addr *ip6dst; void *payload; - mlen = sizeof (struct GNUNET_EXIT_UdpInternetMessage) + + mlen = sizeof (struct GNUNET_EXIT_UdpInternetMessage) + alen + payload_length - sizeof (struct GNUNET_TUN_UdpHeader); if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) { @@ -1151,7 +1151,7 @@ route_packet (struct DestinationEntry *destination, tnq->msg = &tnq[1]; uim = (struct GNUNET_EXIT_UdpInternetMessage *) &tnq[1]; uim->header.size = htons ((uint16_t) mlen); - uim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET); + uim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET); uim->af = htonl (destination->details.exit_destination.af); uim->source_port = (ntohs (udp->source_port) < 32000) ? udp->source_port : 0; uim->destination_port = udp->destination_port; @@ -1182,7 +1182,7 @@ route_packet (struct DestinationEntry *destination, { struct GNUNET_EXIT_TcpServiceStartMessage *tsm; - mlen = sizeof (struct GNUNET_EXIT_TcpServiceStartMessage) + + mlen = sizeof (struct GNUNET_EXIT_TcpServiceStartMessage) + payload_length - sizeof (struct GNUNET_TUN_TcpHeader); if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) { @@ -1209,7 +1209,7 @@ route_packet (struct DestinationEntry *destination, struct in6_addr *ip6dst; void *payload; - mlen = sizeof (struct GNUNET_EXIT_TcpInternetStartMessage) + + mlen = sizeof (struct GNUNET_EXIT_TcpInternetStartMessage) + alen + payload_length - sizeof (struct GNUNET_TUN_TcpHeader); if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) { @@ -1248,7 +1248,7 @@ route_packet (struct DestinationEntry *destination, { struct GNUNET_EXIT_TcpDataMessage *tdm; - mlen = sizeof (struct GNUNET_EXIT_TcpDataMessage) + + mlen = sizeof (struct GNUNET_EXIT_TcpDataMessage) + payload_length - sizeof (struct GNUNET_TUN_TcpHeader); if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) { @@ -1274,7 +1274,7 @@ route_packet (struct DestinationEntry *destination, { struct GNUNET_EXIT_IcmpServiceMessage *ism; - mlen = sizeof (struct GNUNET_EXIT_IcmpServiceMessage) + + mlen = sizeof (struct GNUNET_EXIT_IcmpServiceMessage) + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) { @@ -1303,7 +1303,7 @@ route_packet (struct DestinationEntry *destination, case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH: case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED: /* throw away ICMP payload, won't be useful for the other side anyway */ - payload_length = sizeof (struct GNUNET_TUN_IcmpHeader); + payload_length = sizeof (struct GNUNET_TUN_IcmpHeader); break; default: GNUNET_STATISTICS_update (stats, @@ -1321,7 +1321,7 @@ route_packet (struct DestinationEntry *destination, case GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED: case GNUNET_TUN_ICMPTYPE6_PARAMETER_PROBLEM: /* throw away ICMP payload, won't be useful for the other side anyway */ - payload_length = sizeof (struct GNUNET_TUN_IcmpHeader); + payload_length = sizeof (struct GNUNET_TUN_IcmpHeader); break; case GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST: case GNUNET_TUN_ICMPTYPE6_ECHO_REPLY: @@ -1340,8 +1340,8 @@ route_packet (struct DestinationEntry *destination, } /* update length calculations, as payload_length may have changed */ - mlen = sizeof (struct GNUNET_EXIT_IcmpServiceMessage) + - alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); + mlen = sizeof (struct GNUNET_EXIT_IcmpServiceMessage) + + alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); tnq->len = mlen; ism->header.size = htons ((uint16_t) mlen); /* finally, copy payload (if there is any left...) */ @@ -1356,7 +1356,7 @@ route_packet (struct DestinationEntry *destination, struct in6_addr *ip6dst; void *payload; - mlen = sizeof (struct GNUNET_EXIT_IcmpInternetMessage) + + mlen = sizeof (struct GNUNET_EXIT_IcmpInternetMessage) + alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) { @@ -1366,7 +1366,7 @@ route_packet (struct DestinationEntry *destination, tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueueEntry) + mlen); tnq->msg = &tnq[1]; iim = (struct GNUNET_EXIT_IcmpInternetMessage *) &tnq[1]; - iim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_INTERNET); + iim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_INTERNET); iim->icmp_header = *icmp; /* Perform ICMP protocol-translation (depending on destination AF and source AF) and throw away ICMP payload depending on ICMP message type */ @@ -1375,11 +1375,11 @@ route_packet (struct DestinationEntry *destination, case AF_INET: switch (icmp->type) { - case GNUNET_TUN_ICMPTYPE_ECHO_REPLY: + case GNUNET_TUN_ICMPTYPE_ECHO_REPLY: if (destination->details.exit_destination.af == AF_INET6) iim->icmp_header.type = GNUNET_TUN_ICMPTYPE6_ECHO_REPLY; break; - case GNUNET_TUN_ICMPTYPE_ECHO_REQUEST: + case GNUNET_TUN_ICMPTYPE_ECHO_REQUEST: if (destination->details.exit_destination.af == AF_INET6) iim->icmp_header.type = GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST; break; @@ -1411,7 +1411,7 @@ route_packet (struct DestinationEntry *destination, GNUNET_STATISTICS_update (stats, gettext_noop ("# ICMPv4 packets dropped (type not allowed)"), 1, GNUNET_NO); - GNUNET_free (tnq); + GNUNET_free (tnq); return; } /* end of AF_INET */ @@ -1467,17 +1467,17 @@ route_packet (struct DestinationEntry *destination, GNUNET_STATISTICS_update (stats, gettext_noop ("# ICMPv6 packets dropped (type not allowed)"), 1, GNUNET_NO); - GNUNET_free (tnq); + GNUNET_free (tnq); return; } /* end of AF_INET6 */ break; default: GNUNET_assert (0); - } + } /* update length calculations, as payload_length may have changed */ - mlen = sizeof (struct GNUNET_EXIT_IcmpInternetMessage) + - alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); + mlen = sizeof (struct GNUNET_EXIT_IcmpInternetMessage) + + alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); tnq->len = mlen; iim->header.size = htons ((uint16_t) mlen); @@ -1549,7 +1549,7 @@ message_token (void *cls, case ETH_P_IPV6: { const struct GNUNET_TUN_IPv6Header *pkt6; - + if (mlen < sizeof (struct GNUNET_TUN_IPv6Header)) { /* blame kernel */ @@ -1576,8 +1576,8 @@ message_token (void *cls, route_packet (de, AF_INET6, pkt6->next_header, - &pkt6->source_address, - &pkt6->destination_address, + &pkt6->source_address, + &pkt6->destination_address, &pkt6[1], mlen - sizeof (struct GNUNET_TUN_IPv6Header)); } @@ -1612,14 +1612,14 @@ message_token (void *cls, if (pkt4->header_length * 4 != sizeof (struct GNUNET_TUN_IPv4Header)) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _("Received IPv4 packet with options (dropping it)\n")); + _("Received IPv4 packet with options (dropping it)\n")); return GNUNET_OK; } route_packet (de, AF_INET, pkt4->protocol, - &pkt4->source_address, - &pkt4->destination_address, + &pkt4->source_address, + &pkt4->destination_address, &pkt4[1], mlen - sizeof (struct GNUNET_TUN_IPv4Header)); } @@ -1696,7 +1696,7 @@ make_up_icmpv6_payload (struct TunnelState *ts, * @param message the actual message * @return #GNUNET_OK to keep the connection open, * #GNUNET_SYSERR to close it (signal serious error) - */ + */ static int receive_icmp_back (void *cls, struct GNUNET_MESH_Tunnel *tunnel, @@ -1731,7 +1731,7 @@ receive_icmp_back (void *cls, { char sbuf[INET6_ADDRSTRLEN]; char dbuf[INET6_ADDRSTRLEN]; - + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ICMP packet from mesh, sending %u bytes from %s -> %s via TUN\n", (unsigned int) mlen, @@ -1742,8 +1742,8 @@ receive_icmp_back (void *cls, { case AF_INET: { - size_t size = sizeof (struct GNUNET_TUN_IPv4Header) - + sizeof (struct GNUNET_TUN_IcmpHeader) + size_t size = sizeof (struct GNUNET_TUN_IPv4Header) + + sizeof (struct GNUNET_TUN_IcmpHeader) + sizeof (struct GNUNET_MessageHeader) + sizeof (struct GNUNET_TUN_Layer2PacketHeader) + mlen; @@ -1767,12 +1767,12 @@ receive_icmp_back (void *cls, memcpy (&icmp[1], &i2v[1], mlen); - /* For some ICMP types, we need to adjust (make up) the payload here. - Also, depending on the AF used on the other side, we have to + /* For some ICMP types, we need to adjust (make up) the payload here. + Also, depending on the AF used on the other side, we have to do ICMP PT (translate ICMP types) */ switch (ntohl (i2v->af)) { - case AF_INET: + case AF_INET: switch (icmp->type) { case GNUNET_TUN_ICMPTYPE_ECHO_REPLY: @@ -1780,11 +1780,11 @@ receive_icmp_back (void *cls, break; case GNUNET_TUN_ICMPTYPE_DESTINATION_UNREACHABLE: case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH: - case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED: + case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED: { struct GNUNET_TUN_IPv4Header *ipp = (struct GNUNET_TUN_IPv4Header *) &icmp[1]; struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; - + if (mlen != 0) { /* sender did not strip ICMP payload? */ @@ -1814,7 +1814,7 @@ receive_icmp_back (void *cls, { struct GNUNET_TUN_IPv4Header *ipp = (struct GNUNET_TUN_IPv4Header *) &icmp[1]; struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; - + if (mlen != 0) { /* sender did not strip ICMP payload? */ @@ -1831,7 +1831,7 @@ receive_icmp_back (void *cls, { struct GNUNET_TUN_IPv4Header *ipp = (struct GNUNET_TUN_IPv4Header *) &icmp[1]; struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; - + if (mlen != 0) { /* sender did not strip ICMP payload? */ @@ -1881,8 +1881,8 @@ receive_icmp_back (void *cls, break; case AF_INET6: { - size_t size = sizeof (struct GNUNET_TUN_IPv6Header) - + sizeof (struct GNUNET_TUN_IcmpHeader) + size_t size = sizeof (struct GNUNET_TUN_IPv6Header) + + sizeof (struct GNUNET_TUN_IcmpHeader) + sizeof (struct GNUNET_MessageHeader) + sizeof (struct GNUNET_TUN_Layer2PacketHeader) + mlen; @@ -1905,12 +1905,12 @@ receive_icmp_back (void *cls, &i2v[1], mlen); - /* For some ICMP types, we need to adjust (make up) the payload here. - Also, depending on the AF used on the other side, we have to + /* For some ICMP types, we need to adjust (make up) the payload here. + Also, depending on the AF used on the other side, we have to do ICMP PT (translate ICMP types) */ switch (ntohl (i2v->af)) { - case AF_INET: + case AF_INET: /* ICMP PT 4-to-6 and possibly making up payloads */ switch (icmp->type) { @@ -1925,7 +1925,7 @@ receive_icmp_back (void *cls, { struct GNUNET_TUN_IPv6Header *ipp = (struct GNUNET_TUN_IPv6Header *) &icmp[1]; struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; - + if (mlen != 0) { /* sender did not strip ICMP payload? */ @@ -1937,12 +1937,12 @@ receive_icmp_back (void *cls, make_up_icmpv6_payload (ts, ipp, udp); } break; - case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED: + case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED: icmp->type = GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED; { struct GNUNET_TUN_IPv6Header *ipp = (struct GNUNET_TUN_IPv6Header *) &icmp[1]; struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; - + if (mlen != 0) { /* sender did not strip ICMP payload? */ @@ -1957,7 +1957,7 @@ receive_icmp_back (void *cls, case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH: GNUNET_STATISTICS_update (stats, gettext_noop ("# ICMPv4 packets dropped (impossible PT to v6)"), - 1, GNUNET_NO); + 1, GNUNET_NO); return GNUNET_OK; default: GNUNET_break_op (0); @@ -1978,7 +1978,7 @@ receive_icmp_back (void *cls, { struct GNUNET_TUN_IPv6Header *ipp = (struct GNUNET_TUN_IPv6Header *) &icmp[1]; struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; - + if (mlen != 0) { /* sender did not strip ICMP payload? */ @@ -2018,7 +2018,7 @@ receive_icmp_back (void *cls, default: GNUNET_assert (0); } - GNUNET_CONTAINER_heap_update_cost (tunnel_heap, + GNUNET_CONTAINER_heap_update_cost (tunnel_heap, ts->heap_node, GNUNET_TIME_absolute_get ().abs_value_us); return GNUNET_OK; @@ -2035,7 +2035,7 @@ receive_icmp_back (void *cls, * @param message the actual message * @return #GNUNET_OK to keep the connection open, * #GNUNET_SYSERR to close it (signal serious error) - */ + */ static int receive_udp_back (void *cls, struct GNUNET_MESH_Tunnel *tunnel, @@ -2070,7 +2070,7 @@ receive_udp_back (void *cls, { char sbuf[INET6_ADDRSTRLEN]; char dbuf[INET6_ADDRSTRLEN]; - + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received UDP reply from mesh, sending %u bytes from %s:%u -> %s:%u via TUN\n", (unsigned int) mlen, @@ -2083,8 +2083,8 @@ receive_udp_back (void *cls, { case AF_INET: { - size_t size = sizeof (struct GNUNET_TUN_IPv4Header) - + sizeof (struct GNUNET_TUN_UdpHeader) + size_t size = sizeof (struct GNUNET_TUN_IPv4Header) + + sizeof (struct GNUNET_TUN_UdpHeader) + sizeof (struct GNUNET_MessageHeader) + sizeof (struct GNUNET_TUN_Layer2PacketHeader) + mlen; @@ -2128,8 +2128,8 @@ receive_udp_back (void *cls, break; case AF_INET6: { - size_t size = sizeof (struct GNUNET_TUN_IPv6Header) - + sizeof (struct GNUNET_TUN_UdpHeader) + size_t size = sizeof (struct GNUNET_TUN_IPv6Header) + + sizeof (struct GNUNET_TUN_UdpHeader) + sizeof (struct GNUNET_MessageHeader) + sizeof (struct GNUNET_TUN_Layer2PacketHeader) + mlen; @@ -2173,7 +2173,7 @@ receive_udp_back (void *cls, default: GNUNET_assert (0); } - GNUNET_CONTAINER_heap_update_cost (tunnel_heap, + GNUNET_CONTAINER_heap_update_cost (tunnel_heap, ts->heap_node, GNUNET_TIME_absolute_get ().abs_value_us); return GNUNET_OK; @@ -2190,7 +2190,7 @@ receive_udp_back (void *cls, * @param message the actual message * @return #GNUNET_OK to keep the connection open, * #GNUNET_SYSERR to close it (signal serious error) - */ + */ static int receive_tcp_back (void *cls, struct GNUNET_MESH_Tunnel *tunnel, @@ -2220,7 +2220,7 @@ receive_tcp_back (void *cls, { char sbuf[INET6_ADDRSTRLEN]; char dbuf[INET6_ADDRSTRLEN]; - + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received TCP reply from mesh, sending %u bytes from %s:%u -> %s:%u via TUN\n", (unsigned int) mlen, @@ -2238,8 +2238,8 @@ receive_tcp_back (void *cls, { case AF_INET: { - size_t size = sizeof (struct GNUNET_TUN_IPv4Header) - + sizeof (struct GNUNET_TUN_TcpHeader) + size_t size = sizeof (struct GNUNET_TUN_IPv4Header) + + sizeof (struct GNUNET_TUN_TcpHeader) + sizeof (struct GNUNET_MessageHeader) + sizeof (struct GNUNET_TUN_Layer2PacketHeader) + mlen; @@ -2277,8 +2277,8 @@ receive_tcp_back (void *cls, break; case AF_INET6: { - size_t size = sizeof (struct GNUNET_TUN_IPv6Header) - + sizeof (struct GNUNET_TUN_TcpHeader) + size_t size = sizeof (struct GNUNET_TUN_IPv6Header) + + sizeof (struct GNUNET_TUN_TcpHeader) + sizeof (struct GNUNET_MessageHeader) + sizeof (struct GNUNET_TUN_Layer2PacketHeader) + mlen; @@ -2315,7 +2315,7 @@ receive_tcp_back (void *cls, } break; } - GNUNET_CONTAINER_heap_update_cost (tunnel_heap, + GNUNET_CONTAINER_heap_update_cost (tunnel_heap, ts->heap_node, GNUNET_TIME_absolute_get ().abs_value_us); return GNUNET_OK; @@ -2342,10 +2342,10 @@ allocate_v4_address (struct in_addr *v4) unsigned int tries; GNUNET_assert (1 == inet_pton (AF_INET, ipv4addr, &addr)); - GNUNET_assert (1 == inet_pton (AF_INET, ipv4mask, &mask)); - /* Given 192.168.0.1/255.255.0.0, we want a mask + GNUNET_assert (1 == inet_pton (AF_INET, ipv4mask, &mask)); + /* Given 192.168.0.1/255.255.0.0, we want a mask of '192.168.255.255', thus: */ - mask.s_addr = addr.s_addr | ~mask.s_addr; + mask.s_addr = addr.s_addr | ~mask.s_addr; tries = 0; do { @@ -2357,9 +2357,9 @@ allocate_v4_address (struct in_addr *v4) return GNUNET_SYSERR; } /* Pick random IPv4 address within the subnet, except 'addr' or 'mask' itself */ - rnd.s_addr = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, + rnd.s_addr = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX); - v4->s_addr = (addr.s_addr | rnd.s_addr) & mask.s_addr; + v4->s_addr = (addr.s_addr | rnd.s_addr) & mask.s_addr; get_destination_key_from_ip (AF_INET, v4, &key); @@ -2399,7 +2399,7 @@ allocate_v6_address (struct in6_addr *v6) mask = addr; for (i=127;i>=ipv6prefix;i--) mask.s6_addr[i / 8] |= (1 << (i % 8)); - + /* Pick random IPv6 address within the subnet, except 'addr' or 'mask' itself */ tries = 0; do @@ -2414,7 +2414,7 @@ allocate_v6_address (struct in6_addr *v6) } for (i=0;i<16;i++) { - rnd.s6_addr[i] = (unsigned char) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, + rnd.s6_addr[i] = (unsigned char) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256); v6->s6_addr[i] = (addr.s6_addr[i] | rnd.s6_addr[i]) & mask.s6_addr[i]; @@ -2466,7 +2466,7 @@ free_destination_entry (struct DestinationEntry *de) if (NULL != de->heap_node) { GNUNET_CONTAINER_heap_remove_node (de->heap_node); - de->heap_node = NULL; + de->heap_node = NULL; GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (destination_map, &de->key, @@ -2481,7 +2481,7 @@ free_destination_entry (struct DestinationEntry *de) * * @param except destination that must NOT be cleaned up, even if it is the oldest */ -static void +static void expire_destination (struct DestinationEntry *except) { struct DestinationEntry *de; @@ -2495,13 +2495,13 @@ expire_destination (struct DestinationEntry *except) /** - * Allocate an IP address for the response. + * Allocate an IP address for the response. * * @param result_af desired address family; set to the actual * address family; can initially be AF_UNSPEC if there * is no preference; will be set to AF_UNSPEC if the * allocation failed - * @param addr set to either v4 or v6 depending on which + * @param addr set to either v4 or v6 depending on which * storage location was used; set to NULL if allocation failed * @param v4 storage space for an IPv4 address * @param v6 storage space for an IPv6 address @@ -2550,7 +2550,7 @@ allocate_response_ip (int *result_af, return GNUNET_SYSERR; } return GNUNET_OK; -} +} /** @@ -2577,7 +2577,7 @@ service_redirect_to_ip (void *cls, void *addr; struct DestinationEntry *de; struct GNUNET_HashCode key; - + /* validate and parse request */ mlen = ntohs (message->size); if (mlen < sizeof (struct RedirectToIpRequestMessage)) @@ -2596,7 +2596,7 @@ service_redirect_to_ip (void *cls, { GNUNET_break (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); - return; + return; } break; case AF_INET6: @@ -2604,13 +2604,13 @@ service_redirect_to_ip (void *cls, { GNUNET_break (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); - return; + return; } break; default: GNUNET_break (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); - return; + return; } /* allocate response IP */ @@ -2620,13 +2620,13 @@ service_redirect_to_ip (void *cls, &v4, &v6)) { GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); - return; + return; } /* send reply with our IP address */ send_client_reply (client, msg->request_id, result_af, - addr); + addr); if (result_af == AF_UNSPEC) { /* failure, we're done */ @@ -2637,14 +2637,14 @@ service_redirect_to_ip (void *cls, { char sbuf[INET6_ADDRSTRLEN]; char dbuf[INET6_ADDRSTRLEN]; - + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Allocated address %s for redirection via exit to %s\n", inet_ntop (result_af, addr, sbuf, sizeof (sbuf)), inet_ntop (addr_af, &msg[1], dbuf, sizeof (dbuf))); } - + /* setup destination record */ de = GNUNET_new (struct DestinationEntry); de->is_service = GNUNET_NO; @@ -2683,7 +2683,7 @@ service_redirect_to_ip (void *cls, * @param message redirection request (a `struct RedirectToPeerRequestMessage`) */ static void -service_redirect_to_service (void *cls, +service_redirect_to_service (void *cls, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { @@ -2696,7 +2696,7 @@ service_redirect_to_service (void *cls, struct GNUNET_HashCode key; struct TunnelState *ts; struct DestinationTunnel *dt; - + /* parse request */ msg = (const struct RedirectToServiceRequestMessage *) message; @@ -2707,12 +2707,12 @@ service_redirect_to_service (void *cls, &v4, &v6)) { GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); - return; + return; } send_client_reply (client, msg->request_id, result_af, - addr); + addr); if (result_af == AF_UNSPEC) { /* failure, we're done */ @@ -2724,14 +2724,14 @@ service_redirect_to_service (void *cls, { char sbuf[INET6_ADDRSTRLEN]; - + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Allocated address %s for redirection to service %s on peer %s\n", inet_ntop (result_af, addr, sbuf, sizeof (sbuf)), GNUNET_h2s (&msg->service_descriptor), GNUNET_i2s (&msg->target)); } - + /* setup destination record */ de = GNUNET_new (struct DestinationEntry); de->is_service = GNUNET_YES; @@ -2778,15 +2778,15 @@ service_redirect_to_service (void *cls, /** * Function called whenever a tunnel is destroyed. Should clean up * any associated state. - * + * * @param cls closure (set from #GNUNET_MESH_connect) * @param tunnel connection to the other end (henceforth invalid) * @param tunnel_ctx place where local state associated * with the tunnel is stored (our `struct TunnelState`) - */ + */ static void -tunnel_cleaner (void *cls, - const struct GNUNET_MESH_Tunnel *tunnel, +tunnel_cleaner (void *cls, + const struct GNUNET_MESH_Tunnel *tunnel, void *tunnel_ctx) { struct TunnelState *ts = tunnel_ctx; @@ -2851,7 +2851,7 @@ cleanup (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "VPN is shutting down\n"); if (NULL != destination_map) - { + { GNUNET_CONTAINER_multihashmap_iterate (destination_map, &cleanup_destination, NULL); @@ -2864,7 +2864,7 @@ cleanup (void *cls, destination_heap = NULL; } if (NULL != tunnel_map) - { + { GNUNET_CONTAINER_multihashmap_iterate (tunnel_map, &cleanup_tunnel, NULL); @@ -2916,8 +2916,8 @@ run (void *cls, static const struct GNUNET_SERVER_MessageHandler service_handlers[] = { /* callback, cls, type, size */ { &service_redirect_to_ip, NULL, GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_IP, 0}, - { &service_redirect_to_service, NULL, - GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_SERVICE, + { &service_redirect_to_service, NULL, + GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_SERVICE, sizeof (struct RedirectToServiceRequestMessage) }, {NULL, NULL, 0, 0} }; @@ -2982,7 +2982,7 @@ run (void *cls, &ipv6addr) || (1 != inet_pton (AF_INET6, ipv6addr, &v6))) ) { - GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV6ADDR", + GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV6ADDR", _("Must specify valid IPv6 address")); GNUNET_SCHEDULER_shutdown (); return; @@ -3023,7 +3023,7 @@ run (void *cls, &ipv4addr) || (1 != inet_pton (AF_INET, ipv4addr, &v4))) ) { - GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV4ADDR", + GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV4ADDR", _("Must specify valid IPv4 address")); GNUNET_SCHEDULER_shutdown (); return; @@ -3051,9 +3051,9 @@ run (void *cls, vpn_argv[6] = NULL; mesh_handle = - GNUNET_MESH_connect (cfg_, NULL, - NULL, - &tunnel_cleaner, + GNUNET_MESH_connect (cfg_, NULL, + NULL, + &tunnel_cleaner, mesh_handlers, NULL); helper_handle = GNUNET_HELPER_start (GNUNET_NO, @@ -3076,7 +3076,7 @@ int main (int argc, char *const *argv) { return (GNUNET_OK == - GNUNET_SERVICE_run (argc, argv, "vpn", + GNUNET_SERVICE_run (argc, argv, "vpn", GNUNET_SERVICE_OPTION_NONE, &run, NULL)) ? global_ret : 1; } 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) * will match 'result_af' from the request * @param address IP address (struct in_addr or struct in_addr6, depending on 'af') * that the VPN allocated for the redirection; - * traffic to this IP will now be redirected to the + * traffic to this IP will now be redirected to the * specified target peer; NULL on error */ static void @@ -167,7 +167,7 @@ run (void *cls, char *const *args, const char *cfgfile, { int dst_af; int req_af; - struct GNUNET_PeerIdentity peer; + struct GNUNET_PeerIdentity peer; struct GNUNET_HashCode sd; const void *addr; struct in_addr v4; @@ -194,7 +194,7 @@ run (void *cls, char *const *args, const char *cfgfile, } if (ipv6) req_af = AF_INET6; - + if (NULL == target_ip) { if (NULL == service_name) @@ -233,7 +233,7 @@ run (void *cls, char *const *args, const char *cfgfile, FPRINTF (stderr, _("`%s' is not a valid peer identifier.\n"), peer_id); goto error; - } + } GNUNET_CRYPTO_hash (service_name, strlen (service_name), &sd); @@ -265,7 +265,7 @@ run (void *cls, char *const *args, const char *cfgfile, { dst_af = AF_INET6; addr = &v6; - } + } request = GNUNET_VPN_redirect_to_ip (handle, req_af, 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 * Always zero. */ uint32_t reserved GNUNET_PACKED; - + /** * How long should the redirection be maintained at most? */ @@ -69,7 +69,7 @@ struct RedirectToIpRequestMessage uint64_t request_id GNUNET_PACKED; /* followed by destination address ('struct in_addr' or 'struct in6_addr') */ - + }; @@ -89,7 +89,7 @@ struct RedirectToServiceRequestMessage * Always zero. */ uint32_t reserved GNUNET_PACKED; - + /** * How long should the redirection be maintained at most? */ @@ -99,7 +99,7 @@ struct RedirectToServiceRequestMessage * Desired protocol (IPPROTO_UDP or IPPROTO_TCP) */ int32_t protocol GNUNET_PACKED; - + /** * Address family desired for the result (AF_INET or AF_INET6 or AF_UNSPEC, in nbo) */ @@ -130,7 +130,7 @@ struct RedirectToServiceRequestMessage */ struct RedirectToIpResponseMessage { - + /** * Type is #GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP */ @@ -148,7 +148,7 @@ struct RedirectToIpResponseMessage uint64_t request_id GNUNET_PACKED; /* followed by destination address ('struct in_addr' or 'struct in6_addr') */ - + }; GNUNET_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 * Function to call with the designated IP address. */ GNUNET_VPN_AllocationCallback cb; - + /** * Closure for 'cb'. */ @@ -120,7 +120,7 @@ struct GNUNET_VPN_RedirectionRequest /** * For service redirection, service descriptor. */ - struct GNUNET_HashCode serv; + struct GNUNET_HashCode serv; /** * At what time should the created service mapping expire? @@ -141,7 +141,7 @@ struct GNUNET_VPN_RedirectionRequest * Address family of 'addr'. AF_INET or AF_INET6. */ int addr_af; - + /** * For service redirection, IPPROT_UDP or IPPROTO_TCP. */ @@ -165,7 +165,7 @@ reconnect (struct GNUNET_VPN_Handle *vh); * @param cls the 'struct GNUNET_VPN_Handle' * @param msg message received, NULL on timeout or fatal error */ -static void +static void receive_response (void *cls, const struct GNUNET_MessageHeader* msg) { @@ -176,7 +176,7 @@ receive_response (void *cls, size_t alen; int af; - if (NULL == msg) + if (NULL == msg) { reconnect (vh); return; @@ -212,10 +212,10 @@ receive_response (void *cls, GNUNET_break (0); reconnect (vh); return; - } + } GNUNET_CLIENT_receive (vh->client, &receive_response, vh, - GNUNET_TIME_UNIT_FOREVER_REL); + GNUNET_TIME_UNIT_FOREVER_REL); for (rr = vh->rr_head; NULL != rr; rr = rr->next) { if (rr->request_id == rm->request_id) @@ -260,9 +260,9 @@ transmit_request (void *cls, while ( (NULL != rr) && (0 != rr->request_id) ) rr = rr->next; - if (NULL == rr) + if (NULL == rr) return 0; - if (0 == size) + if (0 == size) { reconnect (vh); return 0; @@ -272,7 +272,7 @@ transmit_request (void *cls, if (0 == vh->request_id_gen) GNUNET_CLIENT_receive (vh->client, &receive_response, vh, - GNUNET_TIME_UNIT_FOREVER_REL); + GNUNET_TIME_UNIT_FOREVER_REL); if (NULL == rr->addr) { ret = sizeof (struct RedirectToServiceRequestMessage); @@ -285,7 +285,7 @@ transmit_request (void *cls, rs.result_af = htonl (rr->result_af); rs.target = rr->peer; rs.service_descriptor = rr->serv; - rs.request_id = rr->request_id = ++vh->request_id_gen; + rs.request_id = rr->request_id = ++vh->request_id_gen; memcpy (buf, &rs, sizeof (struct RedirectToServiceRequestMessage)); } else @@ -332,7 +332,7 @@ transmit_request (void *cls, /** * Add a request to our request queue and transmit it. - * + * * @param rr request to queue and transmit. */ static void @@ -366,12 +366,12 @@ connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_VPN_Handle *vh = cls; - + vh->rt = GNUNET_SCHEDULER_NO_TASK; vh->client = GNUNET_CLIENT_connect ("vpn", vh->cfg); GNUNET_assert (NULL != vh->client); GNUNET_assert (NULL == vh->th); - if (NULL != vh->rr_head) + if (NULL != vh->rr_head) vh->th = GNUNET_CLIENT_notify_transmit_ready (vh->client, sizeof (struct RedirectToServiceRequestMessage), GNUNET_TIME_UNIT_FOREVER_REL, @@ -395,7 +395,7 @@ reconnect (struct GNUNET_VPN_Handle *vh) { GNUNET_CLIENT_notify_transmit_ready_cancel (vh->th); vh->th = NULL; - } + } GNUNET_CLIENT_disconnect (vh->client); vh->client = NULL; vh->request_id_gen = 0; @@ -405,7 +405,7 @@ reconnect (struct GNUNET_VPN_Handle *vh) GNUNET_TIME_relative_min (GNUNET_TIME_relative_multiply (vh->backoff, 2), GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30))); vh->rt = GNUNET_SCHEDULER_add_delayed (vh->backoff, - &connect_task, + &connect_task, vh); } @@ -540,7 +540,7 @@ GNUNET_VPN_redirect_to_ip (struct GNUNET_VPN_Handle *vh, * Connect to the VPN service * * @param cfg configuration to use - * @return VPN handle + * @return VPN handle */ struct GNUNET_VPN_Handle * GNUNET_VPN_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) -- cgit v1.2.3