summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-11-29 20:47:18 +0000
committerChristian Grothoff <christian@grothoff.org>2011-11-29 20:47:18 +0000
commit71ea5bd2d05058008e604ffd42993be9c7250e04 (patch)
treea5074671ddfaa9d1621a4182fc95a91a98b3d536 /src
parentb335777fd435142c16eb05e86c8a64a4b1a45447 (diff)
-fixing indentation
Diffstat (limited to 'src')
-rw-r--r--src/ats/ats_api.c4
-rw-r--r--src/ats/ats_api_performance.c4
-rw-r--r--src/ats/ats_api_scheduling.c81
-rw-r--r--src/ats/gnunet-service-ats_addresses.c43
-rw-r--r--src/ats/gnunet-service-ats_addresses.h3
-rw-r--r--src/ats/gnunet-service-ats_scheduling.c23
-rw-r--r--src/ats/gnunet-service-ats_scheduling.h5
-rw-r--r--src/ats/test_ats_api_scheduling.c12
-rw-r--r--src/core/core_api.c4
-rw-r--r--src/core/gnunet-core-list-connections.c31
-rw-r--r--src/core/gnunet-service-core_clients.c26
-rw-r--r--src/core/gnunet-service-core_neighbours.c8
-rw-r--r--src/core/gnunet-service-core_sessions.c10
-rw-r--r--src/core/test_core_quota_compliance.c16
-rw-r--r--src/datastore/datastore_api.c3
-rw-r--r--src/dht/test_dht_multipeer.c2
-rw-r--r--src/dv/plugin_transport_dv.c15
-rw-r--r--src/dv/test_transport_api_dv.c17
-rw-r--r--src/fragmentation/fragmentation.c11
-rw-r--r--src/fs/fs_api.c2
-rw-r--r--src/fs/fs_search.c2
-rw-r--r--src/fs/gnunet-fs.c3
-rw-r--r--src/fs/gnunet-service-fs.c18
-rw-r--r--src/fs/gnunet-service-fs_lc.c54
-rw-r--r--src/fs/gnunet-service-fs_lc.h2
-rw-r--r--src/fs/gnunet-service-fs_pe.c48
-rw-r--r--src/fs/gnunet-service-fs_pr.c2
-rw-r--r--src/hello/address.c40
-rw-r--r--src/hello/hello.c28
-rw-r--r--src/hello/test_hello.c8
-rw-r--r--src/include/gnunet_ats_service.h17
-rw-r--r--src/include/gnunet_fs_service.h4
-rw-r--r--src/include/gnunet_hello_lib.h22
-rw-r--r--src/include/gnunet_os_lib.h10
-rw-r--r--src/include/gnunet_transport_service.h45
-rw-r--r--src/include/winproc.h20
-rw-r--r--src/mesh/gnunet-service-mesh.c44
-rw-r--r--src/mesh/mesh_tunnel_tree.c2
-rw-r--r--src/mesh/test_mesh_2dtorus.c58
-rw-r--r--src/mesh/test_mesh_small.c2
-rw-r--r--src/mesh/test_mesh_small_unicast_far.c2
-rw-r--r--src/mesh/test_mesh_tree_api.c39
-rw-r--r--src/nat/nat.c12
-rw-r--r--src/nat/test_nat.c9
-rw-r--r--src/nse/gnunet-nse-profiler.c2
-rw-r--r--src/nse/gnunet-service-nse.c41
-rw-r--r--src/nse/nse_api.c2
-rw-r--r--src/peerinfo-tool/gnunet-peerinfo.c17
-rw-r--r--src/peerinfo/gnunet-service-peerinfo.c7
-rwxr-xr-xsrc/peerinfo/perf_peerinfo_api.c6
-rw-r--r--src/peerinfo/test_peerinfo_api.c16
-rw-r--r--src/testing/test_testing_2dtorus.c57
-rw-r--r--src/testing/test_testing_large_topology.c2
-rw-r--r--src/testing/test_testing_topology.c4
-rw-r--r--src/testing/test_testing_topology_blacklist.c2
-rw-r--r--src/testing/testing.c23
-rw-r--r--src/testing/testing_group.c21
-rw-r--r--src/testing/testing_peergroup.c18
-rw-r--r--src/transport/gnunet-service-transport.c39
-rw-r--r--src/transport/gnunet-service-transport_blacklist.c2
-rw-r--r--src/transport/gnunet-service-transport_clients.c43
-rw-r--r--src/transport/gnunet-service-transport_hello.c15
-rw-r--r--src/transport/gnunet-service-transport_hello.h4
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c463
-rw-r--r--src/transport/gnunet-service-transport_neighbours.h19
-rw-r--r--src/transport/gnunet-service-transport_plugins.c17
-rw-r--r--src/transport/gnunet-service-transport_validation.c146
-rw-r--r--src/transport/gnunet-service-transport_validation.h18
-rw-r--r--src/transport/gnunet-transport-wlan-helper-dummy.c47
-rw-r--r--src/transport/gnunet-transport-wlan-helper.c1033
-rw-r--r--src/transport/gnunet-transport.c38
-rw-r--r--src/transport/plugin_transport_http.c41
-rw-r--r--src/transport/plugin_transport_http_server.c49
-rw-r--r--src/transport/plugin_transport_udp.c301
-rw-r--r--src/transport/plugin_transport_wlan.c23
-rw-r--r--src/transport/test_quota_compliance.c3
-rw-r--r--src/transport/test_transport_api_bidirectional_connect.c10
-rw-r--r--src/transport/test_transport_api_disconnect.c2
-rw-r--r--src/transport/test_transport_api_restart_1peer.c28
-rw-r--r--src/transport/test_transport_api_restart_2peers.c30
-rw-r--r--src/transport/test_transport_api_unreliability.c7
-rw-r--r--src/transport/transport-testing.c90
-rw-r--r--src/transport/transport-testing.h8
-rw-r--r--src/transport/transport.h2
-rw-r--r--src/transport/transport_api_address_lookup.c43
-rw-r--r--src/transport/transport_api_address_to_string.c22
-rw-r--r--src/util/common_logging.c209
-rw-r--r--src/util/crypto_random.c8
-rw-r--r--src/util/getopt.c4
-rw-r--r--src/util/os_network.c27
-rw-r--r--src/util/scheduler.c8
-rw-r--r--src/util/service.c12
-rw-r--r--src/util/strings.c4
-rw-r--r--src/util/test_bio.c2
-rw-r--r--src/util/test_common_logging_runtime_loglevels.c9
-rw-r--r--src/util/test_os_network.c7
-rw-r--r--src/vpn/gnunet-daemon-exit.c73
-rw-r--r--src/vpn/gnunet-daemon-vpn-dns.c6
-rw-r--r--src/vpn/gnunet-daemon-vpn-helper.c10
-rw-r--r--src/vpn/gnunet-daemon-vpn.c30
-rw-r--r--src/vpn/gnunet-service-dns.c73
101 files changed, 1959 insertions, 2095 deletions
diff --git a/src/ats/ats_api.c b/src/ats/ats_api.c
index 47daad6cf..7c0fb2d32 100644
--- a/src/ats/ats_api.c
+++ b/src/ats/ats_api.c
@@ -342,9 +342,9 @@ GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
atc->peers = GNUNET_CONTAINER_multihashmap_create (256);
atc->notify_map = GNUNET_CONTAINER_multihashmap_create (256);
GNUNET_CONFIGURATION_get_value_size (cfg, "ats", "WAN_QUOTA_OUT",
- &atc->total_bps_out);
+ &atc->total_bps_out);
GNUNET_CONFIGURATION_get_value_size (cfg, "ats", "WAN_QUOTA_IN",
- &atc->total_bps_in);
+ &atc->total_bps_in);
return atc;
}
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c
index 9739ac1e5..c9f9a0b38 100644
--- a/src/ats/ats_api_performance.c
+++ b/src/ats/ats_api_performance.c
@@ -307,8 +307,8 @@ process_pi_message (struct GNUNET_ATS_PerformanceHandle *ph,
address.address = plugin_address;
address.address_length = plugin_address_length;
address.transport_name = plugin_name;
- ph->infocb (ph->infocb_cls, &address,
- pi->bandwidth_out, pi->bandwidth_in, atsi, ats_count);
+ ph->infocb (ph->infocb_cls, &address, pi->bandwidth_out, pi->bandwidth_in,
+ atsi, ats_count);
return GNUNET_OK;
}
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c
index 89a3bb472..0658e362c 100644
--- a/src/ats/ats_api_scheduling.c
+++ b/src/ats/ats_api_scheduling.c
@@ -287,11 +287,8 @@ find_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id,
const struct GNUNET_PeerIdentity *peer)
{
#if DEBUG_ATS
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Find session %u from peer %s in %p\n",
- (unsigned int) session_id,
- GNUNET_i2s (peer),
- sh);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Find session %u from peer %s in %p\n",
+ (unsigned int) session_id, GNUNET_i2s (peer), sh);
#endif
if (session_id >= sh->session_array_size)
{
@@ -303,14 +300,14 @@ find_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id,
if (sh->session_array[session_id].session == NULL)
{
GNUNET_break (0 ==
- memcmp (peer, &sh->session_array[session_id].peer,
- sizeof (struct GNUNET_PeerIdentity)));
+ memcmp (peer, &sh->session_array[session_id].peer,
+ sizeof (struct GNUNET_PeerIdentity)));
return NULL;
}
if (0 !=
memcmp (peer, &sh->session_array[session_id].peer,
- sizeof (struct GNUNET_PeerIdentity)))
+ sizeof (struct GNUNET_PeerIdentity)))
{
GNUNET_break (0);
sh->reconnect = GNUNET_YES;
@@ -338,10 +335,8 @@ get_session_id (struct GNUNET_ATS_SchedulingHandle *sh, struct Session *session,
#if DEBUG_ATS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Get session ID for session %p from peer %s in %p\n",
- session,
- GNUNET_i2s (peer),
- sh);
+ "Get session ID for session %p from peer %s in %p\n", session,
+ GNUNET_i2s (peer), sh);
#endif
if (NULL == session)
return 0;
@@ -350,8 +345,9 @@ get_session_id (struct GNUNET_ATS_SchedulingHandle *sh, struct Session *session,
{
if (session == sh->session_array[i].session)
{
- GNUNET_assert (0 == memcmp (peer, &sh->session_array[i].peer,
- sizeof (struct GNUNET_PeerIdentity)));
+ GNUNET_assert (0 ==
+ memcmp (peer, &sh->session_array[i].peer,
+ sizeof (struct GNUNET_PeerIdentity)));
return i;
}
if ((f == 0) && (sh->session_array[i].slot_used == GNUNET_NO))
@@ -369,11 +365,8 @@ get_session_id (struct GNUNET_ATS_SchedulingHandle *sh, struct Session *session,
sh->session_array[f].slot_used = GNUNET_YES;
#if DEBUG_ATS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Assigning session ID %u for session %p of peer %s in %p\n",
- f,
- session,
- GNUNET_i2s (peer),
- sh);
+ "Assigning session ID %u for session %p of peer %s in %p\n", f,
+ session, GNUNET_i2s (peer), sh);
#endif
return f;
}
@@ -393,16 +386,15 @@ remove_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id,
{
#if DEBUG_ATS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Remove sessionID %u from peer %s in %p\n",
- (unsigned int) session_id,
- GNUNET_i2s (peer),
- sh);
+ "Remove sessionID %u from peer %s in %p\n",
+ (unsigned int) session_id, GNUNET_i2s (peer), sh);
#endif
if (0 == session_id)
return;
GNUNET_assert (session_id < sh->session_array_size);
GNUNET_assert (GNUNET_YES == sh->session_array[session_id].slot_used);
- GNUNET_assert (0 == memcmp (peer, &sh->session_array[session_id].peer,
+ GNUNET_assert (0 ==
+ memcmp (peer, &sh->session_array[session_id].peer,
sizeof (struct GNUNET_PeerIdentity)));
sh->session_array[session_id].session = NULL;
}
@@ -422,10 +414,8 @@ release_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id,
{
#if DEBUG_ATS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Release sessionID %u from peer %s in %p\n",
- (unsigned int) session_id,
- GNUNET_i2s (peer),
- sh);
+ "Release sessionID %u from peer %s in %p\n",
+ (unsigned int) session_id, GNUNET_i2s (peer), sh);
#endif
if (session_id >= sh->session_array_size)
{
@@ -437,7 +427,8 @@ release_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id,
/* this slot should have been removed from remove_session before */
GNUNET_assert (sh->session_array[session_id].session == NULL);
- if (0 != memcmp (peer, &sh->session_array[session_id].peer,
+ if (0 !=
+ memcmp (peer, &sh->session_array[session_id].peer,
sizeof (struct GNUNET_PeerIdentity)))
{
GNUNET_break (0);
@@ -477,7 +468,7 @@ process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg)
uint16_t plugin_name_length;
uint32_t ats_count;
struct GNUNET_HELLO_Address address;
- struct Session * s;
+ struct Session *s;
if (NULL == msg)
{
@@ -519,7 +510,7 @@ process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg)
force_reconnect (sh);
return;
}
- uint32_t session_id = ntohl (m->session_id);
+ uint32_t session_id = ntohl (m->session_id);
if (session_id == 0)
s = NULL;
@@ -529,9 +520,9 @@ process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg)
if (s == NULL)
{
#if DEBUG_ATS
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "ATS tries to use outdated session `%s'\n",
- GNUNET_i2s(&m->peer));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "ATS tries to use outdated session `%s'\n",
+ GNUNET_i2s (&m->peer));
#endif
GNUNET_CLIENT_receive (sh->client, &process_ats_message, sh,
GNUNET_TIME_UNIT_FOREVER_REL);
@@ -545,9 +536,10 @@ process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg)
if ((s == NULL) && (0 == address.address_length))
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
- "ATS returned invalid address for peer `%s' transport `%s' address length %i, session_id %i\n",
- GNUNET_i2s(&address.peer) , address.transport_name, plugin_address_length, session_id);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "ATS returned invalid address for peer `%s' transport `%s' address length %i, session_id %i\n",
+ GNUNET_i2s (&address.peer), address.transport_name,
+ plugin_address_length, session_id);
GNUNET_break_op (0);
GNUNET_CLIENT_receive (sh->client, &process_ats_message, sh,
GNUNET_TIME_UNIT_FOREVER_REL);
@@ -731,7 +723,9 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh,
size_t namelen;
size_t msize;
- namelen = (address->transport_name == NULL) ? 0 : strlen (address->transport_name) + 1;
+ namelen =
+ (address->transport_name ==
+ NULL) ? 0 : strlen (address->transport_name) + 1;
msize =
sizeof (struct AddressUpdateMessage) + address->address_length +
ats_count * sizeof (struct GNUNET_ATS_Information) + namelen;
@@ -778,8 +772,7 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh,
void
GNUNET_ATS_address_in_use (struct GNUNET_ATS_SchedulingHandle *sh,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
- int in_use)
+ struct Session *session, int in_use)
{
struct PendingMessage *p;
struct AddressUseMessage *m;
@@ -788,7 +781,9 @@ GNUNET_ATS_address_in_use (struct GNUNET_ATS_SchedulingHandle *sh,
size_t msize;
GNUNET_assert (NULL != address);
- namelen = (address->transport_name == NULL) ? 0 : strlen (address->transport_name) + 1;
+ namelen =
+ (address->transport_name ==
+ NULL) ? 0 : strlen (address->transport_name) + 1;
msize = sizeof (struct AddressUseMessage) + address->address_length + namelen;
if ((msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
(address->address_length >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
@@ -839,7 +834,9 @@ GNUNET_ATS_address_destroyed (struct GNUNET_ATS_SchedulingHandle *sh,
GNUNET_assert (address->transport_name != NULL);
namelen = strlen (address->transport_name) + 1;
GNUNET_assert (namelen > 1);
- msize = sizeof (struct AddressDestroyedMessage) + address->address_length + namelen;
+ msize =
+ sizeof (struct AddressDestroyedMessage) + address->address_length +
+ namelen;
if ((msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
(address->address_length >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
(namelen >= GNUNET_SERVER_MAX_MESSAGE_SIZE))
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c
index 04eacbbb1..e9f7539be 100644
--- a/src/ats/gnunet-service-ats_addresses.c
+++ b/src/ats/gnunet-service-ats_addresses.c
@@ -305,26 +305,22 @@ destroy_by_session_id (void *cls, const GNUNET_HashCode * key, void *value)
const struct ATS_Address *info = cls;
struct ATS_Address *aa = value;
- GNUNET_assert (0 == memcmp (&aa->peer,
- &info->peer,
- sizeof (struct GNUNET_PeerIdentity)));
- if ( (info->session_id == 0) &&
- (0 == strcmp (info->plugin,
- aa->plugin)) &&
- (aa->addr_len == info->addr_len) &&
- (0 == memcmp (info->addr,
- aa->addr,
- aa->addr_len)) )
+ GNUNET_assert (0 ==
+ memcmp (&aa->peer, &info->peer,
+ sizeof (struct GNUNET_PeerIdentity)));
+ if ((info->session_id == 0) && (0 == strcmp (info->plugin, aa->plugin)) &&
+ (aa->addr_len == info->addr_len) &&
+ (0 == memcmp (info->addr, aa->addr, aa->addr_len)))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Deleting address for peer `%s': `%s'\n",
- GNUNET_i2s (&aa->peer), aa->plugin);
+ "Deleting address for peer `%s': `%s'\n",
+ GNUNET_i2s (&aa->peer), aa->plugin);
if (GNUNET_YES == destroy_address (aa))
recalculate_assigned_bw ();
return GNUNET_OK;
}
if (aa->session_id != info->session_id)
- return GNUNET_OK; /* irrelevant */
+ return GNUNET_OK; /* irrelevant */
if (aa->session_id != 0)
GNUNET_break (0 == strcmp (info->plugin, aa->plugin));
/* session died */
@@ -358,10 +354,8 @@ GAS_addresses_destroy (const struct GNUNET_PeerIdentity *peer,
aa.addr = plugin_addr;
aa.plugin = (char *) plugin_name;
aa.session_id = session_id;
- GNUNET_CONTAINER_multihashmap_get_multiple (addresses,
- &peer->hashPubKey,
- &destroy_by_session_id,
- &aa);
+ GNUNET_CONTAINER_multihashmap_get_multiple (addresses, &peer->hashPubKey,
+ &destroy_by_session_id, &aa);
}
@@ -414,12 +408,11 @@ find_address_it (void *cls, const GNUNET_HashCode * key, void *value)
void
GAS_addresses_in_use (const struct GNUNET_PeerIdentity *peer,
const char *plugin_name, const void *plugin_addr,
- size_t plugin_addr_len, uint32_t session_id,
- int in_use)
+ size_t plugin_addr_len, uint32_t session_id, int in_use)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message for peer `%s': %i\n",
- "ADDRESS_IN_USE",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received `%s' message for peer `%s': %i\n", "ADDRESS_IN_USE",
GNUNET_i2s (peer), in_use);
}
@@ -476,12 +469,12 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GNUNET_assert (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
- "WAN_QUOTA_IN",
- &wan_quota_in));
+ "WAN_QUOTA_IN",
+ &wan_quota_in));
GNUNET_assert (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
- "WAN_QUOTA_OUT",
- &wan_quota_out));
+ "WAN_QUOTA_OUT",
+ &wan_quota_out));
addresses = GNUNET_CONTAINER_multihashmap_create (128);
}
diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h
index 95f267bf9..75c220017 100644
--- a/src/ats/gnunet-service-ats_addresses.h
+++ b/src/ats/gnunet-service-ats_addresses.h
@@ -52,8 +52,7 @@ GAS_addresses_done (void);
void
GAS_addresses_in_use (const struct GNUNET_PeerIdentity *peer,
const char *plugin_name, const void *plugin_addr,
- size_t plugin_addr_len, uint32_t session_id,
- int in_use);
+ size_t plugin_addr_len, uint32_t session_id, int in_use);
void
GAS_addresses_update (const struct GNUNET_PeerIdentity *peer,
diff --git a/src/ats/gnunet-service-ats_scheduling.c b/src/ats/gnunet-service-ats_scheduling.c
index 4659a2363..f5e286a64 100644
--- a/src/ats/gnunet-service-ats_scheduling.c
+++ b/src/ats/gnunet-service-ats_scheduling.c
@@ -142,8 +142,10 @@ GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity
memcpy (addrp, plugin_addr, plugin_addr_len);
strcpy (&addrp[plugin_addr_len], plugin_name);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS sends quota for peer `%s': (in/out) %u/%u\n",
- GNUNET_i2s (peer), ntohl (bandwidth_in.value__), ntohl(bandwidth_out.value__));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "ATS sends quota for peer `%s': (in/out) %u/%u\n",
+ GNUNET_i2s (peer), ntohl (bandwidth_in.value__),
+ ntohl (bandwidth_out.value__));
GNUNET_SERVER_notification_context_unicast (nc, my_client, &msg->header,
GNUNET_YES);
@@ -182,8 +184,9 @@ GAS_handle_request_address (void *cls, struct GNUNET_SERVER_Client *client,
* @param message the request message
*/
void
-GAS_handle_request_address_cancel (void *cls, struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+GAS_handle_request_address_cancel (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
const struct RequestAddressMessage *msg =
(const struct RequestAddressMessage *) message;
@@ -304,12 +307,8 @@ GAS_handle_address_in_use (void *cls, struct GNUNET_SERVER_Client *client,
}
in_use = ntohs (m->in_use);
- GAS_addresses_in_use (&m->peer,
- plugin_name,
- address,
- address_length,
- ntohl (m->session_id),
- in_use);
+ GAS_addresses_in_use (&m->peer, plugin_name, address, address_length,
+ ntohl (m->session_id), in_use);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
@@ -359,8 +358,8 @@ GAS_handle_address_destroyed (void *cls, struct GNUNET_SERVER_Client *client,
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- if ( (plugin_name_length == 0) ||
- (plugin_name[plugin_name_length - 1] != '\0'))
+ if ((plugin_name_length == 0) ||
+ (plugin_name[plugin_name_length - 1] != '\0'))
{
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
diff --git a/src/ats/gnunet-service-ats_scheduling.h b/src/ats/gnunet-service-ats_scheduling.h
index cb4e5e08e..45fca2f3d 100644
--- a/src/ats/gnunet-service-ats_scheduling.h
+++ b/src/ats/gnunet-service-ats_scheduling.h
@@ -98,8 +98,9 @@ GAS_handle_request_address (void *cls, struct GNUNET_SERVER_Client *client,
* @param message the request message
*/
void
-GAS_handle_request_address_cancel (void *cls, struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message);
+GAS_handle_request_address_cancel (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message);
/**
* Handle 'address update' messages from clients.
diff --git a/src/ats/test_ats_api_scheduling.c b/src/ats/test_ats_api_scheduling.c
index bf11aef8d..fdff3e36d 100644
--- a/src/ats/test_ats_api_scheduling.c
+++ b/src/ats/test_ats_api_scheduling.c
@@ -118,8 +118,7 @@ end ()
static void
-address_suggest_cb (void *cls,
- const struct GNUNET_HELLO_Address *address,
+address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
struct Session *session,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
@@ -130,10 +129,13 @@ address_suggest_cb (void *cls,
GNUNET_i2s (&address->peer));
GNUNET_assert (0 ==
- memcmp (&address->peer, &p[0].id, sizeof (struct GNUNET_PeerIdentity)));
+ memcmp (&address->peer, &p[0].id,
+ sizeof (struct GNUNET_PeerIdentity)));
GNUNET_assert (0 == strcmp (address->transport_name, addr[0].plugin));
GNUNET_assert (address->address_length == addr[0].addr_len);
- GNUNET_assert (0 == memcmp (address->address, addr[0].plugin, address->address_length));
+ GNUNET_assert (0 ==
+ memcmp (address->address, addr[0].plugin,
+ address->address_length));
GNUNET_assert (addr[0].session == session);
@@ -224,7 +226,7 @@ check (void *cls, char *const *args, const char *cfgfile,
GNUNET_ATS_address_update (ats, &address0, addr[0].session, atsi, 2);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing manual address deletion \n");
- address0.peer = p[1].id; // FIXME: why? typo in old code?
+ address0.peer = p[1].id; // FIXME: why? typo in old code?
GNUNET_ATS_address_update (ats, &address0, addr[0].session, NULL, 0);
GNUNET_ATS_address_destroyed (ats, &address0, addr[0].session);
diff --git a/src/core/core_api.c b/src/core/core_api.c
index a279874d7..281a851e0 100644
--- a/src/core/core_api.c
+++ b/src/core/core_api.c
@@ -1424,8 +1424,8 @@ GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork,
}
/* Order entries by deadline, but SKIP 'HEAD' (as we may have transmitted
- that request already or might even already be approved to transmit that
- message to core) */
+ * that request already or might even already be approved to transmit that
+ * message to core) */
pos = pr->pending_head;
if (pos != NULL)
pos = pos->next; /* skip head */
diff --git a/src/core/gnunet-core-list-connections.c b/src/core/gnunet-core-list-connections.c
index e0d95d0f8..c93f50981 100644
--- a/src/core/gnunet-core-list-connections.c
+++ b/src/core/gnunet-core-list-connections.c
@@ -98,11 +98,11 @@ dump_pc (struct PrintContext *pc)
* @param address NULL on error, otherwise 0-terminated printable UTF-8 string
*/
static void
-process_resolved_address (void *cls,
- const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_HELLO_Address *address)
+process_resolved_address (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_HELLO_Address *address)
{
struct PrintContext *pc = cls;
+
// struct AddressStringList *new_address;
if (address == NULL)
@@ -111,16 +111,16 @@ process_resolved_address (void *cls,
return;
}
- /* This does exactly the same as gnunet-transport -i !*/
+ /* This does exactly the same as gnunet-transport -i ! */
/*
- new_address = GNUNET_malloc (sizeof (struct AddressStringList));
-#if VERBOSE
- fprintf (stderr, "Received address %s\n", address);
-#endif
-
- new_address->address_string = GNUNET_strdup ("FIXME");
- GNUNET_CONTAINER_DLL_insert (pc->address_list_head, pc->address_list_tail,
- new_address);
+ * new_address = GNUNET_malloc (sizeof (struct AddressStringList));
+ * #if VERBOSE
+ * fprintf (stderr, "Received address %s\n", address);
+ * #endif
+ *
+ * new_address->address_string = GNUNET_strdup ("FIXME");
+ * GNUNET_CONTAINER_DLL_insert (pc->address_list_head, pc->address_list_tail,
+ * new_address);
*/
}
@@ -143,12 +143,9 @@ connected_peer_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
#endif
pc = GNUNET_malloc (sizeof (struct PrintContext));
pc->peer = *peer;
- GNUNET_TRANSPORT_peer_get_active_addresses (cfg,
- peer,
- GNUNET_YES,
+ GNUNET_TRANSPORT_peer_get_active_addresses (cfg, peer, GNUNET_YES,
GNUNET_TIME_UNIT_MINUTES,
- &process_resolved_address,
- pc);
+ &process_resolved_address, pc);
}
#if VERBOSE
else
diff --git a/src/core/gnunet-service-core_clients.c b/src/core/gnunet-service-core_clients.c
index 5448d5d0f..4098b45b1 100644
--- a/src/core/gnunet-service-core_clients.c
+++ b/src/core/gnunet-service-core_clients.c
@@ -343,13 +343,14 @@ handle_client_send_request (void *cls, struct GNUNET_SERVER_Client *client,
"Client asked for transmission to `%s'\n",
GNUNET_i2s (&req->peer));
#endif
- is_loopback = (0 ==
- memcmp (&req->peer, &GSC_my_identity,
- sizeof (struct GNUNET_PeerIdentity)));
- if ( (! is_loopback) &&
- (GNUNET_YES !=
- GNUNET_CONTAINER_multihashmap_contains (c->connectmap,
- &req->peer.hashPubKey)) )
+ is_loopback =
+ (0 ==
+ memcmp (&req->peer, &GSC_my_identity,
+ sizeof (struct GNUNET_PeerIdentity)));
+ if ((!is_loopback) &&
+ (GNUNET_YES !=
+ GNUNET_CONTAINER_multihashmap_contains (c->connectmap,
+ &req->peer.hashPubKey)))
{
/* neighbour must have disconnected since request was issued,
* ignore (client will realize it once it processes the
@@ -390,8 +391,8 @@ handle_client_send_request (void *cls, struct GNUNET_SERVER_Client *client,
GSC_CLIENTS_solicit_request (car);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
- }
- GSC_SESSIONS_queue_request (car);
+ }
+ GSC_SESSIONS_queue_request (car);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
@@ -610,13 +611,12 @@ GSC_CLIENTS_solicit_request (struct GSC_ClientActiveRequest *car)
c = car->client_handle;
if (GNUNET_YES !=
GNUNET_CONTAINER_multihashmap_contains (c->connectmap,
- &car->
- target.hashPubKey))
+ &car->target.hashPubKey))
{
/* connection has gone down since, drop request */
GNUNET_assert (0 !=
- memcmp (&car->target, &GSC_my_identity,
- sizeof (struct GNUNET_PeerIdentity)));
+ memcmp (&car->target, &GSC_my_identity,
+ sizeof (struct GNUNET_PeerIdentity)));
GSC_SESSIONS_dequeue_request (car);
GSC_CLIENTS_reject_request (car);
return;
diff --git a/src/core/gnunet-service-core_neighbours.c b/src/core/gnunet-service-core_neighbours.c
index 0e292fbd1..6c696ce84 100644
--- a/src/core/gnunet-service-core_neighbours.c
+++ b/src/core/gnunet-service-core_neighbours.c
@@ -427,10 +427,10 @@ handle_transport_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
break;
default:
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Unsupported message of type %u (%u bytes) received from peer `%s'\n"),
- (unsigned int) type,
- (unsigned int) ntohs (message->size),
- GNUNET_i2s (peer));
+ _
+ ("Unsupported message of type %u (%u bytes) received from peer `%s'\n"),
+ (unsigned int) type, (unsigned int) ntohs (message->size),
+ GNUNET_i2s (peer));
return;
}
}
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c
index 219272809..1f697cf16 100644
--- a/src/core/gnunet-service-core_sessions.c
+++ b/src/core/gnunet-service-core_sessions.c
@@ -172,7 +172,7 @@ GSC_SESSIONS_end (const struct GNUNET_PeerIdentity *pid)
struct Session *session;
struct GSC_ClientActiveRequest *car;
struct SessionMessageEntry *sme;
-
+
session = find_session (pid);
if (NULL == session)
return;
@@ -193,9 +193,7 @@ GSC_SESSIONS_end (const struct GNUNET_PeerIdentity *pid)
}
while (NULL != (sme = session->sme_head))
{
- GNUNET_CONTAINER_DLL_remove (session->sme_head,
- session->sme_tail,
- sme);
+ GNUNET_CONTAINER_DLL_remove (session->sme_head, session->sme_tail, sme);
GNUNET_free (sme);
}
GNUNET_SCHEDULER_cancel (session->typemap_task);
@@ -347,7 +345,7 @@ GSC_SESSIONS_queue_request (struct GSC_ClientActiveRequest *car)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Dropped client request for transmission (am disconnected)\n");
#endif
- GNUNET_break (0); /* should have been rejected earlier */
+ GNUNET_break (0); /* should have been rejected earlier */
GSC_CLIENTS_reject_request (car);
return;
}
@@ -438,7 +436,7 @@ solicit_messages (struct Session *session)
discard_expired_requests (session);
so_size = 0;
nxt = session->active_client_request_head;
- while (NULL != (car = nxt) )
+ while (NULL != (car = nxt))
{
nxt = car->next;
if (so_size + car->msize > GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE)
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index 59305725a..adfa93f1f 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -630,20 +630,20 @@ run (void *cls, char *const *args, const char *cfgfile,
GNUNET_assert (test != -1);
GNUNET_assert (GNUNET_SYSERR !=
GNUNET_CONFIGURATION_get_value_size (p1.cfg, "ATS",
- "WAN_QUOTA_IN",
- &current_quota_p1_in));
+ "WAN_QUOTA_IN",
+ &current_quota_p1_in));
GNUNET_assert (GNUNET_SYSERR !=
GNUNET_CONFIGURATION_get_value_size (p2.cfg, "ATS",
- "WAN_QUOTA_IN",
- &current_quota_p2_in));
+ "WAN_QUOTA_IN",
+ &current_quota_p2_in));
GNUNET_assert (GNUNET_SYSERR !=
GNUNET_CONFIGURATION_get_value_size (p1.cfg, "ATS",
- "WAN_QUOTA_OUT",
- &current_quota_p1_out));
+ "WAN_QUOTA_OUT",
+ &current_quota_p1_out));
GNUNET_assert (GNUNET_SYSERR !=
GNUNET_CONFIGURATION_get_value_size (p2.cfg, "ATS",
- "WAN_QUOTA_OUT",
- &current_quota_p2_out));
+ "WAN_QUOTA_OUT",
+ &current_quota_p2_out));
p1.ch =
GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify,
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c
index 5ae9525bd..46004c4f3 100644
--- a/src/datastore/datastore_api.c
+++ b/src/datastore/datastore_api.c
@@ -602,8 +602,7 @@ transmit_request (void *cls, size_t size, void *buf)
if (buf == NULL)
{
#if DEBUG_DATASTORE
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Failed to transmit request to DATASTORE.\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to transmit request to DATASTORE.\n");
#endif
GNUNET_STATISTICS_update (h->stats,
gettext_noop ("# transmission request failures"),
diff --git a/src/dht/test_dht_multipeer.c b/src/dht/test_dht_multipeer.c
index 8de16b363..1a4fbaf13 100644
--- a/src/dht/test_dht_multipeer.c
+++ b/src/dht/test_dht_multipeer.c
@@ -463,7 +463,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
}
ok = 1;
/* testing_peergroup will do that in its own end_badly() handler */
- /*GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);*/
+ /*GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); */
pg = NULL;
}
diff --git a/src/dv/plugin_transport_dv.c b/src/dv/plugin_transport_dv.c
index 569213f72..78200e634 100644
--- a/src/dv/plugin_transport_dv.c
+++ b/src/dv/plugin_transport_dv.c
@@ -160,10 +160,17 @@ handle_dv_message_received (void *cls, struct GNUNET_PeerIdentity *sender,
my_id, GNUNET_i2s (sender),
ntohs (((struct GNUNET_MessageHeader *) msg)->type),
distance);
- if (sender_address_len == (2 * sizeof(struct GNUNET_PeerIdentity)))
- {
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "plugin_transport_dv", "Parsed sender address: %s:%s\n", GNUNET_i2s((struct GNUNET_PeerIdentity *)sender_address), GNUNET_h2s(&((struct GNUNET_PeerIdentity *)&sender_address[sizeof(struct GNUNET_PeerIdentity)])->hashPubKey));
- }
+ if (sender_address_len == (2 * sizeof (struct GNUNET_PeerIdentity)))
+ {
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "plugin_transport_dv",
+ "Parsed sender address: %s:%s\n",
+ GNUNET_i2s ((struct GNUNET_PeerIdentity *) sender_address),
+ GNUNET_h2s (&
+ ((struct GNUNET_PeerIdentity *)
+ &sender_address[sizeof
+ (struct
+ GNUNET_PeerIdentity)])->hashPubKey));
+ }
GNUNET_free_non_null (my_id);
#endif
diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c
index 5f40fb522..942ee07c0 100644
--- a/src/dv/test_transport_api_dv.c
+++ b/src/dv/test_transport_api_dv.c
@@ -394,15 +394,16 @@ send_other_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
* @return connected transport distance
*/
static uint32_t
-get_atsi_distance (const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count)
+get_atsi_distance (const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
unsigned int i;
for (i = 0; i < atsi_count; i++)
- {
- if (ntohl (atsi->type) == GNUNET_ATS_QUALITY_NET_DISTANCE)
- return ntohl (atsi->value);
- }
+ {
+ if (ntohl (atsi->type) == GNUNET_ATS_QUALITY_NET_DISTANCE)
+ return ntohl (atsi->value);
+ }
GNUNET_break (0);
/* FIXME: we do not have distance data? Assume direct neighbor. */
@@ -411,8 +412,7 @@ get_atsi_distance (const struct GNUNET_ATS_Information *atsi, unsigned int atsi_
static int
-process_mtype (void *cls,
- const struct GNUNET_PeerIdentity *peer,
+process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
const struct GNUNET_ATS_Information *atsi,
unsigned int atsi_count)
@@ -464,7 +464,8 @@ process_mtype (void *cls,
{
GNUNET_SCHEDULER_cancel (die_task);
#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Scheduling timeout from DV connections.\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Scheduling timeout from DV connections.\n");
#endif
die_task =
GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, &end_badly,
diff --git a/src/fragmentation/fragmentation.c b/src/fragmentation/fragmentation.c
index e5b11f5d9..8fab3fee4 100644
--- a/src/fragmentation/fragmentation.c
+++ b/src/fragmentation/fragmentation.c
@@ -117,7 +117,7 @@ struct GNUNET_FRAGMENT_Context
/**
* Target fragment size.
*/
- uint16_t mtu;
+ uint16_t mtu;
};
@@ -208,7 +208,8 @@ transmit_next (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
fc->num_rounds++;
delay =
GNUNET_TIME_relative_max (GNUNET_TIME_relative_multiply (delay, 2),
- GNUNET_TIME_relative_multiply (fc->delay, fc->num_rounds));
+ GNUNET_TIME_relative_multiply (fc->delay,
+ fc->num_rounds));
/* never use zero, need some time for ACK always */
delay = GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MILLISECONDS, delay);
fc->last_round = GNUNET_TIME_absolute_get ();
@@ -330,13 +331,13 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc,
if (ntohl (fa->fragment_id) != fc->fragment_id)
return GNUNET_SYSERR; /* not our ACK */
abits = GNUNET_ntohll (fa->bits);
- if ( (GNUNET_YES == fc->wack) &&
- (abits == (fc->acks & abits)) )
+ if ((GNUNET_YES == fc->wack) && (abits == (fc->acks & abits)))
{
/* normal ACK, can update running average of delay... */
fc->wack = GNUNET_NO;
ndelay = GNUNET_TIME_absolute_get_duration (fc->last_round);
- fc->delay.rel_value = (ndelay.rel_value * fc->num_rounds + 3 * fc->delay.rel_value) / 4;
+ fc->delay.rel_value =
+ (ndelay.rel_value * fc->num_rounds + 3 * fc->delay.rel_value) / 4;
}
GNUNET_STATISTICS_update (fc->stats,
_("# fragment acknowledgements received"), 1,
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c
index ce4b3b887..ab351a209 100644
--- a/src/fs/fs_api.c
+++ b/src/fs/fs_api.c
@@ -2464,7 +2464,7 @@ deserialize_download (struct GNUNET_FS_Handle *h,
}
if (parent != NULL)
{
- GNUNET_abort (); // for debugging for now - FIXME
+ GNUNET_abort (); // for debugging for now - FIXME
GNUNET_CONTAINER_DLL_insert (parent->child_head, parent->child_tail, dc);
}
if (search != NULL)
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c
index a2346aab9..052bf83d2 100644
--- a/src/fs/fs_search.c
+++ b/src/fs/fs_search.c
@@ -995,7 +995,7 @@ transmit_search_request (void *cls, size_t size, void *buf)
mbc.put_cnt = GNUNET_MIN (mbc.put_cnt, sqms - mbc.skip_cnt);
if (sc->search_request_map_offset < sqms)
GNUNET_assert (mbc.put_cnt > 0);
-
+
sm->header.size = htons (msize);
sm->type = htonl (GNUNET_BLOCK_TYPE_ANY);
sm->anonymity_level = htonl (sc->anonymity);
diff --git a/src/fs/gnunet-fs.c b/src/fs/gnunet-fs.c
index 9025b71da..dc86ce984 100644
--- a/src/fs/gnunet-fs.c
+++ b/src/fs/gnunet-fs.c
@@ -93,7 +93,8 @@ run (void *cls, char *const *args, const char *cfgfile,
{
if (list_indexed_files)
{
- fs = GNUNET_FS_start (cfg, "gnunet-fs", NULL, NULL, GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_END);
+ fs = GNUNET_FS_start (cfg, "gnunet-fs", NULL, NULL, GNUNET_FS_FLAGS_NONE,
+ GNUNET_FS_OPTIONS_END);
if (NULL == fs)
{
ret = 1;
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 5923823ef..2a90b538c 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -232,9 +232,9 @@ update_latencies (const struct GNUNET_ATS_Information *atsi,
{
if (ntohl (atsi[i].type) == GNUNET_ATS_QUALITY_NET_DELAY)
{
- GSF_avg_latency.rel_value = (GSF_avg_latency.rel_value * 31 +
- GNUNET_MIN (5000,
- ntohl (atsi[i].value))) / 32;
+ GSF_avg_latency.rel_value =
+ (GSF_avg_latency.rel_value * 31 +
+ GNUNET_MIN (5000, ntohl (atsi[i].value))) / 32;
GNUNET_STATISTICS_set (GSF_stats,
gettext_noop
("# running average P2P latency (ms)"),
@@ -405,8 +405,7 @@ handle_start_search (void *cls, struct GNUNET_SERVER_Client *client,
int ret;
pr = NULL;
- ret = GSF_local_client_start_search_handler_ (client, message,
- &pr);
+ ret = GSF_local_client_start_search_handler_ (client, message, &pr);
switch (ret)
{
case GNUNET_SYSERR:
@@ -572,11 +571,10 @@ main_init (struct GNUNET_SERVER_Handle *server,
{NULL, NULL, 0, 0}
};
- GSF_core = GNUNET_CORE_connect (GSF_cfg, 1,
- NULL, &peer_init_handler,
- &peer_connect_handler,
- &GSF_peer_disconnect_handler_, NULL,
- GNUNET_NO, NULL, GNUNET_NO, p2p_handlers);
+ GSF_core =
+ GNUNET_CORE_connect (GSF_cfg, 1, NULL, &peer_init_handler,
+ &peer_connect_handler, &GSF_peer_disconnect_handler_,
+ NULL, GNUNET_NO, NULL, GNUNET_NO, p2p_handlers);
if (NULL == GSF_core)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c
index 65dece707..502cef941 100644
--- a/src/fs/gnunet-service-fs_lc.c
+++ b/src/fs/gnunet-service-fs_lc.c
@@ -295,7 +295,7 @@ int
GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader
*message,
- struct GSF_PendingRequest **prptr)
+ struct GSF_PendingRequest **prptr)
{
static GNUNET_HashCode all_zeros;
const struct SearchMessage *sm;
@@ -350,45 +350,45 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client,
{
#if DEBUG_FS_CLIENT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Have existing request, merging content-seen lists.\n");
+ "Have existing request, merging content-seen lists.\n");
#endif
- GSF_pending_request_update_ (cr->pr, (const GNUNET_HashCode *) &sm[1],
- sc);
+ GSF_pending_request_update_ (cr->pr, (const GNUNET_HashCode *) &sm[1], sc);
GNUNET_STATISTICS_update (GSF_stats,
- gettext_noop
- ("# client searches updated (merged content seen list)"),
- 1, GNUNET_NO);
- }
+ gettext_noop
+ ("# client searches updated (merged content seen list)"),
+ 1, GNUNET_NO);
+ }
else
{
GNUNET_STATISTICS_update (GSF_stats,
- gettext_noop ("# client searches active"), 1,
- GNUNET_NO);
+ gettext_noop ("# client searches active"), 1,
+ GNUNET_NO);
cr = GNUNET_malloc (sizeof (struct ClientRequest));
cr->lc = lc;
GNUNET_CONTAINER_DLL_insert (lc->cr_head, lc->cr_tail, cr);
options = GSF_PRO_LOCAL_REQUEST;
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,
- (type == GNUNET_BLOCK_TYPE_FS_SBLOCK) ? &sm->target /* namespace */
- : NULL,
- (0 !=
- memcmp (&sm->target, &all_zeros,
- sizeof (GNUNET_HashCode)))
- ? (const struct GNUNET_PeerIdentity *)
- &sm->target : NULL, NULL, 0,
- 0 /* bf */ ,
- ntohl (sm->anonymity_level),
- 0 /* priority */ ,
- 0 /* ttl */ ,
- 0 /* sender PID */ ,
- 0 /* origin PID */ ,
- (const GNUNET_HashCode *) &sm[1], sc,
- &client_response_handler, cr);
+ cr->pr = GSF_pending_request_create_ (options, type, &sm->query, (type == GNUNET_BLOCK_TYPE_FS_SBLOCK) ? &sm->target /* namespace */
+ : NULL,
+ (0 !=
+ memcmp (&sm->target, &all_zeros,
+ sizeof (GNUNET_HashCode)))
+ ? (const struct GNUNET_PeerIdentity *)
+ &sm->target : NULL, NULL, 0,
+ 0 /* bf */ ,
+ ntohl (sm->anonymity_level),
+ 0 /* priority */ ,
+ 0 /* ttl */ ,
+ 0 /* sender PID */ ,
+ 0 /* origin PID */ ,
+ (const GNUNET_HashCode *) &sm[1], sc,
+ &client_response_handler, cr);
}
*prptr = cr->pr;
- return (0 != (SEARCH_MESSAGE_OPTION_CONTINUED & ntohl (sm->options))) ? GNUNET_NO : GNUNET_YES;
+ return (0 !=
+ (SEARCH_MESSAGE_OPTION_CONTINUED & ntohl (sm->options))) ? GNUNET_NO :
+ GNUNET_YES;
}
diff --git a/src/fs/gnunet-service-fs_lc.h b/src/fs/gnunet-service-fs_lc.h
index 78b23dc40..3bddb8947 100644
--- a/src/fs/gnunet-service-fs_lc.h
+++ b/src/fs/gnunet-service-fs_lc.h
@@ -57,7 +57,7 @@ int
GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader
*message,
- struct GSF_PendingRequest **prptr);
+ struct GSF_PendingRequest **prptr);
/**
diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c
index 200d7a0e4..0a40065cc 100644
--- a/src/fs/gnunet-service-fs_pe.c
+++ b/src/fs/gnunet-service-fs_pe.c
@@ -265,7 +265,7 @@ plan (struct PeerPlan *pp, struct GSF_RequestPlan *rp)
gettext_noop ("# average retransmission delay (ms)"),
total_delay * 1000LL / plan_count, GNUNET_NO);
prd = GSF_pending_request_get_data_ (rp->prl_head->pr);
-
+
if (rp->transmission_counter < 8)
delay =
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
@@ -283,30 +283,32 @@ plan (struct PeerPlan *pp, struct GSF_RequestPlan *rp)
GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
delay.rel_value + 1);
/* Add 0.01 to avg_delay to avoid division-by-zero later */
- avg_delay = (((avg_delay * (N-1.0)) + delay.rel_value) / N) + 0.01;
+ avg_delay = (((avg_delay * (N - 1.0)) + delay.rel_value) / N) + 0.01;
/*
- For the priority, we need to consider a few basic rules:
- 1) if we just started requesting (delay is small), we should
- virtually always have a priority of zero.
- 2) for requests with average latency, our priority should match
- the average priority observed on the network
- 3) even the longest-running requests should not be WAY out of
- the observed average (thus we bound by a factor of 2)
- 4) we add +1 to the observed average priority to avoid everyone
- staying put at zero (2 * 0 = 0...).
-
- Using the specific calculation below, we get:
-
- delay = 0 => priority = 0;
- delay = avg delay => priority = running-average-observed-priority;
- delay >> avg_delay => priority = 2 * running-average-observed-priority;
-
- which satisfies all of the rules above.
-
- Note: M_PI_4 = PI/4 = arctan(1)
- */
- rp->priority = round ((GSF_current_priorities + 1.0) * atan (delay.rel_value / avg_delay)) / M_PI_4;
+ * For the priority, we need to consider a few basic rules:
+ * 1) if we just started requesting (delay is small), we should
+ * virtually always have a priority of zero.
+ * 2) for requests with average latency, our priority should match
+ * the average priority observed on the network
+ * 3) even the longest-running requests should not be WAY out of
+ * the observed average (thus we bound by a factor of 2)
+ * 4) we add +1 to the observed average priority to avoid everyone
+ * staying put at zero (2 * 0 = 0...).
+ *
+ * Using the specific calculation below, we get:
+ *
+ * delay = 0 => priority = 0;
+ * delay = avg delay => priority = running-average-observed-priority;
+ * delay >> avg_delay => priority = 2 * running-average-observed-priority;
+ *
+ * which satisfies all of the rules above.
+ *
+ * Note: M_PI_4 = PI/4 = arctan(1)
+ */
+ rp->priority =
+ round ((GSF_current_priorities +
+ 1.0) * atan (delay.rel_value / avg_delay)) / M_PI_4;
/* Note: usage of 'round' and 'atan' requires -lm */
if (rp->transmission_counter != 0)
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index e6add21b9..1bd16c9f1 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -1588,7 +1588,7 @@ GSF_pending_request_init_ ()
}
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_size (GSF_cfg, "ats", "WAN_QUOTA_OUT",
- &bps))
+ &bps))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_
diff --git a/src/hello/address.c b/src/hello/address.c
index b511ca9df..618aa6e6a 100644
--- a/src/hello/address.c
+++ b/src/hello/address.c
@@ -39,21 +39,20 @@
*/
struct GNUNET_HELLO_Address *
GNUNET_HELLO_address_allocate (const struct GNUNET_PeerIdentity *peer,
- const char *transport_name,
- const void *address,
- size_t address_length)
+ const char *transport_name, const void *address,
+ size_t address_length)
{
struct GNUNET_HELLO_Address *addr;
size_t slen;
char *end;
slen = strlen (transport_name) + 1;
- addr = GNUNET_malloc (sizeof (struct GNUNET_HELLO_Address) +
- address_length +
- slen);
+ addr =
+ GNUNET_malloc (sizeof (struct GNUNET_HELLO_Address) + address_length +
+ slen);
addr->peer = *peer;
addr->address = &addr[1];
- end = (char*) &addr[1];
+ end = (char *) &addr[1];
memcpy (end, address, address_length);
addr->address_length = address_length;
addr->transport_name = &end[address_length];
@@ -69,11 +68,10 @@ GNUNET_HELLO_address_allocate (const struct GNUNET_PeerIdentity *peer,
* @return the size
*/
size_t
-GNUNET_HELLO_address_get_size (const struct GNUNET_HELLO_Address *address)
+GNUNET_HELLO_address_get_size (const struct GNUNET_HELLO_Address * address)
{
- return sizeof (struct GNUNET_HELLO_Address) +
- address->address_length +
- strlen(address->transport_name) + 1;
+ return sizeof (struct GNUNET_HELLO_Address) + address->address_length +
+ strlen (address->transport_name) + 1;
}
@@ -86,10 +84,9 @@ GNUNET_HELLO_address_get_size (const struct GNUNET_HELLO_Address *address)
struct GNUNET_HELLO_Address *
GNUNET_HELLO_address_copy (const struct GNUNET_HELLO_Address *address)
{
- return GNUNET_HELLO_address_allocate (&address->peer,
- address->transport_name,
- address->address,
- address->address_length);
+ return GNUNET_HELLO_address_allocate (&address->peer, address->transport_name,
+ address->address,
+ address->address_length);
}
@@ -103,21 +100,18 @@ GNUNET_HELLO_address_copy (const struct GNUNET_HELLO_Address *address)
*/
int
GNUNET_HELLO_address_cmp (const struct GNUNET_HELLO_Address *a1,
- const struct GNUNET_HELLO_Address *a2)
+ const struct GNUNET_HELLO_Address *a2)
{
int ret;
- ret = strcmp (a1->transport_name,
- a2->transport_name);
+ ret = strcmp (a1->transport_name, a2->transport_name);
if (0 != ret)
return ret;
- if (a1->address_length < a2->address_length)
+ if (a1->address_length < a2->address_length)
return -1;
- if (a1->address_length > a2->address_length)
+ if (a1->address_length > a2->address_length)
return 1;
- return memcmp (a1->address,
- a1->address,
- a1->address_length);
+ return memcmp (a1->address, a1->address, a1->address_length);
}
diff --git a/src/hello/hello.c b/src/hello/hello.c
index 9c0c3d4ac..f7d34233c 100644
--- a/src/hello/hello.c
+++ b/src/hello/hello.c
@@ -74,8 +74,7 @@ struct GNUNET_HELLO_Message
*/
size_t
GNUNET_HELLO_add_address (const struct GNUNET_HELLO_Address *address,
- struct GNUNET_TIME_Absolute expiration,
- char *target,
+ struct GNUNET_TIME_Absolute expiration, char *target,
size_t max)
{
uint16_t alen;
@@ -232,8 +231,8 @@ GNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg,
wpos = 0;
woff = (ret != NULL) ? (char *) &ret[1] : NULL;
GNUNET_CRYPTO_hash (&msg->publicKey,
- sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
- &address.peer.hashPubKey);
+ sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
+ &address.peer.hashPubKey);
while (insize > 0)
{
esize = get_hello_address_size (inptr, insize, &alen);
@@ -280,14 +279,12 @@ struct ExpireContext
static int
-get_match_exp (void *cls,
- const struct GNUNET_HELLO_Address *address,
+get_match_exp (void *cls, const struct GNUNET_HELLO_Address *address,
struct GNUNET_TIME_Absolute expiration)
{
struct ExpireContext *ec = cls;
- if (0 == GNUNET_HELLO_address_cmp (address,
- ec->address))
+ if (0 == GNUNET_HELLO_address_cmp (address, ec->address))
{
ec->found = GNUNET_YES;
ec->expiration = expiration;
@@ -311,8 +308,7 @@ struct MergeContext
static int
-copy_latest (void *cls,
- const struct GNUNET_HELLO_Address *address,
+copy_latest (void *cls, const struct GNUNET_HELLO_Address *address,
struct GNUNET_TIME_Absolute expiration)
{
struct MergeContext *mc = cls;
@@ -327,9 +323,8 @@ copy_latest (void *cls,
(mc->take_equal == GNUNET_YES)))
{
mc->ret +=
- GNUNET_HELLO_add_address (address,
- expiration,
- &mc->buf[mc->ret], mc->max - mc->ret);
+ GNUNET_HELLO_add_address (address, expiration, &mc->buf[mc->ret],
+ mc->max - mc->ret);
}
return GNUNET_OK;
}
@@ -388,8 +383,7 @@ struct DeltaContext
static int
-delta_match (void *cls,
- const struct GNUNET_HELLO_Address *address,
+delta_match (void *cls, const struct GNUNET_HELLO_Address *address,
struct GNUNET_TIME_Absolute expiration)
{
struct DeltaContext *dc = cls;
@@ -547,9 +541,7 @@ find_other_matching (void *cls, const struct GNUNET_HELLO_Address *address,
if (expiration.abs_value < ec->expiration_limit.abs_value)
return GNUNET_YES;
- if (0 ==
- GNUNET_HELLO_address_cmp (address,
- ec->address))
+ if (0 == GNUNET_HELLO_address_cmp (address, ec->address))
{
ec->found = GNUNET_YES;
if (expiration.abs_value < ec->expiration.abs_value)
diff --git a/src/hello/test_hello.c b/src/hello/test_hello.c
index ca69dfc18..eb15668f4 100644
--- a/src/hello/test_hello.c
+++ b/src/hello/test_hello.c
@@ -47,8 +47,8 @@ my_addr_gen (void *cls, size_t max, void *buf)
address.transport_name = "test";
address.address_length = *i;
ret =
- GNUNET_HELLO_add_address (&address, GNUNET_TIME_absolute_get (),
- buf, max);
+ GNUNET_HELLO_add_address (&address, GNUNET_TIME_absolute_get (), buf,
+ max);
(*i)--;
return ret;
}
@@ -67,7 +67,9 @@ check_addr (void *cls, const struct GNUNET_HELLO_Address *address,
GNUNET_assert (address->address_length > 0);
GNUNET_assert (*i & (1 << (address->address_length - 1)));
*i -= (1 << (address->address_length - 1));
- GNUNET_assert (0 == strncmp ("address_information", address->address, address->address_length));
+ GNUNET_assert (0 ==
+ strncmp ("address_information", address->address,
+ address->address_length));
GNUNET_assert (0 == strcmp ("test", address->transport_name));
return GNUNET_OK;
}
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h
index 8c9be13d4..ecbdd2f70 100644
--- a/src/include/gnunet_ats_service.h
+++ b/src/include/gnunet_ats_service.h
@@ -448,7 +448,9 @@ struct Session;
* @param ats_count number of performance records in 'ats'
*/
typedef void (*GNUNET_ATS_AddressSuggestionCallback) (void *cls,
- const struct GNUNET_HELLO_Address *address,
+ const struct
+ GNUNET_HELLO_Address *
+ address,
struct Session * session,
struct
GNUNET_BANDWIDTH_Value32NBO
@@ -504,7 +506,7 @@ GNUNET_ATS_suggest_address (struct GNUNET_ATS_SchedulingHandle *sh,
*/
void
GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh,
- const struct GNUNET_PeerIdentity *peer);
+ const struct GNUNET_PeerIdentity *peer);
/**
* We have updated performance statistics for a given address. Note
@@ -522,7 +524,7 @@ GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh,
*/
void
GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh,
- const struct GNUNET_HELLO_Address *address,
+ const struct GNUNET_HELLO_Address *address,
struct Session *session,
const struct GNUNET_ATS_Information *ats,
uint32_t ats_count);
@@ -540,8 +542,7 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh,
void
GNUNET_ATS_address_in_use (struct GNUNET_ATS_SchedulingHandle *sh,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
- int in_use);
+ struct Session *session, int in_use);
/**
* A session got destroyed, stop including it as a valid address.
@@ -553,7 +554,7 @@ GNUNET_ATS_address_in_use (struct GNUNET_ATS_SchedulingHandle *sh,
void
GNUNET_ATS_address_destroyed (struct GNUNET_ATS_SchedulingHandle *sh,
const struct GNUNET_HELLO_Address *address,
- struct Session *session);
+ struct Session *session);
/* ******************************** Performance API ***************************** */
@@ -575,7 +576,9 @@ struct GNUNET_ATS_PerformanceHandle;
* @param ats_count number of performance records in 'ats'
*/
typedef void (*GNUNET_ATS_PeerInformationCallback) (void *cls,
- const struct GNUNET_HELLO_Address *address,
+ const struct
+ GNUNET_HELLO_Address *
+ address,
struct
GNUNET_BANDWIDTH_Value32NBO
bandwidth_out,
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h
index f4a71dd46..69918c8df 100644
--- a/src/include/gnunet_fs_service.h
+++ b/src/include/gnunet_fs_service.h
@@ -1036,10 +1036,10 @@ struct GNUNET_FS_ProgressInfo
*/
unsigned int depth;
- /**
+ /**
* How much trust did we offer for downloading this block?
*/
- unsigned int trust_offered;
+ unsigned int trust_offered;
} progress;
diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h
index 09f5f1c7d..ffddb0ba2 100644
--- a/src/include/gnunet_hello_lib.h
+++ b/src/include/gnunet_hello_lib.h
@@ -50,7 +50,7 @@ struct GNUNET_HELLO_Address
/**
* For which peer is this an address?
- */
+ */
struct GNUNET_PeerIdentity peer;
/**
@@ -83,9 +83,8 @@ struct GNUNET_HELLO_Address
*/
struct GNUNET_HELLO_Address *
GNUNET_HELLO_address_allocate (const struct GNUNET_PeerIdentity *peer,
- const char *transport_name,
- const void *address,
- size_t address_length);
+ const char *transport_name, const void *address,
+ size_t address_length);
/**
@@ -108,7 +107,7 @@ GNUNET_HELLO_address_copy (const struct GNUNET_HELLO_Address *address);
*/
int
GNUNET_HELLO_address_cmp (const struct GNUNET_HELLO_Address *a1,
- const struct GNUNET_HELLO_Address *a2);
+ const struct GNUNET_HELLO_Address *a2);
/**
@@ -122,7 +121,7 @@ GNUNET_HELLO_address_get_size (const struct GNUNET_HELLO_Address *address);
/**
* Free an address.
- *
+ *
* @param addr address to free
*/
#define GNUNET_HELLO_address_free(addr) GNUNET_free(addr)
@@ -150,8 +149,7 @@ struct GNUNET_HELLO_Message;
*/
size_t
GNUNET_HELLO_add_address (const struct GNUNET_HELLO_Address *address,
- struct GNUNET_TIME_Absolute expiration,
- char *target,
+ struct GNUNET_TIME_Absolute expiration, char *target,
size_t max);
@@ -240,9 +238,11 @@ GNUNET_HELLO_equals (const struct GNUNET_HELLO_Message *h1,
* GNUNET_NO to delete it from the HELLO
* GNUNET_SYSERR to stop iterating (but keep current address)
*/
-typedef int (*GNUNET_HELLO_AddressIterator) (void *cls,
- const struct GNUNET_HELLO_Address *address,
- struct GNUNET_TIME_Absolute expiration);
+typedef int (*GNUNET_HELLO_AddressIterator) (void *cls,
+ const struct GNUNET_HELLO_Address *
+ address,
+ struct GNUNET_TIME_Absolute
+ expiration);
/**
diff --git a/src/include/gnunet_os_lib.h b/src/include/gnunet_os_lib.h
index 12ec3a54e..aed5e3b01 100644
--- a/src/include/gnunet_os_lib.h
+++ b/src/include/gnunet_os_lib.h
@@ -153,10 +153,12 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind);
*/
typedef int (*GNUNET_OS_NetworkInterfaceProcessor) (void *cls, const char *name,
int isDefault,
- const struct sockaddr * addr,
- const struct sockaddr * broadcast_addr,
- const struct sockaddr * netmask,
- socklen_t addrlen);
+ const struct sockaddr *
+ addr,
+ const struct sockaddr *
+ broadcast_addr,
+ const struct sockaddr *
+ netmask, socklen_t addrlen);
/**
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h
index 24fa124f0..996712730 100644
--- a/src/include/gnunet_transport_service.h
+++ b/src/include/gnunet_transport_service.h
@@ -109,7 +109,7 @@ typedef void (*GNUNET_TRANSPORT_NotifyDisconnect) (void *cls,
* otherwise 0-terminated printable UTF-8 string
*/
typedef void (*GNUNET_TRANSPORT_AddressToStringCallback) (void *cls,
- const char *address);
+ const char *address);
/**
@@ -120,8 +120,12 @@ typedef void (*GNUNET_TRANSPORT_AddressToStringCallback) (void *cls,
* @param address address, NULL for disconnect notification in monitor mode
*/
typedef void (*GNUNET_TRANSPORT_PeerIterateCallback) (void *cls,
- const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_HELLO_Address *address);
+ const struct
+ GNUNET_PeerIdentity *
+ peer,
+ const struct
+ GNUNET_HELLO_Address *
+ address);
/**
@@ -291,12 +295,13 @@ struct GNUNET_TRANSPORT_AddressToStringContext;
* @return handle to cancel the operation, NULL on error
*/
struct GNUNET_TRANSPORT_AddressToStringContext *
-GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const struct GNUNET_HELLO_Address *address,
- int numeric,
- struct GNUNET_TIME_Relative timeout,
- GNUNET_TRANSPORT_AddressToStringCallback aluc,
- void *aluc_cls);
+GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle
+ *cfg,
+ const struct GNUNET_HELLO_Address *address,
+ int numeric,
+ struct GNUNET_TIME_Relative timeout,
+ GNUNET_TRANSPORT_AddressToStringCallback
+ aluc, void *aluc_cls);
/**
@@ -306,8 +311,8 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf
*/
void
GNUNET_TRANSPORT_address_to_string_cancel (struct
- GNUNET_TRANSPORT_AddressToStringContext
- *alc);
+ GNUNET_TRANSPORT_AddressToStringContext
+ *alc);
/**
@@ -328,12 +333,14 @@ GNUNET_TRANSPORT_address_to_string_cancel (struct
* @param peer_address_callback_cls closure for peer_address_callback
*/
struct GNUNET_TRANSPORT_PeerIterateContext *
-GNUNET_TRANSPORT_peer_get_active_addresses (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const struct GNUNET_PeerIdentity *peer,
- int one_shot,
- struct GNUNET_TIME_Relative timeout,
- GNUNET_TRANSPORT_PeerIterateCallback peer_address_callback,
- void *peer_address_callback_cls);
+GNUNET_TRANSPORT_peer_get_active_addresses (const struct
+ GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_PeerIdentity
+ *peer, int one_shot,
+ struct GNUNET_TIME_Relative timeout,
+ GNUNET_TRANSPORT_PeerIterateCallback
+ peer_address_callback,
+ void *peer_address_callback_cls);
/**
@@ -343,8 +350,8 @@ GNUNET_TRANSPORT_peer_get_active_addresses (const struct GNUNET_CONFIGURATION_Ha
*/
void
GNUNET_TRANSPORT_peer_get_active_addresses_cancel (struct
- GNUNET_TRANSPORT_PeerIterateContext
-*alc);
+ GNUNET_TRANSPORT_PeerIterateContext
+ *alc);
/**
diff --git a/src/include/winproc.h b/src/include/winproc.h
index ac4eecdfb..74e41edc9 100644
--- a/src/include/winproc.h
+++ b/src/include/winproc.h
@@ -208,16 +208,16 @@ extern "C"
#define ENUMNICS3_MASK_OK 0x01
#define ENUMNICS3_BCAST_OK 0x02
-struct EnumNICs3_results
-{
- unsigned char flags;
- int is_default;
- char pretty_name[1001];
- size_t addr_size;
- struct sockaddr address;
- struct sockaddr mask;
- struct sockaddr broadcast;
-};
+ struct EnumNICs3_results
+ {
+ unsigned char flags;
+ int is_default;
+ char pretty_name[1001];
+ size_t addr_size;
+ struct sockaddr address;
+ struct sockaddr mask;
+ struct sockaddr broadcast;
+ };
int EnumNICs3 (struct EnumNICs3_results **, int *EnumNICs3_results_count);
void EnumNICs3_free (struct EnumNICs3_results *);
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 8883602ab..564640acd 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -1461,7 +1461,8 @@ peer_info_remove_path (struct MeshPeerInfo *peer, GNUNET_PEER_Id p1,
for (i = 0; i < peer->ntunnels; i++)
{
d = tunnel_notify_connection_broken (peer->tunnels[i], p1, p2);
- if (0 == d) continue;
+ if (0 == d)
+ continue;
/* TODO
* Problem: one or more peers have been deleted from the tunnel tree.
* We don't know who they are to try to add them again.
@@ -1699,7 +1700,7 @@ path_build_from_dht (const struct GNUNET_PeerIdentity *get_path,
/**
* Adds a path to the peer_infos of all the peers in the path
- *
+ *
* @param p Path to process.
* @param confirmed Whether we know if the path works or not. FIXME use
*/
@@ -1709,16 +1710,16 @@ path_add_to_peers (struct MeshPeerPath *p, int confirmed)
unsigned int i;
/* TODO: invert and add */
- for (i = 0; i < p->length && p->peers[i] != myid; i++) /* skip'em */;
+ for (i = 0; i < p->length && p->peers[i] != myid; i++) /* skip'em */ ;
for (i++; i < p->length; i++)
{
struct MeshPeerInfo *aux;
struct MeshPeerPath *copy;
- aux = peer_info_get_short(p->peers[i]);
- copy = path_duplicate(p);
+ aux = peer_info_get_short (p->peers[i]);
+ copy = path_duplicate (p);
copy->length = i + 1;
- peer_info_add_path(aux, copy, GNUNET_NO);
+ peer_info_add_path (aux, copy, GNUNET_NO);
}
}
@@ -2063,14 +2064,12 @@ tunnel_send_multicast (struct MeshTunnel *t,
mcast = (struct GNUNET_MESH_Multicast *) mdata->data;
mcast->ttl = htonl (ntohl (mcast->ttl) - 1);
#if MESH_DEBUG
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "MESH: data packet, ttl: %u\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: data packet, ttl: %u\n",
ntohl (mcast->ttl));
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "MESH: not a data packet, no ttl\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: not a data packet, no ttl\n");
#endif
}
if (NULL != t->client)
@@ -2601,7 +2600,7 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
/* FIXME error. destroy tunnel? leave for timeout? */
return 0;
}
- path_add_to_peers(path, GNUNET_NO);
+ path_add_to_peers (path, GNUNET_NO);
tunnel_add_path (t, path, own_pos);
if (own_pos == size - 1)
{
@@ -2938,16 +2937,14 @@ handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer,
{
/* FIXME: already seen this packet, log dropping */
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "MESH: Already seen mid %u, DROPPING!\n",
- t->mid);
+ "MESH: Already seen mid %u, DROPPING!\n", t->mid);
return GNUNET_OK;
}
#if MESH_DEBUG
else
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "MESH: mid %u not seen yet, forwarding\n",
- ntohl (msg->mid));
+ "MESH: mid %u not seen yet, forwarding\n", ntohl (msg->mid));
}
#endif
t->mid = ntohl (msg->mid);
@@ -2960,15 +2957,12 @@ handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer,
send_subscribed_clients (message, &msg[1].header);
}
#if MESH_DEBUG
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "MESH: ttl: %u\n",
- ntohl (msg->ttl));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: ttl: %u\n", ntohl (msg->ttl));
#endif
if (ntohl (msg->ttl) == 0)
{
/* FIXME: ttl is 0, log dropping */
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "MESH: TTL is 0, DROPPING!\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "MESH: TTL is 0, DROPPING!\n");
return GNUNET_OK;
}
tunnel_send_multicast (t, message);
@@ -3097,11 +3091,11 @@ handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
peer_info = peer_info_get (&msg->peer_id);
/* Add paths to peers? */
- p = tree_get_path_to_peer(t->tree, peer_info->id);
+ p = tree_get_path_to_peer (t->tree, peer_info->id);
if (NULL != p)
{
path_add_to_peers (p, GNUNET_YES);
- path_destroy(p);
+ path_destroy (p);
}
else
{
@@ -3122,7 +3116,7 @@ handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
GNUNET_DHT_get_stop (t->dht_get_type);
t->dht_get_type = NULL;
}
- if (tree_get_status(t->tree, peer_info->id) != MESH_PEER_READY)
+ if (tree_get_status (t->tree, peer_info->id) != MESH_PEER_READY)
{
tree_set_status (t->tree, peer_info->id, MESH_PEER_READY);
send_client_peer_connected (t, peer_info->id);
@@ -3308,7 +3302,7 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
p = path_build_from_dht (get_path, get_path_length, put_path,
put_path_length);
- path_add_to_peers(p, GNUNET_NO);
+ path_add_to_peers (p, GNUNET_NO);
for (i = 0; i < path_info->peer->ntunnels; i++)
{
tunnel_add_peer (path_info->peer->tunnels[i], path_info->peer);
@@ -3362,7 +3356,7 @@ dht_get_type_handler (void *cls, struct GNUNET_TIME_Absolute exp,
p = path_build_from_dht (get_path, get_path_length, put_path,
put_path_length);
- path_add_to_peers(p, GNUNET_NO);
+ path_add_to_peers (p, GNUNET_NO);
tunnel_add_peer (t, peer_info);
peer_info_connect (peer_info, t);
}
diff --git a/src/mesh/mesh_tunnel_tree.c b/src/mesh/mesh_tunnel_tree.c
index 7b04385bc..a7577e36f 100644
--- a/src/mesh/mesh_tunnel_tree.c
+++ b/src/mesh/mesh_tunnel_tree.c
@@ -992,7 +992,7 @@ tree_del_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer,
*
* @return Number of hops to reach destination, UINT_MAX in case the peer is not
* in the path.
- *
+ *
* TODO: adapt to allow any start / root combination
* TODO: take in account state of the nodes
*/
diff --git a/src/mesh/test_mesh_2dtorus.c b/src/mesh/test_mesh_2dtorus.c
index 718ab0864..6d91185cc 100644
--- a/src/mesh/test_mesh_2dtorus.c
+++ b/src/mesh/test_mesh_2dtorus.c
@@ -104,8 +104,7 @@ shutdown_callback (void *cls, const char *emsg)
if (emsg != NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "test: Shutdown of peers failed! (%s)\n",
- emsg);
+ "test: Shutdown of peers failed! (%s)\n", emsg);
ok--;
}
#if VERBOSE
@@ -122,8 +121,7 @@ static void
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Ending test.\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Ending test.\n");
#endif
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
@@ -134,8 +132,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
static void
disconnect_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: disconnecting peers\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: disconnecting peers\n");
if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle)
{
@@ -162,33 +159,26 @@ topo_cb (void *cls, const struct GNUNET_PeerIdentity *first,
topo_connections++;
if (NULL != emsg)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "test: Error by topo %u: %s\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: Error by topo %u: %s\n",
topo_connections, emsg);
}
else
{
if (first == NULL || second == NULL)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Connection %u NULL\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Connection %u NULL\n",
topo_connections);
if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
{
GNUNET_SCHEDULER_cancel (disconnect_task);
- GNUNET_SCHEDULER_add_now(&disconnect_peers, NULL);
+ GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL);
}
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Connection %u ok\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Connection %u ok\n",
topo_connections);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: %s\n",
- GNUNET_i2s (first));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: %s\n",
- GNUNET_i2s (second));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: %s\n", GNUNET_i2s (first));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: %s\n", GNUNET_i2s (second));
}
}
@@ -205,8 +195,8 @@ peergroup_ready (void *cls, const char *emsg)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"test: Peergroup callback called with error, aborting test!\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Error from testing: `%s'\n", emsg);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Error from testing: `%s'\n",
+ emsg);
ok--;
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
return;
@@ -216,8 +206,7 @@ peergroup_ready (void *cls, const char *emsg)
"************************************************************\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"test: Peer Group started successfully!\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Have %u connections\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Have %u connections\n",
total_connections);
#endif
@@ -225,8 +214,7 @@ peergroup_ready (void *cls, const char *emsg)
if (0 < failed_connections)
{
ok = GNUNET_SYSERR;
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "test: %u connections have FAILED!\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "test: %u connections have FAILED!\n",
failed_connections);
disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL);
@@ -272,12 +260,9 @@ connect_cb (void *cls, const struct GNUNET_PeerIdentity *first,
{
failed_connections++;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Problem with new connection (%s)\n",
- emsg);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n",
- GNUNET_i2s (first));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n",
- GNUNET_i2s (second));
+ "test: Problem with new connection (%s)\n", emsg);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n", GNUNET_i2s (first));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n", GNUNET_i2s (second));
}
}
@@ -310,8 +295,7 @@ run (void *cls, char *const *args, const char *cfgfile,
NULL);
#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Starting daemons.\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Starting daemons.\n");
GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing",
"use_progressbars", "YES");
#endif
@@ -369,16 +353,14 @@ main (int argc, char *argv[])
GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
- "test_mesh_2dtorus",
- gettext_noop ("Test mesh 2d torus."), options,
- &run, NULL);
+ "test_mesh_2dtorus", gettext_noop ("Test mesh 2d torus."),
+ options, &run, NULL);
#if REMOVE_DIR
GNUNET_DISK_directory_remove ("/tmp/test_mesh_2dtorus");
#endif
if (GNUNET_OK != ok)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "test: FAILED!\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: FAILED!\n");
return 1;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: success\n");
diff --git a/src/mesh/test_mesh_small.c b/src/mesh/test_mesh_small.c
index 5a83994f3..f273b04ab 100644
--- a/src/mesh/test_mesh_small.c
+++ b/src/mesh/test_mesh_small.c
@@ -767,7 +767,7 @@ run (void *cls, char *const *args, const char *cfgfile,
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (testing_cfg, "test_mesh_small",
- "WAIT_TIME", &wait_time))
+ "WAIT_TIME", &wait_time))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Option test_mesh_small:wait_time is required!\n");
diff --git a/src/mesh/test_mesh_small_unicast_far.c b/src/mesh/test_mesh_small_unicast_far.c
index 1708e96cd..ed65da2e4 100644
--- a/src/mesh/test_mesh_small_unicast_far.c
+++ b/src/mesh/test_mesh_small_unicast_far.c
@@ -480,7 +480,7 @@ run (void *cls, char *const *args, const char *cfgfile,
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (testing_cfg, "test_mesh_small",
- "WAIT_TIME", &wait_time))
+ "WAIT_TIME", &wait_time))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Option test_mesh_small:wait_time is required!\n");
diff --git a/src/mesh/test_mesh_tree_api.c b/src/mesh/test_mesh_tree_api.c
index ec92a5ece..60e31bdde 100644
--- a/src/mesh/test_mesh_tree_api.c
+++ b/src/mesh/test_mesh_tree_api.c
@@ -78,16 +78,15 @@ test_assert (GNUNET_PEER_Id peer_id, enum MeshPeerState status,
if (n->peer != peer_id)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Retrieved peer has wrong ID! (Got %u, expected %u)\n",
- n->peer, peer_id);
+ "Retrieved peer has wrong ID! (Got %u, expected %u)\n", n->peer,
+ peer_id);
failed++;
}
if (n->status != status)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Retrieved peer has wrong status! (Got %u, expected %u)\n",
- n->status,
- status);
+ n->status, status);
failed++;
}
for (c = n->children_head, i = 0; NULL != c; c = c->next, i++) ;
@@ -101,7 +100,8 @@ test_assert (GNUNET_PEER_Id peer_id, enum MeshPeerState status,
if (0 != first_hop &&
GNUNET_PEER_search (tree_get_first_hop (tree, peer_id)) != first_hop)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Wrong first hop! (Got %u, expected %u)\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Wrong first hop! (Got %u, expected %u)\n",
GNUNET_PEER_search (tree_get_first_hop (tree, peer_id)),
first_hop);
failed++;
@@ -112,8 +112,8 @@ test_assert (GNUNET_PEER_Id peer_id, enum MeshPeerState status,
GNUNET_PEER_resolve (peer_id, &id);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "*** Peer %s (%u) has failed %d checks!\n",
- GNUNET_i2s (&id), peer_id, failed - pre_failed);
+ "*** Peer %s (%u) has failed %d checks!\n", GNUNET_i2s (&id),
+ peer_id, failed - pre_failed);
}
}
@@ -219,41 +219,34 @@ main (int argc, char *argv[])
for (i = 1; i < 5; i++)
{
path->length = i;
- if (tree_get_path_cost(tree, path) != 0)
+ if (tree_get_path_cost (tree, path) != 0)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "test: length %u cost failed!\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: length %u cost failed!\n",
i);
failed++;
}
}
path->length++;
path->peers[4] = 6;
- if (tree_get_path_cost(tree, path) != 1)
+ if (tree_get_path_cost (tree, path) != 1)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "test: length %u cost failed!\n",
- i);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: length %u cost failed!\n", i);
failed++;
}
path->peers[3] = 7;
- if (tree_get_path_cost(tree, path) != 2)
+ if (tree_get_path_cost (tree, path) != 2)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "test: length %u cost failed!\n",
- i);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: length %u cost failed!\n", i);
failed++;
}
path->length--;
- if (tree_get_path_cost(tree, path) != 1)
+ if (tree_get_path_cost (tree, path) != 1)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "test: length %u cost failed!\n",
- i);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: length %u cost failed!\n", i);
failed++;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Deleting third path (5)\n");
- tree_set_status(tree, 5, MESH_PEER_READY);
+ tree_set_status (tree, 5, MESH_PEER_READY);
cb_call = 1;
node = tree_del_path (tree, 5, &cb, NULL);
tree_debug (tree);
diff --git a/src/nat/nat.c b/src/nat/nat.c
index e199bf2b0..9f8fec9a0 100644
--- a/src/nat/nat.c
+++ b/src/nat/nat.c
@@ -635,12 +635,10 @@ process_hostname_ip (void *cls, const struct sockaddr *addr, socklen_t addrlen)
* @return GNUNET_OK to continue iterating
*/
static int
-process_interfaces(void *cls, const char *name,
- int isDefault,
- const struct sockaddr * addr,
- const struct sockaddr * broadcast_addr,
- const struct sockaddr * netmask,
- socklen_t addrlen)
+process_interfaces (void *cls, const char *name, int isDefault,
+ const struct sockaddr *addr,
+ const struct sockaddr *broadcast_addr,
+ const struct sockaddr *netmask, socklen_t addrlen)
{
struct GNUNET_NAT_Handle *h = cls;
const struct sockaddr_in *s4;
@@ -655,7 +653,7 @@ process_interfaces(void *cls, const char *name,
ip = &s4->sin_addr;
/* Check if address is in 127.0.0.0/8 */
- uint32_t address = ntohl ((uint32_t)(s4->sin_addr.s_addr));
+ uint32_t address = ntohl ((uint32_t) (s4->sin_addr.s_addr));
uint32_t value = (address & 0xFF000000) ^ 0x7F000000;
if ((h->return_localaddress == GNUNET_NO) && (value == 0))
diff --git a/src/nat/test_nat.c b/src/nat/test_nat.c
index f7f64ce03..f81f00f6b 100644
--- a/src/nat/test_nat.c
+++ b/src/nat/test_nat.c
@@ -97,12 +97,9 @@ struct addr_cls
* @return GNUNET_OK to continue iterating
*/
static int
-process_if (void *cls, const char *name,
- int isDefault,
- const struct sockaddr * addr,
- const struct sockaddr * broadcast_addr,
- const struct sockaddr * netmask,
- socklen_t addrlen)
+process_if (void *cls, const char *name, int isDefault,
+ const struct sockaddr *addr, const struct sockaddr *broadcast_addr,
+ const struct sockaddr *netmask, socklen_t addrlen)
{
struct addr_cls *data = cls;
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c
index 115d7b417..32f650feb 100644
--- a/src/nse/gnunet-nse-profiler.c
+++ b/src/nse/gnunet-nse-profiler.c
@@ -556,7 +556,7 @@ run (void *cls, char *const *args, const char *cfgfile,
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (testing_cfg, "nse-profiler",
- "WAIT_TIME", &wait_time))
+ "WAIT_TIME", &wait_time))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Option nse-profiler:wait_time is required!\n");
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index 23144b346..86b75c9c9 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -305,6 +305,7 @@ setup_estimate_message (struct GNUNET_NSE_ClientMessage *em)
double variance;
double val;
double nsize;
+
#define WEST 1
/* Weighted incremental algorithm for stddev according to West (1979) */
#if WEST
@@ -353,13 +354,13 @@ setup_estimate_message (struct GNUNET_NSE_ClientMessage *em)
if (0 != estimate_count)
{
mean = sum / estimate_count;
- variance = (vsq - mean * sum) / (estimate_count - 1.0); // terrible for numerical stability...
+ variance = (vsq - mean * sum) / (estimate_count - 1.0); // terrible for numerical stability...
}
#endif
if (variance >= 0)
std_dev = sqrt (variance);
else
- std_dev = variance; /* must be infinity due to estimate_count == 0 */
+ std_dev = variance; /* must be infinity due to estimate_count == 0 */
current_std_dev = std_dev;
current_size_estimate = mean;
@@ -564,8 +565,8 @@ transmit_ready (void *cls, size_t size, void *buf)
GNUNET_SCHEDULER_add_delayed (get_transmit_delay (0), &transmit_task,
peer_entry);
}
- if ( (ntohl (size_estimate_messages[idx].hop_count) == 0) &&
- (GNUNET_SCHEDULER_NO_TASK != proof_task) )
+ if ((ntohl (size_estimate_messages[idx].hop_count) == 0) &&
+ (GNUNET_SCHEDULER_NO_TASK != proof_task))
{
GNUNET_STATISTICS_update (stats,
"# flood messages not generated (no proof yet)",
@@ -667,8 +668,8 @@ setup_flood_message (unsigned int slot, struct GNUNET_TIME_Absolute ts)
fm->proof_of_work = my_proof;
if (nse_work_required > 0)
GNUNET_assert (GNUNET_OK ==
- GNUNET_CRYPTO_rsa_sign (my_private_key, &fm->purpose,
- &fm->signature));
+ GNUNET_CRYPTO_rsa_sign (my_private_key, &fm->purpose,
+ &fm->signature));
else
memset (&fm->signature, 0, sizeof (fm->signature));
}
@@ -905,12 +906,12 @@ verify_message_crypto (const struct GNUNET_NSE_FloodMessage *incoming_flood)
GNUNET_break_op (0);
return GNUNET_NO;
}
- if ( (nse_work_required > 0) &&
- (GNUNET_OK !=
- GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_NSE_SEND,
- &incoming_flood->purpose,
- &incoming_flood->signature,
- &incoming_flood->pkey)) )
+ if ((nse_work_required > 0) &&
+ (GNUNET_OK !=
+ GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_NSE_SEND,
+ &incoming_flood->purpose,
+ &incoming_flood->signature,
+ &incoming_flood->pkey)))
{
GNUNET_break_op (0);
return GNUNET_NO;
@@ -1139,8 +1140,9 @@ handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
peer_entry = GNUNET_malloc (sizeof (struct NSEPeerEntry));
peer_entry->id = *peer;
GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_put (peers, &peer->hashPubKey, peer_entry,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+ GNUNET_CONTAINER_multihashmap_put (peers, &peer->hashPubKey,
+ peer_entry,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
peer_entry->transmit_task =
GNUNET_SCHEDULER_add_delayed (get_transmit_delay (-1), &transmit_task,
peer_entry);
@@ -1267,14 +1269,14 @@ core_init (void *cls, struct GNUNET_CORE_Handle *server,
(now.abs_value / gnunet_nse_interval.rel_value) *
gnunet_nse_interval.rel_value;
next_timestamp.abs_value =
- current_timestamp.abs_value + gnunet_nse_interval.rel_value;
+ current_timestamp.abs_value + gnunet_nse_interval.rel_value;
estimate_index = HISTORY_SIZE - 1;
estimate_count = 0;
- if (GNUNET_YES == check_proof_of_work (&my_public_key,
- my_proof))
+ if (GNUNET_YES == check_proof_of_work (&my_public_key, my_proof))
{
prev_time.abs_value =
- current_timestamp.abs_value - (estimate_index - 1) * gnunet_nse_interval.rel_value;
+ current_timestamp.abs_value - (estimate_index -
+ 1) * gnunet_nse_interval.rel_value;
setup_flood_message (estimate_index, prev_time);
estimate_count++;
}
@@ -1386,8 +1388,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
nc = GNUNET_SERVER_notification_context_create (server, 1);
/* Connect to core service and register core handlers */
coreAPI = GNUNET_CORE_connect (cfg, /* Main configuration */
- 1,
- NULL, /* Closure passed to functions */
+ 1, NULL, /* Closure passed to functions */
&core_init, /* Call core_init once connected */
&handle_core_connect, /* Handle connects */
&handle_core_disconnect, /* Handle disconnects */
diff --git a/src/nse/nse_api.c b/src/nse/nse_api.c
index e32c08e4b..db5e9d117 100644
--- a/src/nse/nse_api.c
+++ b/src/nse/nse_api.c
@@ -105,7 +105,7 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
if (msg == NULL)
{
- /* Error, timeout, death */
+ /* Error, timeout, death */
GNUNET_CLIENT_disconnect (h->client, GNUNET_NO);
h->client = NULL;
h->reconnect_task =
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c
index d54eb1081..337a9b2ab 100644
--- a/src/peerinfo-tool/gnunet-peerinfo.c
+++ b/src/peerinfo-tool/gnunet-peerinfo.c
@@ -101,8 +101,7 @@ process_resolved_address (void *cls, const char *address)
* @return GNUNET_OK to keep the address and continue
*/
static int
-count_address (void *cls,
- const struct GNUNET_HELLO_Address *address,
+count_address (void *cls, const struct GNUNET_HELLO_Address *address,
struct GNUNET_TIME_Absolute expiration)
{
struct PrintContext *pc = cls;
@@ -121,17 +120,15 @@ count_address (void *cls,
* @return GNUNET_OK to keep the address and continue
*/
static int
-print_address (void *cls,
- const struct GNUNET_HELLO_Address *address,
+print_address (void *cls, const struct GNUNET_HELLO_Address *address,
struct GNUNET_TIME_Absolute expiration)
{
struct PrintContext *pc = cls;
- GNUNET_TRANSPORT_address_to_string (cfg,
- address,
- no_resolve,
- GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 10),
- &process_resolved_address, pc);
+
+ GNUNET_TRANSPORT_address_to_string (cfg, address, no_resolve,
+ GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS, 10),
+ &process_resolved_address, pc);
return GNUNET_OK;
}
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c
index fc7cc781f..799fdc6d8 100644
--- a/src/peerinfo/gnunet-service-peerinfo.c
+++ b/src/peerinfo/gnunet-service-peerinfo.c
@@ -122,8 +122,7 @@ make_info_message (const struct HostEntry *he)
* @return GNUNET_NO if expiration smaller than the current time
*/
static int
-discard_expired (void *cls,
- const struct GNUNET_HELLO_Address *address,
+discard_expired (void *cls, const struct GNUNET_HELLO_Address *address,
struct GNUNET_TIME_Absolute expiration)
{
const struct GNUNET_TIME_Absolute *now = cls;
@@ -131,8 +130,8 @@ discard_expired (void *cls,
if (now->abs_value > expiration.abs_value)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Removing expired address of transport `%s'\n"),
- address->transport_name);
+ _("Removing expired address of transport `%s'\n"),
+ address->transport_name);
return GNUNET_NO;
}
return GNUNET_OK;
diff --git a/src/peerinfo/perf_peerinfo_api.c b/src/peerinfo/perf_peerinfo_api.c
index c4e6dcc12..38bbb828f 100755
--- a/src/peerinfo/perf_peerinfo_api.c
+++ b/src/peerinfo/perf_peerinfo_api.c
@@ -50,8 +50,8 @@ static struct GNUNET_PeerIdentity pid;
static int
-check_it (void *cls,
- const struct GNUNET_HELLO_Address *address, struct GNUNET_TIME_Absolute expiration)
+check_it (void *cls, const struct GNUNET_HELLO_Address *address,
+ struct GNUNET_TIME_Absolute expiration)
{
#if DEBUG
if (addrlen > 0)
@@ -80,7 +80,7 @@ address_generator (void *cls, size_t max, void *buf)
address.address = caddress;
address.transport_name = "peerinfotest";
ret =
- GNUNET_HELLO_add_address (&address,
+ GNUNET_HELLO_add_address (&address,
GNUNET_TIME_relative_to_absolute
(GNUNET_TIME_UNIT_HOURS), buf, max);
GNUNET_free (caddress);
diff --git a/src/peerinfo/test_peerinfo_api.c b/src/peerinfo/test_peerinfo_api.c
index 607c1fa4e..fbd12c387 100644
--- a/src/peerinfo/test_peerinfo_api.c
+++ b/src/peerinfo/test_peerinfo_api.c
@@ -45,16 +45,17 @@ static struct GNUNET_PEERINFO_Handle *h;
static unsigned int retries;
static int
-check_it (void *cls,
- const struct GNUNET_HELLO_Address *address,
- struct GNUNET_TIME_Absolute expiration)
+check_it (void *cls, const struct GNUNET_HELLO_Address *address,
+ struct GNUNET_TIME_Absolute expiration)
{
unsigned int *agc = cls;
if (address != NULL)
{
GNUNET_assert (0 == strcmp ("peerinfotest", address->transport_name));
- GNUNET_assert (0 == strncmp ("Address", address->address, address->address_length));
+ GNUNET_assert (0 ==
+ strncmp ("Address", address->address,
+ address->address_length));
(*agc) -= (1 << (address->address_length - 1));
}
return GNUNET_OK;
@@ -75,10 +76,9 @@ address_generator (void *cls, size_t max, void *buf)
address.transport_name = "peerinfotest";
address.address_length = *agc;
ret =
- GNUNET_HELLO_add_address (&address,
- GNUNET_TIME_relative_to_absolute
- (GNUNET_TIME_UNIT_HOURS), buf,
- max);
+ GNUNET_HELLO_add_address (&address,
+ GNUNET_TIME_relative_to_absolute
+ (GNUNET_TIME_UNIT_HOURS), buf, max);
(*agc)--;
return ret;
}
diff --git a/src/testing/test_testing_2dtorus.c b/src/testing/test_testing_2dtorus.c
index f1ddff0ea..7b109bca4 100644
--- a/src/testing/test_testing_2dtorus.c
+++ b/src/testing/test_testing_2dtorus.c
@@ -104,8 +104,7 @@ shutdown_callback (void *cls, const char *emsg)
if (emsg != NULL)
{
#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Shutdown of peers failed!\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Shutdown of peers failed!\n");
#endif
ok--;
}
@@ -123,8 +122,7 @@ static void
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Ending test.\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Ending test.\n");
#endif
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
@@ -135,8 +133,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
static void
disconnect_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: disconnecting peers\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: disconnecting peers\n");
if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle)
{
@@ -163,33 +160,26 @@ topo_cb (void *cls, const struct GNUNET_PeerIdentity *first,
topo_connections++;
if (NULL != emsg)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "test: Error by topo %u: %s\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: Error by topo %u: %s\n",
topo_connections, emsg);
}
else
{
if (first == NULL || second == NULL)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Connection %u NULL\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Connection %u NULL\n",
topo_connections);
if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
{
GNUNET_SCHEDULER_cancel (disconnect_task);
- GNUNET_SCHEDULER_add_now(&disconnect_peers, NULL);
+ GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL);
}
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Connection %u ok\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Connection %u ok\n",
topo_connections);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: %s\n",
- GNUNET_i2s (first));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: %s\n",
- GNUNET_i2s (second));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: %s\n", GNUNET_i2s (first));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: %s\n", GNUNET_i2s (second));
}
}
@@ -206,8 +196,8 @@ peergroup_ready (void *cls, const char *emsg)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"test: Peergroup callback called with error, aborting test!\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Error from testing: `%s'\n", emsg);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Error from testing: `%s'\n",
+ emsg);
ok--;
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
return;
@@ -217,8 +207,7 @@ peergroup_ready (void *cls, const char *emsg)
"************************************************************\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"test: Peer Group started successfully!\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Have %u connections\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Have %u connections\n",
total_connections);
#endif
@@ -226,8 +215,7 @@ peergroup_ready (void *cls, const char *emsg)
if (0 < failed_connections)
{
ok = GNUNET_SYSERR;
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "test: %u connections have FAILED!\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "test: %u connections have FAILED!\n",
failed_connections);
disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL);
@@ -273,12 +261,9 @@ connect_cb (void *cls, const struct GNUNET_PeerIdentity *first,
{
failed_connections++;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Problem with new connection (%s)\n",
- emsg);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n",
- GNUNET_i2s (first));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n",
- GNUNET_i2s (second));
+ "test: Problem with new connection (%s)\n", emsg);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n", GNUNET_i2s (first));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n", GNUNET_i2s (second));
}
}
@@ -311,8 +296,7 @@ run (void *cls, char *const *args, const char *cfgfile,
NULL);
#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Starting daemons.\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Starting daemons.\n");
GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing",
"use_progressbars", "YES");
#endif
@@ -371,15 +355,14 @@ main (int argc, char *argv[])
GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
"test_testing_2dtorus",
- gettext_noop ("Test testing 2d torus."), options,
- &run, NULL);
+ gettext_noop ("Test testing 2d torus."), options, &run,
+ NULL);
#if REMOVE_DIR
GNUNET_DISK_directory_remove ("/tmp/test_testing_2dtorus");
#endif
if (GNUNET_OK != ok)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "test: FAILED!\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: FAILED!\n");
return 1;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: success\n");
diff --git a/src/testing/test_testing_large_topology.c b/src/testing/test_testing_large_topology.c
index a27154507..08b1df5b9 100644
--- a/src/testing/test_testing_large_topology.c
+++ b/src/testing/test_testing_large_topology.c
@@ -1045,7 +1045,7 @@ run (void *cls, char *const *args, const char *cfgfile,
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "SETTLE_TIME",
- &settle_time))
+ &settle_time))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
"testing", "SETTLE_TIME");
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c
index ba092220a..f60ac3a1a 100644
--- a/src/testing/test_testing_topology.c
+++ b/src/testing/test_testing_topology.c
@@ -1102,7 +1102,7 @@ run (void *cls, char *const *args, const char *cfgfile,
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "SETTLE_TIME",
- &settle_time))
+ &settle_time))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
"testing", "SETTLE_TIME");
@@ -1111,7 +1111,7 @@ run (void *cls, char *const *args, const char *cfgfile,
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "CONNECT_TIMEOUT",
- &connect_timeout))
+ &connect_timeout))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
"testing", "CONNECT_TIMEOUT");
diff --git a/src/testing/test_testing_topology_blacklist.c b/src/testing/test_testing_topology_blacklist.c
index d53fc8cbe..d45d1bbb4 100644
--- a/src/testing/test_testing_topology_blacklist.c
+++ b/src/testing/test_testing_topology_blacklist.c
@@ -486,7 +486,7 @@ run (void *cls, char *const *args, const char *cfgfile,
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "CONNECT_TIMEOUT",
- &connect_timeout))
+ &connect_timeout))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
"testing", "CONNECT_TIMEOUT");
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 9ba58de61..d7f6946b0 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -65,8 +65,7 @@ static struct GNUNET_CORE_MessageHandler no_handlers[] = { {NULL, 0, 0} };
#if EMPTY_HACK
static int
-test_address (void *cls,
- const struct GNUNET_HELLO_Address *address,
+test_address (void *cls, const struct GNUNET_HELLO_Address *address,
struct GNUNET_TIME_Absolute expiration)
{
int *empty = cls;
@@ -108,7 +107,7 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message)
#endif
GNUNET_assert (daemon->phase == SP_GET_HELLO ||
daemon->phase == SP_START_DONE);
- daemon->cb = NULL; // FIXME: why??? (see fsm:SP_START_CORE, notify_daemon_started)
+ daemon->cb = NULL; // FIXME: why??? (see fsm:SP_START_CORE, notify_daemon_started)
if (daemon->task != GNUNET_SCHEDULER_NO_TASK) /* Assertion here instead? */
GNUNET_SCHEDULER_cancel (daemon->task);
@@ -551,9 +550,9 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
GNUNET_free_non_null (d->username);
GNUNET_free (d->proc);
// GNUNET_free (d); // FIXME (could this leak)
- d->hostname = NULL; // Quick hack to avoid crashing (testing need to be
- d->cfg = NULL; // overhauled anyway, and the error managing is
- // pretty broken anyway.
+ d->hostname = NULL; // Quick hack to avoid crashing (testing need to be
+ d->cfg = NULL; // overhauled anyway, and the error managing is
+ // pretty broken anyway.
return;
}
/* wait some more */
@@ -2037,8 +2036,7 @@ reattempt_daemons_connect (void *cls,
if (NULL != ctx->d2->hello)
{
#if DEBUG_TESTING_RECONNECT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "updating %s's HELLO\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "updating %s's HELLO\n",
ctx->d2->shortname);
#endif
GNUNET_free (ctx->d2->hello);
@@ -2059,8 +2057,7 @@ reattempt_daemons_connect (void *cls,
#if DEBUG_TESTING_RECONNECT
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "didn't have %s's HELLO\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "didn't have %s's HELLO\n",
ctx->d2->shortname);
}
#endif
@@ -2103,8 +2100,7 @@ reattempt_daemons_connect (void *cls,
if (ctx->send_hello == GNUNET_YES)
{
#if DEBUG_TESTING_RECONNECT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending %s's HELLO to %s\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending %s's HELLO to %s\n",
ctx->d1->shortname, ctx->d2->shortname);
#endif
ctx->d1th =
@@ -2126,8 +2122,7 @@ reattempt_daemons_connect (void *cls,
else
{
#if DEBUG_TESTING_RECONNECT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Trying to reconnect %s to %s\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to reconnect %s to %s\n",
ctx->d1->shortname, ctx->d2->shortname);
#endif
GNUNET_TRANSPORT_try_connect (ctx->d1th, &ctx->d2->id);
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c
index f22bb2bff..26aac5e7c 100644
--- a/src/testing/testing_group.c
+++ b/src/testing/testing_group.c
@@ -5554,7 +5554,7 @@ internal_startup_callback (void *cls, const struct GNUNET_PeerIdentity *id,
* Calls GNUNET_TESTING_daemon_continue_startup to set the daemon's state
* from HOSTKEY_CREATED to TOPOLOGY_SETUP. Makes sure not to saturate a host
* with requests delaying them when needed.
- *
+ *
* @param cls closure: internal context of the daemon.
* @param tc TaskContext
*/
@@ -5563,6 +5563,7 @@ internal_continue_startup (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct InternalStartContext *internal_context = cls;
+
internal_context->peer->startup_task = GNUNET_SCHEDULER_NO_TASK;
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
@@ -5586,9 +5587,11 @@ internal_continue_startup (void *cls,
}
else
{
- internal_context->peer->startup_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_MILLISECONDS, 100),
- &internal_continue_startup, internal_context);
+ internal_context->peer->startup_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_MILLISECONDS, 100),
+ &internal_continue_startup,
+ internal_context);
}
}
@@ -5894,16 +5897,18 @@ GNUNET_TESTING_daemons_continue_startup (struct GNUNET_TESTING_PeerGroup *pg)
pg->starting = 0;
for (i = 0; i < pg->total; i++)
{
- pg->peers[i].startup_task = GNUNET_SCHEDULER_add_now (&internal_continue_startup,
- &pg->peers[i].internal_context);
+ pg->peers[i].startup_task =
+ GNUNET_SCHEDULER_add_now (&internal_continue_startup,
+ &pg->peers[i].internal_context);
}
}
#else
pg->starting = 0;
for (i = 0; i < pg->total; i++)
{
- pg->peers[i].startup_task = GNUNET_SCHEDULER_add_now (&internal_continue_startup,
- &pg->peers[i].internal_context);
+ pg->peers[i].startup_task =
+ GNUNET_SCHEDULER_add_now (&internal_continue_startup,
+ &pg->peers[i].internal_context);
}
#endif
}
diff --git a/src/testing/testing_peergroup.c b/src/testing/testing_peergroup.c
index aee9b8a50..1d9d3ba88 100644
--- a/src/testing/testing_peergroup.c
+++ b/src/testing/testing_peergroup.c
@@ -46,7 +46,7 @@ struct PeerGroupStartupContext
unsigned int total;
unsigned int peers_left;
unsigned long long max_concurrent_connections;
-
+
/**
* Maximum attemps to connect two daemons.
*/
@@ -56,7 +56,7 @@ struct PeerGroupStartupContext
* How long to spend trying to establish all the connections?
*/
struct GNUNET_TIME_Relative connect_timeout;
-
+
unsigned long long max_concurrent_ssh;
struct GNUNET_TIME_Absolute timeout;
GNUNET_TESTING_NotifyConnection connect_cb;
@@ -508,7 +508,7 @@ internal_peers_started_callback (void *cls,
pg_start_ctx->connect_topology,
pg_start_ctx->connect_topology_option,
pg_start_ctx->connect_topology_option_modifier,
- pg_start_ctx->connect_timeout,
+ pg_start_ctx->connect_timeout,
pg_start_ctx->connect_attempts, NULL,
NULL);
@@ -755,9 +755,9 @@ GNUNET_TESTING_peergroup_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "CONNECT_TIMEOUT",
- &pg_start_ctx->connect_timeout))
+ &pg_start_ctx->connect_timeout))
{
- pg_start_ctx->connect_timeout = DEFAULT_CONNECT_TIMEOUT;
+ pg_start_ctx->connect_timeout = DEFAULT_CONNECT_TIMEOUT;
}
if (GNUNET_OK !=
@@ -794,17 +794,15 @@ GNUNET_TESTING_peergroup_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
}
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_time (cfg, "testing",
- "PEERGROUP_TIMEOUT",
- &rtimeout))
+ GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "PEERGROUP_TIMEOUT",
+ &rtimeout))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
"testing", "PEERGROUP_TIMEOUT");
GNUNET_free (pg_start_ctx);
return NULL;
}
- pg_start_ctx->timeout =
- GNUNET_TIME_relative_to_absolute (rtimeout);
+ pg_start_ctx->timeout = GNUNET_TIME_relative_to_absolute (rtimeout);
/* Read topology related options from the configuration file */
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index b148f289b..d4d8828d0 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -90,7 +90,7 @@ static void
transmit_our_hello (void *cls, const struct GNUNET_PeerIdentity *target,
const struct GNUNET_ATS_Information *ats,
uint32_t ats_count,
- const struct GNUNET_HELLO_Address *address)
+ const struct GNUNET_HELLO_Address *address)
{
const struct GNUNET_MessageHeader *hello = cls;
@@ -136,7 +136,7 @@ process_payload (const struct GNUNET_PeerIdentity *peer,
size_t msg_size = ntohs (message->size);
size_t size =
sizeof (struct InboundMessage) + msg_size +
- sizeof (struct GNUNET_ATS_Information) * (ats_count + 1);
+ sizeof (struct GNUNET_ATS_Information) * (ats_count + 1);
char buf[size];
struct GNUNET_ATS_Information *ap;
@@ -168,10 +168,11 @@ process_payload (const struct GNUNET_PeerIdentity *peer,
ap = (struct GNUNET_ATS_Information *) &im[1];
memcpy (ap, ats, ats_count * sizeof (struct GNUNET_ATS_Information));
ap[ats_count].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
- ap[ats_count].value = htonl ((uint32_t) GST_neighbour_get_latency (peer).rel_value);
+ ap[ats_count].value =
+ htonl ((uint32_t) GST_neighbour_get_latency (peer).rel_value);
memcpy (&ap[ats_count + 1], message, ntohs (message->size));
- GNUNET_ATS_address_update (GST_ats, address, session, ap, ats_count +1 );
+ GNUNET_ATS_address_update (GST_ats, address, session, ap, ats_count + 1);
GST_clients_broadcast (&im->header, GNUNET_YES);
return ret;
@@ -202,8 +203,7 @@ process_payload (const struct GNUNET_PeerIdentity *peer,
* (plugins that do not support this, can ignore the return value)
*/
static struct GNUNET_TIME_Relative
-plugin_env_receive_callback (void *cls,
- const struct GNUNET_PeerIdentity *peer,
+plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
const struct GNUNET_ATS_Information *ats,
uint32_t ats_count, struct Session *session,
@@ -237,8 +237,8 @@ plugin_env_receive_callback (void *cls,
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
"Processing `%s' from `%s'\n", "PING",
- (sender_address != NULL) ? GST_plugins_a2s (&address)
- : "<inbound>");
+ (sender_address !=
+ NULL) ? GST_plugins_a2s (&address) : "<inbound>");
#endif
GST_validation_handle_ping (peer, message, &address, session);
break;
@@ -246,20 +246,22 @@ plugin_env_receive_callback (void *cls,
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
"Processing `%s' from `%s'\n", "PONG",
- (sender_address != NULL) ? GST_plugins_a2s (&address)
- : "<inbound>");
+ (sender_address !=
+ NULL) ? GST_plugins_a2s (&address) : "<inbound>");
#endif
GST_validation_handle_pong (peer, message);
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT:
- GST_neighbours_handle_connect (message, peer, &address, session, ats, ats_count);
+ GST_neighbours_handle_connect (message, peer, &address, session, ats,
+ ats_count);
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT_ACK:
- GST_neighbours_handle_connect_ack (message, peer, &address,
- session, ats, ats_count);
+ GST_neighbours_handle_connect_ack (message, peer, &address, session, ats,
+ ats_count);
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_ACK:
- GST_neighbours_handle_ack (message, peer, &address, session, ats, ats_count);
+ GST_neighbours_handle_ack (message, peer, &address, session, ats,
+ ats_count);
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT:
GST_neighbours_handle_disconnect_message (peer, message);
@@ -336,7 +338,7 @@ plugin_env_session_end (void *cls, const struct GNUNET_PeerIdentity *peer,
const char *transport_name = cls;
struct GNUNET_HELLO_Address address;
- GNUNET_assert (strlen(transport_name) > 0);
+ GNUNET_assert (strlen (transport_name) > 0);
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Session %X to peer `%s' ended \n",
session, GNUNET_i2s (peer));
@@ -369,8 +371,8 @@ plugin_env_session_end (void *cls, const struct GNUNET_PeerIdentity *peer,
* @param bandwidth_in assigned inbound bandwidth for the connection, 0 to disconnect from peer
*/
static void
-ats_request_address_change (void *cls,
- const struct GNUNET_HELLO_Address *address,
+ats_request_address_change (void *cls,
+ const struct GNUNET_HELLO_Address *address,
struct Session *session,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
@@ -392,8 +394,7 @@ ats_request_address_change (void *cls,
return;
}
/* will never return GNUNET_YES since connection is to be established */
- GST_neighbours_switch_to_address_3way (&address->peer,
- address, session, ats,
+ GST_neighbours_switch_to_address_3way (&address->peer, address, session, ats,
ats_count, bandwidth_in,
bandwidth_out);
}
diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c
index b3edc01db..105f1fcaf 100644
--- a/src/transport/gnunet-service-transport_blacklist.c
+++ b/src/transport/gnunet-service-transport_blacklist.c
@@ -556,7 +556,7 @@ static void
test_connection_ok (void *cls, const struct GNUNET_PeerIdentity *neighbour,
const struct GNUNET_ATS_Information *ats,
uint32_t ats_count,
- const struct GNUNET_HELLO_Address *address)
+ const struct GNUNET_HELLO_Address *address)
{
struct TestConnectionContext *tcc = cls;
struct GST_BlacklistCheck *bc;
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index 2aea7aa7e..da6201d97 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -331,8 +331,8 @@ static void
notify_client_about_neighbour (void *cls,
const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_ATS_Information *ats,
- uint32_t ats_count,
- const struct GNUNET_HELLO_Address *address)
+ uint32_t ats_count,
+ const struct GNUNET_HELLO_Address *address)
{
struct TransportClient *tc = cls;
struct ConnectInfoMessage *cim;
@@ -633,8 +633,9 @@ transmit_address_to_client (void *cls, const char *buf)
* @param message the resolution request
*/
static void
-clients_handle_address_to_string (void *cls, struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+clients_handle_address_to_string (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
const struct AddressLookupMessage *alum;
struct GNUNET_TRANSPORT_PluginFunctions *papi;
@@ -699,34 +700,38 @@ clients_handle_address_to_string (void *cls, struct GNUNET_SERVER_Client *client
*/
static void
output_address (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *ats, uint32_t ats_count,
- const struct GNUNET_HELLO_Address *address)
+ const struct GNUNET_ATS_Information *ats, uint32_t ats_count,
+ const struct GNUNET_HELLO_Address *address)
{
struct GNUNET_SERVER_TransmitContext *tc = cls;
struct AddressIterateResponseMessage *msg;
size_t size;
size_t tlen;
size_t alen;
- char * addr;
+ char *addr;
tlen = strlen (address->transport_name) + 1;
alen = address->address_length;
size = (sizeof (struct AddressIterateResponseMessage) + alen + tlen);
{
char buf[size];
-
- msg = (struct AddressIterateResponseMessage*) buf;
+
+ msg = (struct AddressIterateResponseMessage *) buf;
msg->reserved = htonl (0);
msg->peer = *peer;
msg->addrlen = htonl (alen);
msg->pluginlen = htonl (tlen);
addr = (char *) &msg[1];
- memcpy (addr,address->address, alen);
+ memcpy (addr, address->address, alen);
memcpy (&addr[alen], address->transport_name, tlen);
- GNUNET_SERVER_transmit_context_append_data (tc,
- &buf[sizeof(struct GNUNET_MessageHeader)],
- size - sizeof (struct GNUNET_MessageHeader),
- GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE);
+ GNUNET_SERVER_transmit_context_append_data (tc,
+ &buf[sizeof
+ (struct
+ GNUNET_MessageHeader)],
+ size -
+ sizeof (struct
+ GNUNET_MessageHeader),
+ GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE);
}
}
@@ -746,7 +751,7 @@ clients_handle_address_iterate (void *cls, struct GNUNET_SERVER_Client *client,
{
static struct GNUNET_PeerIdentity all_zeros;
struct GNUNET_SERVER_TransmitContext *tc;
- struct AddressIterateMessage * msg;
+ struct AddressIterateMessage *msg;
struct GNUNET_HELLO_Address *address;
if (ntohs (message->type) != GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE)
@@ -765,7 +770,7 @@ clients_handle_address_iterate (void *cls, struct GNUNET_SERVER_Client *client,
if (GNUNET_YES != ntohl (msg->one_shot))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Address monitoring not implemented\n");
+ "Address monitoring not implemented\n");
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
@@ -779,12 +784,12 @@ clients_handle_address_iterate (void *cls, struct GNUNET_SERVER_Client *client,
else
{
/* just return one neighbour */
- address = GST_neighbour_get_current_address(&msg->peer);
+ address = GST_neighbour_get_current_address (&msg->peer);
if (address != NULL)
output_address (tc, &msg->peer, NULL, 0, address);
}
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);
}
@@ -809,7 +814,7 @@ GST_clients_start (struct GNUNET_SERVER_Handle *server)
sizeof (struct TransportRequestConnectMessage)},
{&clients_handle_address_to_string, NULL,
GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING, 0},
- {&clients_handle_address_iterate, NULL,
+ {&clients_handle_address_iterate, NULL,
GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE,
sizeof (struct AddressIterateMessage)},
{&GST_blacklist_handle_init, NULL,
diff --git a/src/transport/gnunet-service-transport_hello.c b/src/transport/gnunet-service-transport_hello.c
index 8b38a673e..120f17668 100644
--- a/src/transport/gnunet-service-transport_hello.c
+++ b/src/transport/gnunet-service-transport_hello.c
@@ -138,8 +138,8 @@ address_generator (void *cls, size_t max, void *buf)
if (NULL == gc->addr_pos)
return 0;
ret =
- GNUNET_HELLO_add_address (gc->addr_pos->address, gc->expiration,
- buf, max);
+ GNUNET_HELLO_add_address (gc->addr_pos->address, gc->expiration, buf,
+ max);
gc->addr_pos = gc->addr_pos->next;
return ret;
}
@@ -251,7 +251,7 @@ GST_hello_get ()
*/
void
GST_hello_modify_addresses (int addremove,
- const struct GNUNET_HELLO_Address *address)
+ const struct GNUNET_HELLO_Address *address)
{
struct OwnAddressList *al;
@@ -266,10 +266,8 @@ GST_hello_modify_addresses (int addremove,
if (GNUNET_NO == addremove)
{
for (al = oal_head; al != NULL; al = al->next)
- if (0 ==
- GNUNET_HELLO_address_cmp (address,
- al->address))
- {
+ if (0 == GNUNET_HELLO_address_cmp (address, al->address))
+ {
GNUNET_CONTAINER_DLL_remove (oal_head, oal_tail, al);
GNUNET_HELLO_address_free (al->address);
GNUNET_free (al);
@@ -305,8 +303,7 @@ GST_hello_test_address (const struct GNUNET_HELLO_Address *address,
struct OwnAddressList *al;
for (al = oal_head; al != NULL; al = al->next)
- if (0 == GNUNET_HELLO_address_cmp (address,
- al->address))
+ if (0 == GNUNET_HELLO_address_cmp (address, al->address))
{
*sig = &al->pong_signature;
*sig_expiration = &al->pong_sig_expires;
diff --git a/src/transport/gnunet-service-transport_hello.h b/src/transport/gnunet-service-transport_hello.h
index 168dd4364..605d19861 100644
--- a/src/transport/gnunet-service-transport_hello.h
+++ b/src/transport/gnunet-service-transport_hello.h
@@ -76,8 +76,8 @@ GST_hello_get (void);
* @param address address to add or remove
*/
void
-GST_hello_modify_addresses (int addremove,
- const struct GNUNET_HELLO_Address *address);
+GST_hello_modify_addresses (int addremove,
+ const struct GNUNET_HELLO_Address *address);
/**
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 3024d8bc1..a0f6e2e42 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -190,22 +190,22 @@ struct MessageQueue
enum State
{
/**
- * fresh peer or completely disconnected
+ * fresh peer or completely disconnected
*/
S_NOT_CONNECTED,
/**
- * sent CONNECT message to other peer, waiting for CONNECT_ACK
+ * sent CONNECT message to other peer, waiting for CONNECT_ACK
*/
S_CONNECT_SENT,
/**
- * received CONNECT message to other peer, sending CONNECT_ACK
+ * received CONNECT message to other peer, sending CONNECT_ACK
*/
S_CONNECT_RECV,
/**
- * received ACK or payload
+ * received ACK or payload
*/
S_CONNECTED,
@@ -215,7 +215,7 @@ enum State
S_FAST_RECONNECT,
/**
- * Disconnect in progress
+ * Disconnect in progress
*/
S_DISCONNECT
};
@@ -452,6 +452,7 @@ static void
reset_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct NeighbourMapEntry *n = cls;
+
if (n == NULL)
return;
@@ -472,7 +473,7 @@ reset_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
/* destroying address */
if (n->address != NULL)
{
- GNUNET_assert (strlen(n->address->transport_name) > 0);
+ GNUNET_assert (strlen (n->address->transport_name) > 0);
GNUNET_ATS_address_destroyed (GST_ats, n->address, n->session);
}
@@ -522,6 +523,7 @@ change (struct NeighbourMapEntry *n, int state, int line)
{
char *old = GNUNET_strdup (print_state (n->state));
char *new = GNUNET_strdup (print_state (state));
+
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Illegal state transition from `%s' to `%s' in line %u \n", old,
new, line);
@@ -534,6 +536,7 @@ change (struct NeighbourMapEntry *n, int state, int line)
{
char *old = GNUNET_strdup (print_state (n->state));
char *new = GNUNET_strdup (print_state (state));
+
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"State for neighbour `%s' %X changed from `%s' to `%s' in line %u\n",
GNUNET_i2s (&n->id), n, old, new, line);
@@ -551,8 +554,7 @@ change (struct NeighbourMapEntry *n, int state, int line)
if (n->state_reset != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (n->state_reset);
n->state_reset =
- GNUNET_SCHEDULER_add_delayed (SETUP_CONNECTION_TIMEOUT, &reset_task,
- n);
+ GNUNET_SCHEDULER_add_delayed (SETUP_CONNECTION_TIMEOUT, &reset_task, n);
break;
case S_CONNECTED:
case S_NOT_CONNECTED:
@@ -562,10 +564,10 @@ change (struct NeighbourMapEntry *n, int state, int line)
#if DEBUG_TRANSPORT
char *old = GNUNET_strdup (print_state (n->state));
char *new = GNUNET_strdup (print_state (state));
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Removed reset task for peer `%s' %s failed in state transition `%s' -> `%s' \n",
- GNUNET_i2s (&n->id), GST_plugins_a2s (n->address),
- old, new);
+ "Removed reset task for peer `%s' %s failed in state transition `%s' -> `%s' \n",
+ GNUNET_i2s (&n->id), GST_plugins_a2s (n->address), old, new);
GNUNET_free (old);
GNUNET_free (new);
#endif
@@ -578,7 +580,7 @@ change (struct NeighbourMapEntry *n, int state, int line)
default:
GNUNET_assert (0);
}
-
+
return GNUNET_OK;
@@ -588,9 +590,8 @@ static ssize_t
send_with_plugin (const struct GNUNET_PeerIdentity *target, const char *msgbuf,
size_t msgbuf_size, uint32_t priority,
struct GNUNET_TIME_Relative timeout, struct Session *session,
- const struct GNUNET_HELLO_Address *address,
- int force_address, GNUNET_TRANSPORT_TransmitContinuation cont,
- void *cont_cls)
+ const struct GNUNET_HELLO_Address *address, int force_address,
+ GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
{
struct GNUNET_TRANSPORT_PluginFunctions *papi;
size_t ret = GNUNET_SYSERR;
@@ -620,8 +621,8 @@ send_with_plugin (const struct GNUNET_PeerIdentity *target, const char *msgbuf,
ret =
papi->send (papi->cls, target, msgbuf, msgbuf_size, 0, timeout, session,
- address->address,
- address->address_length, GNUNET_YES, cont, cont_cls);
+ address->address, address->address_length, GNUNET_YES, cont,
+ cont_cls);
if (ret == -1)
{
@@ -657,7 +658,7 @@ transmit_send_continuation (void *cls,
struct NeighbourMapEntry *n;
struct NeighbourMapEntry *tmp;
- tmp = lookup_neighbour(receiver);
+ tmp = lookup_neighbour (receiver);
mq = cls;
n = mq->n;
@@ -720,8 +721,7 @@ try_transmission_to_peer (struct NeighbourMapEntry *n)
if (n->address == NULL)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "No address for peer `%s'\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No address for peer `%s'\n",
GNUNET_i2s (&n->id));
transmit_send_continuation (mq, &n->id, GNUNET_SYSERR);
GNUNET_assert (n->transmission_task == GNUNET_SCHEDULER_NO_TASK);
@@ -740,8 +740,7 @@ try_transmission_to_peer (struct NeighbourMapEntry *n)
if ((n->address->address_length == 0) && (n->session == NULL))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "No address for peer `%s'\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No address for peer `%s'\n",
GNUNET_i2s (&n->id));
transmit_send_continuation (mq, &n->id, GNUNET_SYSERR);
GNUNET_assert (n->transmission_task == GNUNET_SCHEDULER_NO_TASK);
@@ -751,9 +750,8 @@ try_transmission_to_peer (struct NeighbourMapEntry *n)
ret =
send_with_plugin (&n->id, mq->message_buf, mq->message_buf_size, 0,
- timeout, n->session, n->address,
- GNUNET_YES, &transmit_send_continuation,
- mq);
+ timeout, n->session, n->address, GNUNET_YES,
+ &transmit_send_continuation, mq);
if (ret == -1)
{
/* failure, but 'send' would not call continuation in this case,
@@ -826,7 +824,8 @@ send_disconnect (const struct GNUNET_PeerIdentity *target,
#endif
disconnect_msg.header.size = htons (sizeof (struct SessionDisconnectMessage));
- disconnect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT);
+ disconnect_msg.header.type =
+ htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT);
disconnect_msg.reserved = htonl (0);
disconnect_msg.purpose.size =
htonl (sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose) +
@@ -846,8 +845,7 @@ send_disconnect (const struct GNUNET_PeerIdentity *target,
send_with_plugin (target, (const char *) &disconnect_msg,
sizeof (disconnect_msg), UINT32_MAX,
GNUNET_TIME_UNIT_FOREVER_REL, session, address,
- GNUNET_YES,
- &send_disconnect_cont, NULL);
+ GNUNET_YES, &send_disconnect_cont, NULL);
if (ret == GNUNET_SYSERR)
return GNUNET_SYSERR;
@@ -880,9 +878,7 @@ disconnect_neighbour (struct NeighbourMapEntry *n)
/* send DISCONNECT MESSAGE */
if ((previous_state == S_CONNECTED) || is_connecting (n))
{
- if (GNUNET_OK ==
- send_disconnect (&n->id, n->address,
- n->session))
+ if (GNUNET_OK == send_disconnect (&n->id, n->address, n->session))
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sent DISCONNECT_MSG to `%s'\n",
GNUNET_i2s (&n->id));
else
@@ -898,9 +894,7 @@ disconnect_neighbour (struct NeighbourMapEntry *n)
GNUNET_assert (NULL != n->address);
if (n->address_state == USED)
{
- GST_validation_set_address_use (&n->id,
- n->address,
- n->session,
+ GST_validation_set_address_use (&n->id, n->address, n->session,
GNUNET_NO);
GNUNET_ATS_address_in_use (GST_ats, n->address, n->session, GNUNET_NO);
@@ -911,6 +905,7 @@ disconnect_neighbour (struct NeighbourMapEntry *n)
if (n->address != NULL)
{
struct GNUNET_TRANSPORT_PluginFunctions *papi;
+
papi = GST_plugins_find (n->address->transport_name);
if (papi != NULL)
papi->disconnect (papi->cls, &n->id);
@@ -928,27 +923,27 @@ disconnect_neighbour (struct NeighbourMapEntry *n)
n->is_active = NULL;
}
- switch (previous_state) {
- case S_CONNECTED:
+ switch (previous_state)
+ {
+ case S_CONNECTED:
// GNUNET_assert (neighbours_connected > 0);
- neighbours_connected--;
- GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != n->keepalive_task);
- GNUNET_SCHEDULER_cancel (n->keepalive_task);
- n->keepalive_task = GNUNET_SCHEDULER_NO_TASK;
- GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), -1,
- GNUNET_NO);
- disconnect_notify_cb (callback_cls, &n->id);
- break;
- case S_FAST_RECONNECT:
- GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), -1,
- GNUNET_NO);
- GNUNET_STATISTICS_update (GST_stats,
- gettext_noop
- ("# fast reconnects failed"),
- 1, GNUNET_NO);
- disconnect_notify_cb (callback_cls, &n->id);
- default:
- break;
+ neighbours_connected--;
+ GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != n->keepalive_task);
+ GNUNET_SCHEDULER_cancel (n->keepalive_task);
+ n->keepalive_task = GNUNET_SCHEDULER_NO_TASK;
+ GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), -1,
+ GNUNET_NO);
+ disconnect_notify_cb (callback_cls, &n->id);
+ break;
+ case S_FAST_RECONNECT:
+ GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), -1,
+ GNUNET_NO);
+ GNUNET_STATISTICS_update (GST_stats,
+ gettext_noop ("# fast reconnects failed"), 1,
+ GNUNET_NO);
+ disconnect_notify_cb (callback_cls, &n->id);
+ default:
+ break;
}
GNUNET_ATS_suggest_address_cancel (GST_ats, &n->id);
@@ -1030,17 +1025,18 @@ neighbour_keepalive_task (void *cls,
m.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE);
- ret = send_with_plugin (&n->id, (const void *) &m, sizeof (m),
- UINT32_MAX /* priority */ ,
- GNUNET_TIME_UNIT_FOREVER_REL, n->session, n->address,
- GNUNET_YES, NULL, NULL);
+ ret =
+ send_with_plugin (&n->id, (const void *) &m, sizeof (m),
+ UINT32_MAX /* priority */ ,
+ GNUNET_TIME_UNIT_FOREVER_REL, n->session, n->address,
+ GNUNET_YES, NULL, NULL);
n->expect_latency_response = GNUNET_NO;
- n->keep_alive_sent = GNUNET_TIME_absolute_get_zero();
+ n->keep_alive_sent = GNUNET_TIME_absolute_get_zero ();
if (ret != GNUNET_SYSERR)
{
n->expect_latency_response = GNUNET_YES;
- n->keep_alive_sent = GNUNET_TIME_absolute_get();
+ n->keep_alive_sent = GNUNET_TIME_absolute_get ();
}
}
@@ -1115,19 +1111,22 @@ struct ContinutionContext
struct Session *session;
};
-static void send_outbound_quota (const struct GNUNET_PeerIdentity *target, struct GNUNET_BANDWIDTH_Value32NBO quota)
+static void
+send_outbound_quota (const struct GNUNET_PeerIdentity *target,
+ struct GNUNET_BANDWIDTH_Value32NBO quota)
{
- struct QuotaSetMessage q_msg;
+ struct QuotaSetMessage q_msg;
+
#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Sending outbound quota of %u Bps for peer `%s' to all clients\n",
- ntohl (quota.value__), GNUNET_i2s (target));
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Sending outbound quota of %u Bps for peer `%s' to all clients\n",
+ ntohl (quota.value__), GNUNET_i2s (target));
#endif
- q_msg.header.size = htons (sizeof (struct QuotaSetMessage));
- q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA);
- q_msg.quota = quota;
- q_msg.peer = (*target);
- GST_clients_broadcast (&q_msg.header, GNUNET_NO);
+ q_msg.header.size = htons (sizeof (struct QuotaSetMessage));
+ q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA);
+ q_msg.quota = quota;
+ q_msg.peer = (*target);
+ GST_clients_broadcast (&q_msg.header, GNUNET_NO);
}
/**
@@ -1143,17 +1142,15 @@ static void
send_connect_continuation (void *cls, const struct GNUNET_PeerIdentity *target,
int success)
{
- struct ContinutionContext * cc = cls;
+ struct ContinutionContext *cc = cls;
struct NeighbourMapEntry *n = lookup_neighbour (&cc->address->peer);
-
+
if (GNUNET_YES != success)
{
- GNUNET_assert (strlen(cc->address->transport_name) > 0);
+ GNUNET_assert (strlen (cc->address->transport_name) > 0);
GNUNET_ATS_address_destroyed (GST_ats, cc->address, cc->session);
}
- if ( (NULL == neighbours) ||
- (NULL == n) ||
- (n->state == S_DISCONNECT))
+ if ((NULL == neighbours) || (NULL == n) || (n->state == S_DISCONNECT))
{
GNUNET_HELLO_address_free (cc->address);
GNUNET_free (cc);
@@ -1161,7 +1158,7 @@ send_connect_continuation (void *cls, const struct GNUNET_PeerIdentity *target,
}
if ((GNUNET_YES == success) &&
- ((n->state == S_NOT_CONNECTED) || (n->state == S_CONNECT_SENT)))
+ ((n->state == S_NOT_CONNECTED) || (n->state == S_CONNECT_SENT)))
{
change_state (n, S_CONNECT_SENT);
GNUNET_HELLO_address_free (cc->address);
@@ -1170,21 +1167,19 @@ send_connect_continuation (void *cls, const struct GNUNET_PeerIdentity *target,
}
if ((GNUNET_NO == success) &&
- ((n->state == S_NOT_CONNECTED) || (n->state == S_CONNECT_SENT)))
+ ((n->state == S_NOT_CONNECTED) || (n->state == S_CONNECT_SENT)))
{
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Failed to send CONNECT_MSG to peer `%4s' with address '%s' session %p, asking ATS for new address \n",
- GNUNET_i2s (&n->id),
- GST_plugins_a2s (n->address),
- n->session);
+ GNUNET_i2s (&n->id), GST_plugins_a2s (n->address), n->session);
#endif
change_state (n, S_NOT_CONNECTED);
if (n->ats_suggest != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (n->ats_suggest);
n->ats_suggest =
- GNUNET_SCHEDULER_add_delayed (ATS_RESPONSE_TIMEOUT, &ats_suggest_cancel,
- n);
+ GNUNET_SCHEDULER_add_delayed (ATS_RESPONSE_TIMEOUT, &ats_suggest_cancel,
+ n);
GNUNET_ATS_suggest_address (GST_ats, &n->id);
}
GNUNET_HELLO_address_free (cc->address);
@@ -1205,7 +1200,7 @@ send_switch_address_continuation (void *cls,
const struct GNUNET_PeerIdentity *target,
int success)
{
- struct ContinutionContext * cc = cls;
+ struct ContinutionContext *cc = cls;
struct NeighbourMapEntry *n;
if (neighbours == NULL)
@@ -1215,7 +1210,7 @@ send_switch_address_continuation (void *cls,
return; /* neighbour is going away */
}
- n = lookup_neighbour(&cc->address->peer);
+ n = lookup_neighbour (&cc->address->peer);
if ((n == NULL) || (is_disconnecting (n)))
{
GNUNET_HELLO_address_free (cc->address);
@@ -1229,10 +1224,9 @@ send_switch_address_continuation (void *cls,
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Failed to switch connected peer `%s' to address '%s' session %X, asking ATS for new address \n",
- GNUNET_i2s (&n->id),
- GST_plugins_a2s (n->address), n->session);
+ GNUNET_i2s (&n->id), GST_plugins_a2s (n->address), n->session);
#endif
- GNUNET_assert (strlen(cc->address->transport_name) > 0);
+ GNUNET_assert (strlen (cc->address->transport_name) > 0);
GNUNET_ATS_address_destroyed (GST_ats, cc->address, cc->session);
if (n->ats_suggest != GNUNET_SCHEDULER_NO_TASK)
@@ -1246,49 +1240,48 @@ send_switch_address_continuation (void *cls,
return;
}
/* Tell ATS that switching addresses was successful */
- switch (n->state) {
- case S_CONNECTED:
- if (n->address_state == FRESH)
- {
- GST_validation_set_address_use (&n->id,
- cc->address,
- cc->session,
- GNUNET_YES);
- GNUNET_ATS_address_update (GST_ats, cc->address, cc->session, NULL, 0);
- GNUNET_ATS_address_in_use (GST_ats, cc->address, cc->session, GNUNET_YES);
- n->address_state = USED;
- }
- break;
- case S_FAST_RECONNECT:
+ switch (n->state)
+ {
+ case S_CONNECTED:
+ if (n->address_state == FRESH)
+ {
+ GST_validation_set_address_use (&n->id, cc->address, cc->session,
+ GNUNET_YES);
+ GNUNET_ATS_address_update (GST_ats, cc->address, cc->session, NULL, 0);
+ GNUNET_ATS_address_in_use (GST_ats, cc->address, cc->session, GNUNET_YES);
+ n->address_state = USED;
+ }
+ break;
+ case S_FAST_RECONNECT:
#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Successful fast reconnect to peer `%s'\n", GNUNET_i2s (&n->id));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Successful fast reconnect to peer `%s'\n",
+ GNUNET_i2s (&n->id));
#endif
- change_state (n, S_CONNECTED);
- neighbours_connected++;
- GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1,
- GNUNET_NO);
-
- if (n->address_state == FRESH)
- {
- GST_validation_set_address_use (&n->id,
- cc->address,
- cc->session,
- GNUNET_YES);
- GNUNET_ATS_address_update (GST_ats, cc->address, cc->session, NULL, 0);
- GNUNET_ATS_address_in_use (GST_ats, cc->address, cc->session, GNUNET_YES);
- n->address_state = USED;
- }
-
- if (n->keepalive_task == GNUNET_SCHEDULER_NO_TASK)
- n->keepalive_task = GNUNET_SCHEDULER_add_now (&neighbour_keepalive_task, n);
-
- /* Updating quotas */
- GST_neighbours_set_incoming_quota (&n->id, n->bandwidth_in);
- send_outbound_quota(target, n->bandwidth_out);
-
- default:
- break;
+ change_state (n, S_CONNECTED);
+ neighbours_connected++;
+ GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1,
+ GNUNET_NO);
+
+ if (n->address_state == FRESH)
+ {
+ GST_validation_set_address_use (&n->id, cc->address, cc->session,
+ GNUNET_YES);
+ GNUNET_ATS_address_update (GST_ats, cc->address, cc->session, NULL, 0);
+ GNUNET_ATS_address_in_use (GST_ats, cc->address, cc->session, GNUNET_YES);
+ n->address_state = USED;
+ }
+
+ if (n->keepalive_task == GNUNET_SCHEDULER_NO_TASK)
+ n->keepalive_task =
+ GNUNET_SCHEDULER_add_now (&neighbour_keepalive_task, n);
+
+ /* Updating quotas */
+ GST_neighbours_set_incoming_quota (&n->id, n->bandwidth_in);
+ send_outbound_quota (target, n->bandwidth_out);
+
+ default:
+ break;
}
GNUNET_HELLO_address_free (cc->address);
GNUNET_free (cc);
@@ -1309,7 +1302,7 @@ send_connect_ack_continuation (void *cls,
const struct GNUNET_PeerIdentity *target,
int success)
{
- struct ContinutionContext * cc = cls;
+ struct ContinutionContext *cc = cls;
struct NeighbourMapEntry *n;
if (neighbours == NULL)
@@ -1319,7 +1312,7 @@ send_connect_ack_continuation (void *cls,
return; /* neighbour is going away */
}
- n = lookup_neighbour(&cc->address->peer);
+ n = lookup_neighbour (&cc->address->peer);
if ((n == NULL) || (is_disconnecting (n)))
{
GNUNET_HELLO_address_free (cc->address);
@@ -1338,12 +1331,10 @@ send_connect_ack_continuation (void *cls,
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Failed to send CONNECT_MSG to peer `%4s' with address '%s' session %X, asking ATS for new address \n",
- GNUNET_i2s (&n->id),
- GST_plugins_a2s (n->address),
- n->session);
+ GNUNET_i2s (&n->id), GST_plugins_a2s (n->address), n->session);
#endif
change_state (n, S_NOT_CONNECTED);
- GNUNET_assert (strlen(cc->address->transport_name) > 0);
+ GNUNET_assert (strlen (cc->address->transport_name) > 0);
GNUNET_ATS_address_destroyed (GST_ats, cc->address, cc->session);
if (n->ats_suggest != GNUNET_SCHEDULER_NO_TASK)
@@ -1372,8 +1363,8 @@ send_connect_ack_continuation (void *cls,
*/
int
GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ const struct GNUNET_HELLO_Address
+ *address, struct Session *session,
const struct GNUNET_ATS_Information *ats,
uint32_t ats_count,
struct GNUNET_BANDWIDTH_Value32NBO
@@ -1383,7 +1374,7 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
{
struct NeighbourMapEntry *n;
struct SessionConnectMessage connect_msg;
- struct ContinutionContext * cc;
+ struct ContinutionContext *cc;
size_t msg_len;
size_t ret;
@@ -1401,11 +1392,11 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
return GNUNET_NO;
}
GNUNET_assert (address->transport_name != NULL);
- if ( (session == NULL) && (0 == address->address_length) )
+ if ((session == NULL) && (0 == address->address_length))
{
GNUNET_break_op (0);
/* FIXME: is this actually possible? When does this happen? */
- if (strlen(address->transport_name) > 0)
+ if (strlen (address->transport_name) > 0)
GNUNET_ATS_address_destroyed (GST_ats, address, session);
GNUNET_ATS_suggest_address (GST_ats, peer);
return GNUNET_NO;
@@ -1415,10 +1406,8 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"ATS tells us to switch to address '%s' session %p for peer `%s' in state `%s'\n",
- GST_plugins_a2s (address),
- session,
- GNUNET_i2s (peer),
- print_state(n->state));
+ GST_plugins_a2s (address), session, GNUNET_i2s (peer),
+ print_state (n->state));
#endif
if (n->ats_suggest != GNUNET_SCHEDULER_NO_TASK)
{
@@ -1426,17 +1415,15 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
n->ats_suggest = GNUNET_SCHEDULER_NO_TASK;
}
/* do not switch addresses just update quotas */
- if ( (n->state == S_CONNECTED) &&
- (NULL != n->address) &&
- (0 == GNUNET_HELLO_address_cmp (address,
- n->address)) &&
- (n->session == session) )
+ if ((n->state == S_CONNECTED) && (NULL != n->address) &&
+ (0 == GNUNET_HELLO_address_cmp (address, n->address)) &&
+ (n->session == session))
{
n->bandwidth_in = bandwidth_in;
n->bandwidth_out = bandwidth_out;
GST_neighbours_set_incoming_quota (&n->id, n->bandwidth_in);
- send_outbound_quota(peer, n->bandwidth_out);
- return GNUNET_NO;
+ send_outbound_quota (peer, n->bandwidth_out);
+ return GNUNET_NO;
}
if (n->state == S_CONNECTED)
{
@@ -1444,9 +1431,7 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
GNUNET_assert (NULL != n->address);
if (n->address_state == USED)
{
- GST_validation_set_address_use (&n->id,
- n->address,
- n->session,
+ GST_validation_set_address_use (&n->id, n->address, n->session,
GNUNET_NO);
GNUNET_ATS_address_in_use (GST_ats, n->address, n->session, GNUNET_NO);
n->address_state = UNUSED;
@@ -1468,7 +1453,7 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
&neighbour_timeout_task, n);
switch (n->state)
{
- case S_NOT_CONNECTED:
+ case S_NOT_CONNECTED:
case S_CONNECT_SENT:
msg_len = sizeof (struct SessionConnectMessage);
connect_msg.header.size = htons (msg_len);
@@ -1478,15 +1463,13 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
connect_msg.timestamp =
GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
- cc = GNUNET_malloc(sizeof (struct ContinutionContext));
+ cc = GNUNET_malloc (sizeof (struct ContinutionContext));
cc->session = session;
cc->address = GNUNET_HELLO_address_copy (address);
ret =
send_with_plugin (peer, (const char *) &connect_msg, msg_len,
UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL, session,
- address, GNUNET_YES,
- &send_connect_continuation,
- cc);
+ address, GNUNET_YES, &send_connect_continuation, cc);
return GNUNET_NO;
case S_CONNECT_RECV:
/* We received a CONNECT message and asked ATS for an address */
@@ -1497,18 +1480,18 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
connect_msg.reserved = htonl (0);
connect_msg.timestamp =
GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
- cc = GNUNET_malloc(sizeof (struct ContinutionContext));
+ cc = GNUNET_malloc (sizeof (struct ContinutionContext));
cc->session = session;
cc->address = GNUNET_HELLO_address_copy (address);
ret =
send_with_plugin (&n->id, (const void *) &connect_msg, msg_len,
UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL, session,
- address, GNUNET_YES,
- &send_connect_ack_continuation, cc);
+ address, GNUNET_YES, &send_connect_ack_continuation,
+ cc);
return GNUNET_NO;
case S_CONNECTED:
case S_FAST_RECONNECT:
- /* connected peer is switching addresses or tries fast reconnect*/
+ /* connected peer is switching addresses or tries fast reconnect */
msg_len = sizeof (struct SessionConnectMessage);
connect_msg.header.size = htons (msg_len);
connect_msg.header.type =
@@ -1516,7 +1499,7 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
connect_msg.reserved = htonl (0);
connect_msg.timestamp =
GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
- cc = GNUNET_malloc(sizeof (struct ContinutionContext));
+ cc = GNUNET_malloc (sizeof (struct ContinutionContext));
cc->session = session;
cc->address = GNUNET_HELLO_address_copy (address);
ret =
@@ -1528,13 +1511,12 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Failed to send CONNECT_MESSAGE to `%4s' using address '%s' session %X\n",
- GNUNET_i2s (peer),
- GST_plugins_a2s (address), session);
+ GNUNET_i2s (peer), GST_plugins_a2s (address), session);
}
return GNUNET_NO;
default:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Invalid connection state to switch addresses %u \n", n->state);
+ "Invalid connection state to switch addresses %u \n", n->state);
GNUNET_break_op (0);
return GNUNET_NO;
}
@@ -1544,7 +1526,7 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
/**
* Obtain current latency information for the given neighbour.
*
- * @param peer
+ * @param peer
* @return observed latency of the address, FOREVER if the address was
* never successfully validated
*/
@@ -1554,8 +1536,7 @@ GST_neighbour_get_latency (const struct GNUNET_PeerIdentity *peer)
struct NeighbourMapEntry *n;
n = lookup_neighbour (peer);
- if ( (NULL == n) ||
- ( (n->address == NULL) && (n->session == NULL) ) )
+ if ((NULL == n) || ((n->address == NULL) && (n->session == NULL)))
return GNUNET_TIME_UNIT_FOREVER_REL;
return n->latency;
@@ -1573,8 +1554,7 @@ GST_neighbour_get_current_address (const struct GNUNET_PeerIdentity *peer)
struct NeighbourMapEntry *n;
n = lookup_neighbour (peer);
- if ( (NULL == n) ||
- ( (n->address == NULL) && (n->session == NULL) ) )
+ if ((NULL == n) || ((n->address == NULL) && (n->session == NULL)))
return NULL;
return n->address;
@@ -1600,7 +1580,7 @@ setup_neighbour (const struct GNUNET_PeerIdentity *peer)
n = GNUNET_malloc (sizeof (struct NeighbourMapEntry));
n->id = *peer;
n->state = S_NOT_CONNECTED;
- n->latency = GNUNET_TIME_relative_get_forever();
+ n->latency = GNUNET_TIME_relative_get_forever ();
GNUNET_BANDWIDTH_tracker_init (&n->in_tracker,
GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT,
MAX_BANDWIDTH_CARRY_S);
@@ -1718,11 +1698,9 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
{
if (n->address_state == USED)
{
- GST_validation_set_address_use (&n->id,
- n->address,
- n->session,
+ GST_validation_set_address_use (&n->id, n->address, n->session,
GNUNET_NO);
- GNUNET_ATS_address_in_use (GST_ats,n->address, n->session, GNUNET_NO);
+ GNUNET_ATS_address_in_use (GST_ats, n->address, n->session, GNUNET_NO);
n->address_state = UNUSED;
}
}
@@ -1733,15 +1711,15 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
n->address = NULL;
}
n->session = NULL;
-
+
/* not connected anymore anyway, shouldn't matter */
if (S_CONNECTED != n->state)
return;
/* connected, try fast reconnect */
#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Trying fast reconnect to peer `%s'\n", GNUNET_i2s (peer));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying fast reconnect to peer `%s'\n",
+ GNUNET_i2s (peer));
#endif
change_state (n, S_FAST_RECONNECT);
GNUNET_assert (neighbours_connected > 0);
@@ -1814,7 +1792,7 @@ GST_neighbours_send (const struct GNUNET_PeerIdentity *target, const void *msg,
return;
}
- if ((n->session == NULL) && (n->address == NULL) )
+ if ((n->session == NULL) && (n->address == NULL))
{
GNUNET_STATISTICS_update (GST_stats,
gettext_noop
@@ -1983,6 +1961,7 @@ GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour)
return;
struct GNUNET_MessageHeader m;
+
m.size = htons (sizeof (struct GNUNET_MessageHeader));
m.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE);
@@ -2002,11 +1981,11 @@ GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour)
*/
void
GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
- const struct GNUNET_ATS_Information * ats,
+ const struct GNUNET_ATS_Information *ats,
uint32_t ats_count)
{
struct NeighbourMapEntry *n;
- struct GNUNET_ATS_Information * ats_new;
+ struct GNUNET_ATS_Information *ats_new;
uint32_t latency;
if (neighbours == NULL)
@@ -2034,22 +2013,26 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
}
n->expect_latency_response = GNUNET_NO;
- GNUNET_assert (n->keep_alive_sent.abs_value != GNUNET_TIME_absolute_get_zero().abs_value);
- n->latency = GNUNET_TIME_absolute_get_difference(n->keep_alive_sent, GNUNET_TIME_absolute_get());
+ GNUNET_assert (n->keep_alive_sent.abs_value !=
+ GNUNET_TIME_absolute_get_zero ().abs_value);
+ n->latency =
+ GNUNET_TIME_absolute_get_difference (n->keep_alive_sent,
+ GNUNET_TIME_absolute_get ());
#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Latency for peer `%s' is %llu ms\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Latency for peer `%s' is %llu ms\n",
GNUNET_i2s (&n->id), n->latency.rel_value);
#endif
- if (n->latency.rel_value == GNUNET_TIME_relative_get_forever().rel_value)
+ if (n->latency.rel_value == GNUNET_TIME_relative_get_forever ().rel_value)
{
GNUNET_ATS_address_update (GST_ats, n->address, n->session, ats, ats_count);
}
else
{
- ats_new = GNUNET_malloc (sizeof (struct GNUNET_ATS_Information) * (ats_count + 1));
+ ats_new =
+ GNUNET_malloc (sizeof (struct GNUNET_ATS_Information) *
+ (ats_count + 1));
memcpy (ats_new, ats, sizeof (struct GNUNET_ATS_Information) * ats_count);
/* add latency */
@@ -2060,7 +2043,8 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
latency = n->latency.rel_value;
ats_new[ats_count].value = htonl (latency);
- GNUNET_ATS_address_update (GST_ats, n->address, n->session, ats_new, ats_count + 1);
+ GNUNET_ATS_address_update (GST_ats, n->address, n->session, ats_new,
+ ats_count + 1);
GNUNET_free (ats_new);
}
}
@@ -2314,10 +2298,11 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
{
/* we did not send 'CONNECT' -- at least not recently */
GNUNET_STATISTICS_update (GST_stats,
- gettext_noop ("# unexpected CONNECT_ACK messages (no peer)"), 1,
- GNUNET_NO);
+ gettext_noop
+ ("# unexpected CONNECT_ACK messages (no peer)"),
+ 1, GNUNET_NO);
return;
- }
+ }
/* Additional check
*
@@ -2326,11 +2311,13 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
* We also received an CONNECT message, switched from SENDT to RECV and
* ATS already suggested us an address after a successful blacklist check
*/
- if ((n->state != S_CONNECT_SENT) && ((n->state != S_CONNECT_RECV) && (n->address != NULL)))
+ if ((n->state != S_CONNECT_SENT) &&
+ ((n->state != S_CONNECT_RECV) && (n->address != NULL)))
{
GNUNET_STATISTICS_update (GST_stats,
- gettext_noop ("# unexpected CONNECT_ACK messages"), 1,
- GNUNET_NO);
+ gettext_noop
+ ("# unexpected CONNECT_ACK messages"), 1,
+ GNUNET_NO);
return;
}
@@ -2347,10 +2334,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
GNUNET_assert (NULL != n->address);
if (n->address_state == FRESH)
{
- GST_validation_set_address_use (&n->id,
- n->address,
- n->session,
- GNUNET_YES);
+ GST_validation_set_address_use (&n->id, n->address, n->session, GNUNET_YES);
GNUNET_ATS_address_in_use (GST_ats, n->address, n->session, GNUNET_YES);
n->address_state = USED;
}
@@ -2364,32 +2348,29 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
ret =
send_with_plugin (&n->id, (const char *) &msg, msg_len, UINT32_MAX,
- GNUNET_TIME_UNIT_FOREVER_REL, n->session,
- n->address, GNUNET_YES, NULL,
- NULL);
+ GNUNET_TIME_UNIT_FOREVER_REL, n->session, n->address,
+ GNUNET_YES, NULL, NULL);
if (ret == GNUNET_SYSERR)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Failed to send SESSION_ACK to `%4s' using address '%s' session %X\n",
- GNUNET_i2s (&n->id),
- GST_plugins_a2s (n->address), n->session);
+ GNUNET_i2s (&n->id), GST_plugins_a2s (n->address), n->session);
if (n->keepalive_task == GNUNET_SCHEDULER_NO_TASK)
n->keepalive_task = GNUNET_SCHEDULER_add_now (&neighbour_keepalive_task, n);
-
+
neighbours_connected++;
GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1,
- GNUNET_NO);
+ GNUNET_NO);
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Notify about connect of `%4s' using address '%s' session %X LINE %u\n",
- GNUNET_i2s (&n->id),
- GST_plugins_a2s (n->address), n->session,
- __LINE__);
+ "Notify about connect of `%4s' using address '%s' session %X LINE %u\n",
+ GNUNET_i2s (&n->id), GST_plugins_a2s (n->address), n->session,
+ __LINE__);
#endif
- connect_notify_cb (callback_cls, &n->id, ats, ats_count);
- send_outbound_quota(peer, n->bandwidth_out);
+ connect_notify_cb (callback_cls, &n->id, ats, ats_count);
+ send_outbound_quota (peer, n->bandwidth_out);
}
@@ -2398,15 +2379,14 @@ void
GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct Session *session,
const struct GNUNET_ATS_Information *ats,
uint32_t ats_count)
{
struct NeighbourMapEntry *n;
#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received ACK message from peer `%s'\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ACK message from peer `%s'\n",
GNUNET_i2s (peer));
#endif
@@ -2418,16 +2398,16 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
n = lookup_neighbour (peer);
if (NULL == n)
{
- send_disconnect (peer, address,
- session);
+ send_disconnect (peer, address, session);
GNUNET_break (0);
return;
}
if (S_CONNECTED == n->state)
return;
- if (!is_connecting(n))
+ if (!is_connecting (n))
{
- GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# unexpected ACK messages"), 1,
+ GNUNET_STATISTICS_update (GST_stats,
+ gettext_noop ("# unexpected ACK messages"), 1,
GNUNET_NO);
return;
}
@@ -2441,30 +2421,26 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
GNUNET_assert (n->address != NULL);
if (n->address_state == FRESH)
{
- GST_validation_set_address_use (&n->id,
- n->address,
- n->session,
- GNUNET_YES);
+ GST_validation_set_address_use (&n->id, n->address, n->session, GNUNET_YES);
GNUNET_ATS_address_in_use (GST_ats, n->address, n->session, GNUNET_YES);
n->address_state = USED;
}
neighbours_connected++;
GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1,
- GNUNET_NO);
-
+ GNUNET_NO);
+
GST_neighbours_set_incoming_quota (&n->id, n->bandwidth_in);
if (n->keepalive_task == GNUNET_SCHEDULER_NO_TASK)
- n->keepalive_task = GNUNET_SCHEDULER_add_now (&neighbour_keepalive_task, n);
+ n->keepalive_task = GNUNET_SCHEDULER_add_now (&neighbour_keepalive_task, n);
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Notify about connect of `%4s' using address '%s' session %X LINE %u\n",
- GNUNET_i2s (&n->id),
- GST_plugins_a2s (n->address), n->session,
- __LINE__);
+ "Notify about connect of `%4s' using address '%s' session %X LINE %u\n",
+ GNUNET_i2s (&n->id), GST_plugins_a2s (n->address), n->session,
+ __LINE__);
#endif
- connect_notify_cb (callback_cls, &n->id, ats, ats_count);
- send_outbound_quota(peer, n->bandwidth_out);
+ connect_notify_cb (callback_cls, &n->id, ats, ats_count);
+ send_outbound_quota (peer, n->bandwidth_out);
}
struct BlackListCheckContext
@@ -2514,15 +2490,11 @@ handle_connect_blacklist_cont (void *cls,
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
"transport-ats",
"Giving ATS session %p of address `%s' for peer %s\n",
- bcc->session,
- GST_plugins_a2s (bcc->address),
+ bcc->session, GST_plugins_a2s (bcc->address),
GNUNET_i2s (peer));
/* Tell ATS about the session, so ATS can suggest it if it likes it. */
- GNUNET_ATS_address_update (GST_ats,
- bcc->address,
- bcc->session,
- bcc->ats,
+ GNUNET_ATS_address_update (GST_ats, bcc->address, bcc->session, bcc->ats,
bcc->ats_count);
n->connect_ts = bcc->ts;
}
@@ -2584,10 +2556,10 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message,
GNUNET_ATS_address_update (GST_ats, address, session, ats, ats_count);
n = lookup_neighbour (peer);
- if ( (n != NULL) && (S_CONNECTED == n->state) )
+ if ((n != NULL) && (S_CONNECTED == n->state))
{
- /* connected peer switches addresses */
- return;
+ /* connected peer switches addresses */
+ return;
}
@@ -2603,9 +2575,10 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message,
bcc->ats = (struct GNUNET_ATS_Information *) &bcc[1];
memcpy (bcc->ats, ats, sizeof (struct GNUNET_ATS_Information) * ats_count);
bcc->ats[ats_count].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
- bcc->ats[ats_count].value = htonl ((uint32_t) GST_neighbour_get_latency (peer).rel_value);
- GST_blacklist_test_allowed (peer, address->transport_name, handle_connect_blacklist_cont,
- bcc);
+ bcc->ats[ats_count].value =
+ htonl ((uint32_t) GST_neighbour_get_latency (peer).rel_value);
+ GST_blacklist_test_allowed (peer, address->transport_name,
+ handle_connect_blacklist_cont, bcc);
}
diff --git a/src/transport/gnunet-service-transport_neighbours.h b/src/transport/gnunet-service-transport_neighbours.h
index e85f1a4d0..5b37ccb6a 100644
--- a/src/transport/gnunet-service-transport_neighbours.h
+++ b/src/transport/gnunet-service-transport_neighbours.h
@@ -134,7 +134,7 @@ GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour);
*/
void
GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
- const struct GNUNET_ATS_Information * ats,
+ const struct GNUNET_ATS_Information *ats,
uint32_t ats_count);
@@ -172,7 +172,8 @@ typedef void (*GST_NeighbourIterator) (void *cls,
neighbour,
const struct GNUNET_ATS_Information *
ats, uint32_t ats_count,
- const struct GNUNET_HELLO_Address *address);
+ const struct GNUNET_HELLO_Address *
+ address);
/**
@@ -213,10 +214,10 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
*/
int
GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_HELLO_Address *address,
- struct Session *session,
- const struct GNUNET_ATS_Information *ats,
- uint32_t ats_count,
+ const struct GNUNET_HELLO_Address
+ *address, struct Session *session,
+ const struct GNUNET_ATS_Information *ats,
+ uint32_t ats_count,
struct GNUNET_BANDWIDTH_Value32NBO
bandwidth_in,
struct GNUNET_BANDWIDTH_Value32NBO
@@ -259,7 +260,7 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message,
void
GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_HELLO_Address *address,
+ const struct GNUNET_HELLO_Address *address,
struct Session *session,
const struct GNUNET_ATS_Information *ats,
uint32_t ats_count);
@@ -268,7 +269,7 @@ void
GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct Session *session,
const struct GNUNET_ATS_Information *ats,
uint32_t ats_count);
@@ -276,7 +277,7 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
/**
* Obtain current latency information for the given neighbour.
*
- * @param peer
+ * @param peer
* @return observed latency of the address, FOREVER if the address was
* never successfully validated
*/
diff --git a/src/transport/gnunet-service-transport_plugins.c b/src/transport/gnunet-service-transport_plugins.c
index f14eb57d6..4b3dd455d 100644
--- a/src/transport/gnunet-service-transport_plugins.c
+++ b/src/transport/gnunet-service-transport_plugins.c
@@ -144,7 +144,8 @@ GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb,
if (plug->api == NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to load transport plugin for `%s'\n"), plug->lib_name);
+ _("Failed to load transport plugin for `%s'\n"),
+ plug->lib_name);
GNUNET_CONTAINER_DLL_remove (plugins_head, plugins_tail, plug);
GNUNET_free (plug->short_name);
GNUNET_free (plug->lib_name);
@@ -210,16 +211,16 @@ GST_plugins_a2s (const struct GNUNET_HELLO_Address *address)
api = GST_plugins_find (address->transport_name);
if (NULL == api)
return "<plugin unknown>";
- if (0 == address->address_length)
+ if (0 == address->address_length)
{
- GNUNET_snprintf (unable_to_show,
- sizeof (unable_to_show),
- "<unable to stringify %u-byte long address of %s transport>",
- (unsigned int) address->address_length,
- address->transport_name);
+ GNUNET_snprintf (unable_to_show, sizeof (unable_to_show),
+ "<unable to stringify %u-byte long address of %s transport>",
+ (unsigned int) address->address_length,
+ address->transport_name);
return unable_to_show;
}
- return api->address_to_string (NULL, address->address, address->address_length);
+ return api->address_to_string (NULL, address->address,
+ address->address_length);
}
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
index 006a318f6..641214b39 100644
--- a/src/transport/gnunet-service-transport_validation.c
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -333,9 +333,7 @@ validation_entry_match (void *cls, const GNUNET_HashCode * key, void *value)
struct ValidationEntryMatchContext *vemc = cls;
struct ValidationEntry *ve = value;
- if (0 ==
- GNUNET_HELLO_address_cmp (ve->address,
- vemc->address))
+ if (0 == GNUNET_HELLO_address_cmp (ve->address, vemc->address))
{
vemc->ve = ve;
return GNUNET_NO;
@@ -397,15 +395,13 @@ timeout_hello_validation (void *cls,
struct GNUNET_TIME_Relative left;
ve->timeout_task = GNUNET_SCHEDULER_NO_TASK;
- max = GNUNET_TIME_absolute_max (ve->valid_until,
- ve->revalidation_block);
+ max = GNUNET_TIME_absolute_max (ve->valid_until, ve->revalidation_block);
left = GNUNET_TIME_absolute_get_remaining (max);
if (left.rel_value > 0)
{
/* should wait a bit longer */
- ve->timeout_task = GNUNET_SCHEDULER_add_delayed (left,
- &timeout_hello_validation,
- ve);
+ ve->timeout_task =
+ GNUNET_SCHEDULER_add_delayed (left, &timeout_hello_validation, ve);
return;
}
GNUNET_STATISTICS_update (GST_stats,
@@ -443,10 +439,13 @@ transmit_ping_if_allowed (void *cls, const struct GNUNET_PeerIdentity *pid,
slen = strlen (ve->address->transport_name) + 1;
hello = GST_hello_get ();
hsize = ntohs (hello->size);
- tsize = sizeof (struct TransportPingMessage) + ve->address->address_length + slen + hsize;
+ tsize =
+ sizeof (struct TransportPingMessage) + ve->address->address_length +
+ slen + hsize;
ping.header.size =
- htons (sizeof (struct TransportPingMessage) + ve->address->address_length + slen);
+ htons (sizeof (struct TransportPingMessage) +
+ ve->address->address_length + slen);
ping.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_PING);
ping.challenge = htonl (ve->challenge);
ping.target = *pid;
@@ -459,7 +458,9 @@ transmit_ping_if_allowed (void *cls, const struct GNUNET_PeerIdentity *pid,
"HELLO", "PING", (unsigned int) tsize);
/* message too big (!?), get rid of HELLO */
hsize = 0;
- tsize = sizeof (struct TransportPingMessage) + ve->address->address_length + slen + hsize;
+ tsize =
+ sizeof (struct TransportPingMessage) + ve->address->address_length +
+ slen + hsize;
}
{
char message_buf[tsize];
@@ -481,8 +482,8 @@ transmit_ping_if_allowed (void *cls, const struct GNUNET_PeerIdentity *pid,
ret =
papi->send (papi->cls, pid, message_buf, tsize, PING_PRIORITY,
ACCEPTABLE_PING_DELAY, NULL /* no session */ ,
- ve->address->address, ve->address->address_length,
- GNUNET_YES, NULL, NULL);
+ ve->address->address, ve->address->address_length,
+ GNUNET_YES, NULL, NULL);
}
}
if (-1 != ret)
@@ -515,12 +516,11 @@ revalidate_address (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
ve->revalidation_task = GNUNET_SCHEDULER_NO_TASK;
delay = GNUNET_TIME_absolute_get_remaining (ve->revalidation_block);
/* How long until we can possibly permit the next PING? */
- canonical_delay =
- (ve->in_use == GNUNET_YES)
- ? CONNECTED_PING_FREQUENCY
- : ( (GNUNET_TIME_absolute_get_remaining (ve->valid_until).rel_value > 0)
- ? VALIDATED_PING_FREQUENCY
- : UNVALIDATED_PING_KEEPALIVE);
+ canonical_delay =
+ (ve->in_use ==
+ GNUNET_YES) ? CONNECTED_PING_FREQUENCY
+ : ((GNUNET_TIME_absolute_get_remaining (ve->valid_until).rel_value >
+ 0) ? VALIDATED_PING_FREQUENCY : UNVALIDATED_PING_KEEPALIVE);
if (delay.rel_value > canonical_delay.rel_value * 2)
{
/* situation changed, recalculate delay */
@@ -534,28 +534,28 @@ revalidate_address (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
GNUNET_SCHEDULER_add_delayed (delay, &revalidate_address, ve);
return;
}
- ve->revalidation_block =
- GNUNET_TIME_relative_to_absolute (canonical_delay);
+ ve->revalidation_block = GNUNET_TIME_relative_to_absolute (canonical_delay);
/* schedule next PINGing with some extra random delay to avoid synchronous re-validations */
- rdelay = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- canonical_delay.rel_value);
+ rdelay =
+ GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
+ canonical_delay.rel_value);
delay =
- GNUNET_TIME_relative_add (canonical_delay,
- GNUNET_TIME_relative_multiply
+ GNUNET_TIME_relative_add (canonical_delay,
+ GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MILLISECONDS, rdelay));
ve->revalidation_task =
- GNUNET_SCHEDULER_add_delayed (delay, &revalidate_address, ve);
+ GNUNET_SCHEDULER_add_delayed (delay, &revalidate_address, ve);
- /* start PINGing by checking blacklist */
+ /* start PINGing by checking blacklist */
GNUNET_STATISTICS_update (GST_stats,
gettext_noop ("# address revalidations started"), 1,
- GNUNET_NO);
- bc = GST_blacklist_test_allowed (&ve->pid, ve->address->transport_name,
- &transmit_ping_if_allowed, ve);
+ GNUNET_NO);
+ bc = GST_blacklist_test_allowed (&ve->pid, ve->address->transport_name,
+ &transmit_ping_if_allowed, ve);
if (NULL != bc)
- ve->bc = bc; /* only set 'bc' if 'transmit_ping_if_allowed' was not already
- called... */
+ ve->bc = bc; /* only set 'bc' if 'transmit_ping_if_allowed' was not already
+ * called... */
}
@@ -592,9 +592,11 @@ find_validation_entry (const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded
ve->latency = GNUNET_TIME_UNIT_FOREVER_REL;
ve->challenge =
GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
- ve->timeout_task = GNUNET_SCHEDULER_add_delayed (UNVALIDATED_PING_KEEPALIVE,
- &timeout_hello_validation, ve);
- GNUNET_CONTAINER_multihashmap_put (validation_map, &address->peer.hashPubKey, ve,
+ ve->timeout_task =
+ GNUNET_SCHEDULER_add_delayed (UNVALIDATED_PING_KEEPALIVE,
+ &timeout_hello_validation, ve);
+ GNUNET_CONTAINER_multihashmap_put (validation_map, &address->peer.hashPubKey,
+ ve,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
ve->expecting_pong = GNUNET_NO;
return ve;
@@ -611,8 +613,7 @@ find_validation_entry (const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded
* @return GNUNET_OK (keep the address)
*/
static int
-add_valid_address (void *cls,
- const struct GNUNET_HELLO_Address *address,
+add_valid_address (void *cls, const struct GNUNET_HELLO_Address *address,
struct GNUNET_TIME_Absolute expiration)
{
const struct GNUNET_HELLO_Message *hello = cls;
@@ -628,7 +629,7 @@ add_valid_address (void *cls,
GNUNET_break (0);
return GNUNET_OK; /* invalid HELLO !? */
}
- if (0 == memcmp(&GST_my_identity, &pid, sizeof (struct GNUNET_PeerIdentity)))
+ if (0 == memcmp (&GST_my_identity, &pid, sizeof (struct GNUNET_PeerIdentity)))
{
/* Peerinfo returned own identity, skip validation */
return GNUNET_OK;
@@ -639,8 +640,7 @@ add_valid_address (void *cls,
if (GNUNET_SCHEDULER_NO_TASK == ve->revalidation_task)
ve->revalidation_task = GNUNET_SCHEDULER_add_now (&revalidate_address, ve);
- GNUNET_ATS_address_update (GST_ats, address, NULL, NULL,
- 0);
+ GNUNET_ATS_address_update (GST_ats, address, NULL, NULL, 0);
return GNUNET_OK;
}
@@ -716,8 +716,7 @@ GST_validation_stop ()
static void
multicast_pong (void *cls,
const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded
- *public_key,
- struct GNUNET_TIME_Absolute valid_until,
+ *public_key, struct GNUNET_TIME_Absolute valid_until,
struct GNUNET_TIME_Absolute validation_block,
const struct GNUNET_HELLO_Address *address)
{
@@ -729,8 +728,7 @@ multicast_pong (void *cls,
return;
(void) papi->send (papi->cls, &address->peer, (const char *) pong,
ntohs (pong->header.size), PONG_PRIORITY,
- ACCEPTABLE_PING_DELAY, NULL,
- address->address,
+ ACCEPTABLE_PING_DELAY, NULL, address->address,
address->address_length, GNUNET_YES, NULL, NULL);
}
@@ -747,7 +745,7 @@ void
GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
const struct GNUNET_MessageHeader *hdr,
const struct GNUNET_HELLO_Address *sender_address,
- struct Session *session)
+ struct Session *session)
{
const struct TransportPingMessage *ping;
struct TransportPongMessage *pong;
@@ -804,8 +802,7 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
address.transport_name = addr;
address.peer = *sender;
if (GNUNET_YES !=
- GST_hello_test_address (&address, &sig_cache,
- &sig_cache_exp))
+ GST_hello_test_address (&address, &sig_cache, &sig_cache_exp))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_
@@ -867,10 +864,8 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
ret =
papi->send (papi->cls, sender, (const char *) pong,
ntohs (pong->header.size), PONG_PRIORITY,
- ACCEPTABLE_PING_DELAY, session,
- sender_address->address,
- sender_address->address_length,
- GNUNET_SYSERR, NULL, NULL);
+ ACCEPTABLE_PING_DELAY, session, sender_address->address,
+ sender_address->address_length, GNUNET_SYSERR, NULL, NULL);
if (ret != -1)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -922,9 +917,9 @@ struct ValidateAddressContext
* @return GNUNET_OK (keep the address)
*/
static int
-validate_address_iterator (void *cls,
- const struct GNUNET_HELLO_Address *address,
- struct GNUNET_TIME_Absolute expiration)
+validate_address_iterator (void *cls,
+ const struct GNUNET_HELLO_Address *address,
+ struct GNUNET_TIME_Absolute expiration)
{
const struct ValidateAddressContext *vac = cls;
struct ValidationEntry *ve;
@@ -933,8 +928,7 @@ validate_address_iterator (void *cls,
return GNUNET_OK; /* expired */
ve = find_validation_entry (&vac->public_key, address);
if (GNUNET_SCHEDULER_NO_TASK == ve->revalidation_task)
- ve->revalidation_task = GNUNET_SCHEDULER_add_now (&revalidate_address,
- ve);
+ ve->revalidation_task = GNUNET_SCHEDULER_add_now (&revalidate_address, ve);
return GNUNET_OK;
}
@@ -956,8 +950,7 @@ add_valid_peer_address (void *cls, size_t max, void *buf)
if (GNUNET_YES == ve->copied)
return 0; /* terminate */
ve->copied = GNUNET_YES;
- return GNUNET_HELLO_add_address (ve->address, ve->valid_until,
- buf, max);
+ return GNUNET_HELLO_add_address (ve->address, ve->valid_until, buf, max);
}
@@ -1056,7 +1049,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
struct GNUNET_ATS_Information ats;
ats.type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
- ats.value = htonl ((uint32_t) ve->latency.rel_value);
+ ats.value = htonl ((uint32_t) ve->latency.rel_value);
GNUNET_ATS_address_update (GST_ats, ve->address, NULL, &ats, 1);
}
/* build HELLO to store in PEERINFO */
@@ -1102,7 +1095,8 @@ GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello)
GNUNET_free (h);
GNUNET_assert (NULL ==
GNUNET_HELLO_iterate_addresses (hm, GNUNET_NO,
- &validate_address_iterator, &vac));
+ &validate_address_iterator,
+ &vac));
}
@@ -1138,8 +1132,8 @@ iterate_addresses (void *cls, const GNUNET_HashCode * key, void *value)
struct IteratorContext *ic = cls;
struct ValidationEntry *ve = value;
- ic->cb (ic->cb_cls, &ve->public_key, ve->valid_until,
- ve->revalidation_block, ve->address);
+ ic->cb (ic->cb_cls, &ve->public_key, ve->valid_until, ve->revalidation_block,
+ ve->address);
return GNUNET_OK;
}
@@ -1178,16 +1172,15 @@ GST_validation_get_addresses (const struct GNUNET_PeerIdentity *target,
*/
void
GST_validation_set_address_use (const struct GNUNET_PeerIdentity *sender,
- const struct GNUNET_HELLO_Address *address,
- struct Session *session,
- int in_use)
+ const struct GNUNET_HELLO_Address *address,
+ struct Session *session, int in_use)
{
struct ValidationEntry *ve;
if (NULL != address)
ve = find_validation_entry (NULL, address);
else
- ve = NULL; /* FIXME: lookup based on session... */
+ ve = NULL; /* FIXME: lookup based on session... */
if (NULL == ve)
{
/* this can happen for inbound connections (sender_address_len == 0); */
@@ -1195,19 +1188,16 @@ GST_validation_set_address_use (const struct GNUNET_PeerIdentity *sender,
}
if (ve->in_use == in_use)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "GST_validation_set_address_use: %s %s: ve->in_use %i <-> in_use %i\n",
- GNUNET_i2s(sender),
- GST_plugins_a2s(address),
- ve->in_use,
- in_use);
- GNUNET_break (ve->in_use != in_use); /* should be different... */
+ "GST_validation_set_address_use: %s %s: ve->in_use %i <-> in_use %i\n",
+ GNUNET_i2s (sender), GST_plugins_a2s (address), ve->in_use,
+ in_use);
+ GNUNET_break (ve->in_use != in_use); /* should be different... */
ve->in_use = in_use;
if (in_use == GNUNET_YES)
{
/* from now on, higher frequeny, so reschedule now */
GNUNET_SCHEDULER_cancel (ve->revalidation_task);
- ve->revalidation_task =
- GNUNET_SCHEDULER_add_now (&revalidate_address, ve);
+ ve->revalidation_task = GNUNET_SCHEDULER_add_now (&revalidate_address, ve);
}
}
@@ -1218,20 +1208,20 @@ GST_validation_set_address_use (const struct GNUNET_PeerIdentity *sender,
*
* @param sender peer
* @param address the address
- * @param session session
+ * @param session session
* @return observed latency of the address, FOREVER if the address was
* never successfully validated
*/
struct GNUNET_TIME_Relative
GST_validation_get_address_latency (const struct GNUNET_PeerIdentity *sender,
- const struct GNUNET_HELLO_Address *address,
- struct Session *session)
+ const struct GNUNET_HELLO_Address *address,
+ struct Session *session)
{
struct ValidationEntry *ve;
if (NULL == address)
{
- GNUNET_break (0); // FIXME: support having latency only with session...
+ GNUNET_break (0); // FIXME: support having latency only with session...
return GNUNET_TIME_UNIT_FOREVER_REL;
}
ve = find_validation_entry (NULL, address);
diff --git a/src/transport/gnunet-service-transport_validation.h b/src/transport/gnunet-service-transport_validation.h
index a3692e3cf..f5282d4e9 100644
--- a/src/transport/gnunet-service-transport_validation.h
+++ b/src/transport/gnunet-service-transport_validation.h
@@ -59,16 +59,15 @@ GST_validation_stop (void);
*/
void
GST_validation_set_address_use (const struct GNUNET_PeerIdentity *sender,
- const struct GNUNET_HELLO_Address *address,
- struct Session *session,
- int in_use);
+ const struct GNUNET_HELLO_Address *address,
+ struct Session *session, int in_use);
/**
* Query validation about the latest observed latency on a given
* address.
*
- * @param sender peer
+ * @param sender peer
* @param address the address
* @param session session
* @return observed latency of the address, FOREVER if the address was
@@ -76,8 +75,8 @@ GST_validation_set_address_use (const struct GNUNET_PeerIdentity *sender,
*/
struct GNUNET_TIME_Relative
GST_validation_get_address_latency (const struct GNUNET_PeerIdentity *sender,
- const struct GNUNET_HELLO_Address *address,
- struct Session *session);
+ const struct GNUNET_HELLO_Address *address,
+ struct Session *session);
/**
@@ -91,8 +90,8 @@ GST_validation_get_address_latency (const struct GNUNET_PeerIdentity *sender,
void
GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
const struct GNUNET_MessageHeader *hdr,
- const struct GNUNET_HELLO_Address *sender_address,
- struct Session *session);
+ const struct GNUNET_HELLO_Address *sender_address,
+ struct Session *session);
/**
@@ -138,7 +137,8 @@ typedef void (*GST_ValidationAddressCallback) (void *cls,
valid_until,
struct GNUNET_TIME_Absolute
validation_block,
- const struct GNUNET_HELLO_Address *address);
+ const struct GNUNET_HELLO_Address
+ * address);
/**
diff --git a/src/transport/gnunet-transport-wlan-helper-dummy.c b/src/transport/gnunet-transport-wlan-helper-dummy.c
index b5f2f625a..32d58426c 100644
--- a/src/transport/gnunet-transport-wlan-helper-dummy.c
+++ b/src/transport/gnunet-transport-wlan-helper-dummy.c
@@ -188,19 +188,15 @@ main (int argc, char *argv[])
erg = mkfifo (FIFO_FILE1, 0666);
if (0 != erg)
{
- fprintf (stderr,
- "Error in mkfifo(%s): %s\n",
- FIFO_FILE1,
- strerror (errno));
+ fprintf (stderr, "Error in mkfifo(%s): %s\n", FIFO_FILE1,
+ strerror (errno));
//exit(1);
}
erg = mkfifo (FIFO_FILE2, 0666);
if (0 != erg)
{
- fprintf (stderr,
- "Error in mkfifo(%s): %s\n",
- FIFO_FILE2,
- strerror (errno));
+ fprintf (stderr, "Error in mkfifo(%s): %s\n", FIFO_FILE2,
+ strerror (errno));
//exit(1);
}
@@ -256,9 +252,7 @@ main (int argc, char *argv[])
if (fdpin >= FD_SETSIZE)
{
- fprintf (stderr,
- "File fdpin number too large (%d > %u)\n",
- fdpin,
+ fprintf (stderr, "File fdpin number too large (%d > %u)\n", fdpin,
(unsigned int) FD_SETSIZE);
goto end;
}
@@ -268,9 +262,7 @@ main (int argc, char *argv[])
if (fdpout >= FD_SETSIZE)
{
- fprintf (stderr,
- "File fdpout number too large (%d > %u)\n",
- fdpout,
+ fprintf (stderr, "File fdpout number too large (%d > %u)\n", fdpout,
(unsigned int) FD_SETSIZE);
goto end;
@@ -328,13 +320,11 @@ main (int argc, char *argv[])
}
retval = select (maxfd + 1, &rfds, &wfds, NULL, &tv);
- if ( (-1 == retval) && (EINTR == errno) )
- continue;
+ if ((-1 == retval) && (EINTR == errno))
+ continue;
if (0 > retval)
{
- fprintf (stderr,
- "select failed: %s\n",
- strerror (errno));
+ fprintf (stderr, "select failed: %s\n", strerror (errno));
closeprog = 1;
break;
}
@@ -347,9 +337,8 @@ main (int argc, char *argv[])
if (0 > ret)
{
closeprog = 1;
- fprintf (stderr,
- "Write ERROR to STDOUT_FILENO: %s\n",
- strerror (errno));
+ fprintf (stderr, "Write ERROR to STDOUT_FILENO: %s\n",
+ strerror (errno));
break;
}
else
@@ -373,9 +362,7 @@ main (int argc, char *argv[])
if (0 > ret)
{
closeprog = 1;
- fprintf (stderr,
- "Write ERROR to fdpout: %s\n",
- strerror (errno));
+ fprintf (stderr, "Write ERROR to fdpout: %s\n", strerror (errno));
}
else
{
@@ -396,9 +383,8 @@ main (int argc, char *argv[])
if (0 > readsize)
{
closeprog = 1;
- fprintf (stderr,
- "Error reading from STDIN_FILENO: %s\n",
- strerror (errno));
+ fprintf (stderr, "Error reading from STDIN_FILENO: %s\n",
+ strerror (errno));
}
else if (0 < readsize)
{
@@ -419,9 +405,7 @@ main (int argc, char *argv[])
if (0 > readsize)
{
closeprog = 1;
- fprintf (stderr,
- "Error reading from fdpin: %s\n",
- strerror (errno));
+ fprintf (stderr, "Error reading from fdpin: %s\n", strerror (errno));
break;
}
else if (0 < readsize)
@@ -453,4 +437,3 @@ end:
}
return 0;
}
-
diff --git a/src/transport/gnunet-transport-wlan-helper.c b/src/transport/gnunet-transport-wlan-helper.c
index 53e0efedd..ca4542f1a 100644
--- a/src/transport/gnunet-transport-wlan-helper.c
+++ b/src/transport/gnunet-transport-wlan-helper.c
@@ -239,35 +239,35 @@ enum ieee80211_radiotap_type
};
/* For IEEE80211_RADIOTAP_FLAGS */
-#define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received
- * during CFP
- */
-#define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received
- * with short
- * preamble
- */
-#define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received
- * with WEP encryption
- */
-#define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received
- * with fragmentation
- */
-#define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */
-#define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /* frame has padding between
- * 802.11 header and payload
- * (to 32-bit boundary)
- */
+#define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received
+ * during CFP
+ */
+#define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received
+ * with short
+ * preamble
+ */
+#define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received
+ * with WEP encryption
+ */
+#define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received
+ * with fragmentation
+ */
+#define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */
+#define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /* frame has padding between
+ * 802.11 header and payload
+ * (to 32-bit boundary)
+ */
/* For IEEE80211_RADIOTAP_RX_FLAGS */
-#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 /* frame failed crc check */
+#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 /* frame failed crc check */
/* For IEEE80211_RADIOTAP_TX_FLAGS */
-#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive
- * retries */
-#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */
-#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */
-#define IEEE80211_RADIOTAP_F_TX_NOACK 0x0008 /* frame should not be ACKed */
-#define IEEE80211_RADIOTAP_F_TX_NOSEQ 0x0010 /* sequence number handled
- * by userspace */
+#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive
+ * retries */
+#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */
+#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */
+#define IEEE80211_RADIOTAP_F_TX_NOACK 0x0008 /* frame should not be ACKed */
+#define IEEE80211_RADIOTAP_F_TX_NOSEQ 0x0010 /* sequence number handled
+ * by userspace */
/**
@@ -478,10 +478,9 @@ struct ieee80211_radiotap_iterator
* index corresponds to the IEEE80211_RADIOTAP_... defines.
*/
static int
-ieee80211_radiotap_iterator_init (struct ieee80211_radiotap_iterator
- *iterator,
- struct ieee80211_radiotap_header
- *radiotap_header, int max_length)
+ieee80211_radiotap_iterator_init (struct ieee80211_radiotap_iterator *iterator,
+ struct ieee80211_radiotap_header
+ *radiotap_header, int max_length)
{
if (iterator == NULL)
return (-EINVAL);
@@ -503,47 +502,47 @@ ieee80211_radiotap_iterator_init (struct ieee80211_radiotap_iterator
iterator->arg_index = 0;
iterator->bitmap_shifter = le32toh (radiotap_header->it_present);
iterator->arg =
- ((uint8_t *) radiotap_header) + sizeof (struct ieee80211_radiotap_header);
+ ((uint8_t *) radiotap_header) + sizeof (struct ieee80211_radiotap_header);
iterator->this_arg = 0;
/* find payload start allowing for extended bitmap(s) */
if ((iterator->bitmap_shifter & IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK))
+ {
+ while (le32toh (*((uint32_t *) iterator->arg)) &
+ IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK)
{
- while (le32toh (*((uint32_t *) iterator->arg)) &
- IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK)
- {
- iterator->arg += sizeof (uint32_t);
-
- /*
- * check for insanity where the present bitmaps
- * keep claiming to extend up to or even beyond the
- * stated radiotap header length
- */
-
- if ((((void *) iterator->arg) - ((void *) iterator->rtheader)) >
- iterator->max_length)
- return (-EINVAL);
-
- }
-
iterator->arg += sizeof (uint32_t);
/*
- * no need to check again for blowing past stated radiotap
- * header length, becuase ieee80211_radiotap_iterator_next
- * checks it before it is dereferenced
+ * check for insanity where the present bitmaps
+ * keep claiming to extend up to or even beyond the
+ * stated radiotap header length
*/
+ if ((((void *) iterator->arg) - ((void *) iterator->rtheader)) >
+ iterator->max_length)
+ return (-EINVAL);
+
}
+ iterator->arg += sizeof (uint32_t);
+
+ /*
+ * no need to check again for blowing past stated radiotap
+ * header length, becuase ieee80211_radiotap_iterator_next
+ * checks it before it is dereferenced
+ */
+
+ }
+
/* we are all initialized happily */
return 0;
}
/**
- * @brief ieee80211_radiotap_iterator_next - return next radiotap parser iterator arg
+ * @brief ieee80211_radiotap_iterator_next - return next radiotap parser iterator arg
*
* This function returns the next radiotap arg index (IEEE80211_RADIOTAP_...)
* and sets iterator->this_arg to point to the payload for the arg. It takes
@@ -556,8 +555,7 @@ ieee80211_radiotap_iterator_init (struct ieee80211_radiotap_iterator
* @return next present arg index on success or negative if no more or error
*/
static int
-ieee80211_radiotap_iterator_next (struct ieee80211_radiotap_iterator
- *iterator)
+ieee80211_radiotap_iterator_next (struct ieee80211_radiotap_iterator *iterator)
{
/*
@@ -594,10 +592,10 @@ ieee80211_radiotap_iterator_next (struct ieee80211_radiotap_iterator
[IEEE80211_RADIOTAP_RX_FLAGS] = 0x22,
[IEEE80211_RADIOTAP_RTS_RETRIES] = 0x11,
[IEEE80211_RADIOTAP_DATA_RETRIES] = 0x11
- /*
- * add more here as they are defined in
- * include/net/ieee80211_radiotap.h
- */
+ /*
+ * add more here as they are defined in
+ * include/net/ieee80211_radiotap.h
+ */
};
/*
@@ -606,92 +604,92 @@ ieee80211_radiotap_iterator_next (struct ieee80211_radiotap_iterator
*/
while (iterator->arg_index < (int) sizeof (rt_sizes))
+ {
+ int hit = 0;
+
+ if (!(iterator->bitmap_shifter & 1))
+ goto next_entry; /* arg not present */
+
+ /*
+ * arg is present, account for alignment padding
+ * 8-bit args can be at any alignment
+ * 16-bit args must start on 16-bit boundary
+ * 32-bit args must start on 32-bit boundary
+ * 64-bit args must start on 64-bit boundary
+ *
+ * note that total arg size can differ from alignment of
+ * elements inside arg, so we use upper nybble of length
+ * table to base alignment on
+ *
+ * also note: these alignments are ** relative to the
+ * start of the radiotap header **. There is no guarantee
+ * that the radiotap header itself is aligned on any
+ * kind of boundary.
+ */
+
+ if ((((void *) iterator->arg) -
+ ((void *) iterator->rtheader)) & ((rt_sizes[iterator->arg_index] >> 4)
+ - 1))
+ iterator->arg_index +=
+ (rt_sizes[iterator->arg_index] >> 4) -
+ ((((void *) iterator->arg) -
+ ((void *) iterator->rtheader)) & ((rt_sizes[iterator->arg_index] >>
+ 4) - 1));
+
+ /*
+ * 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;
+ hit = 1;
+
+ /* internally move on the size of this arg */
+
+ 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 (-EINVAL);
+
+next_entry:
+
+ iterator->arg_index++;
+ if (((iterator->arg_index & 31) == 0))
{
- int hit = 0;
-
- if (!(iterator->bitmap_shifter & 1))
- goto next_entry; /* arg not present */
-
- /*
- * arg is present, account for alignment padding
- * 8-bit args can be at any alignment
- * 16-bit args must start on 16-bit boundary
- * 32-bit args must start on 32-bit boundary
- * 64-bit args must start on 64-bit boundary
- *
- * note that total arg size can differ from alignment of
- * elements inside arg, so we use upper nybble of length
- * table to base alignment on
- *
- * also note: these alignments are ** relative to the
- * start of the radiotap header **. There is no guarantee
- * that the radiotap header itself is aligned on any
- * kind of boundary.
- */
-
- if ((((void *) iterator->arg) -
- ((void *) iterator->rtheader)) & ((rt_sizes[iterator->arg_index] >>
- 4) - 1))
- iterator->arg_index +=
- (rt_sizes[iterator->arg_index] >> 4) -
- ((((void *) iterator->arg) -
- ((void *) iterator->rtheader)) & ((rt_sizes[iterator->arg_index]
- >> 4) - 1));
-
- /*
- * 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;
- hit = 1;
-
- /* internally move on the size of this arg */
-
- 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 (-EINVAL);
-
- next_entry:
-
- iterator->arg_index++;
- if (((iterator->arg_index & 31) == 0))
- {
- /* completed current uint32_t bitmap */
- if (iterator->bitmap_shifter & 1)
- {
- /* b31 was set, there is more */
- /* move to next uint32_t bitmap */
- iterator->bitmap_shifter = le32toh (*iterator->next_bitmap);
- iterator->next_bitmap++;
- }
- else
- {
- /* no more bitmaps: end */
- iterator->arg_index = sizeof (rt_sizes);
- }
- }
+ /* completed current uint32_t bitmap */
+ if (iterator->bitmap_shifter & 1)
+ {
+ /* b31 was set, there is more */
+ /* move to next uint32_t bitmap */
+ iterator->bitmap_shifter = le32toh (*iterator->next_bitmap);
+ iterator->next_bitmap++;
+ }
else
- { /* just try the next bit */
- iterator->bitmap_shifter >>= 1;
- }
+ {
+ /* no more bitmaps: end */
+ iterator->arg_index = sizeof (rt_sizes);
+ }
+ }
+ else
+ { /* just try the next bit */
+ iterator->bitmap_shifter >>= 1;
+ }
- /* if we found a valid arg earlier, return it now */
+ /* if we found a valid arg earlier, return it now */
- if (hit)
- return (iterator->this_arg_index);
+ if (hit)
+ return (iterator->this_arg_index);
- }
+ }
/* we don't know how to handle any more args, we're done */
@@ -841,7 +839,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
crc = calc_crc_osdep (buf, len);
buf += len;
return (((crc) & 0xFF) == buf[0] && ((crc >> 8) & 0xFF) == buf[1] &&
- ((crc >> 16) & 0xFF) == buf[2] && ((crc >> 24) & 0xFF) == buf[3]);
+ ((crc >> 16) & 0xFF) == buf[2] && ((crc >> 24) & 0xFF) == buf[3]);
}
@@ -890,8 +888,8 @@ linux_get_channel (const struct Hardware_Infos *dev)
* @return size read from the buffer
*/
static ssize_t
-linux_read (struct Hardware_Infos *dev, unsigned char *buf,
- size_t buf_size, struct Radiotap_rx *ri)
+linux_read (struct Hardware_Infos *dev, unsigned char *buf, size_t buf_size,
+ struct Radiotap_rx *ri)
{
unsigned char tmpbuf[buf_size];
ssize_t caplen;
@@ -901,172 +899,170 @@ linux_read (struct Hardware_Infos *dev, unsigned char *buf,
caplen = read (dev->fd_raw, tmpbuf, buf_size);
if (0 > caplen)
- {
- if (EAGAIN == errno)
- return 0;
- fprintf (stderr, "Failed to read from RAW socket: %s\n",
- strerror (errno));
- return -1;
- }
+ {
+ if (EAGAIN == errno)
+ return 0;
+ fprintf (stderr, "Failed to read from RAW socket: %s\n", strerror (errno));
+ return -1;
+ }
memset (buf, 0, buf_size);
memset (ri, 0, sizeof (*ri));
switch (dev->arptype_in)
+ {
+ case ARPHRD_IEEE80211_PRISM:
+ {
+ /* skip the prism header */
+ if (tmpbuf[7] == 0x40)
{
- case ARPHRD_IEEE80211_PRISM:
- {
- /* skip the prism header */
- if (tmpbuf[7] == 0x40)
- {
- /* prism54 uses a different format */
- ri->ri_power = tmpbuf[0x33];
- ri->ri_noise = *(unsigned int *) (tmpbuf + 0x33 + 12);
- ri->ri_rate = (*(unsigned int *) (tmpbuf + 0x33 + 24)) * 500000;
- got_signal = 1;
- got_noise = 1;
- n = 0x40;
- }
- else
- {
- ri->ri_mactime = *(uint64_t *) (tmpbuf + 0x5C - 48);
- ri->ri_channel = *(unsigned int *) (tmpbuf + 0x5C - 36);
- ri->ri_power = *(unsigned int *) (tmpbuf + 0x5C);
- ri->ri_noise = *(unsigned int *) (tmpbuf + 0x5C + 12);
- ri->ri_rate = (*(unsigned int *) (tmpbuf + 0x5C + 24)) * 500000;
- got_channel = 1;
- got_signal = 1;
- got_noise = 1;
- n = *(int *) (tmpbuf + 4);
- }
-
- if (n < 8 || n >= caplen)
- return (0);
- }
- break;
+ /* prism54 uses a different format */
+ ri->ri_power = tmpbuf[0x33];
+ ri->ri_noise = *(unsigned int *) (tmpbuf + 0x33 + 12);
+ ri->ri_rate = (*(unsigned int *) (tmpbuf + 0x33 + 24)) * 500000;
+ got_signal = 1;
+ got_noise = 1;
+ n = 0x40;
+ }
+ else
+ {
+ ri->ri_mactime = *(uint64_t *) (tmpbuf + 0x5C - 48);
+ ri->ri_channel = *(unsigned int *) (tmpbuf + 0x5C - 36);
+ ri->ri_power = *(unsigned int *) (tmpbuf + 0x5C);
+ ri->ri_noise = *(unsigned int *) (tmpbuf + 0x5C + 12);
+ ri->ri_rate = (*(unsigned int *) (tmpbuf + 0x5C + 24)) * 500000;
+ got_channel = 1;
+ got_signal = 1;
+ got_noise = 1;
+ n = *(int *) (tmpbuf + 4);
+ }
+
+ if (n < 8 || n >= caplen)
+ return (0);
+ }
+ break;
- case ARPHRD_IEEE80211_FULL:
+ case ARPHRD_IEEE80211_FULL:
+ {
+ struct ieee80211_radiotap_iterator iterator;
+ struct ieee80211_radiotap_header *rthdr;
+
+ rthdr = (struct ieee80211_radiotap_header *) tmpbuf;
+
+ if (ieee80211_radiotap_iterator_init (&iterator, rthdr, caplen) < 0)
+ return (0);
+
+ /* go through the radiotap arguments we have been given
+ * by the driver
+ */
+
+ while (ieee80211_radiotap_iterator_next (&iterator) >= 0)
+ {
+
+ switch (iterator.this_arg_index)
{
- struct ieee80211_radiotap_iterator iterator;
- struct ieee80211_radiotap_header *rthdr;
-
- rthdr = (struct ieee80211_radiotap_header *) tmpbuf;
-
- if (ieee80211_radiotap_iterator_init (&iterator, rthdr, caplen) < 0)
- return (0);
-
- /* go through the radiotap arguments we have been given
- * by the driver
- */
-
- while (ieee80211_radiotap_iterator_next (&iterator) >= 0)
- {
-
- switch (iterator.this_arg_index)
- {
-
- case IEEE80211_RADIOTAP_TSFT:
- ri->ri_mactime = le64toh (*((uint64_t *) iterator.this_arg));
- break;
-
- case IEEE80211_RADIOTAP_DBM_ANTSIGNAL:
- if (!got_signal)
- {
- if (*iterator.this_arg < 127)
- ri->ri_power = *iterator.this_arg;
- else
- ri->ri_power = *iterator.this_arg - 255;
-
- got_signal = 1;
- }
- break;
-
- case IEEE80211_RADIOTAP_DB_ANTSIGNAL:
- if (!got_signal)
- {
- if (*iterator.this_arg < 127)
- ri->ri_power = *iterator.this_arg;
- else
- ri->ri_power = *iterator.this_arg - 255;
-
- got_signal = 1;
- }
- break;
-
- case IEEE80211_RADIOTAP_DBM_ANTNOISE:
- if (!got_noise)
- {
- if (*iterator.this_arg < 127)
- ri->ri_noise = *iterator.this_arg;
- else
- ri->ri_noise = *iterator.this_arg - 255;
-
- got_noise = 1;
- }
- break;
-
- case IEEE80211_RADIOTAP_DB_ANTNOISE:
- if (!got_noise)
- {
- if (*iterator.this_arg < 127)
- ri->ri_noise = *iterator.this_arg;
- else
- ri->ri_noise = *iterator.this_arg - 255;
-
- got_noise = 1;
- }
- break;
-
- case IEEE80211_RADIOTAP_ANTENNA:
- ri->ri_antenna = *iterator.this_arg;
- break;
-
- case IEEE80211_RADIOTAP_CHANNEL:
- ri->ri_channel = *iterator.this_arg;
- got_channel = 1;
- break;
-
- case IEEE80211_RADIOTAP_RATE:
- ri->ri_rate = (*iterator.this_arg) * 500000;
- break;
-
- case IEEE80211_RADIOTAP_FLAGS:
- /* is the CRC visible at the end?
- * remove
- */
- if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS)
- {
- fcs_removed = 1;
- caplen -= 4;
- }
-
- if (*iterator.this_arg & IEEE80211_RADIOTAP_F_RX_BADFCS)
- return (0);
-
- break;
- }
- }
- n = le16toh (rthdr->it_len);
- if (n <= 0 || n >= caplen)
- return 0;
+
+ case IEEE80211_RADIOTAP_TSFT:
+ ri->ri_mactime = le64toh (*((uint64_t *) iterator.this_arg));
+ break;
+
+ case IEEE80211_RADIOTAP_DBM_ANTSIGNAL:
+ if (!got_signal)
+ {
+ if (*iterator.this_arg < 127)
+ ri->ri_power = *iterator.this_arg;
+ else
+ ri->ri_power = *iterator.this_arg - 255;
+
+ got_signal = 1;
+ }
+ break;
+
+ case IEEE80211_RADIOTAP_DB_ANTSIGNAL:
+ if (!got_signal)
+ {
+ if (*iterator.this_arg < 127)
+ ri->ri_power = *iterator.this_arg;
+ else
+ ri->ri_power = *iterator.this_arg - 255;
+
+ got_signal = 1;
+ }
+ break;
+
+ case IEEE80211_RADIOTAP_DBM_ANTNOISE:
+ if (!got_noise)
+ {
+ if (*iterator.this_arg < 127)
+ ri->ri_noise = *iterator.this_arg;
+ else
+ ri->ri_noise = *iterator.this_arg - 255;
+
+ got_noise = 1;
+ }
+ break;
+
+ case IEEE80211_RADIOTAP_DB_ANTNOISE:
+ if (!got_noise)
+ {
+ if (*iterator.this_arg < 127)
+ ri->ri_noise = *iterator.this_arg;
+ else
+ ri->ri_noise = *iterator.this_arg - 255;
+
+ got_noise = 1;
+ }
+ break;
+
+ case IEEE80211_RADIOTAP_ANTENNA:
+ ri->ri_antenna = *iterator.this_arg;
+ break;
+
+ case IEEE80211_RADIOTAP_CHANNEL:
+ ri->ri_channel = *iterator.this_arg;
+ got_channel = 1;
+ break;
+
+ case IEEE80211_RADIOTAP_RATE:
+ ri->ri_rate = (*iterator.this_arg) * 500000;
+ break;
+
+ case IEEE80211_RADIOTAP_FLAGS:
+ /* is the CRC visible at the end?
+ * remove
+ */
+ if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS)
+ {
+ fcs_removed = 1;
+ caplen -= 4;
+ }
+
+ if (*iterator.this_arg & IEEE80211_RADIOTAP_F_RX_BADFCS)
+ return (0);
+
+ break;
}
- break;
- case ARPHRD_IEEE80211:
- /* do nothing? */
- break;
- default:
- errno = ENOTSUP;
- return -1;
}
+ n = le16toh (rthdr->it_len);
+ if (n <= 0 || n >= caplen)
+ return 0;
+ }
+ break;
+ case ARPHRD_IEEE80211:
+ /* do nothing? */
+ break;
+ default:
+ errno = ENOTSUP;
+ return -1;
+ }
caplen -= n;
//detect fcs at the end, even if the flag wasn't set and remove it
- if ((0 == fcs_removed)
- && (1 == check_crc_buf_osdep (tmpbuf + n, caplen - 4)))
- {
- caplen -= 4;
- }
+ if ((0 == fcs_removed) && (1 == check_crc_buf_osdep (tmpbuf + n, caplen - 4)))
+ {
+ caplen -= 4;
+ }
memcpy (buf, tmpbuf + n, caplen);
if (!got_channel)
ri->ri_channel = linux_get_channel (dev);
@@ -1092,12 +1088,11 @@ openraw (struct Hardware_Infos *dev)
memset (&ifr, 0, sizeof (ifr));
strncpy (ifr.ifr_name, dev->iface, IFNAMSIZ);
if (-1 == ioctl (dev->fd_raw, SIOCGIFINDEX, &ifr))
- {
- fprintf (stderr,
- "ioctl(SIOCGIFINDEX) on interface `%.*s' failed: %s\n",
- IFNAMSIZ, dev->iface, strerror (errno));
- return 1;
- }
+ {
+ fprintf (stderr, "ioctl(SIOCGIFINDEX) on interface `%.*s' failed: %s\n",
+ IFNAMSIZ, dev->iface, strerror (errno));
+ return 1;
+ }
/* lookup the hardware type */
memset (&sll, 0, sizeof (sll));
@@ -1105,78 +1100,72 @@ openraw (struct Hardware_Infos *dev)
sll.sll_ifindex = ifr.ifr_ifindex;
sll.sll_protocol = htons (ETH_P_ALL);
if (-1 == ioctl (dev->fd_raw, SIOCGIFHWADDR, &ifr))
- {
- fprintf (stderr,
- "ioctl(SIOCGIFHWADDR) on interface `%.*s' failed: %s\n",
- IFNAMSIZ, dev->iface, strerror (errno));
- return 1;
- }
+ {
+ fprintf (stderr, "ioctl(SIOCGIFHWADDR) on interface `%.*s' failed: %s\n",
+ IFNAMSIZ, dev->iface, strerror (errno));
+ return 1;
+ }
/* lookup iw mode */
memset (&wrq, 0, sizeof (struct iwreq));
strncpy (wrq.ifr_name, dev->iface, IFNAMSIZ);
if (-1 == ioctl (dev->fd_raw, SIOCGIWMODE, &wrq))
- {
- /* most probably not supported (ie for rtap ipw interface) *
- * so just assume its correctly set... */
- wrq.u.mode = IW_MODE_MONITOR;
- }
+ {
+ /* most probably not supported (ie for rtap ipw interface) *
+ * so just assume its correctly set... */
+ wrq.u.mode = IW_MODE_MONITOR;
+ }
if (((ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211) &&
(ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211_PRISM) &&
(ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211_FULL)) ||
(wrq.u.mode != IW_MODE_MONITOR))
- {
- fprintf (stderr,
- "Error: interface `%.*s' is not in monitor mode\n",
- IFNAMSIZ, dev->iface);
- return 1;
- }
+ {
+ fprintf (stderr, "Error: interface `%.*s' is not in monitor mode\n",
+ IFNAMSIZ, dev->iface);
+ return 1;
+ }
/* Is interface st to up, broadcast & running ? */
if ((ifr.ifr_flags | IFF_UP | IFF_BROADCAST | IFF_RUNNING) != ifr.ifr_flags)
+ {
+ /* Bring interface up */
+ ifr.ifr_flags |= IFF_UP | IFF_BROADCAST | IFF_RUNNING;
+
+ if (-1 == ioctl (dev->fd_raw, SIOCSIFFLAGS, &ifr))
{
- /* Bring interface up */
- ifr.ifr_flags |= IFF_UP | IFF_BROADCAST | IFF_RUNNING;
-
- if (-1 == ioctl (dev->fd_raw, SIOCSIFFLAGS, &ifr))
- {
- fprintf (stderr,
- "ioctl(SIOCSIFFLAGS) on interface `%.*s' failed: %s\n",
- IFNAMSIZ, dev->iface, strerror (errno));
- return 1;
- }
+ fprintf (stderr, "ioctl(SIOCSIFFLAGS) on interface `%.*s' failed: %s\n",
+ IFNAMSIZ, dev->iface, strerror (errno));
+ return 1;
}
+ }
/* bind the raw socket to the interface */
if (-1 == bind (dev->fd_raw, (struct sockaddr *) &sll, sizeof (sll)))
- {
- fprintf (stderr,
- "Failed to bind interface `%.*s': %s\n", IFNAMSIZ,
- dev->iface, strerror (errno));
- return 1;
- }
+ {
+ fprintf (stderr, "Failed to bind interface `%.*s': %s\n", IFNAMSIZ,
+ dev->iface, strerror (errno));
+ return 1;
+ }
/* lookup the hardware type */
if (-1 == ioctl (dev->fd_raw, SIOCGIFHWADDR, &ifr))
- {
- fprintf (stderr,
- "ioctl(SIOCGIFHWADDR) on interface `%.*s' failed: %s\n",
- IFNAMSIZ, dev->iface, strerror (errno));
- return 1;
- }
+ {
+ fprintf (stderr, "ioctl(SIOCGIFHWADDR) on interface `%.*s' failed: %s\n",
+ IFNAMSIZ, dev->iface, strerror (errno));
+ return 1;
+ }
memcpy (&dev->pl_mac, ifr.ifr_hwaddr.sa_data, MAC_ADDR_SIZE);
dev->arptype_in = ifr.ifr_hwaddr.sa_family;
if ((ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211) &&
(ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211_PRISM) &&
(ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211_FULL))
- {
- fprintf (stderr,
- "Unsupported hardware link type %d on interface `%.*s'\n",
- ifr.ifr_hwaddr.sa_family, IFNAMSIZ, dev->iface);
- return 1;
- }
+ {
+ fprintf (stderr, "Unsupported hardware link type %d on interface `%.*s'\n",
+ ifr.ifr_hwaddr.sa_family, IFNAMSIZ, dev->iface);
+ return 1;
+ }
/* enable promiscuous mode */
memset (&mr, 0, sizeof (mr));
@@ -1184,13 +1173,12 @@ openraw (struct Hardware_Infos *dev)
mr.mr_type = PACKET_MR_PROMISC;
if (0 !=
setsockopt (dev->fd_raw, SOL_PACKET, PACKET_ADD_MEMBERSHIP, &mr,
- sizeof (mr)))
- {
- fprintf (stderr,
- "Failed to enable promiscuous mode on interface `%.*s'\n",
- IFNAMSIZ, dev->iface);
- return 1;
- }
+ sizeof (mr)))
+ {
+ fprintf (stderr, "Failed to enable promiscuous mode on interface `%.*s'\n",
+ IFNAMSIZ, dev->iface);
+ return 1;
+ }
return 0;
}
@@ -1211,36 +1199,34 @@ wlaninit (struct Hardware_Infos *dev, const char *iface)
dev->fd_raw = socket (PF_PACKET, SOCK_RAW, htons (ETH_P_ALL));
if (0 > dev->fd_raw)
- {
- fprintf (stderr, "Failed to create raw socket: %s\n", strerror (errno));
- return 1;
- }
+ {
+ fprintf (stderr, "Failed to create raw socket: %s\n", strerror (errno));
+ return 1;
+ }
if (dev->fd_raw >= FD_SETSIZE)
- {
- fprintf (stderr,
- "File descriptor too large for select (%d > %d)\n",
- dev->fd_raw, FD_SETSIZE);
- close (dev->fd_raw);
- return 1;
- }
+ {
+ fprintf (stderr, "File descriptor too large for select (%d > %d)\n",
+ dev->fd_raw, FD_SETSIZE);
+ close (dev->fd_raw);
+ return 1;
+ }
/* mac80211 stack detection */
ret =
- snprintf (strbuf,
- sizeof (strbuf), "/sys/class/net/%s/phy80211/subsystem", iface);
+ 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", iface);
- close (dev->fd_raw);
- return 1;
- }
+ {
+ fprintf (stderr, "Did not find 802.11 interface `%s'. Exiting.\n", iface);
+ close (dev->fd_raw);
+ return 1;
+ }
strncpy (dev->iface, iface, IFNAMSIZ);
if (0 != openraw (dev))
- {
- close (dev->fd_raw);
- return 1;
- }
+ {
+ close (dev->fd_raw);
+ return 1;
+ }
return 0;
}
@@ -1254,7 +1240,7 @@ wlaninit (struct Hardware_Infos *dev, const char *iface)
*/
static int
mac_test (const struct ieee80211_frame *uint8_taIeeeHeader,
- const struct Hardware_Infos *dev)
+ const struct Hardware_Infos *dev)
{
if (0 != memcmp (uint8_taIeeeHeader->i_addr3, &mac_bssid, MAC_ADDR_SIZE))
return 1;
@@ -1273,7 +1259,7 @@ mac_test (const struct ieee80211_frame *uint8_taIeeeHeader,
*/
static void
mac_set (struct ieee80211_frame *uint8_taIeeeHeader,
- const struct Hardware_Infos *dev)
+ const struct Hardware_Infos *dev)
{
uint8_taIeeeHeader->i_fc[0] = 0x08;
uint8_taIeeeHeader->i_fc[1] = 0x00;
@@ -1289,8 +1275,7 @@ mac_set (struct ieee80211_frame *uint8_taIeeeHeader,
* @param hdr pointer to the start of the packet
*/
static void
-stdin_send_hw (void *cls, void *client,
- const struct GNUNET_MessageHeader *hdr)
+stdin_send_hw (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
{
struct Hardware_Infos *dev = cls;
struct sendbuf *write_pout = &dev->write_pout;
@@ -1305,7 +1290,7 @@ stdin_send_hw (void *cls, void *client,
rtheader.rate = 0x00;
rtheader.pad1 = 0x00;
rtheader.txflags =
- htole16 (IEEE80211_RADIOTAP_F_TX_NOACK | IEEE80211_RADIOTAP_F_TX_NOSEQ);
+ htole16 (IEEE80211_RADIOTAP_F_TX_NOACK | IEEE80211_RADIOTAP_F_TX_NOSEQ);
/* { 0x00, 0x00, <-- radiotap version
* 0x0c, 0x00, <- radiotap header length
@@ -1318,24 +1303,23 @@ stdin_send_hw (void *cls, void *client,
sendsize = ntohs (hdr->size);
if (sendsize <
sizeof (struct Radiotap_Send) + sizeof (struct GNUNET_MessageHeader))
- {
- fprintf (stderr,
- "Function stdin_send_hw: malformed packet (too small)\n");
- exit (1);
- }
+ {
+ fprintf (stderr, "Function stdin_send_hw: malformed packet (too small)\n");
+ exit (1);
+ }
sendsize -=
- sizeof (struct Radiotap_Send) + sizeof (struct GNUNET_MessageHeader);
+ sizeof (struct Radiotap_Send) + sizeof (struct GNUNET_MessageHeader);
if (MAXLINE < sendsize)
- {
- fprintf (stderr, "Function stdin_send_hw: Packet too big for buffer\n");
- exit (1);
- }
+ {
+ fprintf (stderr, "Function stdin_send_hw: Packet too big for buffer\n");
+ exit (1);
+ }
if (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA != ntohs (hdr->type))
- {
- fprintf (stderr, "Function stdin_send: wrong packet type\n");
- exit (1);
- }
+ {
+ fprintf (stderr, "Function stdin_send: wrong packet type\n");
+ exit (1);
+ }
rtheader.header.it_len = htole16 (sizeof (rtheader));
rtheader.rate = header->rate;
@@ -1343,8 +1327,7 @@ stdin_send_hw (void *cls, void *client,
memcpy (write_pout->buf + sizeof (rtheader), &header[1], sendsize);
/* payload contains MAC address, but we don't trust it, so we'll
* overwrite it with OUR MAC address again to prevent mischief */
- wlanheader =
- (struct ieee80211_frame *) (write_pout->buf + sizeof (rtheader));
+ wlanheader = (struct ieee80211_frame *) (write_pout->buf + sizeof (rtheader));
mac_set (wlanheader, dev);
write_pout->size = sendsize + sizeof (rtheader);
}
@@ -1372,19 +1355,19 @@ main (int argc, char *argv[])
struct GNUNET_SERVER_MessageStreamTokenizer *stdin_mst;
if (2 != argc)
- {
- fprintf (stderr,
- "You must specify the name of the interface as the first and only argument to this program.\n");
- return 1;
- }
+ {
+ fprintf (stderr,
+ "You must specify the name of the interface as the first and only argument to this program.\n");
+ return 1;
+ }
if (0 != wlaninit (&dev, argv[1]))
return 1;
uid = getuid ();
if (0 != setresuid (uid, uid, uid))
- {
- fprintf (stderr, "Failed to setresuid: %s\n", strerror (errno));
- /* not critical, continue anyway */
- }
+ {
+ fprintf (stderr, "Failed to setresuid: %s\n", strerror (errno));
+ /* not critical, continue anyway */
+ }
dev.write_pout.size = 0;
dev.write_pout.pos = 0;
@@ -1396,135 +1379,129 @@ main (int argc, char *argv[])
stdin_open = 1;
while (1)
+ {
+ maxfd = -1;
+ FD_ZERO (&rfds);
+ if ((0 == dev.write_pout.size) && (1 == stdin_open))
+ {
+ FD_SET (STDIN_FILENO, &rfds);
+ maxfd = MAX (maxfd, STDIN_FILENO);
+ }
+ if (0 == write_std.size)
+ {
+ FD_SET (dev.fd_raw, &rfds);
+ maxfd = MAX (maxfd, dev.fd_raw);
+ }
+ FD_ZERO (&wfds);
+ if (0 < write_std.size)
+ {
+ FD_SET (STDOUT_FILENO, &wfds);
+ maxfd = MAX (maxfd, STDOUT_FILENO);
+ }
+ if (0 < dev.write_pout.size)
+ {
+ FD_SET (dev.fd_raw, &wfds);
+ maxfd = MAX (maxfd, dev.fd_raw);
+ }
+ retval = select (maxfd + 1, &rfds, &wfds, NULL, NULL);
+ if ((-1 == retval) && (EINTR == errno))
+ continue;
+ if (0 > retval)
+ {
+ fprintf (stderr, "select failed: %s\n", strerror (errno));
+ break;
+ }
+ if (FD_ISSET (STDOUT_FILENO, &wfds))
+ {
+ ret =
+ write (STDOUT_FILENO, write_std.buf + write_std.pos,
+ write_std.size - write_std.pos);
+ if (0 > ret)
+ {
+ fprintf (stderr, "Failed to write to STDOUT: %s\n", strerror (errno));
+ break;
+ }
+ write_std.pos += ret;
+ if (write_std.pos == write_std.size)
+ {
+ write_std.pos = 0;
+ write_std.size = 0;
+ }
+ }
+ if (FD_ISSET (dev.fd_raw, &wfds))
+ {
+ ret = write (dev.fd_raw, dev.write_pout.buf, dev.write_pout.size);
+ if (0 > ret)
+ {
+ fprintf (stderr, "Failed to write to WLAN device: %s\n",
+ strerror (errno));
+ break;
+ }
+ dev.write_pout.pos += ret;
+ if ((dev.write_pout.pos != dev.write_pout.size) && (ret != 0))
+ {
+ /* we should not get partial sends with packet-oriented devices... */
+ fprintf (stderr, "Write error, partial send: %u/%u\n",
+ dev.write_pout.pos, dev.write_pout.size);
+ break;
+ }
+ if (dev.write_pout.pos == dev.write_pout.size)
+ {
+ dev.write_pout.pos = 0;
+ dev.write_pout.size = 0;
+ }
+ }
+
+ if (FD_ISSET (STDIN_FILENO, &rfds))
{
- maxfd = -1;
- FD_ZERO (&rfds);
- if ((0 == dev.write_pout.size) && (1 == stdin_open))
- {
- FD_SET (STDIN_FILENO, &rfds);
- maxfd = MAX (maxfd, STDIN_FILENO);
- }
- if (0 == write_std.size)
- {
- FD_SET (dev.fd_raw, &rfds);
- maxfd = MAX (maxfd, dev.fd_raw);
- }
- FD_ZERO (&wfds);
- if (0 < write_std.size)
- {
- FD_SET (STDOUT_FILENO, &wfds);
- maxfd = MAX (maxfd, STDOUT_FILENO);
- }
- if (0 < dev.write_pout.size)
- {
- FD_SET (dev.fd_raw, &wfds);
- maxfd = MAX (maxfd, dev.fd_raw);
- }
- retval = select (maxfd + 1, &rfds, &wfds, NULL, NULL);
- if ((-1 == retval) && (EINTR == errno))
- continue;
- if (0 > retval)
- {
- fprintf (stderr, "select failed: %s\n", strerror (errno));
- break;
- }
- if (FD_ISSET (STDOUT_FILENO, &wfds))
- {
- ret =
- write (STDOUT_FILENO,
- write_std.buf + write_std.pos,
- write_std.size - write_std.pos);
- if (0 > ret)
- {
- fprintf (stderr,
- "Failed to write to STDOUT: %s\n", strerror (errno));
- break;
- }
- write_std.pos += ret;
- if (write_std.pos == write_std.size)
- {
- write_std.pos = 0;
- write_std.size = 0;
- }
- }
- if (FD_ISSET (dev.fd_raw, &wfds))
- {
- ret = write (dev.fd_raw, dev.write_pout.buf, dev.write_pout.size);
- if (0 > ret)
- {
- fprintf (stderr,
- "Failed to write to WLAN device: %s\n",
- strerror (errno));
- break;
- }
- dev.write_pout.pos += ret;
- if ((dev.write_pout.pos != dev.write_pout.size) && (ret != 0))
- {
- /* we should not get partial sends with packet-oriented devices... */
- fprintf (stderr,
- "Write error, partial send: %u/%u\n",
- dev.write_pout.pos, dev.write_pout.size);
- break;
- }
- if (dev.write_pout.pos == dev.write_pout.size)
- {
- dev.write_pout.pos = 0;
- dev.write_pout.size = 0;
- }
- }
-
- if (FD_ISSET (STDIN_FILENO, &rfds))
- {
- ret = read (STDIN_FILENO, readbuf, sizeof (readbuf));
- if (0 > ret)
- {
- fprintf (stderr,
- "Read error from STDIN: %s\n", strerror (errno));
- break;
- }
- if (0 == ret)
- {
- /* stop reading... */
- stdin_open = 0;
- }
- GNUNET_SERVER_mst_receive (stdin_mst, NULL, readbuf, ret, GNUNET_NO,
- GNUNET_NO);
- }
-
- if (FD_ISSET (dev.fd_raw, &rfds))
- {
- struct GNUNET_MessageHeader *header;
- struct Radiotap_rx *rxinfo;
- struct ieee80211_frame *datastart;
-
- header = (struct GNUNET_MessageHeader *) write_std.buf;
- rxinfo = (struct Radiotap_rx *) &header[1];
- datastart = (struct ieee80211_frame *) &rxinfo[1];
- ret =
- linux_read (&dev, (unsigned char *) datastart,
- sizeof (write_std.buf) - sizeof (struct Radiotap_rx) -
- sizeof (struct GNUNET_MessageHeader), rxinfo);
- if (0 > ret)
- {
- fprintf (stderr,
- "Read error from raw socket: %s\n", strerror (errno));
- break;
- }
- if ((0 < ret) && (0 == mac_test (datastart, &dev)))
- {
- write_std.size =
- ret + sizeof (struct GNUNET_MessageHeader) +
- sizeof (struct Radiotap_rx);
- header->size = htons (write_std.size);
- header->type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA);
- }
- }
+ ret = read (STDIN_FILENO, readbuf, sizeof (readbuf));
+ if (0 > ret)
+ {
+ fprintf (stderr, "Read error from STDIN: %s\n", strerror (errno));
+ break;
+ }
+ if (0 == ret)
+ {
+ /* stop reading... */
+ stdin_open = 0;
+ }
+ GNUNET_SERVER_mst_receive (stdin_mst, NULL, readbuf, ret, GNUNET_NO,
+ GNUNET_NO);
+ }
+ if (FD_ISSET (dev.fd_raw, &rfds))
+ {
+ struct GNUNET_MessageHeader *header;
+ struct Radiotap_rx *rxinfo;
+ struct ieee80211_frame *datastart;
+
+ header = (struct GNUNET_MessageHeader *) write_std.buf;
+ rxinfo = (struct Radiotap_rx *) &header[1];
+ datastart = (struct ieee80211_frame *) &rxinfo[1];
+ ret =
+ linux_read (&dev, (unsigned char *) datastart,
+ sizeof (write_std.buf) - sizeof (struct Radiotap_rx) -
+ sizeof (struct GNUNET_MessageHeader), rxinfo);
+ if (0 > ret)
+ {
+ fprintf (stderr, "Read error from raw socket: %s\n", strerror (errno));
+ break;
+ }
+ if ((0 < ret) && (0 == mac_test (datastart, &dev)))
+ {
+ write_std.size =
+ ret + sizeof (struct GNUNET_MessageHeader) +
+ sizeof (struct Radiotap_rx);
+ header->size = htons (write_std.size);
+ header->type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA);
+ }
}
+
+ }
/* Error handling, try to clean up a bit at least */
GNUNET_SERVER_mst_destroy (stdin_mst);
close (dev.fd_raw);
- return 1; /* we never exit 'normally' */
+ return 1; /* we never exit 'normally' */
}
/* end of gnunet-transport-wlan-helper.c */
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index 66f02b104..c069bfb24 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -437,14 +437,14 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
traffic_received += ntohs (message->size);
}
-void process_string (void *cls,
- const char *address)
+void
+process_string (void *cls, const char *address)
{
- struct GNUNET_PeerIdentity * peer = cls;
+ struct GNUNET_PeerIdentity *peer = cls;
if ((address != NULL))
{
- fprintf (stdout, _("Peer `%s': %s\n"), GNUNET_i2s(peer), address);
+ fprintf (stdout, _("Peer `%s': %s\n"), GNUNET_i2s (peer), address);
}
else
{
@@ -463,29 +463,25 @@ void process_string (void *cls,
* @param addrlen number of bytes in addr
*/
static void
-process_address (void *cls,
- const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_HELLO_Address *address)
+process_address (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_HELLO_Address *address)
{
- const struct GNUNET_CONFIGURATION_Handle * cfg = cls;
+ const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
struct GNUNET_PeerIdentity *peercp;
- if ( (address == NULL) || (peer == NULL) )
+ if ((address == NULL) || (peer == NULL))
{
/* done */
return;
}
- peercp = GNUNET_malloc(sizeof (struct GNUNET_PeerIdentity));
+ peercp = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity));
*peercp = *peer;
/* Resolve address to string */
- GNUNET_TRANSPORT_address_to_string (cfg,
- address,
- numeric,
- GNUNET_TIME_UNIT_MINUTES,
- &process_string,
- peercp);
+ GNUNET_TRANSPORT_address_to_string (cfg, address, numeric,
+ GNUNET_TIME_UNIT_MINUTES, &process_string,
+ peercp);
}
@@ -542,8 +538,8 @@ run (void *cls, char *const *args, const char *cfgfile,
if (iterate_connections)
{
GNUNET_TRANSPORT_peer_get_active_addresses (cfg, NULL, GNUNET_YES,
- GNUNET_TIME_UNIT_MINUTES,
- &process_address, (void *)cfg);
+ GNUNET_TIME_UNIT_MINUTES,
+ &process_address, (void *) cfg);
}
}
@@ -568,9 +564,9 @@ main (int argc, char *const *argv)
{'t', "test", NULL,
gettext_noop ("test transport configuration (involves external server)"),
0, &GNUNET_GETOPT_set_one, &test_configuration},
- {'n', "numeric", NULL,
- gettext_noop ("do not resolve hostnames"),
- 0, &GNUNET_GETOPT_set_one, &numeric},
+ {'n', "numeric", NULL,
+ gettext_noop ("do not resolve hostnames"),
+ 0, &GNUNET_GETOPT_set_one, &numeric},
GNUNET_GETOPT_OPTION_VERBOSE (&verbosity),
GNUNET_GETOPT_OPTION_END
};
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c
index a6c9190bd..502e26597 100644
--- a/src/transport/plugin_transport_http.c
+++ b/src/transport/plugin_transport_http.c
@@ -513,6 +513,7 @@ http_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
struct Plugin *plugin = cls;
struct HTTP_Message *msg;
struct Session *s;
+
GNUNET_assert (plugin != NULL);
int res = GNUNET_SYSERR;
@@ -563,17 +564,20 @@ http_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
GNUNET_i2s (target));
#endif
int res = GNUNET_OK;
+
if (addrlen == sizeof (struct IPv4HttpAddress))
{
- struct IPv4HttpAddress * a4 = (struct IPv4HttpAddress *) addr;
- if ((ntohs(a4->u4_port) == 0) || (plugin->ipv4 == GNUNET_NO))
- res = GNUNET_SYSERR;
+ struct IPv4HttpAddress *a4 = (struct IPv4HttpAddress *) addr;
+
+ if ((ntohs (a4->u4_port) == 0) || (plugin->ipv4 == GNUNET_NO))
+ res = GNUNET_SYSERR;
}
if (addrlen == sizeof (struct IPv6HttpAddress))
{
- struct IPv6HttpAddress * a6 = (struct IPv6HttpAddress *) addr;
- if ((ntohs(a6->u6_port) == 0) || (plugin->ipv6 == GNUNET_NO))
- res = GNUNET_SYSERR;
+ struct IPv6HttpAddress *a6 = (struct IPv6HttpAddress *) addr;
+
+ if ((ntohs (a6->u6_port) == 0) || (plugin->ipv6 == GNUNET_NO))
+ res = GNUNET_SYSERR;
}
if (res == GNUNET_OK)
{
@@ -606,8 +610,7 @@ http_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
{
#if DEBUG_HTTP
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
- "Using outbound client session %p to send to `%s'\n",
- s,
+ "Using outbound client session %p to send to `%s'\n", s,
GNUNET_i2s (target));
#endif
@@ -618,8 +621,7 @@ http_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
{
#if DEBUG_HTTP
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
- "Using inbound server %p session to send to `%s'\n",
- s,
+ "Using inbound server %p session to send to `%s'\n", s,
GNUNET_i2s (target));
#endif
@@ -659,16 +661,17 @@ http_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
GNUNET_assert (GNUNET_OK == server_disconnect (s));
GNUNET_CONTAINER_DLL_remove (plugin->head, plugin->tail, s);
- struct HTTP_Message * msg = s->msg_head;
- struct HTTP_Message * tmp = s->msg_head;
+ struct HTTP_Message *msg = s->msg_head;
+ struct HTTP_Message *tmp = s->msg_head;
+
while (msg != NULL)
{
tmp = msg->next;
- GNUNET_CONTAINER_DLL_remove(s->msg_head,s->msg_tail, msg);
+ GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, msg);
if (msg->transmit_cont != NULL)
{
- msg->transmit_cont(msg->transmit_cont_cls, target, GNUNET_SYSERR);
+ msg->transmit_cont (msg->transmit_cont_cls, target, GNUNET_SYSERR);
}
GNUNET_free (msg);
msg = tmp;
@@ -1427,18 +1430,20 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls)
while (s != NULL)
{
struct Session *t = s->next;
+
GNUNET_CONTAINER_DLL_remove (plugin->head, plugin->tail, s);
- struct HTTP_Message * msg = s->msg_head;
- struct HTTP_Message * tmp = s->msg_head;
+ struct HTTP_Message *msg = s->msg_head;
+ struct HTTP_Message *tmp = s->msg_head;
+
while (msg != NULL)
{
tmp = msg->next;
- GNUNET_CONTAINER_DLL_remove(s->msg_head,s->msg_tail, msg);
+ GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, msg);
if (msg->transmit_cont != NULL)
{
- msg->transmit_cont(msg->transmit_cont_cls, &s->target, GNUNET_SYSERR);
+ msg->transmit_cont (msg->transmit_cont_cls, &s->target, GNUNET_SYSERR);
}
GNUNET_free (msg);
msg = tmp;
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index 159b0853f..2c180c5ff 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -312,6 +312,7 @@ static ssize_t
server_send_callback (void *cls, uint64_t pos, char *buf, size_t max)
{
struct Session *s = cls;
+
#if VERBOSE_SERVER
GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, s->plugin->name,
"Server: %X can sent maximum %u \n", s, max);
@@ -349,6 +350,7 @@ server_send_callback (void *cls, uint64_t pos, char *buf, size_t max)
#if VERBOSE_SERVER
struct Plugin *plugin = s->plugin;
+
GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
"Server: %X: sent %u bytes\n", s, bytes_read);
#endif
@@ -575,7 +577,8 @@ found:
#endif
MHD_set_connection_option (mhd_connection, MHD_CONNECTION_OPTION_TIMEOUT, to);
- struct MHD_Daemon * d = NULL;
+ struct MHD_Daemon *d = NULL;
+
if (s->addrlen == sizeof (struct IPv6HttpAddress))
d = plugin->server_v6;
if (s->addrlen == sizeof (struct IPv4HttpAddress))
@@ -649,10 +652,10 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
if ((sc->session->server_recv == NULL) || (sc->session->server_send == NULL))
{
#if VERBOSE_SERVER
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
- "Server: Delayed read from `%s' `%s' since not both semi-connections are connected\n",
- GNUNET_i2s (&s->target),
- http_plugin_address_to_string (NULL, s->addr, s->addrlen));
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Server: Delayed read from `%s' `%s' since not both semi-connections are connected\n",
+ GNUNET_i2s (&s->target),
+ http_plugin_address_to_string (NULL, s->addr, s->addrlen));
#endif
return MHD_YES;
}
@@ -674,7 +677,8 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
"Server: Peer `%s' PUT on address `%s' connected\n",
GNUNET_i2s (&s->target),
- http_plugin_address_to_string (NULL, s->addr, s->addrlen));
+ http_plugin_address_to_string (NULL, s->addr,
+ s->addrlen));
#endif
return MHD_YES;
}
@@ -686,7 +690,8 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
"Server: peer `%s' PUT on address `%s' received %u bytes\n",
GNUNET_i2s (&s->target),
- http_plugin_address_to_string (NULL,s->addr, s->addrlen),
+ http_plugin_address_to_string (NULL, s->addr,
+ s->addrlen),
*upload_data_size);
#endif
struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
@@ -739,6 +744,7 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
to);
}
struct MHD_Daemon *d = NULL;
+
if (s->addrlen == sizeof (struct IPv6HttpAddress))
d = plugin->server_v6;
if (s->addrlen == sizeof (struct IPv4HttpAddress))
@@ -839,6 +845,7 @@ server_disconnect_cb (void *cls, struct MHD_Connection *connection,
plugin->cur_connections--;
struct MHD_Daemon *d = NULL;
+
if (s->addrlen == sizeof (struct IPv6HttpAddress))
d = plugin->server_v6;
if (s->addrlen == sizeof (struct IPv4HttpAddress))
@@ -894,11 +901,11 @@ server_send (struct Session *s, struct HTTP_Message *msg)
if (s->addrlen == sizeof (struct IPv4HttpAddress))
{
- server_reschedule (s->plugin, s->plugin->server_v4 , GNUNET_YES);
+ server_reschedule (s->plugin, s->plugin->server_v4, GNUNET_YES);
}
else if (s->addrlen == sizeof (struct IPv6HttpAddress))
{
- server_reschedule (s->plugin, s->plugin->server_v6 , GNUNET_YES);
+ server_reschedule (s->plugin, s->plugin->server_v6, GNUNET_YES);
}
else
return GNUNET_SYSERR;
@@ -926,7 +933,7 @@ server_v4_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
return;
#if VERBOSE_SERVER
GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
- "Running IPv4 server\n");
+ "Running IPv4 server\n");
#endif
GNUNET_assert (MHD_YES == MHD_run (plugin->server_v4));
if (plugin->server_v4 != NULL)
@@ -954,7 +961,7 @@ server_v6_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
return;
#if VERBOSE_SERVER
GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
- "Running IPv6 server\n");
+ "Running IPv6 server\n");
#endif
GNUNET_assert (MHD_YES == MHD_run (plugin->server_v6));
if (plugin->server_v6 != NULL)
@@ -1027,8 +1034,8 @@ server_schedule (struct Plugin *plugin, struct MHD_Daemon *daemon_handle,
plugin->server_v4_task = GNUNET_SCHEDULER_NO_TASK;
}
#if VERBOSE_SERVER
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
- "Scheduling IPv4 server task in %llu ms\n", tv);
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
+ "Scheduling IPv4 server task in %llu ms\n", tv);
#endif
ret =
GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
@@ -1043,8 +1050,8 @@ server_schedule (struct Plugin *plugin, struct MHD_Daemon *daemon_handle,
plugin->server_v6_task = GNUNET_SCHEDULER_NO_TASK;
}
#if VERBOSE_SERVER
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
- "Scheduling IPv6 server task in %llu ms\n", tv);
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
+ "Scheduling IPv6 server task in %llu ms\n", tv);
#endif
ret =
GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
@@ -1195,8 +1202,7 @@ server_stop (struct Plugin *plugin)
struct Session *t = NULL;
#if VERBOSE_SERVER
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
- "server_stop\n");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, "server_stop\n");
#endif
struct MHD_Daemon *server_v4_tmp = plugin->server_v4;
@@ -1236,16 +1242,17 @@ server_stop (struct Plugin *plugin)
"Deleting semi-sessions %p\n", s);
#endif
t = s->next;
- struct HTTP_Message * msg = s->msg_head;
- struct HTTP_Message * tmp = s->msg_head;
+ struct HTTP_Message *msg = s->msg_head;
+ struct HTTP_Message *tmp = s->msg_head;
+
while (msg != NULL)
{
tmp = msg->next;
- GNUNET_CONTAINER_DLL_remove(s->msg_head,s->msg_tail, msg);
+ GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, msg);
if (msg->transmit_cont != NULL)
{
- msg->transmit_cont(msg->transmit_cont_cls, &s->target, GNUNET_SYSERR);
+ msg->transmit_cont (msg->transmit_cont_cls, &s->target, GNUNET_SYSERR);
}
GNUNET_free (msg);
msg = tmp;
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index a0d5072b8..1ef0bca98 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -267,7 +267,7 @@ struct BroadcastAddress
struct BroadcastAddress *next;
struct BroadcastAddress *prev;
- void * addr;
+ void *addr;
socklen_t addrlen;
};
@@ -540,8 +540,11 @@ destroy_session (void *cls, const GNUNET_HashCode * key, void *value)
struct Session *peer_session = value;
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (peer_session->plugin->sessions,
- &peer_session->target.hashPubKey, peer_session));
+ GNUNET_CONTAINER_multihashmap_remove (peer_session->
+ plugin->sessions,
+ &peer_session->
+ target.hashPubKey,
+ peer_session));
if (peer_session->frag != NULL)
GNUNET_FRAGMENT_context_destroy (peer_session->frag);
if (GNUNET_SCHEDULER_NO_TASK != peer_session->delayed_cont_task)
@@ -568,7 +571,8 @@ destroy_inbound_session (void *cls, const GNUNET_HashCode * key, void *value)
GNUNET_SCHEDULER_cancel (s->invalidation_task);
if (GNUNET_SCHEDULER_NO_TASK != s->delayed_cont_task)
GNUNET_SCHEDULER_cancel (s->delayed_cont_task);
- GNUNET_CONTAINER_multihashmap_remove (s->plugin->inbound_sessions, &s->target.hashPubKey, s);
+ GNUNET_CONTAINER_multihashmap_remove (s->plugin->inbound_sessions,
+ &s->target.hashPubKey, s);
GNUNET_free (s);
return GNUNET_OK;
}
@@ -1300,42 +1304,46 @@ udp_read (struct Plugin *plugin, struct GNUNET_NETWORK_Handle *rsock)
switch (ntohs (msg->type))
{
case GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON:
+ {
+ if (fromlen == sizeof (struct sockaddr_in))
{
- if (fromlen == sizeof (struct sockaddr_in))
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Received IPv4 HELLO beacon broadcast with %i bytes from address %s\n",
- ret, GNUNET_a2s((const struct sockaddr *) &addr, fromlen));
-
- struct Mstv4Context *mc;
- mc = GNUNET_malloc (sizeof (struct Mstv4Context));
- struct sockaddr_in *av4 = (struct sockaddr_in *) &addr;
-
- mc->addr.ipv4_addr = av4->sin_addr.s_addr;
- mc->addr.u4_port = av4->sin_port;
- if (GNUNET_OK !=
- GNUNET_SERVER_mst_receive (plugin->broadcast_ipv4_mst, mc, buf, ret, GNUNET_NO,
- GNUNET_NO))
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Received IPv4 HELLO beacon broadcast with %i bytes from address %s\n",
+ ret, GNUNET_a2s ((const struct sockaddr *) &addr, fromlen));
+
+ struct Mstv4Context *mc;
+
+ mc = GNUNET_malloc (sizeof (struct Mstv4Context));
+ struct sockaddr_in *av4 = (struct sockaddr_in *) &addr;
+
+ mc->addr.ipv4_addr = av4->sin_addr.s_addr;
+ mc->addr.u4_port = av4->sin_port;
+ if (GNUNET_OK !=
+ GNUNET_SERVER_mst_receive (plugin->broadcast_ipv4_mst, mc, buf, ret,
+ GNUNET_NO, GNUNET_NO))
GNUNET_free (mc);
- }
- else if (fromlen == sizeof (struct sockaddr_in6))
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Received IPv6 HELLO beacon broadcast with %i bytes from address %s\n",
- ret, GNUNET_a2s((const struct sockaddr *) &addr, fromlen));
+ }
+ else if (fromlen == sizeof (struct sockaddr_in6))
+ {
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Received IPv6 HELLO beacon broadcast with %i bytes from address %s\n",
+ ret, GNUNET_a2s ((const struct sockaddr *) &addr, fromlen));
- struct Mstv6Context *mc;
- mc = GNUNET_malloc (sizeof (struct Mstv6Context));
- struct sockaddr_in6 *av6 = (struct sockaddr_in6 *) &addr;
+ struct Mstv6Context *mc;
- mc->addr.ipv6_addr = av6->sin6_addr;
- mc->addr.u6_port = av6->sin6_port;
+ mc = GNUNET_malloc (sizeof (struct Mstv6Context));
+ struct sockaddr_in6 *av6 = (struct sockaddr_in6 *) &addr;
- if (GNUNET_OK !=
- GNUNET_SERVER_mst_receive (plugin->broadcast_ipv6_mst, mc, buf, ret, GNUNET_NO,
- GNUNET_NO))
- GNUNET_free (mc);
- }
- return;
+ mc->addr.ipv6_addr = av6->sin6_addr;
+ mc->addr.u6_port = av6->sin6_port;
+
+ if (GNUNET_OK !=
+ GNUNET_SERVER_mst_receive (plugin->broadcast_ipv6_mst, mc, buf, ret,
+ GNUNET_NO, GNUNET_NO))
+ GNUNET_free (mc);
}
+ return;
+ }
case GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_MESSAGE:
if (ntohs (msg->size) < sizeof (struct UDPMessage))
{
@@ -1489,7 +1497,7 @@ udp_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
void
broadcast_ipv4_mst_cb (void *cls, void *client,
- const struct GNUNET_MessageHeader *message)
+ const struct GNUNET_MessageHeader *message)
{
struct Plugin *plugin = cls;
struct Mstv4Context *mc = client;
@@ -1517,15 +1525,16 @@ broadcast_ipv4_mst_cb (void *cls, void *client,
(const char *) &mc->addr, sizeof (mc->addr));
GNUNET_STATISTICS_update (plugin->env->stats,
- _("# IPv4 broadcast HELLO beacons received via udp"), 1,
- GNUNET_NO);
+ _
+ ("# IPv4 broadcast HELLO beacons received via udp"),
+ 1, GNUNET_NO);
GNUNET_free (mc);
}
void
broadcast_ipv6_mst_cb (void *cls, void *client,
- const struct GNUNET_MessageHeader *message)
+ const struct GNUNET_MessageHeader *message)
{
struct Plugin *plugin = cls;
@@ -1554,14 +1563,16 @@ broadcast_ipv6_mst_cb (void *cls, void *client,
(const char *) &mc->addr, sizeof (mc->addr));
GNUNET_STATISTICS_update (plugin->env->stats,
- _("# IPv6 multicast HELLO beacons received via udp"), 1,
- GNUNET_NO);
+ _
+ ("# IPv6 multicast HELLO beacons received via udp"),
+ 1, GNUNET_NO);
GNUNET_free (mc);
}
static void
-udp_ipv4_broadcast_send (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+udp_ipv4_broadcast_send (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct Plugin *plugin = cls;
int sent;
@@ -1571,7 +1582,7 @@ udp_ipv4_broadcast_send (void *cls, const struct GNUNET_SCHEDULER_TaskContext *t
const struct GNUNET_MessageHeader *hello;
struct UDP_Beacon_Message *msg;
- struct BroadcastAddress * baddr;
+ struct BroadcastAddress *baddr;
plugin->send_ipv4_broadcast_task = GNUNET_SCHEDULER_NO_TASK;
@@ -1594,18 +1605,21 @@ udp_ipv4_broadcast_send (void *cls, const struct GNUNET_SCHEDULER_TaskContext *t
/* just IPv4 */
while ((baddr != NULL) && (baddr->addrlen == sizeof (struct sockaddr_in)))
{
- struct sockaddr_in * addr = (struct sockaddr_in * ) baddr->addr;
+ struct sockaddr_in *addr = (struct sockaddr_in *) baddr->addr;
+
addr->sin_port = htons (plugin->port);
- sent = GNUNET_NETWORK_socket_sendto (plugin->sockv4, msg, msg_size,
- (const struct sockaddr *) addr,
- baddr->addrlen);
+ sent =
+ GNUNET_NETWORK_socket_sendto (plugin->sockv4, msg, msg_size,
+ (const struct sockaddr *) addr,
+ baddr->addrlen);
if (sent == GNUNET_SYSERR)
- GNUNET_log_strerror(GNUNET_ERROR_TYPE_ERROR, "sendto");
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sendto");
else
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Sent HELLO beacon broadcast with %i bytes to address %s\n",
- sent, GNUNET_a2s(baddr->addr, baddr->addrlen));
- baddr = baddr->next;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Sent HELLO beacon broadcast with %i bytes to address %s\n", sent,
+ GNUNET_a2s (baddr->addr, baddr->addrlen));
+ baddr = baddr->next;
}
plugin->send_ipv4_broadcast_task =
@@ -1614,7 +1628,8 @@ udp_ipv4_broadcast_send (void *cls, const struct GNUNET_SCHEDULER_TaskContext *t
}
static void
-udp_ipv6_broadcast_send (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+udp_ipv6_broadcast_send (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct Plugin *plugin = cls;
int sent;
@@ -1642,14 +1657,19 @@ udp_ipv6_broadcast_send (void *cls, const struct GNUNET_SCHEDULER_TaskContext *t
memcpy (&msg[1], hello, hello_size);
sent = 0;
- sent = GNUNET_NETWORK_socket_sendto (plugin->sockv6, msg, msg_size,
- (const struct sockaddr *) &plugin->ipv6_multicast_address,
- sizeof(struct sockaddr_in6));
+ sent =
+ GNUNET_NETWORK_socket_sendto (plugin->sockv6, msg, msg_size,
+ (const struct sockaddr *)
+ &plugin->ipv6_multicast_address,
+ sizeof (struct sockaddr_in6));
if (sent == GNUNET_SYSERR)
- GNUNET_log_strerror(GNUNET_ERROR_TYPE_ERROR, "sendto");
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sendto");
else
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending IPv6 HELLO beacon broadcast with %i bytes to address %s\n",
- sent, GNUNET_a2s((const struct sockaddr *) &plugin->ipv6_multicast_address, sizeof(struct sockaddr_in6)));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending IPv6 HELLO beacon broadcast with %i bytes to address %s\n",
+ sent,
+ GNUNET_a2s ((const struct sockaddr *) &plugin->ipv6_multicast_address,
+ sizeof (struct sockaddr_in6)));
@@ -1953,33 +1973,33 @@ udp_nat_port_map_callback (void *cls, int add_remove,
static int
-iface_proc (void *cls, const char *name,
- int isDefault,
- const struct sockaddr * addr,
- const struct sockaddr * broadcast_addr,
- const struct sockaddr * netmask,
- socklen_t addrlen)
+iface_proc (void *cls, const char *name, int isDefault,
+ const struct sockaddr *addr, const struct sockaddr *broadcast_addr,
+ const struct sockaddr *netmask, socklen_t addrlen)
{
struct Plugin *plugin = cls;
if (addr != NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "address %s for interface %s %p\n ",
- GNUNET_a2s(addr,addrlen), name, addr);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "broadcast address %s for interface %s %p\n ",
- GNUNET_a2s(broadcast_addr,addrlen), name, broadcast_addr);
+ GNUNET_a2s (addr, addrlen), name, addr);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "broadcast address %s for interface %s %p\n ",
+ GNUNET_a2s (broadcast_addr, addrlen), name, broadcast_addr);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "netmask %s for interface %s %p\n ",
- GNUNET_a2s(netmask,addrlen), name, netmask);
+ GNUNET_a2s (netmask, addrlen), name, netmask);
- /* Collecting broadcast addresses*/
+ /* Collecting broadcast addresses */
if (broadcast_addr != NULL)
{
- struct BroadcastAddress * ba = GNUNET_malloc(sizeof (struct BroadcastAddress));
- ba->addr = GNUNET_malloc(addrlen);
- memcpy(ba->addr, broadcast_addr, addrlen);
+ struct BroadcastAddress *ba =
+ GNUNET_malloc (sizeof (struct BroadcastAddress));
+ ba->addr = GNUNET_malloc (addrlen);
+ memcpy (ba->addr, broadcast_addr, addrlen);
ba->addrlen = addrlen;
- GNUNET_CONTAINER_DLL_insert(plugin->ipv4_broadcast_head, plugin->ipv4_broadcast_tail, ba);
+ GNUNET_CONTAINER_DLL_insert (plugin->ipv4_broadcast_head,
+ plugin->ipv4_broadcast_tail, ba);
}
}
return GNUNET_OK;
@@ -2225,73 +2245,80 @@ libgnunet_plugin_transport_udp_init (void *cls)
{
/* create IPv4 broadcast socket */
plugin->broadcast_ipv4 = GNUNET_NO;
- if (plugin->sockv4 != NULL)
- {
- int yes = 1;
+ if (plugin->sockv4 != NULL)
+ {
+ int yes = 1;
- if (GNUNET_NETWORK_socket_setsockopt
- (plugin->sockv4, SOL_SOCKET, SO_BROADCAST, &yes, sizeof (int)) != GNUNET_OK)
- {
- LOG (GNUNET_ERROR_TYPE_WARNING,
- _
- ("Failed to set IPv4 broadcast option for broadcast socket on port %d\n"),
- ntohs (serverAddrv4.sin_port));
- }
- else
- {
- GNUNET_OS_network_interfaces_list(iface_proc, plugin);
- plugin->send_ipv4_broadcast_task =
+ if (GNUNET_NETWORK_socket_setsockopt
+ (plugin->sockv4, SOL_SOCKET, SO_BROADCAST, &yes,
+ sizeof (int)) != GNUNET_OK)
+ {
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ _
+ ("Failed to set IPv4 broadcast option for broadcast socket on port %d\n"),
+ ntohs (serverAddrv4.sin_port));
+ }
+ else
+ {
+ GNUNET_OS_network_interfaces_list (iface_proc, plugin);
+ plugin->send_ipv4_broadcast_task =
GNUNET_SCHEDULER_add_now (&udp_ipv4_broadcast_send, plugin);
- plugin->broadcast_ipv4_mst =
- GNUNET_SERVER_mst_create (broadcast_ipv4_mst_cb, plugin);
+ plugin->broadcast_ipv4_mst =
+ GNUNET_SERVER_mst_create (broadcast_ipv4_mst_cb, plugin);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "IPv4 Broadcasting running\n");
- plugin->broadcast_ipv4 = GNUNET_YES;
- }
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "IPv4 Broadcasting running\n");
+ plugin->broadcast_ipv4 = GNUNET_YES;
}
+ }
- plugin->broadcast_ipv6 = GNUNET_NO;
- if (plugin->sockv6 != NULL)
+ plugin->broadcast_ipv6 = GNUNET_NO;
+ if (plugin->sockv6 != NULL)
+ {
+ memset (&plugin->ipv6_multicast_address, 0, sizeof (struct sockaddr_in6));
+ GNUNET_assert (1 ==
+ inet_pton (AF_INET6, "FF05::13B",
+ &plugin->ipv6_multicast_address.sin6_addr));
+
+ plugin->ipv6_multicast_address.sin6_family = AF_INET6;
+ plugin->ipv6_multicast_address.sin6_port = htons (plugin->port);
+
+ plugin->broadcast_ipv6_mst =
+ GNUNET_SERVER_mst_create (broadcast_ipv6_mst_cb, plugin);
+
+ /* Create IPv6 multicast request */
+ struct ipv6_mreq multicastRequest;
+
+ multicastRequest.ipv6mr_multiaddr =
+ plugin->ipv6_multicast_address.sin6_addr;
+ /* TODO: 0 selects the "best" interface, tweak to use all interfaces
+ *
+ * http://tools.ietf.org/html/rfc2553#section-5.2:
+ *
+ * IPV6_JOIN_GROUP
+ *
+ * Join a multicast group on a specified local interface. If the
+ * interface index is specified as 0, the kernel chooses the local
+ * interface. For example, some kernels look up the multicast
+ * group in the normal IPv6 routing table and using the resulting
+ * interface.
+ * */
+ multicastRequest.ipv6mr_interface = 0;
+
+ /* Join the multicast group */
+ if (GNUNET_NETWORK_socket_setsockopt
+ (plugin->sockv6, IPPROTO_IPV6, IPV6_JOIN_GROUP,
+ (char *) &multicastRequest, sizeof (multicastRequest)) == GNUNET_OK)
{
- memset (&plugin->ipv6_multicast_address, 0, sizeof (struct sockaddr_in6));
- GNUNET_assert (1 == inet_pton(AF_INET6, "FF05::13B", &plugin->ipv6_multicast_address.sin6_addr));
-
- plugin->ipv6_multicast_address.sin6_family = AF_INET6;
- plugin->ipv6_multicast_address.sin6_port = htons(plugin->port);
-
- plugin->broadcast_ipv6_mst =
- GNUNET_SERVER_mst_create (broadcast_ipv6_mst_cb, plugin);
-
- /* Create IPv6 multicast request */
- struct ipv6_mreq multicastRequest;
- multicastRequest.ipv6mr_multiaddr = plugin->ipv6_multicast_address.sin6_addr;
- /* TODO: 0 selects the "best" interface, tweak to use all interfaces
- *
- * http://tools.ietf.org/html/rfc2553#section-5.2:
- *
- * IPV6_JOIN_GROUP
- *
- * Join a multicast group on a specified local interface. If the
- * interface index is specified as 0, the kernel chooses the local
- * interface. For example, some kernels look up the multicast
- * group in the normal IPv6 routing table and using the resulting
- * interface.
- * */
- multicastRequest.ipv6mr_interface = 0;
-
- /* Join the multicast group */
- if ( GNUNET_NETWORK_socket_setsockopt( plugin->sockv6, IPPROTO_IPV6, IPV6_JOIN_GROUP, (char*) &multicastRequest, sizeof(multicastRequest)) == GNUNET_OK )
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG, "IPv6 broadcasting running\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "IPv6 broadcasting running\n");
- plugin->send_ipv6_broadcast_task =
+ plugin->send_ipv6_broadcast_task =
GNUNET_SCHEDULER_add_now (&udp_ipv6_broadcast_send, plugin);
- plugin->broadcast_ipv6 = GNUNET_YES;
- }
- else
- LOG (GNUNET_ERROR_TYPE_DEBUG, "IPv6 broadcasting not running\n");
+ plugin->broadcast_ipv6 = GNUNET_YES;
}
+ else
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "IPv6 broadcasting not running\n");
+ }
}
if (sockets_created == 0)
@@ -2351,8 +2378,10 @@ libgnunet_plugin_transport_udp_done (void *cls)
while (plugin->ipv4_broadcast_head != NULL)
{
- struct BroadcastAddress * p= plugin->ipv4_broadcast_head;
- GNUNET_CONTAINER_DLL_remove(plugin->ipv4_broadcast_head, plugin->ipv4_broadcast_tail, p);
+ struct BroadcastAddress *p = plugin->ipv4_broadcast_head;
+
+ GNUNET_CONTAINER_DLL_remove (plugin->ipv4_broadcast_head,
+ plugin->ipv4_broadcast_tail, p);
GNUNET_free (p->addr);
GNUNET_free (p);
}
@@ -2362,16 +2391,20 @@ libgnunet_plugin_transport_udp_done (void *cls)
{
/* Create IPv6 multicast request */
struct ipv6_mreq multicastRequest;
- multicastRequest.ipv6mr_multiaddr = plugin->ipv6_multicast_address.sin6_addr;
+
+ multicastRequest.ipv6mr_multiaddr =
+ plugin->ipv6_multicast_address.sin6_addr;
multicastRequest.ipv6mr_interface = 0;
/* Join the multicast address */
- if ( GNUNET_NETWORK_socket_setsockopt( plugin->sockv6, IPPROTO_IPV6, IPV6_LEAVE_GROUP, (char*) &multicastRequest, sizeof(multicastRequest)) == 0 )
+ if (GNUNET_NETWORK_socket_setsockopt
+ (plugin->sockv6, IPPROTO_IPV6, IPV6_LEAVE_GROUP,
+ (char *) &multicastRequest, sizeof (multicastRequest)) == 0)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "IPv6 Broadcasting stopped\n");
}
else
- GNUNET_log_strerror(GNUNET_ERROR_TYPE_ERROR, setsockopt);
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, setsockopt);
if (plugin->send_ipv6_broadcast_task != GNUNET_SCHEDULER_NO_TASK)
{
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index c7029a579..bf5411d59 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -355,7 +355,7 @@ struct Sessionqueue
struct Sessionqueue *prev;
struct Session *content;
#if !HAVE_UNALIGNED_64_ACCESS
- void *dummy; /* for alignment, see #1909 */
+ void *dummy; /* for alignment, see #1909 */
#endif
};
@@ -1066,8 +1066,9 @@ set_next_send (struct Plugin *const plugin)
struct GNUNET_TIME_Relative next_send;
//abort if helper is not running
- if (plugin->helper_is_running == GNUNET_NO){
- return;
+ if (plugin->helper_is_running == GNUNET_NO)
+ {
+ return;
}
//cancel old task
@@ -1465,12 +1466,13 @@ wlan_transport_start_wlan_helper (struct Plugin *plugin)
const char *filenameloopback = "gnunet-transport-wlan-helper-dummy";
char *absolute_filename = NULL;
- if (plugin->helper_is_running == GNUNET_YES){
+ if (plugin->helper_is_running == GNUNET_YES)
+ {
#if DEBUG_wlan
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
"wlan_transport_start_wlan_helper not needed, helper already running!");
#endif
- return GNUNET_YES;
+ return GNUNET_YES;
}
plugin->server_stdout = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_NO, GNUNET_YES);
@@ -1634,12 +1636,13 @@ wlan_transport_stop_wlan_helper (struct Plugin *plugin)
"Stoping WLAN helper process\n");
#endif
- if (plugin->helper_is_running == GNUNET_NO){
+ if (plugin->helper_is_running == GNUNET_NO)
+ {
#if DEBUG_wlan
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
"wlan_transport_stop_wlan_helper not needed, helper already stopped!");
#endif
- return GNUNET_YES;
+ return GNUNET_YES;
}
if (plugin->server_write_delay_task != GNUNET_SCHEDULER_NO_TASK)
@@ -2604,13 +2607,15 @@ wlan_data_message_handler (void *cls, const struct GNUNET_MessageHeader *hdr)
temp_hdr = (const struct GNUNET_MessageHeader *) &wlanheader[1];
crc = ntohl (wlanheader->crc);
wlanheader->crc = 0;
- if (GNUNET_CRYPTO_crc32_n ((char *) wlanheader, ntohs (wlanheader->header.size)) != crc)
+ if (GNUNET_CRYPTO_crc32_n
+ ((char *) wlanheader, ntohs (wlanheader->header.size)) != crc)
{
//wrong crc, dispose message
GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, PLUGIN_LOG_NAME,
"Wlan message header crc was wrong: %u != %u\n",
GNUNET_CRYPTO_crc32_n ((char *) wlanheader,
- ntohs (wlanheader->header.size)), crc);
+ ntohs (wlanheader->header.size)),
+ crc);
hexdump ((void *) hdr, ntohs (hdr->size));
return;
}
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c
index 52051954b..1742dd0d3 100644
--- a/src/transport/test_quota_compliance.c
+++ b/src/transport/test_quota_compliance.c
@@ -484,8 +484,7 @@ generate_config (char *cfg_file, unsigned long long quota_in,
GNUNET_asprintf (&fname, "q_in_%llu_q_out_%llu_%s", quota_in, quota_out,
cfg_file);
GNUNET_CONFIGURATION_set_value_string (cfg, "PATHS", "DEFAULTCONFIG", fname);
- GNUNET_CONFIGURATION_set_value_number (cfg, "ats", "WAN_QUOTA_IN",
- quota_in);
+ GNUNET_CONFIGURATION_set_value_number (cfg, "ats", "WAN_QUOTA_IN", quota_in);
GNUNET_CONFIGURATION_set_value_number (cfg, "ats", "WAN_QUOTA_OUT",
quota_out);
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_write (cfg, fname));
diff --git a/src/transport/test_transport_api_bidirectional_connect.c b/src/transport/test_transport_api_bidirectional_connect.c
index aa6f98027..20005deab 100644
--- a/src/transport/test_transport_api_bidirectional_connect.c
+++ b/src/transport/test_transport_api_bidirectional_connect.c
@@ -312,10 +312,12 @@ start_cb (struct PeerContext *p, void *cls)
"Test tries to connect peer %u (`%s') <-> peer %u (`%s')\n",
p1->no, sender_c, p2->no, GNUNET_i2s (&p2->id));
- cc1 = GNUNET_TRANSPORT_TESTING_connect_peers (tth, p2, p1, &testing_connect_cb,
- NULL);
- cc2 = GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, &testing_connect_cb,
- NULL);
+ cc1 =
+ GNUNET_TRANSPORT_TESTING_connect_peers (tth, p2, p1, &testing_connect_cb,
+ NULL);
+ cc2 =
+ GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, &testing_connect_cb,
+ NULL);
}
static void
diff --git a/src/transport/test_transport_api_disconnect.c b/src/transport/test_transport_api_disconnect.c
index 7dd9bd913..026ed085a 100644
--- a/src/transport/test_transport_api_disconnect.c
+++ b/src/transport/test_transport_api_disconnect.c
@@ -128,7 +128,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (cc != NULL)
{
- GNUNET_TRANSPORT_TESTING_connect_peers_cancel(tth, cc);
+ GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc);
cc = NULL;
}
diff --git a/src/transport/test_transport_api_restart_1peer.c b/src/transport/test_transport_api_restart_1peer.c
index 87383bbac..61423a7ee 100644
--- a/src/transport/test_transport_api_restart_1peer.c
+++ b/src/transport/test_transport_api_restart_1peer.c
@@ -155,10 +155,12 @@ static void
reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct PeerContext *p = cls;
+
reconnect_task = GNUNET_SCHEDULER_NO_TASK;
GNUNET_TRANSPORT_try_connect (p->th, &p2->id);
- reconnect_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, &reconnect, p);
+ reconnect_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &reconnect, p);
}
static void
@@ -166,20 +168,17 @@ restart_cb (struct PeerContext *p, void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Restarted peer %u (`%4s'), issuing reconnect\n",
- p->no,
+ "Restarted peer %u (`%4s'), issuing reconnect\n", p->no,
GNUNET_i2s (&p->id));
- reconnect_task = GNUNET_SCHEDULER_add_now(&reconnect, p);
+ reconnect_task = GNUNET_SCHEDULER_add_now (&reconnect, p);
}
-static
-void restart (struct PeerContext *p , char * cfg_file)
+static void
+restart (struct PeerContext *p, char *cfg_file)
{
GNUNET_assert (p != NULL);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Restarting peer %u (`%4s')\n",
- p->no,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Restarting peer %u (`%4s')\n", p->no,
GNUNET_i2s (&p->id));
GNUNET_TRANSPORT_TESTING_restart_peer (tth, p, cfg_file, &restart_cb, p);
return;
@@ -200,6 +199,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
GNUNET_assert (t != NULL);
char *ps = GNUNET_strdup (GNUNET_i2s (&p->id));
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer %u (`%4s') received message of type %d and size %u size from peer %u (`%4s')!\n",
p->no, ps, ntohs (message->type), ntohs (message->size), t->no,
@@ -217,8 +217,8 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Restarted peers connected, stopping test...\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Restarted peers connected, stopping test...\n");
ok = 0;
end ();
}
@@ -329,6 +329,7 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
char *ps = GNUNET_strdup (GNUNET_i2s (&p->id));
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer %u (`%4s'): peer (`%s') disconnected from me!\n", p->no, ps,
GNUNET_i2s (peer));
@@ -368,6 +369,7 @@ start_cb (struct PeerContext *p, void *cls)
return;
char *sender_c = GNUNET_strdup (GNUNET_i2s (&p1->id));
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Test tries to connect peer %u (`%s') -> peer %u (`%s')\n",
p1->no, sender_c, p2->no, GNUNET_i2s (&p2->id));
@@ -451,8 +453,8 @@ main (int argc, char *argv[])
tth = GNUNET_TRANSPORT_TESTING_init ();
- GNUNET_asprintf(&cfg_file_p1,"test_transport_api_tcp_peer1.conf");
- GNUNET_asprintf(&cfg_file_p2,"test_transport_api_tcp_peer2.conf");
+ GNUNET_asprintf (&cfg_file_p1, "test_transport_api_tcp_peer1.conf");
+ GNUNET_asprintf (&cfg_file_p2, "test_transport_api_tcp_peer2.conf");
ret = check ();
diff --git a/src/transport/test_transport_api_restart_2peers.c b/src/transport/test_transport_api_restart_2peers.c
index 44a41614f..67cc90f0e 100644
--- a/src/transport/test_transport_api_restart_2peers.c
+++ b/src/transport/test_transport_api_restart_2peers.c
@@ -155,36 +155,36 @@ static void
reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct PeerContext *p = cls;
+
reconnect_task = GNUNET_SCHEDULER_NO_TASK;
GNUNET_TRANSPORT_try_connect (p1->th, &p2->id);
- reconnect_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, &reconnect, p);
+ reconnect_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &reconnect, p);
}
static void
restart_cb (struct PeerContext *p, void *cls)
{
static int c;
+
c++;
if (c != 2)
return;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Restarted peer %u (`%4s'), issuing reconnect\n",
- p->no,
+ "Restarted peer %u (`%4s'), issuing reconnect\n", p->no,
GNUNET_i2s (&p->id));
- reconnect_task = GNUNET_SCHEDULER_add_now(&reconnect, p);
+ reconnect_task = GNUNET_SCHEDULER_add_now (&reconnect, p);
}
-static
-void restart (struct PeerContext *p , char * cfg_file)
+static void
+restart (struct PeerContext *p, char *cfg_file)
{
GNUNET_assert (p != NULL);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Restarting peer %u (`%4s')\n",
- p->no,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Restarting peer %u (`%4s')\n", p->no,
GNUNET_i2s (&p->id));
GNUNET_TRANSPORT_TESTING_restart_peer (tth, p, cfg_file, &restart_cb, p);
return;
@@ -205,6 +205,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
GNUNET_assert (t != NULL);
char *ps = GNUNET_strdup (GNUNET_i2s (&p->id));
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer %u (`%4s') received message of type %d and size %u size from peer %u (`%4s')!\n",
p->no, ps, ntohs (message->type), ntohs (message->size), t->no,
@@ -223,8 +224,8 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Restarted peers connected, stopping test...\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Restarted peers connected, stopping test...\n");
ok = 0;
end ();
}
@@ -335,6 +336,7 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
char *ps = GNUNET_strdup (GNUNET_i2s (&p->id));
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer %u (`%4s'): peer (`%s') disconnected from me!\n", p->no, ps,
GNUNET_i2s (peer));
@@ -374,6 +376,7 @@ start_cb (struct PeerContext *p, void *cls)
return;
char *sender_c = GNUNET_strdup (GNUNET_i2s (&p1->id));
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Test tries to connect peer %u (`%s') -> peer %u (`%s')\n",
p1->no, sender_c, p2->no, GNUNET_i2s (&p2->id));
@@ -457,8 +460,8 @@ main (int argc, char *argv[])
tth = GNUNET_TRANSPORT_TESTING_init ();
- GNUNET_asprintf(&cfg_file_p1,"test_transport_api_tcp_peer1.conf");
- GNUNET_asprintf(&cfg_file_p2,"test_transport_api_tcp_peer2.conf");
+ GNUNET_asprintf (&cfg_file_p1, "test_transport_api_tcp_peer1.conf");
+ GNUNET_asprintf (&cfg_file_p2, "test_transport_api_tcp_peer2.conf");
ret = check ();
@@ -472,4 +475,5 @@ main (int argc, char *argv[])
return ret;
}
+
/* end of test_transport_api_restart_2peers.c */
diff --git a/src/transport/test_transport_api_unreliability.c b/src/transport/test_transport_api_unreliability.c
index 90defae02..e52b20f7c 100644
--- a/src/transport/test_transport_api_unreliability.c
+++ b/src/transport/test_transport_api_unreliability.c
@@ -229,10 +229,9 @@ get_size (unsigned int iter)
#ifndef LINUX
/* FreeBSD/OSX etc. Unix DGRAMs do not work
- with large messages */
- if (0 == strcmp ("unix",
- test_plugin))
- return sizeof (struct TestMessage) + (ret % 1024);
+ * with large messages */
+ if (0 == strcmp ("unix", test_plugin))
+ return sizeof (struct TestMessage) + (ret % 1024);
#endif
return sizeof (struct TestMessage) + (ret % 60000);
}
diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c
index e45953239..9f7a99a7b 100644
--- a/src/transport/transport-testing.c
+++ b/src/transport/transport-testing.c
@@ -284,22 +284,22 @@ GNUNET_TRANSPORT_TESTING_start_peer (struct GNUNET_TRANSPORT_TESTING_handle
p->cfg = GNUNET_CONFIGURATION_create ();
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
- if (GNUNET_CONFIGURATION_have_value (p->
- cfg, "PATHS", "SERVICEHOME"))
+ if (GNUNET_CONFIGURATION_have_value (p->cfg, "PATHS", "SERVICEHOME"))
GNUNET_assert (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_string (p->cfg, "PATHS",
"SERVICEHOME",
&p->servicehome));
- if (NULL != p->servicehome)
- GNUNET_DISK_directory_remove (p->servicehome);
+ if (NULL != p->servicehome)
+ GNUNET_DISK_directory_remove (p->servicehome);
- hostkey = get_host_key(tth);
+ hostkey = get_host_key (tth);
if (hostkey != NULL)
{
GNUNET_asprintf (&p->hostkeyfile, "%s/.hostkey", p->servicehome);
- GNUNET_assert(GNUNET_OK == GNUNET_DISK_directory_create_for_file (p->hostkeyfile));
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_DISK_directory_create_for_file (p->hostkeyfile));
fn = GNUNET_DISK_file_open (p->hostkeyfile,
GNUNET_DISK_OPEN_READWRITE |
GNUNET_DISK_OPEN_CREATE,
@@ -355,11 +355,11 @@ GNUNET_TRANSPORT_TESTING_start_peer (struct GNUNET_TRANSPORT_TESTING_handle
* @return GNUNET_OK in success otherwise GNUNET_SYSERR
*/
int
-GNUNET_TRANSPORT_TESTING_restart_peer (struct GNUNET_TRANSPORT_TESTING_handle *tth,
- struct PeerContext *p,
+GNUNET_TRANSPORT_TESTING_restart_peer (struct GNUNET_TRANSPORT_TESTING_handle
+ *tth, struct PeerContext *p,
const char *cfgname,
- GNUNET_TRANSPORT_TESTING_start_cb restart_cb,
- void *cb_cls)
+ GNUNET_TRANSPORT_TESTING_start_cb
+ restart_cb, void *cb_cls)
{
struct GNUNET_DISK_FileHandle *fn;
@@ -370,9 +370,8 @@ GNUNET_TRANSPORT_TESTING_restart_peer (struct GNUNET_TRANSPORT_TESTING_handle *t
/* shutdown */
#if VERBOSE
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing",
- "Stopping peer %u (`%s')\n", p->no,
- GNUNET_i2s (&p->id));
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing",
+ "Stopping peer %u (`%s')\n", p->no, GNUNET_i2s (&p->id));
#endif
if (p->ghh != NULL)
GNUNET_TRANSPORT_get_hello_cancel (p->ghh);
@@ -400,48 +399,48 @@ GNUNET_TRANSPORT_TESTING_restart_peer (struct GNUNET_TRANSPORT_TESTING_handle *t
/* start */
#if VERBOSE
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing",
- "Restarting peer %u (`%s')\n", p->no,
- GNUNET_i2s (&p->id));
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing",
+ "Restarting peer %u (`%s')\n", p->no, GNUNET_i2s (&p->id));
#endif
- sleep (5); // YUCK!
+ sleep (5); // YUCK!
if (GNUNET_DISK_file_test (cfgname) == GNUNET_NO)
{
GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "transport-testing",
- "File not found: `%s' \n", cfgname);
+ "File not found: `%s' \n", cfgname);
goto fail;
}
p->cfg = GNUNET_CONFIGURATION_create ();
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
- if (! GNUNET_CONFIGURATION_have_value (p->cfg, "PATHS", "SERVICEHOME"))
+ if (!GNUNET_CONFIGURATION_have_value (p->cfg, "PATHS", "SERVICEHOME"))
goto fail;
fn = GNUNET_DISK_file_open (p->hostkeyfile,
- GNUNET_DISK_OPEN_READWRITE |
- GNUNET_DISK_OPEN_CREATE,
- GNUNET_DISK_PERM_USER_READ |
- GNUNET_DISK_PERM_USER_WRITE);
+ GNUNET_DISK_OPEN_READWRITE |
+ GNUNET_DISK_OPEN_CREATE,
+ GNUNET_DISK_PERM_USER_READ |
+ GNUNET_DISK_PERM_USER_WRITE);
if (fn == NULL)
- goto fail;
+ goto fail;
if (GNUNET_OK != GNUNET_DISK_file_close (fn))
- goto fail;
+ goto fail;
- p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
- "gnunet-service-arm", "-c", cfgname,
- #if VERBOSE_PEERS
- "-L", "DEBUG",
- #else
- "-L", "ERROR",
- #endif
- NULL);
+ p->arm_proc =
+ GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
+ "gnunet-service-arm", "-c", cfgname,
+#if VERBOSE_PEERS
+ "-L", "DEBUG",
+#else
+ "-L", "ERROR",
+#endif
+ NULL);
p->th =
- GNUNET_TRANSPORT_connect (p->cfg, NULL, p, &notify_receive,
- &notify_connect, &notify_disconnect);
+ GNUNET_TRANSPORT_connect (p->cfg, NULL, p, &notify_receive,
+ &notify_connect, &notify_disconnect);
GNUNET_assert (p->th != NULL);
p->start_cb = restart_cb;
@@ -451,11 +450,11 @@ GNUNET_TRANSPORT_TESTING_restart_peer (struct GNUNET_TRANSPORT_TESTING_handle *t
GNUNET_assert (p->ghh != NULL);
return GNUNET_OK;
- fail:
+fail:
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing",
- "Restarting peer %u (`%s') failed, removing peer\n", p->no,
- GNUNET_i2s (&p->id));
- GNUNET_TRANSPORT_TESTING_stop_peer (tth,p);
+ "Restarting peer %u (`%s') failed, removing peer\n", p->no,
+ GNUNET_i2s (&p->id));
+ GNUNET_TRANSPORT_TESTING_stop_peer (tth, p);
return GNUNET_SYSERR;
}
@@ -643,11 +642,11 @@ GNUNET_TRANSPORT_TESTING_init ()
/* prepare hostkeys */
tth = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_TESTING_handle));
tth->hostkey_data = NULL;
- const char * hostkeys_file = "../../contrib/testing_hostkeys.dat";
+ const char *hostkeys_file = "../../contrib/testing_hostkeys.dat";
+
if (GNUNET_YES != GNUNET_DISK_file_test (hostkeys_file))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Could not read hostkeys file!\n"));
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Could not read hostkeys file!\n"));
}
else
{
@@ -656,8 +655,7 @@ GNUNET_TRANSPORT_TESTING_init ()
GNUNET_DISK_PERM_NONE);
if (NULL == fd)
{
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open",
- hostkeys_file);
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", hostkeys_file);
GNUNET_free (tth);
return NULL;
}
@@ -668,7 +666,7 @@ GNUNET_TRANSPORT_TESTING_init ()
if (0 != (fs % HOSTKEYFILESIZE))
{
GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "transport-testing",
- "File size %llu seems incorrect for hostkeys...\n", fs);
+ "File size %llu seems incorrect for hostkeys...\n", fs);
}
else
{
@@ -676,7 +674,7 @@ GNUNET_TRANSPORT_TESTING_init ()
tth->hostkey_data = GNUNET_malloc_large (fs);
GNUNET_assert (fs == GNUNET_DISK_file_read (fd, tth->hostkey_data, fs));
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing",
- "Read %llu hostkeys from file\n", total_hostkeys);
+ "Read %llu hostkeys from file\n", total_hostkeys);
tth->hostkeys_total = total_hostkeys;
}
GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fd));
diff --git a/src/transport/transport-testing.h b/src/transport/transport-testing.h
index 883c68837..c77d79381 100644
--- a/src/transport/transport-testing.h
+++ b/src/transport/transport-testing.h
@@ -169,11 +169,11 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct GNUNET_TRANSPORT_TESTING_handle *tth,
* @return GNUNET_OK in success otherwise GNUNET_SYSERR
*/
int
-GNUNET_TRANSPORT_TESTING_restart_peer (struct GNUNET_TRANSPORT_TESTING_handle *tth,
- struct PeerContext *p,
+GNUNET_TRANSPORT_TESTING_restart_peer (struct GNUNET_TRANSPORT_TESTING_handle
+ *tth, struct PeerContext *p,
const char *cfgname,
- GNUNET_TRANSPORT_TESTING_start_cb start_cb,
- void *cb_cls);
+ GNUNET_TRANSPORT_TESTING_start_cb
+ start_cb, void *cb_cls);
/**
* Connect the given peers and call the callback when both peers report the
diff --git a/src/transport/transport.h b/src/transport/transport.h
index bfcf9fe6e..d2792b92d 100644
--- a/src/transport/transport.h
+++ b/src/transport/transport.h
@@ -401,7 +401,7 @@ struct AddressIterateResponseMessage
* length of the plugin name
*/
uint32_t pluginlen GNUNET_PACKED;
-
+
};
diff --git a/src/transport/transport_api_address_lookup.c b/src/transport/transport_api_address_lookup.c
index 7cd61e896..9ae9b4031 100644
--- a/src/transport/transport_api_address_lookup.c
+++ b/src/transport/transport_api_address_lookup.c
@@ -93,7 +93,8 @@ peer_address_response_processor (void *cls,
return;
}
size = ntohs (msg->size);
- GNUNET_break (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE);
+ GNUNET_break (ntohs (msg->type) ==
+ GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE);
if (size == sizeof (struct GNUNET_MessageHeader))
{
/* done! */
@@ -102,8 +103,11 @@ peer_address_response_processor (void *cls,
return;
}
- if ( (size < sizeof (struct GNUNET_MessageHeader) + sizeof (struct AddressIterateResponseMessage)) ||
- (ntohs (msg->type) != GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE) )
+ if ((size <
+ sizeof (struct GNUNET_MessageHeader) +
+ sizeof (struct AddressIterateResponseMessage)) ||
+ (ntohs (msg->type) !=
+ GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE))
{
GNUNET_break (0);
pal_ctx->cb (pal_ctx->cb_cls, NULL, NULL);
@@ -112,8 +116,8 @@ peer_address_response_processor (void *cls,
}
air_msg = (struct AddressIterateResponseMessage *) msg;
- tlen = ntohl(air_msg->pluginlen);
- alen = ntohl(air_msg->addrlen);
+ tlen = ntohl (air_msg->pluginlen);
+ alen = ntohl (air_msg->addrlen);
if (size != sizeof (struct AddressIterateResponseMessage) + tlen + alen)
{
@@ -126,7 +130,7 @@ peer_address_response_processor (void *cls,
addr = (const char *) &air_msg[1];
transport_name = &addr[alen];
- if (transport_name[tlen-1] != '\0')
+ if (transport_name[tlen - 1] != '\0')
{
GNUNET_break_op (0);
pal_ctx->cb (pal_ctx->cb_cls, NULL, NULL);
@@ -135,13 +139,14 @@ peer_address_response_processor (void *cls,
}
/* expect more replies */
- GNUNET_CLIENT_receive (pal_ctx->client,
- &peer_address_response_processor, pal_ctx,
+ GNUNET_CLIENT_receive (pal_ctx->client, &peer_address_response_processor,
+ pal_ctx,
GNUNET_TIME_absolute_get_remaining (pal_ctx->timeout));
/* notify client */
- address = GNUNET_HELLO_address_allocate (&air_msg->peer,
- transport_name, addr, alen);
+ address =
+ GNUNET_HELLO_address_allocate (&air_msg->peer, transport_name, addr,
+ alen);
pal_ctx->cb (pal_ctx->cb_cls, &air_msg->peer, address);
GNUNET_HELLO_address_free (address);
}
@@ -165,11 +170,13 @@ peer_address_response_processor (void *cls,
* @param peer_address_callback_cls closure for peer_address_callback
*/
struct GNUNET_TRANSPORT_PeerIterateContext *
-GNUNET_TRANSPORT_peer_get_active_addresses (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const struct GNUNET_PeerIdentity *peer,
- int one_shot,
+GNUNET_TRANSPORT_peer_get_active_addresses (const struct
+ GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_PeerIdentity
+ *peer, int one_shot,
struct GNUNET_TIME_Relative timeout,
- GNUNET_TRANSPORT_PeerIterateCallback peer_address_callback,
+ GNUNET_TRANSPORT_PeerIterateCallback
+ peer_address_callback,
void *peer_address_callback_cls)
{
struct GNUNET_TRANSPORT_PeerIterateContext *pal_ctx;
@@ -180,7 +187,7 @@ GNUNET_TRANSPORT_peer_get_active_addresses (const struct GNUNET_CONFIGURATION_Ha
if (GNUNET_YES != one_shot)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Address monitoring not implemented\n");
+ "Address monitoring not implemented\n");
return NULL;
}
client = GNUNET_CLIENT_connect ("transport", cfg);
@@ -192,7 +199,7 @@ GNUNET_TRANSPORT_peer_get_active_addresses (const struct GNUNET_CONFIGURATION_Ha
msg.one_shot = htonl (one_shot);
msg.timeout = GNUNET_TIME_absolute_hton (abs_timeout);
if (peer == NULL)
- memset (&msg.peer, 0 , sizeof (struct GNUNET_PeerIdentity));
+ memset (&msg.peer, 0, sizeof (struct GNUNET_PeerIdentity));
else
msg.peer = *peer;
pal_ctx = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PeerIterateContext));
@@ -216,8 +223,8 @@ GNUNET_TRANSPORT_peer_get_active_addresses (const struct GNUNET_CONFIGURATION_Ha
*/
void
GNUNET_TRANSPORT_peer_get_active_addresses_cancel (struct
- GNUNET_TRANSPORT_PeerIterateContext
- *alc)
+ GNUNET_TRANSPORT_PeerIterateContext
+ *alc)
{
GNUNET_CLIENT_disconnect (alc->client, GNUNET_NO);
GNUNET_free (alc);
diff --git a/src/transport/transport_api_address_to_string.c b/src/transport/transport_api_address_to_string.c
index 5c44c288b..4d809530a 100644
--- a/src/transport/transport_api_address_to_string.c
+++ b/src/transport/transport_api_address_to_string.c
@@ -76,7 +76,7 @@ address_response_processor (void *cls, const struct GNUNET_MessageHeader *msg)
return;
}
GNUNET_break (ntohs (msg->type) ==
- GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY);
+ GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY);
size = ntohs (msg->size);
if (size == sizeof (struct GNUNET_MessageHeader))
{
@@ -116,12 +116,13 @@ address_response_processor (void *cls, const struct GNUNET_MessageHeader *msg)
* @return handle to cancel the operation, NULL on error
*/
struct GNUNET_TRANSPORT_AddressToStringContext *
-GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const struct GNUNET_HELLO_Address *address,
- int numeric,
- struct GNUNET_TIME_Relative timeout,
- GNUNET_TRANSPORT_AddressToStringCallback aluc,
- void *aluc_cls)
+GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle
+ *cfg,
+ const struct GNUNET_HELLO_Address *address,
+ int numeric,
+ struct GNUNET_TIME_Relative timeout,
+ GNUNET_TRANSPORT_AddressToStringCallback
+ aluc, void *aluc_cls)
{
size_t len;
size_t alen;
@@ -145,8 +146,7 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf
if (client == NULL)
return NULL;
#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "GNUNET_TRANSPORT_address_to_string\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "GNUNET_TRANSPORT_address_to_string\n");
#endif
msg = GNUNET_malloc (len);
msg->header.size = htons (len);
@@ -180,8 +180,8 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf
*/
void
GNUNET_TRANSPORT_address_to_string_cancel (struct
- GNUNET_TRANSPORT_AddressToStringContext
- *alc)
+ GNUNET_TRANSPORT_AddressToStringContext
+ *alc)
{
GNUNET_CLIENT_disconnect (alc->client, GNUNET_NO);
GNUNET_free (alc);
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index ded410e3d..22901bf26 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -268,9 +268,9 @@ void
GNUNET_abort ()
{
#if WINDOWS
- DebugBreak();
+ DebugBreak ();
#endif
- abort();
+ abort ();
}
@@ -292,6 +292,7 @@ add_definition (char *component, char *file, char *function, int from_line,
{
struct LogDef n;
int r;
+
if (logdefs_size == logdefs_len)
resize_logdefs ();
memset (&n, 0, sizeof (n));
@@ -299,27 +300,26 @@ add_definition (char *component, char *file, char *function, int from_line,
component = (char *) ".*";
r = regcomp (&n.component_regex, (const char *) component, REG_NOSUB);
if (r != 0)
- {
- return r;
- }
+ {
+ return r;
+ }
if (strlen (file) == 0)
file = (char *) ".*";
r = regcomp (&n.file_regex, (const char *) file, REG_NOSUB);
if (r != 0)
- {
- regfree (&n.component_regex);
- return r;
- }
- if ( (NULL == function) ||
- (strlen (function) == 0))
+ {
+ regfree (&n.component_regex);
+ return r;
+ }
+ if ((NULL == function) || (strlen (function) == 0))
function = (char *) ".*";
r = regcomp (&n.function_regex, (const char *) function, REG_NOSUB);
if (r != 0)
- {
- regfree (&n.component_regex);
- regfree (&n.file_regex);
- return r;
- }
+ {
+ regfree (&n.component_regex);
+ regfree (&n.file_regex);
+ return r;
+ }
n.from_line = from_line;
n.to_line = to_line;
n.level = level;
@@ -364,16 +364,16 @@ GNUNET_get_log_call_status (int caller_level, const char *comp,
force_only = min_level >= 0;
for (i = 0; i < logdefs_len; i++)
{
- ld = &logdefs[i];
- if ((!force_only || ld->force) &&
- (line >= ld->from_line && line <= ld->to_line) &&
- (regexec (&ld->component_regex, comp, 0, NULL, 0) == 0) &&
- (regexec (&ld->file_regex, file, 0, NULL, 0) == 0) &&
- (regexec (&ld->function_regex, function, 0, NULL, 0) == 0))
- {
- /* We're finished */
- return caller_level <= ld->level;
- }
+ ld = &logdefs[i];
+ if ((!force_only || ld->force) &&
+ (line >= ld->from_line && line <= ld->to_line) &&
+ (regexec (&ld->component_regex, comp, 0, NULL, 0) == 0) &&
+ (regexec (&ld->file_regex, file, 0, NULL, 0) == 0) &&
+ (regexec (&ld->function_regex, function, 0, NULL, 0) == 0))
+ {
+ /* We're finished */
+ return caller_level <= ld->level;
+ }
}
/* No matches - use global level, if defined */
if (min_level >= 0)
@@ -434,83 +434,83 @@ parse_definitions (const char *constname, int force)
to_line = INT_MAX;
for (p = def, state = 0, start = def; keep_looking; p++)
{
- switch (p[0])
- {
- case ';': /* found a field separator */
- p[0] = '\0';
- switch (state)
- {
- case 0: /* within a component name */
- comp = start;
- break;
- case 1: /* within a file name */
- file = start;
- break;
- case 2: /* within a function name */
- /* after a file name there must be a function name */
- function = start;
- break;
- case 3: /* within a from-to line range */
- if (strlen (start) > 0)
- {
- errno = 0;
- from_line = strtol (start, &t, 10);
- if (errno != 0 || from_line < 0)
- {
- free (def);
- return counter;
- }
- if (t < p && t[0] == '-')
- {
- errno = 0;
- start = t + 1;
- to_line = strtol (start, &t, 10);
- if (errno != 0 || to_line < 0 || t != p)
- {
- free (def);
- return counter;
- }
- }
- else /* one number means "match this line only" */
- to_line = from_line;
- }
- else /* default to 0-max */
- {
- from_line = 0;
- to_line = INT_MAX;
- }
- break;
- }
- start = p + 1;
- state += 1;
- break;
- case '\0': /* found EOL */
- keep_looking = 0;
- /* fall through to '/' */
- case '/': /* found a definition separator */
- switch (state)
- {
- case 4: /* within a log level */
- p[0] = '\0';
- state = 0;
- level = get_type ((const char *) start);
- if (level == GNUNET_ERROR_TYPE_INVALID
- || level == GNUNET_ERROR_TYPE_UNSPECIFIED
- || 0 != add_definition (comp, file, function, from_line,
- to_line, level, force))
- {
- free (def);
- return counter;
- }
- counter += 1;
- start = p + 1;
- break;
- default:
- break;
- }
- default:
- break;
- }
+ switch (p[0])
+ {
+ case ';': /* found a field separator */
+ p[0] = '\0';
+ switch (state)
+ {
+ case 0: /* within a component name */
+ comp = start;
+ break;
+ case 1: /* within a file name */
+ file = start;
+ break;
+ case 2: /* within a function name */
+ /* after a file name there must be a function name */
+ function = start;
+ break;
+ case 3: /* within a from-to line range */
+ if (strlen (start) > 0)
+ {
+ errno = 0;
+ from_line = strtol (start, &t, 10);
+ if (errno != 0 || from_line < 0)
+ {
+ free (def);
+ return counter;
+ }
+ if (t < p && t[0] == '-')
+ {
+ errno = 0;
+ start = t + 1;
+ to_line = strtol (start, &t, 10);
+ if (errno != 0 || to_line < 0 || t != p)
+ {
+ free (def);
+ return counter;
+ }
+ }
+ else /* one number means "match this line only" */
+ to_line = from_line;
+ }
+ else /* default to 0-max */
+ {
+ from_line = 0;
+ to_line = INT_MAX;
+ }
+ break;
+ }
+ start = p + 1;
+ state += 1;
+ break;
+ case '\0': /* found EOL */
+ keep_looking = 0;
+ /* fall through to '/' */
+ case '/': /* found a definition separator */
+ switch (state)
+ {
+ case 4: /* within a log level */
+ p[0] = '\0';
+ state = 0;
+ level = get_type ((const char *) start);
+ if (level == GNUNET_ERROR_TYPE_INVALID ||
+ level == GNUNET_ERROR_TYPE_UNSPECIFIED ||
+ 0 != add_definition (comp, file, function, from_line, to_line,
+ level, force))
+ {
+ free (def);
+ return counter;
+ }
+ counter += 1;
+ start = p + 1;
+ break;
+ default:
+ break;
+ }
+ default:
+ break;
+ }
}
free (def);
return counter;
@@ -560,8 +560,7 @@ GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile)
component_nopid = GNUNET_strdup (comp);
env_logfile = getenv ("GNUNET_FORCE_LOGFILE");
- if ( (env_logfile != NULL) &&
- (strlen (env_logfile) > 0) )
+ if ((env_logfile != NULL) && (strlen (env_logfile) > 0))
logfile = env_logfile;
if (logfile == NULL)
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c
index a1485029e..ff20646f7 100644
--- a/src/util/crypto_random.c
+++ b/src/util/crypto_random.c
@@ -38,10 +38,10 @@
/* The code is derived from glibc, obviously */
#if MINGW
#ifdef RANDOM
-# undef RANDOM
+#undef RANDOM
#endif
#ifdef SRANDOM
-# undef SRANDOM
+#undef SRANDOM
#endif
#define RANDOM() glibc_weak_rand32()
#define SRANDOM(s) glibc_weak_srand32(s)
@@ -57,6 +57,7 @@ int32_t
glibc_weak_rand32 ()
{
int32_t val = glibc_weak_rand32_state;
+
val = ((glibc_weak_rand32_state * 1103515245) + 12345) & 0x7fffffff;
glibc_weak_rand32_state = val;
return val;
@@ -314,7 +315,8 @@ void __attribute__ ((constructor)) GNUNET_CRYPTO_random_init ()
gcry_set_progress_handler (&entropy_generator, NULL);
atexit (&killfind);
GNUNET_CRYPTO_seed_weak_random (time (NULL) ^
- GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX));
+ GNUNET_CRYPTO_random_u32
+ (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX));
}
diff --git a/src/util/getopt.c b/src/util/getopt.c
index 6c63cb339..08c133423 100644
--- a/src/util/getopt.c
+++ b/src/util/getopt.c
@@ -257,8 +257,8 @@ extern pid_t __libc_pid;
/* Make sure the environment variable bash 2.0 puts in the environment
is valid for the getopt call we must make sure that the ARGV passed
to getopt is that one passed to the process. */
-static void
- GNUNET_UNUSED store_args_and_env (int argc, char *const *argv)
+static void GNUNET_UNUSED
+store_args_and_env (int argc, char *const *argv)
{
/* XXX This is no good solution. We should rather copy the args so
* that we can compare them later. But we must not use malloc(3). */
diff --git a/src/util/os_network.c b/src/util/os_network.c
index a4758496e..b25e9d00b 100644
--- a/src/util/os_network.c
+++ b/src/util/os_network.c
@@ -58,12 +58,13 @@ GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor proc,
for (i = 0; i < results_count; i++)
{
- if (GNUNET_OK != proc (proc_cls, results[i].pretty_name,
- results[i].is_default,
- &results[i].address,
- results[i].flags & ENUMNICS3_MASK_OK ? &results[i].mask : NULL,
- results[i].flags & ENUMNICS3_BCAST_OK ? &results[i].broadcast : NULL,
- results[i].addr_size))
+ if (GNUNET_OK !=
+ proc (proc_cls, results[i].pretty_name, results[i].is_default,
+ &results[i].address,
+ results[i].flags & ENUMNICS3_MASK_OK ? &results[i].mask : NULL,
+ results[i].
+ flags & ENUMNICS3_BCAST_OK ? &results[i].broadcast : NULL,
+ results[i].addr_size))
break;
}
EnumNICs3_free (results);
@@ -92,10 +93,8 @@ GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor proc,
if (GNUNET_OK !=
proc (proc_cls, ifa_ptr->ifa_name,
0 == strcmp (ifa_ptr->ifa_name, GNUNET_DEFAULT_INTERFACE),
- ifa_ptr->ifa_addr,
- ifa_ptr->ifa_broadaddr,
- ifa_ptr->ifa_netmask,
- alen))
+ ifa_ptr->ifa_addr, ifa_ptr->ifa_broadaddr,
+ ifa_ptr->ifa_netmask, alen))
break;
}
}
@@ -169,9 +168,7 @@ GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor proc,
proc (proc_cls, ifc, 0 == strcmp (ifc, GNUNET_DEFAULT_INTERFACE),
(const struct sockaddr *) &a4,
/* TODO broadcast and netmask */
- NULL,
- NULL,
- sizeof (a4)))
+ NULL, NULL, sizeof (a4)))
break;
continue;
}
@@ -188,9 +185,7 @@ GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor proc,
proc (proc_cls, ifc, 0 == strcmp (ifc, GNUNET_DEFAULT_INTERFACE),
(const struct sockaddr *) &a6,
/* TODO broadcast and netmask */
- NULL,
- NULL,
- sizeof (a6)))
+ NULL, NULL, sizeof (a6)))
break;
continue;
}
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index d4a11fc8a..1acc9a6d6 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -676,7 +676,7 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws)
if (((tc.reason & GNUNET_SCHEDULER_REASON_WRITE_READY) != 0) &&
(pos->write_fd != -1) &&
(!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd)))
- GNUNET_abort (); // added to ready in previous select loop!
+ GNUNET_abort (); // added to ready in previous select loop!
#if DEBUG_TASKS
LOG (GNUNET_ERROR_TYPE_DEBUG, "Running task: %llu / %p\n", pos->id,
pos->callback_cls);
@@ -726,9 +726,9 @@ sighandler_shutdown ()
static char c;
int old_errno = errno; /* backup errno */
- if (getpid() != my_pid)
- exit(1); /* we have fork'ed since the signal handler was created,
- ignore the signal, see https://gnunet.org/vfork discussion */
+ if (getpid () != my_pid)
+ exit (1); /* we have fork'ed since the signal handler was created,
+ * ignore the signal, see https://gnunet.org/vfork discussion */
GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle
(shutdown_pipe_handle, GNUNET_DISK_PIPE_END_WRITE),
&c, sizeof (c));
diff --git a/src/util/service.c b/src/util/service.c
index b5711972b..91fc460e2 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -1566,12 +1566,12 @@ GNUNET_SERVICE_run (int argc, char *const *argv, const char *serviceName,
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Service `%s' runs with configuration from `%s'\n", serviceName, cfg_fn);
#endif
- if ( (GNUNET_OK ==
- GNUNET_CONFIGURATION_get_value_number (sctx.cfg, "TESTING", "SKEW_OFFSET",
- &skew_offset)) &&
- (GNUNET_OK ==
- GNUNET_CONFIGURATION_get_value_number (sctx.cfg, "TESTING",
- "SKEW_VARIANCE", &skew_variance)) )
+ if ((GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_number (sctx.cfg, "TESTING",
+ "SKEW_OFFSET", &skew_offset)) &&
+ (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_number (sctx.cfg, "TESTING",
+ "SKEW_VARIANCE", &skew_variance)))
{
clock_offset = skew_offset - skew_variance;
GNUNET_TIME_set_offset (clock_offset);
diff --git a/src/util/strings.c b/src/util/strings.c
index 58a4847bc..2b5538b35 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -237,7 +237,7 @@ GNUNET_STRINGS_fancy_size_to_bytes (const char *fancy_size,
last = 0;
if (1 != sscanf (tok, "%llu", &last))
{
- GNUNET_free (in);
+ GNUNET_free (in);
return GNUNET_SYSERR; /* expected number */
}
}
@@ -316,7 +316,7 @@ GNUNET_STRINGS_fancy_time_to_relative (const char *fancy_size,
last = 0;
if (1 != sscanf (tok, "%llu", &last))
{
- GNUNET_free (in);
+ GNUNET_free (in);
return GNUNET_SYSERR; /* expected number */
}
}
diff --git a/src/util/test_bio.c b/src/util/test_bio.c
index 19f78b6b7..9b18258fb 100644
--- a/src/util/test_bio.c
+++ b/src/util/test_bio.c
@@ -195,7 +195,7 @@ test_bigmeta_rw ()
static int
test_directory_r ()
{
-#if LINUX
+#if LINUX
char *msg;
char readResult[200];
struct GNUNET_BIO_ReadHandle *fileR;
diff --git a/src/util/test_common_logging_runtime_loglevels.c b/src/util/test_common_logging_runtime_loglevels.c
index 79b888c56..9b5b1228a 100644
--- a/src/util/test_common_logging_runtime_loglevels.c
+++ b/src/util/test_common_logging_runtime_loglevels.c
@@ -314,14 +314,13 @@ runone ()
break;
}
- proc =
- GNUNET_OS_start_process (NULL, pipe_stdout,
+ proc = GNUNET_OS_start_process (NULL, pipe_stdout,
#if MINGW
- "test_common_logging_dummy",
+ "test_common_logging_dummy",
#else
- "./test_common_logging_dummy",
+ "./test_common_logging_dummy",
#endif
- "test_common_logging_dummy", NULL);
+ "test_common_logging_dummy", NULL);
putenv ("GNUNET_FORCE_LOG=");
putenv ("GNUNET_LOG=");
diff --git a/src/util/test_os_network.c b/src/util/test_os_network.c
index ab39e5eda..423e66f63 100644
--- a/src/util/test_os_network.c
+++ b/src/util/test_os_network.c
@@ -34,11 +34,8 @@
* (success).
*/
static int
-proc (void *cls, const char *name,
- int isDefault,
- const struct sockaddr * addr,
- const struct sockaddr * broadcast_addr,
- const struct sockaddr * netmask,
+proc (void *cls, const char *name, int isDefault, const struct sockaddr *addr,
+ const struct sockaddr *broadcast_addr, const struct sockaddr *netmask,
socklen_t addrlen)
{
int *ok = cls;
diff --git a/src/vpn/gnunet-daemon-exit.c b/src/vpn/gnunet-daemon-exit.c
index e7d904120..2e8061024 100644
--- a/src/vpn/gnunet-daemon-exit.c
+++ b/src/vpn/gnunet-daemon-exit.c
@@ -170,8 +170,8 @@ struct tunnel_state
* Function that frees everything from a hashmap
*/
static int
-free_iterate (void *cls GNUNET_UNUSED, const GNUNET_HashCode * hash
- GNUNET_UNUSED, void *value)
+free_iterate (void *cls GNUNET_UNUSED,
+ const GNUNET_HashCode * hash GNUNET_UNUSED, void *value)
{
GNUNET_free (value);
return GNUNET_YES;
@@ -181,8 +181,7 @@ free_iterate (void *cls GNUNET_UNUSED, const GNUNET_HashCode * hash
* Function scheduled as very last function, cleans up after us
*/
static void
-cleanup (void *cls
- GNUNET_UNUSED,
+cleanup (void *cls GNUNET_UNUSED,
const struct GNUNET_SCHEDULER_TaskContext *tskctx)
{
GNUNET_assert (0 != (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN));
@@ -199,11 +198,9 @@ cleanup (void *cls
}
static void *
-new_tunnel (void *cls
- GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
- const struct GNUNET_PeerIdentity *initiator
- GNUNET_UNUSED, const struct GNUNET_ATS_Information *ats
- GNUNET_UNUSED)
+new_tunnel (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
+ const struct GNUNET_PeerIdentity *initiator GNUNET_UNUSED,
+ const struct GNUNET_ATS_Information *ats GNUNET_UNUSED)
{
struct tunnel_state *s = GNUNET_malloc (sizeof *s);
@@ -214,8 +211,7 @@ new_tunnel (void *cls
}
static void
-clean_tunnel (void *cls
- GNUNET_UNUSED, const struct GNUNET_MESH_Tunnel *tunnel,
+clean_tunnel (void *cls GNUNET_UNUSED, const struct GNUNET_MESH_Tunnel *tunnel,
void *tunnel_ctx)
{
GNUNET_free (tunnel_ctx);
@@ -531,8 +527,7 @@ tcp_from_helper (struct tcp_pkt *tcp, unsigned char *dadr, size_t addrlen,
* Receive packets from the helper-process
*/
static void
-message_token (void *cls GNUNET_UNUSED, void *client
- GNUNET_UNUSED,
+message_token (void *cls GNUNET_UNUSED, void *client GNUNET_UNUSED,
const struct GNUNET_MessageHeader *message)
{
GNUNET_assert (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_HELPER);
@@ -1038,15 +1033,11 @@ prepare_ipv6_packet (size_t len, uint16_t pktlen, void *payload,
* The messages are one GNUNET_HashCode for the service followed by a struct tcp_pkt
*/
static int
-receive_tcp_service (void *cls
- GNUNET_UNUSED,
- struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx
- GNUNET_UNUSED,
- const struct GNUNET_PeerIdentity *sender
- GNUNET_UNUSED,
+receive_tcp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
+ void **tunnel_ctx GNUNET_UNUSED,
+ const struct GNUNET_PeerIdentity *sender GNUNET_UNUSED,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi
- GNUNET_UNUSED)
+ const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received TCP-Packet\n");
GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1);
@@ -1144,15 +1135,11 @@ receive_tcp_service (void *cls
}
static int
-receive_tcp_remote (void *cls
- GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
- void **tunnel_ctx
- GNUNET_UNUSED,
- const struct GNUNET_PeerIdentity *sender
- GNUNET_UNUSED,
+receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
+ void **tunnel_ctx GNUNET_UNUSED,
+ const struct GNUNET_PeerIdentity *sender GNUNET_UNUSED,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi
- GNUNET_UNUSED)
+ const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
{
GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1);
struct tcp_pkt *pkt = (struct tcp_pkt *) (desc + 1);
@@ -1220,15 +1207,11 @@ receive_tcp_remote (void *cls
}
static int
-receive_udp_remote (void *cls
- GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
- void **tunnel_ctx
- GNUNET_UNUSED,
- const struct GNUNET_PeerIdentity *sender
- GNUNET_UNUSED,
+receive_udp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
+ void **tunnel_ctx GNUNET_UNUSED,
+ const struct GNUNET_PeerIdentity *sender GNUNET_UNUSED,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi
- GNUNET_UNUSED)
+ const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
{
GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1);
struct udp_pkt *pkt = (struct udp_pkt *) (desc + 1);
@@ -1300,14 +1283,11 @@ receive_udp_remote (void *cls
* The messages are one GNUNET_HashCode for the service, followed by a struct udp_pkt
*/
static int
-receive_udp_service (void *cls
- GNUNET_UNUSED,
- struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx,
- const struct GNUNET_PeerIdentity *sender
- GNUNET_UNUSED,
+receive_udp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
+ void **tunnel_ctx,
+ const struct GNUNET_PeerIdentity *sender GNUNET_UNUSED,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi
- GNUNET_UNUSED)
+ const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
{
GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1);
struct udp_pkt *pkt = (struct udp_pkt *) (desc + 1);
@@ -1463,8 +1443,9 @@ connect_to_mesh ()
* @param cfg_ configuration
*/
static void
-run (void *cls, char *const *args GNUNET_UNUSED, const char *cfgfile
- GNUNET_UNUSED, const struct GNUNET_CONFIGURATION_Handle *cfg_)
+run (void *cls, char *const *args GNUNET_UNUSED,
+ const char *cfgfile GNUNET_UNUSED,
+ const struct GNUNET_CONFIGURATION_Handle *cfg_)
{
cfg = cfg_;
diff --git a/src/vpn/gnunet-daemon-vpn-dns.c b/src/vpn/gnunet-daemon-vpn-dns.c
index 0e4c88a29..bd65e373f 100644
--- a/src/vpn/gnunet-daemon-vpn-dns.c
+++ b/src/vpn/gnunet-daemon-vpn-dns.c
@@ -127,8 +127,7 @@ send_query (void *cls GNUNET_UNUSED, size_t size, void *buf)
* Connect to the service-dns
*/
void
-connect_to_service_dns (void *cls
- GNUNET_UNUSED,
+connect_to_service_dns (void *cls GNUNET_UNUSED,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
conn_task = GNUNET_SCHEDULER_NO_TASK;
@@ -169,8 +168,7 @@ connect_to_service_dns (void *cls
* handle it
*/
void
-dns_answer_handler (void *cls
- GNUNET_UNUSED,
+dns_answer_handler (void *cls GNUNET_UNUSED,
const struct GNUNET_MessageHeader *msg)
{
/* the service disconnected, reconnect after short wait */
diff --git a/src/vpn/gnunet-daemon-vpn-helper.c b/src/vpn/gnunet-daemon-vpn-helper.c
index 1ffb0f7d8..41910a701 100644
--- a/src/vpn/gnunet-daemon-vpn-helper.c
+++ b/src/vpn/gnunet-daemon-vpn-helper.c
@@ -168,8 +168,7 @@ initialize_tunnel_state (int addrlen, struct GNUNET_MESH_TransmitHandle *th)
* Send an dns-answer-packet to the helper
*/
void
-helper_write (void *cls
- GNUNET_UNUSED,
+helper_write (void *cls GNUNET_UNUSED,
const struct GNUNET_SCHEDULER_TaskContext *tsdkctx)
{
if (tsdkctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)
@@ -297,7 +296,7 @@ helper_write (void *cls
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Wrong addrlen = %d\n",
ans->pkt.addrlen);
GNUNET_assert (0);
- return; /* convince compiler that we're done here */
+ return; /* convince compiler that we're done here */
}
GNUNET_CONTAINER_DLL_remove (answer_proc_head, answer_proc_tail, ans);
@@ -321,8 +320,7 @@ helper_write (void *cls
* Receive packets from the helper-process
*/
void
-message_token (void *cls GNUNET_UNUSED, void *client
- GNUNET_UNUSED,
+message_token (void *cls GNUNET_UNUSED, void *client GNUNET_UNUSED,
const struct GNUNET_MessageHeader *message)
{
GNUNET_assert (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_HELPER);
@@ -402,7 +400,7 @@ message_token (void *cls GNUNET_UNUSED, void *client
htons (sizeof (struct GNUNET_MessageHeader) +
sizeof (GNUNET_HashCode) + ntohs (pkt6->ip6_hdr.paylgth));
- GNUNET_MESH_ApplicationType app_type = 0; /* fix compiler uninitialized warning... */
+ GNUNET_MESH_ApplicationType app_type = 0; /* fix compiler uninitialized warning... */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "me->addrlen is %d\n",
me->addrlen);
diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c
index 376d3574e..6b65b709e 100644
--- a/src/vpn/gnunet-daemon-vpn.c
+++ b/src/vpn/gnunet-daemon-vpn.c
@@ -78,8 +78,7 @@ GNUNET_SCHEDULER_TaskIdentifier shs_task;
*{{{
*/
static void
-cleanup (void *cls
- GNUNET_UNUSED,
+cleanup (void *cls GNUNET_UNUSED,
const struct GNUNET_SCHEDULER_TaskContext *tskctx)
{
GNUNET_assert (0 != (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN));
@@ -168,8 +167,7 @@ address4_mapping_exists (uint32_t addr)
}
static void
-collect_mappings (void *cls
- GNUNET_UNUSED,
+collect_mappings (void *cls GNUNET_UNUSED,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
@@ -335,8 +333,7 @@ port_in_ports (uint64_t ports, uint16_t port)
void
send_pkt_to_peer (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi
- GNUNET_UNUSED)
+ const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
{
/* peer == NULL means that all peers in this request are connected */
if (peer == NULL)
@@ -856,12 +853,10 @@ add_additional_port (struct map_entry *me, uint16_t port)
}
static int
-receive_udp_back (void *cls
- GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
+receive_udp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
void **tunnel_ctx, const struct GNUNET_PeerIdentity *sender,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi
- GNUNET_UNUSED)
+ const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
{
GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1);
struct remote_addr *s = (struct remote_addr *) desc;
@@ -1033,13 +1028,11 @@ receive_udp_back (void *cls
}
static int
-receive_tcp_back (void *cls
- GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
- void **tunnel_ctx, const struct GNUNET_PeerIdentity *sender
- GNUNET_UNUSED,
+receive_tcp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
+ void **tunnel_ctx,
+ const struct GNUNET_PeerIdentity *sender GNUNET_UNUSED,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi
- GNUNET_UNUSED)
+ const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
{
GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1);
struct remote_addr *s = (struct remote_addr *) desc;
@@ -1245,8 +1238,9 @@ cleaner (void *cls, const struct GNUNET_MESH_Tunnel *tunnel, void *tunnel_ctx)
* @param cfg_ configuration
*/
static void
-run (void *cls, char *const *args GNUNET_UNUSED, const char *cfgfile
- GNUNET_UNUSED, const struct GNUNET_CONFIGURATION_Handle *cfg_)
+run (void *cls, char *const *args GNUNET_UNUSED,
+ const char *cfgfile GNUNET_UNUSED,
+ const struct GNUNET_CONFIGURATION_Handle *cfg_)
{
static const struct GNUNET_MESH_MessageHandler handlers[] = {
{receive_udp_back, GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK, 0},
diff --git a/src/vpn/gnunet-service-dns.c b/src/vpn/gnunet-service-dns.c
index e44405a8e..6ef621c26 100644
--- a/src/vpn/gnunet-service-dns.c
+++ b/src/vpn/gnunet-service-dns.c
@@ -167,8 +167,7 @@ client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
* Hijack all outgoing DNS-Traffic but for traffic leaving "our" port.
*/
static void
-hijack (void *cls
- GNUNET_UNUSED, const struct GNUNET_SCHEDULER_TaskContext *tc)
+hijack (void *cls GNUNET_UNUSED, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
@@ -207,11 +206,9 @@ hijack (void *cls
}
static void *
-new_tunnel (void *cls
- GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
- const struct GNUNET_PeerIdentity *initiator
- GNUNET_UNUSED, const struct GNUNET_ATS_Information *ats
- GNUNET_UNUSED)
+new_tunnel (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
+ const struct GNUNET_PeerIdentity *initiator GNUNET_UNUSED,
+ const struct GNUNET_ATS_Information *ats GNUNET_UNUSED)
{
struct tunnel_state *s = GNUNET_malloc (sizeof *s);
@@ -222,8 +219,7 @@ new_tunnel (void *cls
}
static void
-clean_tunnel (void *cls
- GNUNET_UNUSED, const struct GNUNET_MESH_Tunnel *tunnel,
+clean_tunnel (void *cls GNUNET_UNUSED, const struct GNUNET_MESH_Tunnel *tunnel,
void *tunnel_ctx)
{
GNUNET_free (tunnel_ctx);
@@ -386,8 +382,7 @@ mesh_send (void *cls, size_t size, void *buf)
void
mesh_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi
- GNUNET_UNUSED)
+ const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
{
if (NULL == peer)
return;
@@ -447,15 +442,11 @@ send_mesh_query (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
}
static int
-receive_mesh_query (void *cls
- GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
- void **ctx
- GNUNET_UNUSED,
- const struct GNUNET_PeerIdentity *sender
- GNUNET_UNUSED,
+receive_mesh_query (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
+ void **ctx GNUNET_UNUSED,
+ const struct GNUNET_PeerIdentity *sender GNUNET_UNUSED,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi
- GNUNET_UNUSED)
+ const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
{
struct dns_pkt *dns = (struct dns_pkt *) (message + 1);
@@ -500,14 +491,11 @@ receive_mesh_query (void *cls
}
static int
-receive_mesh_answer (void *cls
- GNUNET_UNUSED,
- struct GNUNET_MESH_Tunnel *tunnel, void **ctx
- GNUNET_UNUSED,
+receive_mesh_answer (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
+ void **ctx GNUNET_UNUSED,
const struct GNUNET_PeerIdentity *sender,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi
- GNUNET_UNUSED)
+ const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
{
/* TODo: size check */
struct dns_pkt *dns = (struct dns_pkt *) (message + 1);
@@ -749,16 +737,13 @@ send_rev_query (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* Receive a block from the dht.
*/
static void
-receive_dht (void *cls, struct GNUNET_TIME_Absolute exp
- GNUNET_UNUSED, const GNUNET_HashCode * key
- GNUNET_UNUSED,
- const struct GNUNET_PeerIdentity *get_path
- GNUNET_UNUSED, unsigned int get_path_length
- GNUNET_UNUSED,
- const struct GNUNET_PeerIdentity *put_path
- GNUNET_UNUSED, unsigned int put_path_length
- GNUNET_UNUSED, enum GNUNET_BLOCK_Type type, size_t size,
- const void *data)
+receive_dht (void *cls, struct GNUNET_TIME_Absolute exp GNUNET_UNUSED,
+ const GNUNET_HashCode * key GNUNET_UNUSED,
+ const struct GNUNET_PeerIdentity *get_path GNUNET_UNUSED,
+ unsigned int get_path_length GNUNET_UNUSED,
+ const struct GNUNET_PeerIdentity *put_path GNUNET_UNUSED,
+ unsigned int put_path_length GNUNET_UNUSED,
+ enum GNUNET_BLOCK_Type type, size_t size, const void *data)
{
unsigned short id = ((struct receive_dht_cls *) cls)->id;
@@ -868,8 +853,7 @@ receive_dht (void *cls, struct GNUNET_TIME_Absolute exp
* This receives a GNUNET_MESSAGE_TYPE_REHIJACK and rehijacks the DNS
*/
static void
-rehijack (void *cls
- GNUNET_UNUSED, struct GNUNET_SERVER_Client *client,
+rehijack (void *cls GNUNET_UNUSED, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message GNUNET_UNUSED)
{
unhijack (dnsoutport);
@@ -882,8 +866,7 @@ rehijack (void *cls
* This receives the dns-payload from the daemon-vpn and sends it on over the udp-socket
*/
static void
-receive_query (void *cls
- GNUNET_UNUSED, struct GNUNET_SERVER_Client *client,
+receive_query (void *cls GNUNET_UNUSED, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
struct query_packet *pkt = (struct query_packet *) message;
@@ -1231,8 +1214,7 @@ handle_response (struct dns_pkt *dns, struct sockaddr *addr, socklen_t addrlen,
* Read a response-packet of the UDP-Socket
*/
static void
-read_response6 (void *cls
- GNUNET_UNUSED,
+read_response6 (void *cls GNUNET_UNUSED,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct sockaddr_in6 addr;
@@ -1281,8 +1263,7 @@ read_response6 (void *cls
* Read a response-packet of the UDP-Socket
*/
static void
-read_response (void *cls
- GNUNET_UNUSED,
+read_response (void *cls GNUNET_UNUSED,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct sockaddr_in addr;
@@ -1438,8 +1419,7 @@ handle_response (struct dns_pkt *dns, struct sockaddr *addr, socklen_t addrlen,
* @param tc unused
*/
static void
-cleanup_task (void *cls
- GNUNET_UNUSED,
+cleanup_task (void *cls GNUNET_UNUSED,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
GNUNET_assert (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN));
@@ -1665,8 +1645,7 @@ publish_iterate (void *cls GNUNET_UNUSED, const char *section)
* Publish a DNS-record in the DHT.
*/
static void
-publish_names (void *cls
- GNUNET_UNUSED,
+publish_names (void *cls GNUNET_UNUSED,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))