From 51a6531fa5c68eed968b314a5124a2fdfb3556d2 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 22 Aug 2010 13:36:42 +0000 Subject: whitespace --- src/transport/gnunet-nat-client-windows.c | 128 ++++----- src/transport/gnunet-nat-server-windows.c | 144 +++++----- src/transport/gnunet-service-transport.c | 366 ++++++++++++------------- src/transport/gnunet-transport-wlan-helper.c | 6 +- src/transport/plugin_transport_https.c | 4 +- src/transport/plugin_transport_tcp.c | 102 +++---- src/transport/plugin_transport_template.c | 8 +- src/transport/plugin_transport_udp.c | 82 +++--- src/transport/test_plugin_transport_http.c | 2 +- src/transport/test_plugin_transport_https.c | 2 +- src/transport/test_transport_api.c | 10 +- src/transport/test_transport_api_reliability.c | 14 +- src/transport/transport_api.c | 64 ++--- src/transport/transport_api_address_lookup.c | 16 +- src/transport/transport_api_blacklist.c | 10 +- 15 files changed, 479 insertions(+), 479 deletions(-) (limited to 'src') diff --git a/src/transport/gnunet-nat-client-windows.c b/src/transport/gnunet-nat-client-windows.c index 3d3127157..2507a96b4 100644 --- a/src/transport/gnunet-nat-client-windows.c +++ b/src/transport/gnunet-nat-client-windows.c @@ -70,65 +70,65 @@ /** * IPv4 header. */ -struct ip_header +struct ip_header { /** - * Version (4 bits) + Internet header length (4 bits) + * Version (4 bits) + Internet header length (4 bits) */ - uint8_t vers_ihl; + uint8_t vers_ihl; /** * Type of service */ - uint8_t tos; + uint8_t tos; /** * Total length */ - uint16_t pkt_len; + uint16_t pkt_len; /** * Identification */ - uint16_t id; + uint16_t id; /** * Flags (3 bits) + Fragment offset (13 bits) */ - uint16_t flags_frag_offset; + uint16_t flags_frag_offset; /** * Time to live */ - uint8_t ttl; + uint8_t ttl; /** - * Protocol + * Protocol */ - uint8_t proto; + uint8_t proto; /** * Header checksum */ - uint16_t checksum; + uint16_t checksum; /** * Source address */ - uint32_t src_ip; + uint32_t src_ip; /** - * Destination address + * Destination address */ - uint32_t dst_ip; + uint32_t dst_ip; }; /** * Format of ICMP packet. */ -struct icmp_ttl_exceeded_header +struct icmp_ttl_exceeded_header { uint8_t type; @@ -179,7 +179,7 @@ static struct in_addr dummy; /** * Port we are listening on (communicated to the server). - */ + */ static uint16_t port; @@ -192,17 +192,17 @@ static uint16_t port; * @param buf where to write the address result * @return 1 on success */ -static int -inet_pton (int af, - const char *cp, +static int +inet_pton (int af, + const char *cp, struct in_addr *buf) { buf->s_addr = inet_addr(cp); if (buf->s_addr == INADDR_NONE) { - fprintf(stderr, - "Error %d handling address %s", - WSAGetLastError(), + fprintf(stderr, + "Error %d handling address %s", + WSAGetLastError(), cp); return 0; } @@ -217,16 +217,16 @@ inet_pton (int af, * @param bytes number of bytes in data (must be multiple of 2) * @return the CRC 16. */ -static uint16_t -calc_checksum(const uint16_t *data, +static uint16_t +calc_checksum(const uint16_t *data, unsigned int bytes) { uint32_t sum; unsigned int i; sum = 0; - for (i=0;i> 16); sum = htons(0xffff - sum); return sum; @@ -244,7 +244,7 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other) { char packet[sizeof(struct ip_header) * 2 + - sizeof(struct icmp_ttl_exceeded_header) + + sizeof(struct icmp_ttl_exceeded_header) + sizeof(struct udp_header)]; struct ip_header ip_pkt; struct icmp_ttl_exceeded_header icmp_pkt; @@ -265,10 +265,10 @@ send_icmp_udp (const struct in_addr *my_ip, ip_pkt.checksum = 0; ip_pkt.src_ip = my_ip->s_addr; ip_pkt.dst_ip = other->s_addr; - ip_pkt.checksum = htons(calc_checksum((uint16_t*)&ip_pkt, + ip_pkt.checksum = htons(calc_checksum((uint16_t*)&ip_pkt, sizeof (struct ip_header))); - memcpy(&packet[off], - &ip_pkt, + memcpy(&packet[off], + &ip_pkt, sizeof(struct ip_header)); off += sizeof(struct ip_header); @@ -277,7 +277,7 @@ send_icmp_udp (const struct in_addr *my_ip, icmp_pkt.checksum = 0; icmp_pkt.unused = 0; memcpy(&packet[off], - &icmp_pkt, + &icmp_pkt, sizeof(struct icmp_ttl_exceeded_header)); off += sizeof(struct icmp_ttl_exceeded_header); @@ -293,32 +293,32 @@ send_icmp_udp (const struct in_addr *my_ip, ip_pkt.checksum = 0; ip_pkt.src_ip = other->s_addr; ip_pkt.dst_ip = dummy.s_addr; - ip_pkt.checksum = htons(calc_checksum((uint16_t*)&ip_pkt, + ip_pkt.checksum = htons(calc_checksum((uint16_t*)&ip_pkt, sizeof (struct ip_header))); - memcpy(&packet[off], - &ip_pkt, + memcpy(&packet[off], + &ip_pkt, sizeof(struct ip_header)); off += sizeof(struct ip_header); /* build UDP header */ udp_pkt.src_port = htons(NAT_TRAV_PORT); - udp_pkt.dst_port = htons(NAT_TRAV_PORT); + udp_pkt.dst_port = htons(NAT_TRAV_PORT); udp_pkt.length = htons (port); udp_pkt.crc = 0; - memcpy(&packet[off], - &udp_pkt, + memcpy(&packet[off], + &udp_pkt, sizeof(struct udp_header)); off += sizeof(struct udp_header); /* no go back to calculate ICMP packet checksum */ icmp_pkt.checksum = htons(calc_checksum((uint16_t*)&packet[off], - sizeof (struct icmp_ttl_exceeded_header) + - sizeof (struct ip_header) + + sizeof (struct icmp_ttl_exceeded_header) + + sizeof (struct ip_header) + sizeof (struct udp_header))); - memcpy (&packet[sizeof (struct ip_header)], - &icmp_pkt, + memcpy (&packet[sizeof (struct ip_header)], + &icmp_pkt, sizeof (struct icmp_ttl_exceeded_header)); - + memset (&dst, 0, sizeof (dst)); dst.sin_family = AF_INET; dst.sin_addr = *other; @@ -354,8 +354,8 @@ send_icmp (const struct in_addr *my_ip, struct icmp_ttl_exceeded_header icmp_ttl; struct icmp_echo_header icmp_echo; struct sockaddr_in dst; - char packet[sizeof (struct ip_header) * 2 + - sizeof (struct icmp_ttl_exceeded_header) + + char packet[sizeof (struct ip_header) * 2 + + sizeof (struct icmp_ttl_exceeded_header) + sizeof(struct icmp_echo_header)]; size_t off; int err; @@ -365,11 +365,11 @@ send_icmp (const struct in_addr *my_ip, ip_pkt.vers_ihl = 0x45; ip_pkt.tos = 0; ip_pkt.pkt_len = htons (sizeof (packet)); - ip_pkt.id = htons(256); + ip_pkt.id = htons(256); ip_pkt.flags_frag_offset = 0; ip_pkt.ttl = IPDEFTTL; ip_pkt.proto = IPPROTO_ICMP; - ip_pkt.checksum = 0; + ip_pkt.checksum = 0; ip_pkt.src_ip = my_ip->s_addr; ip_pkt.dst_ip = other->s_addr; ip_pkt.checksum = htons(calc_checksum((uint16_t*)&ip_pkt, @@ -381,7 +381,7 @@ send_icmp (const struct in_addr *my_ip, /* icmp reply: time exceeded */ icmp_ttl.type = ICMP_TIME_EXCEEDED; - icmp_ttl.code = 0; + icmp_ttl.code = 0; icmp_ttl.reserved = 0; icmp_ttl.checksum = 0; memcpy (&packet[off], @@ -393,7 +393,7 @@ send_icmp (const struct in_addr *my_ip, ip_pkt.vers_ihl = 0x45; ip_pkt.tos = 0; ip_pkt.pkt_len = (sizeof (struct ip_header) + sizeof (struct icmp_echo_header)); - ip_pkt.id = htons (256); + ip_pkt.id = htons (256); ip_pkt.flags_frag_offset = 0; ip_pkt.ttl = 1; /* real TTL would be 1 on a time exceeded packet */ ip_pkt.proto = IPPROTO_ICMP; @@ -401,9 +401,9 @@ send_icmp (const struct in_addr *my_ip, ip_pkt.dst_ip = dummy.s_addr; ip_pkt.checksum = 0; ip_pkt.checksum = htons(calc_checksum((uint16_t*)&ip_pkt, - sizeof (struct ip_header))); - memcpy (&packet[off], - &ip_pkt, + sizeof (struct ip_header))); + memcpy (&packet[off], + &ip_pkt, sizeof (struct ip_header)); off += sizeof (struct ip_header); @@ -412,17 +412,17 @@ send_icmp (const struct in_addr *my_ip, icmp_echo.reserved = 0; icmp_echo.checksum = 0; icmp_echo.data = htons(port); - icmp_echo.checksum = htons(calc_checksum((uint16_t*) &icmp_echo, + icmp_echo.checksum = htons(calc_checksum((uint16_t*) &icmp_echo, sizeof (struct icmp_echo_header))); memcpy (&packet[off], - &icmp_echo, + &icmp_echo, sizeof(struct icmp_echo_header)); /* no go back to calculate ICMP packet checksum */ off = sizeof (struct ip_header); icmp_ttl.checksum = htons(calc_checksum((uint16_t*) &packet[off], - sizeof (struct icmp_ttl_exceeded_header) + - sizeof (struct ip_header) + + sizeof (struct icmp_ttl_exceeded_header) + + sizeof (struct ip_header) + sizeof (struct icmp_echo_header))); memcpy (&packet[off], &icmp_ttl, @@ -432,18 +432,18 @@ send_icmp (const struct in_addr *my_ip, dst.sin_family = AF_INET; dst.sin_addr = *other; - err = sendto(rawsock, + err = sendto(rawsock, packet, sizeof (packet), 0, - (struct sockaddr*)&dst, - sizeof(dst)); + (struct sockaddr*)&dst, + sizeof(dst)); - if (err < 0) + if (err < 0) { fprintf(stderr, "sendto failed: %s\n", strerror(errno)); } - else if (sizeof (packet) != (size_t) err) + else if (sizeof (packet) != (size_t) err) { fprintf(stderr, "Error: partial send of ICMP message\n"); @@ -470,10 +470,10 @@ make_raw_socket () "Error opening RAW socket: %s\n", strerror (errno)); return INVALID_SOCKET; - } + } if (0 != setsockopt(ret, SOL_SOCKET, SO_BROADCAST, (char*)&bOptVal, bOptLen)) { - fprintf(stderr, + fprintf(stderr, "Error setting SO_BROADCAST to ON: %s\n", strerror (errno)); closesocket(rawsock); @@ -482,7 +482,7 @@ make_raw_socket () if (0 != setsockopt(ret, IPPROTO_IP, IP_HDRINCL, (char*)&bOptVal, bOptLen)) { - fprintf(stderr, + fprintf(stderr, "Error setting IP_HDRINCL to ON: %s\n", strerror (errno)); closesocket(rawsock); @@ -531,7 +531,7 @@ main (int argc, char *const *argv) fprintf (stderr, "Failed to find Winsock 2.1 or better.\n"); return 2; } - if (1 != inet_pton (AF_INET, DUMMY_IP, &dummy)) + if (1 != inet_pton (AF_INET, DUMMY_IP, &dummy)) { fprintf (stderr, "Internal error converting dummy IP to binary.\n"); diff --git a/src/transport/gnunet-nat-server-windows.c b/src/transport/gnunet-nat-server-windows.c index 11c63aa9d..f882641e9 100644 --- a/src/transport/gnunet-nat-server-windows.c +++ b/src/transport/gnunet-nat-server-windows.c @@ -82,64 +82,64 @@ /** * IPv4 header. */ -struct ip_header +struct ip_header { /** - * Version (4 bits) + Internet header length (4 bits) + * Version (4 bits) + Internet header length (4 bits) */ - uint8_t vers_ihl; + uint8_t vers_ihl; /** * Type of service */ - uint8_t tos; + uint8_t tos; /** * Total length */ - uint16_t pkt_len; + uint16_t pkt_len; /** * Identification */ - uint16_t id; + uint16_t id; /** * Flags (3 bits) + Fragment offset (13 bits) */ - uint16_t flags_frag_offset; + uint16_t flags_frag_offset; /** * Time to live */ - uint8_t ttl; + uint8_t ttl; /** - * Protocol + * Protocol */ - uint8_t proto; + uint8_t proto; /** * Header checksum */ - uint16_t checksum; + uint16_t checksum; /** * Source address */ - uint32_t src_ip; + uint32_t src_ip; /** - * Destination address + * Destination address */ - uint32_t dst_ip; + uint32_t dst_ip; }; /** * Format of ICMP packet. */ -struct icmp_ttl_exceeded_header +struct icmp_ttl_exceeded_header { uint8_t type; @@ -205,16 +205,16 @@ static struct in_addr dummy; * @param bytes number of bytes in data (must be multiple of 2) * @return the CRC 16. */ -static uint16_t -calc_checksum(const uint16_t *data, +static uint16_t +calc_checksum(const uint16_t *data, unsigned int bytes) { uint32_t sum; unsigned int i; sum = 0; - for (i=0;i> 16); sum = htons(0xffff - sum); return sum; @@ -229,17 +229,17 @@ calc_checksum(const uint16_t *data, * @param buf where to write the address result * @return 1 on success */ -static int -inet_pton (int af, - const char *cp, +static int +inet_pton (int af, + const char *cp, struct in_addr *buf) { buf->s_addr = inet_addr(cp); if (buf->s_addr == INADDR_NONE) { - fprintf(stderr, - "Error %d handling address %s", - WSAGetLastError(), + fprintf(stderr, + "Error %d handling address %s", + WSAGetLastError(), cp); return 0; } @@ -275,8 +275,8 @@ send_icmp_echo (const struct in_addr *my_ip) ip_pkt.dst_ip = dummy.s_addr; ip_pkt.checksum = htons(calc_checksum((uint16_t*)&ip_pkt, sizeof (struct ip_header))); - memcpy (&packet[off], - &ip_pkt, + memcpy (&packet[off], + &ip_pkt, sizeof (struct ip_header)); off += sizeof (struct ip_header); @@ -284,28 +284,28 @@ send_icmp_echo (const struct in_addr *my_ip) icmp_echo.code = 0; icmp_echo.reserved = 0; icmp_echo.checksum = 0; - icmp_echo.checksum = htons(calc_checksum((uint16_t*) &icmp_echo, + icmp_echo.checksum = htons(calc_checksum((uint16_t*) &icmp_echo, sizeof (struct icmp_echo_header))); - memcpy (&packet[off], - &icmp_echo, + memcpy (&packet[off], + &icmp_echo, sizeof (struct icmp_echo_header)); off += sizeof (struct icmp_echo_header); - + memset (&dst, 0, sizeof (dst)); dst.sin_family = AF_INET; dst.sin_addr = dummy; - err = sendto(rawsock, + err = sendto(rawsock, packet, off, 0, (struct sockaddr*)&dst, sizeof(dst)); - if (err < 0) + if (err < 0) { #if VERBOSE fprintf(stderr, "sendto failed: %s\n", strerror(errno)); #endif } - else if (err != off) + else if (err != off) { fprintf(stderr, "Error: partial send of ICMP message\n"); @@ -321,23 +321,23 @@ send_udp () { struct sockaddr_in dst; ssize_t err; - + memset (&dst, 0, sizeof (dst)); dst.sin_family = AF_INET; dst.sin_addr = dummy; dst.sin_port = htons (NAT_TRAV_PORT); - err = sendto(udpsock, - NULL, 0, 0, - (struct sockaddr*)&dst, + err = sendto(udpsock, + NULL, 0, 0, + (struct sockaddr*)&dst, sizeof(dst)); - if (err < 0) + if (err < 0) { #if VERBOSE fprintf(stderr, "sendto failed: %s\n", strerror(errno)); #endif } - else if (0 != err) + else if (0 != err) { fprintf(stderr, "Error: partial send of ICMP message\n"); @@ -368,7 +368,7 @@ process_icmp_response () fprintf (stderr, "Error reading raw socket: %s\n", strerror (errno)); - return; + return; } have_port = 0; #if VERBOSE @@ -383,17 +383,17 @@ process_icmp_response () } off = 0; memcpy (&ip_pkt, - &buf[off], + &buf[off], sizeof (struct ip_header)); off += sizeof (struct ip_header); - memcpy(&source_ip, - &ip_pkt.src_ip, + memcpy(&source_ip, + &ip_pkt.src_ip, sizeof (source_ip)); - memcpy (&icmp_ttl, - &buf[off], + memcpy (&icmp_ttl, + &buf[off], sizeof (struct icmp_ttl_exceeded_header)); off += sizeof (struct icmp_ttl_exceeded_header); - if ( (ICMP_TIME_EXCEEDED != icmp_ttl.type) || + if ( (ICMP_TIME_EXCEEDED != icmp_ttl.type) || (0 != icmp_ttl.code) ) { /* different type than what we want */ @@ -401,15 +401,15 @@ process_icmp_response () } /* skip 2nd IP header */ memcpy (&ip_pkt, - &buf[off], + &buf[off], sizeof (struct ip_header)); off += sizeof (struct ip_header); switch (ip_pkt.proto) { case IPPROTO_ICMP: - if (have != (sizeof (struct ip_header) * 2 + - sizeof (struct icmp_ttl_exceeded_header) + + if (have != (sizeof (struct ip_header) * 2 + + sizeof (struct icmp_ttl_exceeded_header) + sizeof (struct icmp_echo_header)) ) { /* malformed */ @@ -422,8 +422,8 @@ process_icmp_response () port = (uint16_t) ntohl (icmp_echo.reserved); break; case IPPROTO_UDP: - if (have != (sizeof (struct ip_header) * 2 + - sizeof (struct icmp_ttl_exceeded_header) + + if (have != (sizeof (struct ip_header) * 2 + + sizeof (struct icmp_ttl_exceeded_header) + sizeof (struct udp_header)) ) { /* malformed */ @@ -435,16 +435,16 @@ process_icmp_response () sizeof (struct udp_header)); port = ntohs (udp_pkt.length); break; - default: + default: /* different type than what we want */ return; } - + ssize = sizeof(buf); - WSAAddressToString((LPSOCKADDR)&source_ip, + WSAAddressToString((LPSOCKADDR)&source_ip, sizeof(source_ip), NULL, - buf, + buf, &ssize); if (port == 0) fprintf (stdout, @@ -476,7 +476,7 @@ make_icmp_socket () "Error opening RAW socket: %s\n", strerror (errno)); return INVALID_SOCKET; - } + } return ret; } @@ -501,23 +501,23 @@ make_raw_socket () return INVALID_SOCKET; } - if (0 != setsockopt(rawsock, - SOL_SOCKET, - SO_BROADCAST, + if (0 != setsockopt(rawsock, + SOL_SOCKET, + SO_BROADCAST, (char*)&bOptVal, bOptLen)) { - fprintf(stderr, + fprintf(stderr, "Error setting SO_BROADCAST to ON: %s\n", strerror (errno)); closesocket(rawsock); return INVALID_SOCKET; } - if (0 != setsockopt(rawsock, - IPPROTO_IP, - IP_HDRINCL, + if (0 != setsockopt(rawsock, + IPPROTO_IP, + IP_HDRINCL, (char*)&bOptVal, bOptLen)) { - fprintf(stderr, + fprintf(stderr, "Error setting IP_HDRINCL to ON: %s\n", strerror (errno)); closesocket(rawsock); @@ -566,7 +566,7 @@ make_udp_socket (const struct in_addr *my_ip) int -main (int argc, +main (int argc, char *const *argv) { struct in_addr external; @@ -588,7 +588,7 @@ main (int argc, argv[1], strerror (errno)); return 1; } - if (1 != inet_pton (AF_INET, DUMMY_IP, &dummy)) + if (1 != inet_pton (AF_INET, DUMMY_IP, &dummy)) { fprintf (stderr, "Internal error converting dummy IP to binary.\n"); @@ -601,25 +601,25 @@ main (int argc, } if (INVALID_SOCKET == (icmpsock = make_icmp_socket())) { - return 3; + return 3; } if (INVALID_SOCKET == (make_raw_socket())) { closesocket (icmpsock); - return 3; + return 3; } if (INVALID_SOCKET == (udpsock = make_udp_socket(&external))) { closesocket (icmpsock); closesocket (rawsock); - return 3; + return 3; } while (1) { FD_ZERO (&rs); FD_SET (icmpsock, &rs); tv.tv_sec = 0; - tv.tv_usec = ICMP_SEND_FREQUENCY_MS * 1000; + tv.tv_usec = ICMP_SEND_FREQUENCY_MS * 1000; if (-1 == select (icmpsock + 1, &rs, NULL, NULL, &tv)) { if (errno == EINTR) @@ -641,7 +641,7 @@ main (int argc, closesocket(rawsock); closesocket(udpsock); WSACleanup (); - return 4; + return 4; } diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index ae88b4f6f..de25666fa 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c @@ -78,8 +78,8 @@ #define MAX_CONNECT_RETRY 3 /** - * Limit on the number of ready-to-run tasks when validating - * HELLOs. If more tasks are ready to run, we will drop + * Limit on the number of ready-to-run tasks when validating + * HELLOs. If more tasks are ready to run, we will drop * HELLOs instead of validating them. */ #define MAX_HELLO_LOAD 4 @@ -206,7 +206,7 @@ struct ForeignAddressList unsigned int connect_attempts; /** - * DV distance to this peer (1 if no DV is used). + * DV distance to this peer (1 if no DV is used). * FIXME: need to set this from transport plugins! */ uint32_t distance; @@ -228,7 +228,7 @@ struct ForeignAddressList * successfully transmit or receive data to a peer via a particular * address, we set this to GNUNET_YES. If we later get an error * (disconnect notification, transmission failure, timeout), we set - * it back to GNUNET_NO. + * it back to GNUNET_NO. */ int8_t connected; @@ -479,7 +479,7 @@ struct NeighbourList * Buffer for at most one payload message used when we receive * payload data before our PING-PONG has succeeded. We then * store such messages in this intermediary buffer until the - * connection is fully up. + * connection is fully up. */ struct GNUNET_MessageHeader *pre_connect_message_buffer; @@ -547,7 +547,7 @@ struct NeighbourList unsigned int quota_violation_count; /** - * DV distance to this peer (1 if no DV is used). + * DV distance to this peer (1 if no DV is used). */ uint32_t distance; @@ -643,7 +643,7 @@ struct TransportPongMessage /** * Size of address appended to this message (part of what is - * being signed, hence not redundant). + * being signed, hence not redundant). */ uint32_t addrlen; @@ -698,7 +698,7 @@ struct TransportClient /** * Current transmit request handle. - */ + */ struct GNUNET_CONNECTION_TransmitHandle *th; /** @@ -807,7 +807,7 @@ struct CheckHelloValidatedContext * NULL after we are done processing peerinfo's information. */ struct GNUNET_PEERINFO_IteratorContext *piter; - + /** * Was a HELLO known for this peer to peerinfo? */ @@ -924,7 +924,7 @@ static void try_transmission_to_peer (struct NeighbourList *neighbour); /** * Find an entry in the neighbour list for a particular peer. - * + * * @return NULL if not found. */ static struct NeighbourList * @@ -990,11 +990,11 @@ add_peer_to_blacklist (struct GNUNET_PeerIdentity *peer, char *transport_name) plugin = find_transport(transport_name); if (plugin == NULL) /* Nothing to do */ return; - if (plugin->blacklist == NULL) - plugin->blacklist = GNUNET_CONTAINER_multihashmap_create(TRANSPORT_BLACKLIST_HT_SIZE); + if (plugin->blacklist == NULL) + plugin->blacklist = GNUNET_CONTAINER_multihashmap_create(TRANSPORT_BLACKLIST_HT_SIZE); GNUNET_assert(plugin->blacklist != NULL); GNUNET_CONTAINER_multihashmap_put(plugin->blacklist, &peer->hashPubKey, - NULL, + NULL, GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE); } @@ -1196,7 +1196,7 @@ transmit_to_client_callback (void *cls, size_t size, void *buf) GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes discarded (could not transmit to client)"), ntohs (((const struct GNUNET_MessageHeader*)&q[1])->size), - GNUNET_NO); + GNUNET_NO); GNUNET_CONTAINER_DLL_remove (client->message_queue_head, client->message_queue_tail, q); @@ -1263,7 +1263,7 @@ a2s (const char *plugin, return p->api->address_to_string (p->api->cls, addr, addr_len); -} +} /** @@ -1340,7 +1340,7 @@ transmit_to_client (struct TransportClient *client, ("Dropping message of type %u and size %u, have %u messages pending (%u is the soft limit)\n"), ntohs (msg->type), ntohs (msg->size), - client->message_count, + client->message_count, MAX_PENDING); GNUNET_STATISTICS_update (stats, gettext_noop ("# messages dropped due to slow client"), @@ -1355,7 +1355,7 @@ transmit_to_client (struct TransportClient *client, GNUNET_CONTAINER_DLL_insert_after (client->message_queue_head, client->message_queue_tail, client->message_queue_tail, - q); + q); client->message_count++; if (client->th == NULL) { @@ -1389,7 +1389,7 @@ transmit_send_ok (struct TransportClient *client, send_ok_msg.success = htonl (result); send_ok_msg.latency = GNUNET_TIME_relative_hton (n->latency); send_ok_msg.peer = n->id; - transmit_to_client (client, &send_ok_msg.header, GNUNET_NO); + transmit_to_client (client, &send_ok_msg.header, GNUNET_NO); } @@ -1414,7 +1414,7 @@ transmit_send_continuation (void *cls, { struct MessageQueue *mq = cls; struct NeighbourList *n; - + GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes pending with plugins"), - (int64_t) mq->message_buf_size, @@ -1424,27 +1424,27 @@ transmit_send_continuation (void *cls, GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes successfully transmitted by plugins"), mq->message_buf_size, - GNUNET_NO); + GNUNET_NO); } else { GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes with transmission failure by plugins"), mq->message_buf_size, - GNUNET_NO); - } + GNUNET_NO); + } n = find_neighbour(&mq->neighbour_id); GNUNET_assert (n != NULL); if (mq->specific_address != NULL) { - if (result == GNUNET_OK) + if (result == GNUNET_OK) { mq->specific_address->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); if (mq->specific_address->validated == GNUNET_YES) mark_address_connected (mq->specific_address); - } + } else { if (mq->specific_address->connected != GNUNET_NO) @@ -1462,8 +1462,8 @@ transmit_send_continuation (void *cls, GNUNET_NO); mq->specific_address->connected = GNUNET_NO; } - } - if (! mq->internal_msg) + } + if (! mq->internal_msg) mq->specific_address->in_transmit = GNUNET_NO; } if (mq->client != NULL) @@ -1496,7 +1496,7 @@ find_ready_address(struct NeighbourList *neighbour) addresses = head->addresses; while (addresses != NULL) { - if ( (addresses->timeout.value < now.value) && + if ( (addresses->timeout.value < now.value) && (addresses->connected == GNUNET_YES) ) { #if DEBUG_TRANSPORT @@ -1531,13 +1531,13 @@ find_ready_address(struct NeighbourList *neighbour) (unsigned long long) addresses->timeout.value, (unsigned int) addresses->distance); #endif - if ( ( (best_address == NULL) || + if ( ( (best_address == NULL) || (addresses->connected == GNUNET_YES) || (best_address->connected == GNUNET_NO) ) && (addresses->in_transmit == GNUNET_NO) && - ( (best_address == NULL) || + ( (best_address == NULL) || (addresses->latency.value < best_address->latency.value)) ) - best_address = addresses; + best_address = addresses; /* FIXME: also give lower-latency addresses that are not connected a chance some times... */ addresses = addresses->next; @@ -1549,7 +1549,7 @@ find_ready_address(struct NeighbourList *neighbour) #if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Best address found (`%s') has latency of %llu ms.\n", - (best_address->addrlen > 0) + (best_address->addrlen > 0) ? a2s (best_address->ready_list->plugin->short_name, best_address->addr, best_address->addrlen) @@ -1613,11 +1613,11 @@ try_transmission_to_peer (struct NeighbourList *neighbour) force_address = GNUNET_YES; if (mq->specific_address == NULL) { - mq->specific_address = find_ready_address(neighbour); + mq->specific_address = find_ready_address(neighbour); GNUNET_STATISTICS_update (stats, gettext_noop ("# transport selected peer address freely"), 1, - GNUNET_NO); + GNUNET_NO); force_address = GNUNET_NO; } if (mq->specific_address == NULL) @@ -1625,7 +1625,7 @@ try_transmission_to_peer (struct NeighbourList *neighbour) GNUNET_STATISTICS_update (stats, gettext_noop ("# transport failed to selected peer address"), 1, - GNUNET_NO); + GNUNET_NO); timeout = GNUNET_TIME_absolute_get_remaining (mq->timeout); if (timeout.value == 0) { @@ -1642,14 +1642,14 @@ try_transmission_to_peer (struct NeighbourList *neighbour) GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes discarded (no destination address available)"), mq->message_buf_size, - GNUNET_NO); + GNUNET_NO); if (mq->client != NULL) transmit_send_ok (mq->client, neighbour, GNUNET_NO); GNUNET_CONTAINER_DLL_remove (neighbour->messages_head, neighbour->messages_tail, mq); GNUNET_free (mq); - return; /* nobody ready */ + return; /* nobody ready */ } GNUNET_STATISTICS_update (stats, gettext_noop ("# message delivery deferred (no address)"), @@ -1671,7 +1671,7 @@ try_transmission_to_peer (struct NeighbourList *neighbour) #endif /* FIXME: might want to trigger peerinfo lookup here (unless that's already pending...) */ - return; + return; } GNUNET_CONTAINER_DLL_remove (neighbour->messages_head, neighbour->messages_tail, @@ -1686,7 +1686,7 @@ try_transmission_to_peer (struct NeighbourList *neighbour) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending message of size %u for `%4s' to `%s' via plugin `%s'\n", mq->message_buf_size, - GNUNET_i2s (&neighbour->id), + GNUNET_i2s (&neighbour->id), (mq->specific_address->addr != NULL) ? a2s (mq->plugin->short_name, mq->specific_address->addr, @@ -1717,7 +1717,7 @@ try_transmission_to_peer (struct NeighbourList *neighbour) { /* failure, but 'send' would not call continuation in this case, so we need to do it here! */ - transmit_send_continuation (mq, + transmit_send_continuation (mq, &mq->neighbour_id, GNUNET_SYSERR); } @@ -1781,7 +1781,7 @@ transmit_to_peer (struct TransportClient *client, mq->internal_msg = is_internal; mq->priority = priority; mq->timeout = GNUNET_TIME_relative_to_absolute (timeout); - if (is_internal) + if (is_internal) GNUNET_CONTAINER_DLL_insert (neighbour->messages_head, neighbour->messages_tail, mq); @@ -1883,7 +1883,7 @@ refresh_hello () GNUNET_NO); transmit_to_peer (NULL, NULL, 0, HELLO_ADDRESS_EXPIRATION, - (const char *) our_hello, + (const char *) our_hello, GNUNET_HELLO_size(our_hello), GNUNET_NO, npos); npos = npos->next; @@ -1940,7 +1940,7 @@ update_addresses (struct TransportPlugin *plugin, int fresh) if (prev == NULL) plugin->addresses = pos->next; else - prev->next = pos->next; + prev->next = pos->next; GNUNET_free (pos); } else @@ -1994,7 +1994,7 @@ expire_address_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param value value in the hash map ('struct ValidationEntry*') * @return GNUNET_YES (we should continue to iterate) */ -static int +static int remove_session_validations (void *cls, const GNUNET_HashCode * key, void *value) @@ -2010,7 +2010,7 @@ remove_session_validations (void *cls, /** * We've been disconnected from the other peer (for some - * connection-oriented transport). Either quickly + * connection-oriented transport). Either quickly * re-establish the connection or signal the disconnect * to the CORE. * @@ -2036,7 +2036,7 @@ try_fast_reconnect (struct TransportPlugin *p, 1) ideally: our own willingness / need to connect 2) prior failures to connect to this peer (by plugin) 3) ideally: reasons why other peer terminated (as far as knowable) - + Most importantly, it must be POSSIBLE for another peer to terminate a connection for a while (without us instantly re-establishing it). Similarly, if another peer is gone we should quickly notify CORE. @@ -2044,7 +2044,7 @@ try_fast_reconnect (struct TransportPlugin *p, on the other end), we should reconnect in such a way that BOTH CORE services never even notice. Furthermore, the same mechanism (or small variation) could be used - to switch to a better-performing plugin (ATS). + to switch to a better-performing plugin (ATS). Finally, this needs to be tested throughly... */ @@ -2071,9 +2071,9 @@ try_fast_reconnect (struct TransportPlugin *p, * discard all of those sessions as well. Plugins that do not * use sessions can simply omit calling this function and always * use NULL wherever a session pointer is needed. - * + * * @param cls closure - * @param peer which peer was the session for + * @param peer which peer was the session for * @param session which session is being destoyed */ static void @@ -2336,7 +2336,7 @@ static struct ForeignAddressList * add_peer_address (struct NeighbourList *neighbour, const char *tname, struct Session *session, - const char *addr, + const char *addr, uint16_t addrlen) { struct ReadyList *head; @@ -2372,7 +2372,7 @@ add_peer_address (struct NeighbourList *neighbour, ret->latency = GNUNET_TIME_relative_get_forever(); ret->distance = -1; ret->timeout = GNUNET_TIME_relative_to_absolute - (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); + (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); ret->ready_list = head; ret->next = head->addresses; head->addresses = ret; @@ -2510,7 +2510,7 @@ check_address_exists (void *cls, * @param value value in the hash map (validation to abort) * @return GNUNET_YES (always) */ -static int +static int abort_validation (void *cls, const GNUNET_HashCode * key, void *value) @@ -2620,7 +2620,7 @@ add_to_foreign_address_list (void *cls, GNUNET_STATISTICS_update (stats, gettext_noop ("# valid peer addresses returned by PEERINFO"), 1, - GNUNET_NO); + GNUNET_NO); try = GNUNET_NO; fal = find_peer_address (n, tname, NULL, addr, addrlen); if (fal == NULL) @@ -2639,7 +2639,7 @@ add_to_foreign_address_list (void *cls, GNUNET_STATISTICS_update (stats, gettext_noop ("# previously validated addresses lacking transport"), 1, - GNUNET_NO); + GNUNET_NO); } else { @@ -2663,11 +2663,11 @@ add_to_foreign_address_list (void *cls, } if (fal->validated == GNUNET_NO) { - fal->validated = GNUNET_YES; + fal->validated = GNUNET_YES; GNUNET_STATISTICS_update (stats, gettext_noop ("# peer addresses considered valid"), 1, - GNUNET_NO); + GNUNET_NO); } if (try == GNUNET_YES) { @@ -2702,7 +2702,7 @@ add_hello_for_peer (void *cls, GNUNET_NO); n->piter = NULL; return; - } + } if (h == NULL) return; /* no HELLO available */ #if DEBUG_TRANSPORT @@ -2725,7 +2725,7 @@ add_hello_for_peer (void *cls, /** * Create a fresh entry in our neighbour list for the given peer. - * Will try to transmit our current HELLO to the new neighbour. + * Will try to transmit our current HELLO to the new neighbour. * Do not call this function directly, use 'setup_peer_check_blacklist. * * @param peer the peer for which we create the entry @@ -2803,7 +2803,7 @@ setup_new_neighbour (const struct GNUNET_PeerIdentity *peer, /** * Function called after we have checked if communicating - * with a given peer is acceptable. + * with a given peer is acceptable. * * @param cls closure * @param n NULL if communication is not acceptable @@ -2857,12 +2857,12 @@ static struct Blacklisters *bl_tail; */ struct BlacklistCheck { - + /** * This is a linked list. */ struct BlacklistCheck *next; - + /** * This is a linked list. */ @@ -2921,7 +2921,7 @@ static struct BlacklistCheck *bc_tail; * Perform next action in the blacklist check. * * @param cls the 'struct BlacklistCheck*' - * @param tc unused + * @param tc unused */ static void do_blacklist_check (void *cls, @@ -2959,7 +2959,7 @@ transmit_blacklist_message (void *cls, bm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY); bm.is_allowed = htonl (0); bm.peer = bc->peer; - memcpy (buf, &bm, sizeof (bm)); + memcpy (buf, &bm, sizeof (bm)); GNUNET_SERVER_receive_done (bl->client, GNUNET_OK); return sizeof (bm); } @@ -2969,7 +2969,7 @@ transmit_blacklist_message (void *cls, * Perform next action in the blacklist check. * * @param cls the 'struct BlacklistCheck*' - * @param tc unused + * @param tc unused */ static void do_blacklist_check (void *cls, @@ -2987,14 +2987,14 @@ do_blacklist_check (void *cls, GNUNET_free (bc); return; } - if (bl->bc == NULL) + if (bl->bc == NULL) { bl->bc = bc; bc->th = GNUNET_SERVER_notify_transmit_ready (bl->client, sizeof (struct BlacklistMessage), GNUNET_TIME_UNIT_FOREVER_REL, &transmit_blacklist_message, - bc); + bc); } } @@ -3046,7 +3046,7 @@ setup_peer_check_blacklist (const struct GNUNET_PeerIdentity *peer, /** - * Function called with the result of querying a new blacklister about + * Function called with the result of querying a new blacklister about * it being allowed (or not) to continue to talk to an existing neighbour. * * @param cls the original 'struct NeighbourList' @@ -3139,16 +3139,16 @@ handle_blacklist_reply (void *cls, bl = bl_head; while ( (bl != NULL) && (bl->client != client) ) - bl = bl->next; + bl = bl->next; if (bl == NULL) { GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); return; } bc = bl->bc; - bl->bc = NULL; + bl->bc = NULL; if (ntohl (msg->is_allowed) == GNUNET_SYSERR) - { + { bc->cont (bc->cont_cls, NULL); GNUNET_CONTAINER_DLL_remove (bc_head, bc_tail, bc); GNUNET_free (bc); @@ -3158,7 +3158,7 @@ handle_blacklist_reply (void *cls, bc->bl_pos = bc->bl_pos->next; bc->task = GNUNET_SCHEDULER_add_now (sched, &do_blacklist_check, - bc); + bc); } /* check if any other bc's are waiting for this blacklister */ bc = bc_head; @@ -3168,7 +3168,7 @@ handle_blacklist_reply (void *cls, (GNUNET_SCHEDULER_NO_TASK == bc->task) ) bc->task = GNUNET_SCHEDULER_add_now (sched, &do_blacklist_check, - bc); + bc); bc = bc->next; } } @@ -3180,8 +3180,8 @@ handle_blacklist_reply (void *cls, * @param cls our 'struct PeriodicValidationContext*' * @param tc task context */ -static void -send_periodic_ping (void *cls, +static void +send_periodic_ping (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct ForeignAddressList *peer_address = cls; @@ -3197,13 +3197,13 @@ send_periodic_ping (void *cls, peer_address->revalidate_task = GNUNET_SCHEDULER_NO_TASK; if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) - return; + return; tp = peer_address->ready_list->plugin; neighbour = peer_address->ready_list->neighbour; if (GNUNET_YES != neighbour->public_key_valid) { /* no public key yet, try again later */ - schedule_next_ping (peer_address); + schedule_next_ping (peer_address); return; } caec.addr = peer_address->addr; @@ -3231,7 +3231,7 @@ send_periodic_ping (void *cls, tp->short_name, GNUNET_i2s (&neighbour->id)); #endif - schedule_next_ping (peer_address); + schedule_next_ping (peer_address); return; } va = GNUNET_malloc (sizeof (struct ValidationEntry) + peer_address->addrlen); @@ -3247,7 +3247,7 @@ send_periodic_ping (void *cls, va->addrlen = peer_address->addrlen; } memcpy(&va->publicKey, - &neighbour->publicKey, + &neighbour->publicKey, sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); va->timeout_task = GNUNET_SCHEDULER_add_delayed (sched, @@ -3276,14 +3276,14 @@ send_periodic_ping (void *cls, memcpy(message_buf, our_hello, hello_size); if (peer_address->addr != NULL) { - ping.header.size = htons(sizeof(struct TransportPingMessage) + - peer_address->addrlen + + ping.header.size = htons(sizeof(struct TransportPingMessage) + + peer_address->addrlen + slen); memcpy(&message_buf[hello_size + sizeof (struct TransportPingMessage)], - tp->short_name, + tp->short_name, slen); memcpy(&message_buf[hello_size + sizeof (struct TransportPingMessage) + slen], - peer_address->addr, + peer_address->addr, peer_address->addrlen); } else @@ -3297,7 +3297,7 @@ send_periodic_ping (void *cls, #if DEBUG_TRANSPORT_REVALIDATION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Performing re-validation of address `%s' via `%s' for peer `%4s' sending `%s' (%u bytes) and `%s'\n", - (peer_address->addr != NULL) + (peer_address->addr != NULL) ? a2s (peer_address->plugin->short_name, peer_address->addr, peer_address->addrlen) @@ -3342,12 +3342,12 @@ schedule_next_ping (struct ForeignAddressList *fal) { delay = GNUNET_TIME_UNIT_ZERO; fal->estimated = GNUNET_YES; - } + } if (GNUNET_YES == fal->connected) { delay = GNUNET_TIME_relative_min (delay, CONNECTED_LATENCY_EVALUATION_MAX_DELAY); - } + } /* FIXME: also adjust delay based on how close the last observed latency is to the latency of the best alternative */ /* bound how fast we can go */ @@ -3355,9 +3355,9 @@ schedule_next_ping (struct ForeignAddressList *fal) GNUNET_TIME_UNIT_SECONDS); /* randomize a bit (to avoid doing all at the same time) */ delay.value += GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000); - fal->revalidate_task = GNUNET_SCHEDULER_add_delayed(sched, + fal->revalidate_task = GNUNET_SCHEDULER_add_delayed(sched, delay, - &send_periodic_ping, + &send_periodic_ping, fal); } @@ -3396,8 +3396,8 @@ handle_payload_message (const struct GNUNET_MessageHeader *message, #if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Received message of type %u and size %u from `%4s', sending to all clients.\n", - ntohs (message->type), - ntohs (message->size), + ntohs (message->type), + ntohs (message->size), GNUNET_i2s (&n->id)); #endif if (GNUNET_YES == GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker, @@ -3405,8 +3405,8 @@ handle_payload_message (const struct GNUNET_MessageHeader *message, { n->quota_violation_count++; #if DEBUG_TRANSPORT - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Bandwidth quota (%u b/s) violation detected (total of %u).\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Bandwidth quota (%u b/s) violation detected (total of %u).\n", n->in_tracker.available_bytes_per_s__, n->quota_violation_count); #endif @@ -3414,7 +3414,7 @@ handle_payload_message (const struct GNUNET_MessageHeader *message, GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker, - 32 * 1024); } - else + else { if (n->quota_violation_count > 0) { @@ -3488,8 +3488,8 @@ check_pending_validation (void *cls, if ( (ps - sizeof (struct TransportPongMessage) != ve->addrlen + slen) || (ve->challenge != challenge) || (addr[slen-1] != '\0') || - (0 != strcmp (addr, ve->transport_name)) || - (ntohl (pong->purpose.size) + (0 != strcmp (addr, ve->transport_name)) || + (ntohl (pong->purpose.size) != sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose) + sizeof (uint32_t) + sizeof (struct GNUNET_TIME_AbsoluteNBO) + @@ -3511,16 +3511,16 @@ check_pending_validation (void *cls, } if (0 != memcmp (&pong->pid, key, - sizeof (struct GNUNET_PeerIdentity))) + sizeof (struct GNUNET_PeerIdentity))) { GNUNET_break_op (0); return GNUNET_NO; } if (GNUNET_OK != GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN, - &pong->purpose, + &pong->purpose, &pong->signature, - &ve->publicKey)) + &ve->publicKey)) { GNUNET_break_op (0); return GNUNET_NO; @@ -3537,7 +3537,7 @@ check_pending_validation (void *cls, #endif break; case GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_USING: - if (ve->addrlen != 0) + if (ve->addrlen != 0) { return GNUNET_YES; /* different entry, keep trying */ } @@ -3572,13 +3572,13 @@ check_pending_validation (void *cls, a2s (ve->transport_name, &addr[slen], alen)); - return GNUNET_NO; + return GNUNET_NO; } if (GNUNET_OK != GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_USING, - &pong->purpose, + &pong->purpose, &pong->signature, - &ve->publicKey)) + &ve->publicKey)) { GNUNET_break_op (0); return GNUNET_NO; @@ -3640,7 +3640,7 @@ check_pending_validation (void *cls, GNUNET_STATISTICS_update (stats, gettext_noop ("# peer addresses considered valid"), 1, - GNUNET_NO); + GNUNET_NO); fal->latency = GNUNET_TIME_absolute_get_duration (ve->send_time); schedule_next_ping (fal); if (n->latency.value == GNUNET_TIME_UNIT_FOREVER_REL.value) @@ -3778,7 +3778,7 @@ transmit_hello_and_ping (void *cls, { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to add peer `%4s' for plugin `%s'\n", - GNUNET_i2s (&neighbour->id), + GNUNET_i2s (&neighbour->id), va->transport_name); GNUNET_break (GNUNET_OK == GNUNET_CONTAINER_multihashmap_remove (validation_map, @@ -3808,7 +3808,7 @@ transmit_hello_and_ping (void *cls, #if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Performing validation of address `%s' via `%s' for peer `%4s' sending `%s' (%u bytes) and `%s' (%u bytes)\n", - (va->addrlen == 0) + (va->addrlen == 0) ? "" : a2s (va->transport_name, (const void*) &va[1], va->addrlen), @@ -3821,7 +3821,7 @@ transmit_hello_and_ping (void *cls, GNUNET_STATISTICS_update (stats, gettext_noop ("# PING messages sent for initial validation"), 1, - GNUNET_NO); + GNUNET_NO); transmit_to_peer (NULL, peer_address, GNUNET_SCHEDULER_PRIORITY_DEFAULT, HELLO_VERIFICATION_TIMEOUT, @@ -3847,7 +3847,7 @@ static int run_validation (void *cls, const char *tname, struct GNUNET_TIME_Absolute expiration, - const void *addr, + const void *addr, uint16_t addrlen) { struct CheckHelloValidatedContext *chvc = cls; @@ -3863,7 +3863,7 @@ run_validation (void *cls, GNUNET_STATISTICS_update (stats, gettext_noop ("# peer addresses scheduled for validation"), 1, - GNUNET_NO); + GNUNET_NO); tp = find_transport (tname); if (tp == NULL) { @@ -3875,7 +3875,7 @@ run_validation (void *cls, GNUNET_STATISTICS_update (stats, gettext_noop ("# peer addresses not validated (plugin not available)"), 1, - GNUNET_NO); + GNUNET_NO); return GNUNET_OK; } /* check if this is one of our own addresses */ @@ -3891,7 +3891,7 @@ run_validation (void *cls, GNUNET_STATISTICS_update (stats, gettext_noop ("# peer addresses not validated (loopback)"), 1, - GNUNET_NO); + GNUNET_NO); return GNUNET_OK; } oal = oal->next; @@ -3906,8 +3906,8 @@ run_validation (void *cls, { #if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Attempted to validate blacklisted peer `%s' using `%s'!\n", - GNUNET_i2s(&id), + "Attempted to validate blacklisted peer `%s' using `%s'!\n", + GNUNET_i2s(&id), tname); #endif return GNUNET_OK; @@ -3937,7 +3937,7 @@ run_validation (void *cls, GNUNET_STATISTICS_update (stats, gettext_noop ("# peer addresses not validated (in progress)"), 1, - GNUNET_NO); + GNUNET_NO); return GNUNET_OK; } va = GNUNET_malloc (sizeof (struct ValidationEntry) + addrlen); @@ -4002,7 +4002,7 @@ check_hello_validated (void *cls, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &target.hashPubKey); plain_hello = GNUNET_HELLO_create (&pk, - NULL, + NULL, NULL); GNUNET_PEERINFO_add_peer (peerinfo, plain_hello); GNUNET_free (plain_hello); @@ -4015,10 +4015,10 @@ check_hello_validated (void *cls, GNUNET_STATISTICS_update (stats, gettext_noop ("# new HELLOs requiring full validation"), 1, - GNUNET_NO); + GNUNET_NO); GNUNET_HELLO_iterate_addresses (chvc->hello, - GNUNET_NO, - &run_validation, + GNUNET_NO, + &run_validation, chvc); } else @@ -4026,7 +4026,7 @@ check_hello_validated (void *cls, GNUNET_STATISTICS_update (stats, gettext_noop ("# duplicate HELLO (peer known)"), 1, - GNUNET_NO); + GNUNET_NO); } chvc->ve_count--; if (chvc->ve_count == 0) @@ -4034,10 +4034,10 @@ check_hello_validated (void *cls, GNUNET_CONTAINER_DLL_remove (chvc_head, chvc_tail, chvc); - GNUNET_free (chvc); + GNUNET_free (chvc); } return; - } + } if (h == NULL) return; #if DEBUG_TRANSPORT @@ -4061,16 +4061,16 @@ check_hello_validated (void *cls, GNUNET_STATISTICS_update (stats, gettext_noop ("# no existing neighbour record (validating HELLO)"), 1, - GNUNET_NO); + GNUNET_NO); } GNUNET_STATISTICS_update (stats, gettext_noop ("# HELLO validations (update case)"), 1, - GNUNET_NO); + GNUNET_NO); GNUNET_HELLO_iterate_new_addresses (chvc->hello, h, GNUNET_TIME_relative_to_absolute (HELLO_REVALIDATION_START_TIME), - &run_validation, + &run_validation, chvc); } @@ -4104,7 +4104,7 @@ process_hello (struct TransportPlugin *plugin, GNUNET_STATISTICS_update (stats, gettext_noop ("# HELLOs received for validation"), 1, - GNUNET_NO); + GNUNET_NO); /* first, check if load is too high */ if (GNUNET_SCHEDULER_get_load (sched, @@ -4113,7 +4113,7 @@ process_hello (struct TransportPlugin *plugin, GNUNET_STATISTICS_update (stats, gettext_noop ("# HELLOs ignored due to high load"), 1, - GNUNET_NO); + GNUNET_NO); #if DEBUG_TRANSPORT_HELLO GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ignoring `%s' for `%4s', load too high.\n", @@ -4146,8 +4146,8 @@ process_hello (struct TransportPlugin *plugin, GNUNET_STATISTICS_update (stats, gettext_noop ("# HELLOs ignored for validation (is my own HELLO)"), 1, - GNUNET_NO); - return GNUNET_OK; + GNUNET_NO); + return GNUNET_OK; } chvc = chvc_head; while (NULL != chvc) @@ -4159,7 +4159,7 @@ process_hello (struct TransportPlugin *plugin, #if DEBUG_TRANSPORT_HELLO GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received duplicate `%s' message for `%4s'; ignored\n", - "HELLO", + "HELLO", GNUNET_i2s (&target)); #endif return GNUNET_OK; /* validation already pending */ @@ -4287,12 +4287,12 @@ disconnect_neighbour (struct NeighbourList *n, int check) GNUNET_STATISTICS_update (stats, gettext_noop ("# connected addresses"), -1, - GNUNET_NO); + GNUNET_NO); if (GNUNET_YES == peer_pos->validated) GNUNET_STATISTICS_update (stats, gettext_noop ("# peer addresses considered valid"), -1, - GNUNET_NO); + GNUNET_NO); if (GNUNET_SCHEDULER_NO_TASK != peer_pos->revalidate_task) { GNUNET_SCHEDULER_cancel (sched, @@ -4318,7 +4318,7 @@ disconnect_neighbour (struct NeighbourList *n, int check) GNUNET_CONTAINER_DLL_remove (n->messages_head, n->messages_tail, mq); - GNUNET_assert (0 == memcmp(&mq->neighbour_id, + GNUNET_assert (0 == memcmp(&mq->neighbour_id, &n->id, sizeof(struct GNUNET_PeerIdentity))); GNUNET_free (mq); @@ -4354,9 +4354,9 @@ disconnect_neighbour (struct NeighbourList *n, int check) /** * We have received a PING message from someone. Need to send a PONG message - * in response to the peer by any means necessary. + * in response to the peer by any means necessary. */ -static int +static int handle_ping(void *cls, const struct GNUNET_MessageHeader *message, const struct GNUNET_PeerIdentity *peer, struct Session *session, @@ -4387,17 +4387,17 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, sizeof (struct GNUNET_PeerIdentity))) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - _("Received `%s' message not destined for me!\n"), + _("Received `%s' message not destined for me!\n"), "PING"); return GNUNET_SYSERR; } #if DEBUG_PING_PONG GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, "Processing `%s' from `%s'\n", - "PING", - (sender_address != NULL) + "PING", + (sender_address != NULL) ? a2s (plugin->short_name, - (const struct sockaddr *)sender_address, + (const struct sockaddr *)sender_address, sender_address_len) : ""); #endif @@ -4409,7 +4409,7 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, alen = ntohs (message->size) - sizeof (struct TransportPingMessage); slen = strlen (plugin->short_name) + 1; if (alen == 0) - { + { /* peer wants to confirm that we have an outbound connection to him */ if (session == NULL) { @@ -4429,14 +4429,14 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_USING); pong->challenge = ping->challenge; pong->addrlen = htonl(sender_address_len + slen); - memcpy(&pong->pid, + memcpy(&pong->pid, peer, sizeof(struct GNUNET_PeerIdentity)); - memcpy (&pong[1], - plugin->short_name, + memcpy (&pong[1], + plugin->short_name, slen); - memcpy (&((char*)&pong[1])[slen], - sender_address, + memcpy (&((char*)&pong[1])[slen], + sender_address, sender_address_len); if (GNUNET_TIME_absolute_get_remaining (session_header->pong_sig_expires).value < PONG_SIGNATURE_LIFETIME.value / 4) { @@ -4458,7 +4458,7 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, } memcpy (&pong->signature, &session_header->pong_signature, - sizeof (struct GNUNET_CRYPTO_RsaSignature)); + sizeof (struct GNUNET_CRYPTO_RsaSignature)); } @@ -4500,8 +4500,8 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN); pong->challenge = ping->challenge; pong->addrlen = htonl(alen + slen); - memcpy(&pong->pid, - &my_identity, + memcpy(&pong->pid, + &my_identity, sizeof(struct GNUNET_PeerIdentity)); memcpy (&pong[1], plugin->short_name, slen); memcpy (&((char*)&pong[1])[slen], addr, alen); @@ -4519,10 +4519,10 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_rsa_sign (my_private_key, &pong->purpose, - &oal->pong_signature)); + &oal->pong_signature)); memcpy (&pong->signature, &oal->pong_signature, - sizeof (struct GNUNET_CRYPTO_RsaSignature)); + sizeof (struct GNUNET_CRYPTO_RsaSignature)); } else if (oal == NULL) { @@ -4531,7 +4531,7 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_rsa_sign (my_private_key, &pong->purpose, - &pong->signature)); + &pong->signature)); } else { @@ -4539,7 +4539,7 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, pong->expiration = GNUNET_TIME_absolute_hton (oal->pong_sig_expires); memcpy (&pong->signature, &oal->pong_signature, - sizeof (struct GNUNET_CRYPTO_RsaSignature)); + sizeof (struct GNUNET_CRYPTO_RsaSignature)); } } n = find_neighbour(peer); @@ -4555,7 +4555,7 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, peer, (const char*) pong, ntohs (pong->header.size), - TRANSPORT_PONG_PRIORITY, + TRANSPORT_PONG_PRIORITY, HELLO_VERIFICATION_TIMEOUT, fal->session, fal->addr, @@ -4567,7 +4567,7 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, GNUNET_STATISTICS_update (stats, gettext_noop ("# PONGs unicast via reliable transport"), 1, - GNUNET_NO); + GNUNET_NO); GNUNET_free (pong); return GNUNET_OK; } @@ -4579,7 +4579,7 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, GNUNET_STATISTICS_update (stats, gettext_noop ("# PONGs multicast to all available addresses"), 1, - GNUNET_NO); + GNUNET_NO); rl = n->plugins; while (rl != NULL) { @@ -4587,11 +4587,11 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, while (fal != NULL) { transmit_to_peer(NULL, fal, - TRANSPORT_PONG_PRIORITY, + TRANSPORT_PONG_PRIORITY, HELLO_VERIFICATION_TIMEOUT, - (const char *)pong, - ntohs(pong->header.size), - GNUNET_YES, + (const char *)pong, + ntohs(pong->header.size), + GNUNET_YES, n); fal = fal->next; } @@ -4648,11 +4648,11 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, { if ( (session != NULL) || (sender_address != NULL) ) - peer_address = add_peer_address (n, + peer_address = add_peer_address (n, plugin->short_name, session, - sender_address, - sender_address_len); + sender_address, + sender_address_len); if (peer_address != NULL) { peer_address->distance = distance; @@ -4665,7 +4665,7 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, schedule_next_ping (peer_address); } /* update traffic received amount ... */ - msize = ntohs (message->size); + msize = ntohs (message->size); GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes received from other peers"), msize, @@ -4686,7 +4686,7 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, GNUNET_log (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, _ - ("Dropping incoming message due to repeated bandwidth quota (%u b/s) violations (total of %u).\n"), + ("Dropping incoming message due to repeated bandwidth quota (%u b/s) violations (total of %u).\n"), n->in_tracker.available_bytes_per_s__, n->quota_violation_count); GNUNET_STATISTICS_update (stats, @@ -4699,8 +4699,8 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, #if DEBUG_PING_PONG GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received message of type %u and size %u from `%4s', sending to all clients.\n", - ntohs (message->type), - ntohs (message->size), + ntohs (message->type), + ntohs (message->size), GNUNET_i2s (peer)); #endif switch (ntohs (message->type)) @@ -4722,7 +4722,7 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, handle_payload_message (message, n); break; } - } + } ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 0); if (ret.value > 0) { @@ -4734,7 +4734,7 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, GNUNET_STATISTICS_update (stats, gettext_noop ("# ms throttling suggested"), (int64_t) ret.value, - GNUNET_NO); + GNUNET_NO); } return ret; } @@ -4783,7 +4783,7 @@ handle_start (void *cls, _("Rejecting control connection from peer `%s', which is not me!\n"), GNUNET_i2s (&start->self)); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); - return; + return; } c = GNUNET_malloc (sizeof (struct TransportClient)); c->next = clients; @@ -4801,7 +4801,7 @@ handle_start (void *cls, /* tell new client about all existing connections */ cim.header.size = htons (sizeof (struct ConnectInfoMessage)); cim.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); - n = neighbours; + n = neighbours; while (n != NULL) { if (GNUNET_YES == n->received_pong) @@ -4835,7 +4835,7 @@ handle_hello (void *cls, GNUNET_STATISTICS_update (stats, gettext_noop ("# HELLOs received from clients"), 1, - GNUNET_NO); + GNUNET_NO); ret = process_hello (NULL, message); GNUNET_SERVER_receive_done (client, ret); } @@ -4845,7 +4845,7 @@ handle_hello (void *cls, * Closure for 'transmit_client_message'; followed by * 'msize' bytes of the actual message. */ -struct TransmitClientMessageContext +struct TransmitClientMessageContext { /** * Client on whom's behalf we are sending. @@ -4856,7 +4856,7 @@ struct TransmitClientMessageContext * Timeout for the transmission. */ struct GNUNET_TIME_Absolute timeout; - + /** * Message priority. */ @@ -4864,7 +4864,7 @@ struct TransmitClientMessageContext /** * Size of the message in bytes. - */ + */ uint16_t msize; }; @@ -4888,7 +4888,7 @@ transmit_client_message (void *cls, if (n != NULL) { - transmit_to_peer (tc, NULL, tcmc->priority, + transmit_to_peer (tc, NULL, tcmc->priority, GNUNET_TIME_absolute_get_remaining (tcmc->timeout), (char *)&tcmc[1], tcmc->msize, GNUNET_NO, n); @@ -4928,7 +4928,7 @@ handle_send (void *cls, GNUNET_STATISTICS_update (stats, gettext_noop ("# payload received for other peers"), size, - GNUNET_NO); + GNUNET_NO); obm = (const struct OutboundMessage *) message; obmm = (const struct GNUNET_MessageHeader *) &obm[1]; msize = size - sizeof (struct OutboundMessage); @@ -4968,11 +4968,11 @@ handle_set_quota (void *cls, const struct QuotaSetMessage *qsm = (const struct QuotaSetMessage *) message; struct NeighbourList *n; - + GNUNET_STATISTICS_update (stats, gettext_noop ("# SET QUOTA messages received"), 1, - GNUNET_NO); + GNUNET_NO); n = find_neighbour (&qsm->peer); if (n == NULL) { @@ -4980,20 +4980,20 @@ handle_set_quota (void *cls, GNUNET_STATISTICS_update (stats, gettext_noop ("# SET QUOTA messages ignored (no such peer)"), 1, - GNUNET_NO); + GNUNET_NO); return; } #if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' request (new quota %u, old quota %u) from client for peer `%4s'\n", - "SET_QUOTA", + "SET_QUOTA", (unsigned int) ntohl (qsm->quota.value__), (unsigned int) n->in_tracker.available_bytes_per_s__, GNUNET_i2s (&qsm->peer)); #endif GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker, qsm->quota); - if (0 == ntohl (qsm->quota.value__)) + if (0 == ntohl (qsm->quota.value__)) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting peer `%4s', %s\n", GNUNET_i2s(&n->id), @@ -5007,7 +5007,7 @@ handle_set_quota (void *cls, /** * Take the given address and append it to the set of results sent back to * the client. - * + * * @param cls the transmission context used ('struct GNUNET_SERVER_TransmitContext*') * @param address the resolved name, NULL to indicate the last response */ @@ -5090,7 +5090,7 @@ handle_address_lookup (void *cls, tc = GNUNET_SERVER_transmit_context_create (client); lsPlugin->api->address_pretty_printer (lsPlugin->api->cls, nameTransport, - address, addressLen, + address, addressLen, numeric, rtimeout, &transmit_address_to_client, tc); @@ -5120,7 +5120,7 @@ create_environment (struct TransportPlugin *plug) * Start the specified transport (load the plugin). */ static void -start_transport (struct GNUNET_SERVER_Handle *server, +start_transport (struct GNUNET_SERVER_Handle *server, const char *name) { struct TransportPlugin *plug; @@ -5186,7 +5186,7 @@ client_disconnect_notification (void *cls, if (bc->th != NULL) { GNUNET_CONNECTION_notify_transmit_ready_cancel (bc->th); - bc->th = NULL; + bc->th = NULL; } if (bc->task == GNUNET_SCHEDULER_NO_TASK) bc->task = GNUNET_SCHEDULER_add_now (sched, @@ -5272,7 +5272,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) plugins = plug->next; if (plug->address_update_task != GNUNET_SCHEDULER_NO_TASK) { - GNUNET_SCHEDULER_cancel (plug->env.sched, + GNUNET_SCHEDULER_cancel (plug->env.sched, plug->address_update_task); plug->address_update_task = GNUNET_SCHEDULER_NO_TASK; } @@ -5403,7 +5403,7 @@ run (void *cls, if (peerinfo == NULL) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _("Could not access PEERINFO service. Exiting.\n")); + _("Could not access PEERINFO service. Exiting.\n")); GNUNET_SCHEDULER_shutdown (s); if (stats != NULL) { diff --git a/src/transport/gnunet-transport-wlan-helper.c b/src/transport/gnunet-transport-wlan-helper.c index 47bea007e..152dbd801 100644 --- a/src/transport/gnunet-transport-wlan-helper.c +++ b/src/transport/gnunet-transport-wlan-helper.c @@ -21,13 +21,13 @@ /** * @file src/transport/gnunet-wlan.c * @brief wlan layer two server; must run as root (SUID will do) - * This code will work under GNU/Linux only. + * This code will work under GNU/Linux only. * @author David Brodski * * This program serves as the mediator between the wlan interface and - * gnunet + * gnunet */ - + #include "gnunet-transport-wlan-helper.h" #include diff --git a/src/transport/plugin_transport_https.c b/src/transport/plugin_transport_https.c index 1d90c77f1..ab39eb046 100644 --- a/src/transport/plugin_transport_https.c +++ b/src/transport/plugin_transport_https.c @@ -370,7 +370,7 @@ struct Plugin /* The private key MHD uses as an \0 terminated string */ char * key; - + char * crypto_init; }; @@ -2462,7 +2462,7 @@ libgnunet_plugin_transport_https_init (void *cls) plugin->bind4_address = NULL; } } - + /* Get crypto init string from config */ if (GNUNET_CONFIGURATION_have_value (env->cfg, "transport-https", "CRYPTO_INIT")) diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index f38c08c65..d382b5108 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c @@ -155,7 +155,7 @@ struct Plugin; */ struct LocalAddrList { - + /** * This is a doubly linked list. */ @@ -393,10 +393,10 @@ struct Plugin * List of our IP addresses. */ struct LocalAddrList *lal_head; - + /** * Tail of our IP address list. - */ + */ struct LocalAddrList *lal_tail; /** @@ -480,16 +480,16 @@ check_local_addr (struct Plugin *plugin, /** * Function called for a quick conversion of the binary address to - * a numeric address. Note that the caller must not free the + * a numeric address. Note that the caller must not free the * address and that the next call to this function is allowed * to override the address again. * * @param cls closure ('struct Plugin*') * @param addr binary address * @param addrlen length of the address - * @return string representing the same address + * @return string representing the same address */ -static const char* +static const char* tcp_address_to_string (void *cls, const void *addr, size_t addrlen) @@ -611,7 +611,7 @@ create_session (struct Plugin *plugin, GNUNET_STATISTICS_update (plugin->env->stats, gettext_noop ("# bytes currently in TCP buffers"), pm->message_size, - GNUNET_NO); + GNUNET_NO); GNUNET_CONTAINER_DLL_insert (ret->pending_messages_head, ret->pending_messages_tail, pm); @@ -689,7 +689,7 @@ do_transmit (void *cls, size_t size, void *buf) /* do this call before callbacks (so that if callbacks destroy session, they have a chance to cancel actions done by this call) */ - process_pending_messages (session); + process_pending_messages (session); pid = session->target; /* no do callbacks and do not use session again since the callbacks may abort the session */ @@ -704,11 +704,11 @@ do_transmit (void *cls, size_t size, void *buf) GNUNET_STATISTICS_update (plugin->env->stats, gettext_noop ("# bytes currently in TCP buffers"), - (int64_t) ret, - GNUNET_NO); + GNUNET_NO); GNUNET_STATISTICS_update (plugin->env->stats, gettext_noop ("# bytes discarded by TCP (timeout)"), ret, - GNUNET_NO); + GNUNET_NO); return 0; } /* copy all pending messages that would fit */ @@ -716,9 +716,9 @@ do_transmit (void *cls, size_t size, void *buf) cbuf = buf; hd = NULL; tl = NULL; - while (NULL != (pos = session->pending_messages_head)) + while (NULL != (pos = session->pending_messages_head)) { - if (ret + pos->message_size > size) + if (ret + pos->message_size > size) break; GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, session->pending_messages_tail, @@ -734,7 +734,7 @@ do_transmit (void *cls, size_t size, void *buf) /* schedule 'continuation' before callbacks so that callbacks that cancel everything don't cause us to use a session that no longer exists... */ - process_pending_messages (session); + process_pending_messages (session); session->last_activity = GNUNET_TIME_absolute_get (); pid = session->target; /* we'll now call callbacks that may cancel the session; hence @@ -756,11 +756,11 @@ do_transmit (void *cls, size_t size, void *buf) GNUNET_STATISTICS_update (plugin->env->stats, gettext_noop ("# bytes currently in TCP buffers"), - (int64_t) ret, - GNUNET_NO); + GNUNET_NO); GNUNET_STATISTICS_update (plugin->env->stats, gettext_noop ("# bytes transmitted via TCP"), ret, - GNUNET_NO); + GNUNET_NO); return ret; } @@ -812,7 +812,7 @@ disconnect_session (struct Session *session) (session->connect_addr != NULL) ? tcp_address_to_string (session->plugin, session->connect_addr, - session->connect_alen) : "*", + session->connect_alen) : "*", session); #endif /* remove from session list */ @@ -851,11 +851,11 @@ disconnect_session (struct Session *session) GNUNET_STATISTICS_update (session->plugin->env->stats, gettext_noop ("# bytes currently in TCP buffers"), - (int64_t) pm->message_size, - GNUNET_NO); + GNUNET_NO); GNUNET_STATISTICS_update (session->plugin->env->stats, gettext_noop ("# bytes discarded by TCP (disconnect)"), pm->message_size, - GNUNET_NO); + GNUNET_NO); GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, session->pending_messages_tail, pm); @@ -870,15 +870,15 @@ disconnect_session (struct Session *session) GNUNET_SCHEDULER_cancel (session->plugin->env->sched, session->receive_delay_task); if (session->client != NULL) - GNUNET_SERVER_receive_done (session->client, + GNUNET_SERVER_receive_done (session->client, GNUNET_SYSERR); } - if (session->client != NULL) + if (session->client != NULL) GNUNET_SERVER_client_drop (session->client); GNUNET_STATISTICS_update (session->plugin->env->stats, gettext_noop ("# TCP sessions active"), -1, - GNUNET_NO); + GNUNET_NO); GNUNET_free_non_null (session->connect_addr); GNUNET_free (session); } @@ -886,7 +886,7 @@ disconnect_session (struct Session *session) /** * Given two otherwise equivalent sessions, pick the better one. - * + * * @param s1 one session (also default) * @param s2 other session * @return "better" session (more active) @@ -1043,7 +1043,7 @@ tcp_plugin_send (void *cls, GNUNET_STATISTICS_update (plugin->env->stats, gettext_noop ("# bytes TCP was asked to transmit"), msgbuf_size, - GNUNET_NO); + GNUNET_NO); /* FIXME: we could do this cheaper with a hash table where we could restrict the iteration to entries that match the target peer... */ @@ -1052,17 +1052,17 @@ tcp_plugin_send (void *cls, { cand_session = NULL; next = plugin->sessions; - while (NULL != (session = next)) + while (NULL != (session = next)) { next = session->next; GNUNET_assert (session->client != NULL); if (0 != memcmp (target, - &session->target, + &session->target, sizeof (struct GNUNET_PeerIdentity))) continue; if ( ( (GNUNET_SYSERR == force_address) && (session->expecting_welcome == GNUNET_NO) ) || - (GNUNET_NO == force_address) ) + (GNUNET_NO == force_address) ) { cand_session = select_better_session (cand_session, session); @@ -1076,7 +1076,7 @@ tcp_plugin_send (void *cls, GNUNET_break (0); break; } - if (session->inbound == GNUNET_YES) + if (session->inbound == GNUNET_YES) continue; if (addrlen != session->connect_alen) continue; @@ -1085,7 +1085,7 @@ tcp_plugin_send (void *cls, addrlen)) continue; cand_session = select_better_session (cand_session, - session); + session); } session = cand_session; } @@ -1100,7 +1100,7 @@ tcp_plugin_send (void *cls, GNUNET_STATISTICS_update (plugin->env->stats, gettext_noop ("# bytes discarded by TCP (no address and no connection)"), msgbuf_size, - GNUNET_NO); + GNUNET_NO); return -1; } if (session == NULL) @@ -1119,7 +1119,7 @@ tcp_plugin_send (void *cls, is_natd = GNUNET_YES; memcpy (&a6.sin6_addr, &t6->ipv6_addr, - sizeof (struct in6_addr)); + sizeof (struct in6_addr)); sb = &a6; sbs = sizeof (a6); } @@ -1167,8 +1167,8 @@ tcp_plugin_send (void *cls, pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size); /* FIXME: the memset of this malloc can be up to 2% of our total runtime */ pm->msg = (const char*) &pm[1]; - memcpy (&pm[1], msg, msgbuf_size); - /* FIXME: this memcpy can be up to 7% of our total run-time + memcpy (&pm[1], msg, msgbuf_size); + /* FIXME: this memcpy can be up to 7% of our total run-time (for transport service) */ pm->message_size = msgbuf_size; pm->timeout = GNUNET_TIME_relative_to_absolute (timeout); @@ -1209,7 +1209,7 @@ tcp_plugin_send (void *cls, GNUNET_STATISTICS_update (plugin->env->stats, gettext_noop ("# bytes discarded by TCP (failed to connect)"), msgbuf_size, - GNUNET_NO); + GNUNET_NO); return -1; } #if DEBUG_TCP @@ -1233,7 +1233,7 @@ tcp_plugin_send (void *cls, GNUNET_STATISTICS_update (plugin->env->stats, gettext_noop ("# bytes currently in TCP buffers"), msgbuf_size, - GNUNET_NO); + GNUNET_NO); /* create new message entry */ pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size); pm->msg = (const char*) &pm[1]; @@ -1397,7 +1397,7 @@ tcp_plugin_address_pretty_printer (void *cls, a6.sin6_port = t6->t6_port; memcpy (&a6.sin6_addr, &t6->ipv6_addr, - sizeof (struct in6_addr)); + sizeof (struct in6_addr)); port = ntohs (t6->t6_port); sb = &a6; sbs = sizeof (a6); @@ -1457,7 +1457,7 @@ check_port (struct Plugin *plugin, uint16_t in_port) } -/** +/** * Function that will be called to check if a binary address for this * plugin is well-formed and corresponds to an address for THIS peer * (as per our configuration). Naturally, if absolutely necessary, @@ -1473,8 +1473,8 @@ check_port (struct Plugin *plugin, uint16_t in_port) * and transport, GNUNET_SYSERR if not */ static int -tcp_plugin_check_address (void *cls, - const void *addr, +tcp_plugin_check_address (void *cls, + const void *addr, size_t addrlen) { struct Plugin *plugin = cls; @@ -1507,7 +1507,7 @@ tcp_plugin_check_address (void *cls, GNUNET_break_op (0); return GNUNET_SYSERR; } - if (GNUNET_OK != + if (GNUNET_OK != check_port (plugin, ntohs (v6->t6_port))) return GNUNET_SYSERR; if (GNUNET_OK != @@ -1661,14 +1661,14 @@ handle_tcp_welcome (void *cls, #if DEBUG_TCP GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Received %s message from a `%4s/%p'.\n", + "Received %s message from a `%4s/%p'.\n", "WELCOME", GNUNET_i2s (&wm->clientIdentity), client); #endif GNUNET_STATISTICS_update (plugin->env->stats, gettext_noop ("# TCP WELCOME messages received"), 1, - GNUNET_NO); + GNUNET_NO); session = find_session_by_client (plugin, client); if (session == NULL) { @@ -1749,13 +1749,13 @@ delayed_done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) session->receive_delay_task = GNUNET_SCHEDULER_NO_TASK; delay = session->plugin->env->receive (session->plugin->env->cls, &session->target, - NULL, 0, + NULL, 0, session, NULL, 0); if (delay.value == 0) GNUNET_SERVER_receive_done (session->client, GNUNET_OK); else - session->receive_delay_task = + session->receive_delay_task = GNUNET_SCHEDULER_add_delayed (session->plugin->env->sched, delay, &delayed_done, session); } @@ -1782,8 +1782,8 @@ handle_tcp_data (void *cls, { /* We don't want to propagate WELCOME and NAT Probe messages up! */ GNUNET_SERVER_receive_done (client, GNUNET_OK); - return; - } + return; + } session = find_session_by_client (plugin, client); if ( (NULL == session) || (GNUNET_YES == session->expecting_welcome)) { @@ -1794,22 +1794,22 @@ handle_tcp_data (void *cls, #if DEBUG_TCP GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Passing %u bytes of type %u from `%4s' to transport service.\n", - (unsigned int) ntohs (message->size), + (unsigned int) ntohs (message->size), (unsigned int) ntohs (message->type), GNUNET_i2s (&session->target)); #endif GNUNET_STATISTICS_update (plugin->env->stats, gettext_noop ("# bytes received via TCP"), ntohs (message->size), - GNUNET_NO); + GNUNET_NO); delay = plugin->env->receive (plugin->env->cls, &session->target, message, 1, - session, + session, (GNUNET_YES == session->inbound) ? NULL : session->connect_addr, (GNUNET_YES == session->inbound) ? 0 : session->connect_alen); if (delay.value == 0) GNUNET_SERVER_receive_done (client, GNUNET_OK); else - session->receive_delay_task = + session->receive_delay_task = GNUNET_SCHEDULER_add_delayed (session->plugin->env->sched, delay, &delayed_done, session); } @@ -1823,7 +1823,7 @@ handle_tcp_data (void *cls, * @param client identification of the client */ static void -disconnect_notify (void *cls, +disconnect_notify (void *cls, struct GNUNET_SERVER_Client *client) { struct Plugin *plugin = cls; @@ -2445,7 +2445,7 @@ libgnunet_plugin_transport_tcp_init (void *cls) GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("TCP transport advertises itself as being on port %llu\n"), aport); - GNUNET_SERVER_disconnect_notify (plugin->server, + GNUNET_SERVER_disconnect_notify (plugin->server, &disconnect_notify, plugin); GNUNET_CONFIGURATION_get_value_string(env->cfg, "transport-tcp", "BINDTO", &plugin->bind_address); diff --git a/src/transport/plugin_transport_template.c b/src/transport/plugin_transport_template.c index f6a02fe87..6a9b8612b 100644 --- a/src/transport/plugin_transport_template.c +++ b/src/transport/plugin_transport_template.c @@ -133,7 +133,7 @@ struct Plugin * @param priority how important is the message * @param msgbuf the message to transmit * @param msgbuf_size number of bytes in 'msgbuf' - * @param timeout when should we time out + * @param timeout when should we time out * @param session which session must be used (or NULL for "any") * @param addr the address to use (can be NULL if the plugin * is "on its own" (i.e. re-use existing TCP connection)) @@ -245,16 +245,16 @@ template_plugin_address_suggested (void *cls, /** * Function called for a quick conversion of the binary address to - * a numeric address. Note that the caller must not free the + * a numeric address. Note that the caller must not free the * address and that the next call to this function is allowed * to override the address again. * * @param cls closure * @param addr binary address * @param addrlen length of the address - * @return string representing the same address + * @return string representing the same address */ -static const char* +static const char* template_plugin_address_to_string (void *cls, const void *addr, size_t addrlen) diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 791272e19..f8c68244a 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c @@ -217,7 +217,7 @@ struct UDP_NAT_ProbeMessageConfirmation */ struct LocalAddrList { - + /** * This is a doubly linked list. */ @@ -334,12 +334,12 @@ struct UDP_NAT_Probes struct UDP_Sock_Info { /** - * The network handle + * The network handle */ struct GNUNET_NETWORK_Handle *desc; /** - * The port we bound to + * The port we bound to */ uint16_t port; }; @@ -410,10 +410,10 @@ struct Plugin * List of our IP addresses. */ struct LocalAddrList *lal_head; - + /** * Tail of our IP address list. - */ + */ struct LocalAddrList *lal_tail; /** @@ -537,7 +537,7 @@ udp_transport_server_stop (void *cls) struct PeerSession * -find_session (struct Plugin *plugin, +find_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *peer) { struct PeerSession *pos; @@ -669,7 +669,7 @@ udp_real_send (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "UDP transmit %u-byte message to %s (%d: %s)\n", (unsigned int) ssize, - GNUNET_a2s (sb, sbs), + GNUNET_a2s (sb, sbs), (int) sent, (sent < 0) ? STRERROR (errno) : "ok"); if (cont != NULL) @@ -833,7 +833,7 @@ udp_plugin_send (void *cls, target, msgbuf, msgbuf_size, priority, timeout, - peer_session->connect_addr, peer_session->connect_alen, + peer_session->connect_addr, peer_session->connect_alen, cont, cont_cls); } else /* Haven't gotten a response from this peer, queue message */ @@ -852,11 +852,11 @@ udp_plugin_send (void *cls, } else if (other_peer_natd == GNUNET_NO) /* Other peer not behind a NAT, so we can just send the message as is */ { - sent = udp_real_send(cls, - (addrlen == sizeof (struct IPv4UdpAddress)) ? plugin->udp_sockv4.desc : plugin->udp_sockv6.desc, + sent = udp_real_send(cls, + (addrlen == sizeof (struct IPv4UdpAddress)) ? plugin->udp_sockv4.desc : plugin->udp_sockv6.desc, target, msgbuf, msgbuf_size, - priority, timeout, addr, addrlen, + priority, timeout, addr, addrlen, cont, cont_cls); } else /* Other peer is NAT'd, but we don't want to play with them (or can't!) */ @@ -1008,12 +1008,12 @@ process_interfaces (void *cls, GNUNET_break (0); return GNUNET_OK; } - + GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK, _("Found address `%s' (%s)\n"), GNUNET_a2s (addr, addrlen), name); - + if (addr_nat != NULL) { plugin->env->notify_address (plugin->env->cls, @@ -1083,11 +1083,11 @@ send_udp_probe_message (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc _("Sending a probe to port %d\n"), ntohs(probe->addr.u_port)); #endif probe->count++; - udp_real_send(plugin, - plugin->udp_sockv4.desc, + udp_real_send(plugin, + plugin->udp_sockv4.desc, NULL, - (char *)&message, ntohs(message.header.size), 0, - GNUNET_TIME_relative_get_unit(), + (char *)&message, ntohs(message.header.size), 0, + GNUNET_TIME_relative_get_unit(), &probe->addr, sizeof(struct IPv4UdpAddress), &udp_probe_continuation, probe); } @@ -1329,7 +1329,7 @@ udp_demultiplexer(struct Plugin *plugin, struct GNUNET_PeerIdentity *sender, if (fromlen == sizeof(struct IPv4UdpAddress)) { memset(&addr_buf, 0, sizeof(addr_buf)); - if (NULL == inet_ntop (AF_INET, + if (NULL == inet_ntop (AF_INET, &((struct IPv4UdpAddress *) sender_addr)->ipv4_addr, addr_buf, INET_ADDRSTRLEN)) { @@ -1346,10 +1346,10 @@ udp_demultiplexer(struct Plugin *plugin, struct GNUNET_PeerIdentity *sender, outgoing_probe_confirmation = GNUNET_malloc(sizeof(struct UDP_NAT_ProbeMessageConfirmation)); outgoing_probe_confirmation->header.size = htons(sizeof(struct UDP_NAT_ProbeMessageConfirmation)); outgoing_probe_confirmation->header.type = htons(GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_NAT_PROBE_CONFIRM); - udp_real_send(plugin, sockinfo->desc, NULL, - (char *)outgoing_probe_confirmation, - ntohs(outgoing_probe_confirmation->header.size), 0, - GNUNET_TIME_relative_get_unit(), + udp_real_send(plugin, sockinfo->desc, NULL, + (char *)outgoing_probe_confirmation, + ntohs(outgoing_probe_confirmation->header.size), 0, + GNUNET_TIME_relative_get_unit(), sender_addr, fromlen, NULL, NULL); if (outgoing_probe->task != GNUNET_SCHEDULER_NO_TASK) @@ -1476,7 +1476,7 @@ udp_demultiplexer(struct Plugin *plugin, struct GNUNET_PeerIdentity *sender, "Sending message type %d to transport!\n", ntohs(currhdr->type)); #endif - plugin->env->receive (plugin->env->cls, sender, currhdr, UDP_DIRECT_DISTANCE, + plugin->env->receive (plugin->env->cls, sender, currhdr, UDP_DIRECT_DISTANCE, NULL, sender_addr, fromlen); } @@ -1637,10 +1637,10 @@ udp_transport_server_start (void *cls) plugin->internal_address); #endif /* Start the server process */ - plugin->server_pid = GNUNET_OS_start_process(NULL, - plugin->server_stdout, - "gnunet-nat-server", - "gnunet-nat-server", + plugin->server_pid = GNUNET_OS_start_process(NULL, + plugin->server_stdout, + "gnunet-nat-server", + "gnunet-nat-server", plugin->internal_address, NULL); if (plugin->server_pid == GNUNET_SYSERR) { @@ -1652,7 +1652,7 @@ udp_transport_server_start (void *cls) } /* Close the write end of the read pipe */ GNUNET_DISK_pipe_close_end(plugin->server_stdout, GNUNET_DISK_PIPE_END_WRITE); - + plugin->server_stdout_handle = GNUNET_DISK_pipe_handle(plugin->server_stdout, GNUNET_DISK_PIPE_END_READ); plugin->server_read_task = GNUNET_SCHEDULER_add_read_file (plugin->env->sched, @@ -1689,7 +1689,7 @@ udp_transport_server_start (void *cls) serverAddr = (struct sockaddr *) &serverAddrv6; #if DEBUG_UDP GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Binding to IPv6 port %d\n", + "Binding to IPv6 port %d\n", ntohs(serverAddrv6.sin6_port)); #endif tries = 0; @@ -1699,7 +1699,7 @@ udp_transport_server_start (void *cls) serverAddrv6.sin6_port = htons (GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_STRONG, 33537) + 32000); /* Find a good, non-root port */ #if DEBUG_UDP GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "IPv6 Binding failed, trying new port %d\n", + "IPv6 Binding failed, trying new port %d\n", ntohs(serverAddrv6.sin6_port)); #endif tries++; @@ -1708,7 +1708,7 @@ udp_transport_server_start (void *cls) GNUNET_NETWORK_socket_close (plugin->udp_sockv6.desc); plugin->udp_sockv6.desc = NULL; break; - } + } } if (plugin->udp_sockv6.desc != NULL) { @@ -1741,7 +1741,7 @@ udp_transport_server_start (void *cls) serverAddr = (struct sockaddr *) &serverAddrv4; #if DEBUG_UDP GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Binding to IPv4 port %d\n", + "Binding to IPv4 port %d\n", ntohs(serverAddrv4.sin_port)); #endif tries = 0; @@ -1751,7 +1751,7 @@ udp_transport_server_start (void *cls) serverAddrv4.sin_port = htons (GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_STRONG, 33537) + 32000); /* Find a good, non-root port */ #if DEBUG_UDP GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "IPv4 Binding failed, trying new port %d\n", + "IPv4 Binding failed, trying new port %d\n", ntohs(serverAddrv4.sin_port)); #endif tries++; @@ -1760,7 +1760,7 @@ udp_transport_server_start (void *cls) GNUNET_NETWORK_socket_close (plugin->udp_sockv4.desc); plugin->udp_sockv4.desc = NULL; break; - } + } } if (plugin->udp_sockv4.desc != NULL) { @@ -1772,10 +1772,10 @@ udp_transport_server_start (void *cls) plugin->rs = GNUNET_NETWORK_fdset_create (); GNUNET_NETWORK_fdset_zero (plugin->rs); if (NULL != plugin->udp_sockv4.desc) - GNUNET_NETWORK_fdset_set (plugin->rs, + GNUNET_NETWORK_fdset_set (plugin->rs, plugin->udp_sockv4.desc); if (NULL != plugin->udp_sockv6.desc) - GNUNET_NETWORK_fdset_set (plugin->rs, + GNUNET_NETWORK_fdset_set (plugin->rs, plugin->udp_sockv6.desc); plugin->select_task = @@ -1806,7 +1806,7 @@ check_port (struct Plugin *plugin, uint16_t in_port) if ( (plugin->only_nat_addresses == GNUNET_YES) && (plugin->behind_nat == GNUNET_YES) ) return GNUNET_SYSERR; /* odd case... */ - if (in_port == plugin->port) + if (in_port == plugin->port) return GNUNET_OK; return GNUNET_SYSERR; } @@ -1829,8 +1829,8 @@ check_port (struct Plugin *plugin, uint16_t in_port) * */ static int -udp_check_address (void *cls, - const void *addr, +udp_check_address (void *cls, + const void *addr, size_t addrlen) { struct Plugin *plugin = cls; @@ -1873,7 +1873,7 @@ udp_check_address (void *cls, GNUNET_break_op (0); return GNUNET_SYSERR; } - if (GNUNET_OK != + if (GNUNET_OK != check_port (plugin, ntohs (v6->u6_port))) return GNUNET_SYSERR; if (GNUNET_OK != @@ -2226,7 +2226,7 @@ libgnunet_plugin_transport_udp_init (void *cls) GNUNET_SERVICE_stop (service); GNUNET_free_non_null(external_address); GNUNET_free_non_null(internal_address); - return NULL; + return NULL; } mtu = 1240; diff --git a/src/transport/test_plugin_transport_http.c b/src/transport/test_plugin_transport_http.c index 6dd6e4ef7..27b3e87b3 100644 --- a/src/transport/test_plugin_transport_http.c +++ b/src/transport/test_plugin_transport_http.c @@ -857,7 +857,7 @@ notify_address (void *cls, addrlen); return; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Transport plugin notification for address: `%s':%u\n"), address, port); diff --git a/src/transport/test_plugin_transport_https.c b/src/transport/test_plugin_transport_https.c index 735bab920..6e33a1675 100644 --- a/src/transport/test_plugin_transport_https.c +++ b/src/transport/test_plugin_transport_https.c @@ -884,7 +884,7 @@ notify_address (void *cls, addrlen); return; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Transport plugin notification for address: `%s':%u\n"), address, port); diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index 7e08ebd4b..7bd63414d 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c @@ -193,7 +193,7 @@ notify_connect (void *cls, { GNUNET_SCHEDULER_cancel (sched, die_task); die_task = GNUNET_SCHEDULER_add_delayed (sched, - TIMEOUT_TRANSMIT, + TIMEOUT_TRANSMIT, &end_badly, NULL); GNUNET_TRANSPORT_notify_transmit_ready (p1.th, @@ -347,7 +347,7 @@ run (void *cls, OKPP; sched = s; die_task = GNUNET_SCHEDULER_add_delayed (sched, - TIMEOUT, + TIMEOUT, &end_badly, NULL); if (is_udp) @@ -490,7 +490,7 @@ get_path_from_PATH () } -static int +static int check_gnunet_nat_server() { struct stat statbuf; @@ -505,8 +505,8 @@ check_gnunet_nat_server() return GNUNET_SYSERR; } GNUNET_free (p); - if ( (0 != (statbuf.st_mode & S_ISUID)) && - (statbuf.st_uid == 0) ) + if ( (0 != (statbuf.st_mode & S_ISUID)) && + (statbuf.st_uid == 0) ) return GNUNET_YES; return GNUNET_NO; } diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index a18175bf4..03bef3b4e 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c @@ -119,7 +119,7 @@ end () GNUNET_TRANSPORT_disconnect (p1.th); GNUNET_TRANSPORT_disconnect (p2.th); #if VERBOSE - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transports disconnected, returning success!\n"); #endif delta = GNUNET_TIME_absolute_get_duration (start_time).value; @@ -155,7 +155,7 @@ end_badly (void *cls, } -struct TestMessage +struct TestMessage { struct GNUNET_MessageHeader header; uint32_t num; @@ -241,7 +241,7 @@ notify_receive (void *cls, die_task = GNUNET_SCHEDULER_add_delayed (sched, TIMEOUT, &end_badly, - NULL); + NULL); } if (n == TOTAL_MSGS) end (); @@ -295,7 +295,7 @@ notify_ready (void *cls, size_t size, void *buf) if (n < TOTAL_MSGS) GNUNET_TRANSPORT_notify_transmit_ready (p1.th, &p2.id, - s, 0, TIMEOUT, + s, 0, TIMEOUT, ¬ify_ready, NULL); if (n % 5000 == 0) @@ -368,7 +368,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) { p->cfg = GNUNET_CONFIGURATION_create (); #if START_ARM - p->arm_pid = GNUNET_OS_start_process (NULL, NULL, + p->arm_pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", "gnunet-service-arm", #if VERBOSE_ARM @@ -438,7 +438,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL, p, ¬ify_receive, - ¬ify_connect, + ¬ify_connect, ¬ify_disconnect); GNUNET_assert (p->th != NULL); } @@ -487,7 +487,7 @@ exchange_hello (void *cls, #if VERBOSE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Received HELLO size %d\n", + "Received HELLO size %d\n", GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message)); #endif GNUNET_TRANSPORT_offer_hello (p2.th, message); diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index db96d1800..fa06f7fdb 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c @@ -278,7 +278,7 @@ struct GNUNET_TRANSPORT_Handle /** * Closure for the callbacks. */ - void *cls; + void *cls; /** * Function to call for received data. @@ -361,7 +361,7 @@ struct GNUNET_TRANSPORT_Handle * Delay until we try to reconnect. */ struct GNUNET_TIME_Relative reconnect_delay; - + /** * Set once we are in the process of disconnecting from the * service. @@ -467,14 +467,14 @@ schedule_peer_transmission (struct GNUNET_TRANSPORT_Handle *h) #if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Would need %llu ms before bandwidth is available for delivery to `%4s', that is too long. Signaling timeout.\n", - duration.value, + duration.value, GNUNET_i2s (&n->id)); #endif if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) { GNUNET_SCHEDULER_cancel (h->sched, th->notify_delay_task); th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; - } + } n->transmit_stage = TS_NEW; if (NULL != th->notify) GNUNET_assert (0 == th->notify (th->notify_cls, 0, NULL)); @@ -487,7 +487,7 @@ schedule_peer_transmission (struct GNUNET_TRANSPORT_Handle *h) "Need more bandwidth (%u b/s allowed, %u b needed), delaying delivery to `%4s' by %llu ms\n", (unsigned int) n->out_tracker.available_bytes_per_s__, (unsigned int) th->notify_size - sizeof (struct OutboundMessage), - GNUNET_i2s (&n->id), + GNUNET_i2s (&n->id), duration.value); #endif retry_time = GNUNET_TIME_relative_min (retry_time, @@ -516,7 +516,7 @@ schedule_peer_transmission (struct GNUNET_TRANSPORT_Handle *h) /** * Transmit message(s) to service. * - * @param cls handle to transport + * @param cls handle to transport * @param size number of bytes available in buf * @param buf where to copy the message * @return number of bytes copied to buf @@ -556,7 +556,7 @@ transport_notify_ready (void *cls, size_t size, void *buf) } GNUNET_CONTAINER_DLL_remove (h->control_head, h->control_tail, - cm); + cm); nret = cm->notify (cm->notify_cls, size, &cbuf[ret]); #if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -595,14 +595,14 @@ transport_notify_ready (void *cls, size_t size, void *buf) GNUNET_break (0); } GNUNET_assert (size >= sizeof (struct OutboundMessage)); - mret = th->notify (th->notify_cls, + mret = th->notify (th->notify_cls, size - sizeof (struct OutboundMessage), &cbuf[ret + sizeof (struct OutboundMessage)]); GNUNET_assert (mret <= size - sizeof (struct OutboundMessage)); #if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Message of %u bytes with timeout %llums constructed for `%4s'\n", - (unsigned int) mret, + (unsigned int) mret, (unsigned long long) GNUNET_TIME_absolute_get_remaining (th->timeout).value, GNUNET_i2s (&n->id)); #endif @@ -655,7 +655,7 @@ transport_notify_ready (void *cls, size_t size, void *buf) */ static void schedule_transmission (struct GNUNET_TRANSPORT_Handle *h) -{ +{ size_t size; struct GNUNET_TIME_Relative timeout; struct GNUNET_TRANSPORT_TransmitHandle *th; @@ -668,7 +668,7 @@ schedule_transmission (struct GNUNET_TRANSPORT_Handle *h) _("Could not yet schedule transmission: we are not yet connected to the transport service!\n")); return; /* not yet connected */ } - if (NULL != h->control_head) + if (NULL != h->control_head) { size = h->control_head->notify_size; timeout = GNUNET_TIME_UNIT_FOREVER_REL; @@ -688,7 +688,7 @@ schedule_transmission (struct GNUNET_TRANSPORT_Handle *h) size = th->notify_size; timeout = GNUNET_TIME_absolute_get_remaining (th->timeout); } - h->network_handle = + h->network_handle = GNUNET_CLIENT_notify_transmit_ready (h->client, size, timeout, @@ -756,7 +756,7 @@ schedule_control_transmit (struct GNUNET_TRANSPORT_Handle *h, th->notify_delay_task = GNUNET_SCHEDULER_add_delayed (h->sched, timeout, &control_transmit_timeout, th); - if (at_head) + if (at_head) GNUNET_CONTAINER_DLL_insert (h->control_head, h->control_tail, th); @@ -811,7 +811,7 @@ send_set_quota (void *cls, size_t size, void *buf) #if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' request with respect to `%4s'.\n", - "SET_QUOTA", + "SET_QUOTA", GNUNET_i2s (&sqc->target)); #endif GNUNET_assert (size >= sizeof (struct QuotaSetMessage)); @@ -920,7 +920,7 @@ GNUNET_TRANSPORT_get_hello (struct GNUNET_TRANSPORT_Handle *handle, hwl->rec = rec; hwl->rec_cls = rec_cls; if (handle->my_hello == NULL) - return; + return; rec (rec_cls, (const struct GNUNET_MessageHeader *) handle->my_hello); } @@ -1023,7 +1023,7 @@ GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, GNUNET_break (0); return; } -#if DEBUG_TRANSPORT +#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Offering `%s' message of `%4s' to transport for validation.\n", "HELLO", @@ -1076,8 +1076,8 @@ send_start (void *cls, size_t size, void *buf) /** - * Free neighbour. - * + * Free neighbour. + * * @param n the entry to free */ static void @@ -1112,8 +1112,8 @@ neighbour_free (struct NeighbourList *n) /** - * Mark neighbour as disconnected. - * + * Mark neighbour as disconnected. + * * @param n the entry to mark as disconnected */ static void @@ -1151,7 +1151,7 @@ static void demultiplexer (void *cls, * @param tc scheduler context */ static void -reconnect (void *cls, +reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_TRANSPORT_Handle *h = cls; @@ -1179,7 +1179,7 @@ reconnect (void *cls, n = next; } #if DEBUG_TRANSPORT - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to transport service.\n"); #endif GNUNET_assert (h->client == NULL); @@ -1237,7 +1237,7 @@ schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h) { h->reconnect_delay = GNUNET_TIME_UNIT_MILLISECONDS; } - else + else { h->reconnect_delay = GNUNET_TIME_relative_multiply (h->reconnect_delay, 2); h->reconnect_delay = GNUNET_TIME_relative_min (GNUNET_TIME_UNIT_SECONDS, @@ -1267,7 +1267,7 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h, } #if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Creating entry for neighbour `%4s'.\n", + "Creating entry for neighbour `%4s'.\n", GNUNET_i2s (pid)); #endif n = GNUNET_malloc (sizeof (struct NeighbourList)); @@ -1277,7 +1277,7 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h, MAX_BANDWIDTH_CARRY_S); n->next = h->neighbours; n->h = h; - h->neighbours = n; + h->neighbours = n; return n; } @@ -1358,7 +1358,7 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle) th->notify_delay_task); th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; } - GNUNET_assert (0 == th->notify (th->notify_cls, 0, NULL)); + GNUNET_assert (0 == th->notify (th->notify_cls, 0, NULL)); break; default: GNUNET_break (0); @@ -1456,7 +1456,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) GNUNET_free (h); return; } - if (msg == NULL) + if (msg == NULL) { #if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -1530,7 +1530,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) n->is_connected = GNUNET_YES; if (h->nc_cb != NULL) h->nc_cb (h->cls, &n->id, - GNUNET_TIME_relative_ntoh (cim->latency), + GNUNET_TIME_relative_ntoh (cim->latency), ntohl (cim->distance)); break; case GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT: @@ -1547,7 +1547,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) GNUNET_i2s (&dim->peer)); #endif n = neighbour_find (h, &dim->peer); - GNUNET_break (n != NULL); + GNUNET_break (n != NULL); if (n != NULL) neighbour_disconnect (n); break; @@ -1607,7 +1607,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received message of type %u from `%4s'.\n", ntohs (imm->type), GNUNET_i2s (&im->peer)); -#endif +#endif n = neighbour_find (h, &im->peer); if (n == NULL) { @@ -1659,7 +1659,7 @@ peer_transmit_timeout (void *cls, "Triggering timeout for request to transmit to `%4s' (%d)\n", GNUNET_i2s (&n->id), n->transmit_stage); -#endif +#endif notify = th->notify; notify_cls = th->notify_cls; switch (n->transmit_stage) @@ -1738,7 +1738,7 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle n = neighbour_find (handle, target); if (n == NULL) n = neighbour_add (handle, target); - if (n == NULL) + if (n == NULL) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Could not create neighbour entry for peer `%s'\n", diff --git a/src/transport/transport_api_address_lookup.c b/src/transport/transport_api_address_lookup.c index da723d71c..cb15f0565 100644 --- a/src/transport/transport_api_address_lookup.c +++ b/src/transport/transport_api_address_lookup.c @@ -29,7 +29,7 @@ /** * Context for the address lookup. - */ + */ struct AddressLookupCtx { /** @@ -62,7 +62,7 @@ struct AddressLookupCtx * message with the human-readable address */ static void -address_response_processor (void *cls, +address_response_processor (void *cls, const struct GNUNET_MessageHeader *msg) { struct AddressLookupCtx *alucb = cls; @@ -100,7 +100,7 @@ address_response_processor (void *cls, GNUNET_CLIENT_receive (alucb->client, &address_response_processor, alucb, GNUNET_TIME_absolute_get_remaining - (alucb->timeout)); + (alucb->timeout)); alucb->cb (alucb->cb_cls, address); } @@ -112,7 +112,7 @@ address_response_processor (void *cls, * @param cfg configuration to use * @param address address to convert (binary format) * @param addressLen number of bytes in address - * @param numeric should (IP) addresses be displayed in numeric form + * @param numeric should (IP) addresses be displayed in numeric form * (otherwise do reverse DNS lookup) * @param nameTrans name of the transport to which the address belongs * @param timeout how long is the lookup allowed to take at most @@ -121,8 +121,8 @@ address_response_processor (void *cls, */ void GNUNET_TRANSPORT_address_lookup (struct GNUNET_SCHEDULER_Handle *sched, - const struct GNUNET_CONFIGURATION_Handle *cfg, - const char *address, + const struct GNUNET_CONFIGURATION_Handle *cfg, + const char *address, size_t addressLen, int numeric, const char *nameTrans, @@ -168,8 +168,8 @@ GNUNET_TRANSPORT_address_lookup (struct GNUNET_SCHEDULER_Handle *sched, aluCB->timeout = abs_timeout; aluCB->client = client; GNUNET_assert (GNUNET_OK == - GNUNET_CLIENT_transmit_and_get_response (client, - &msg->header, + GNUNET_CLIENT_transmit_and_get_response (client, + &msg->header, timeout, GNUNET_YES, &address_response_processor, diff --git a/src/transport/transport_api_blacklist.c b/src/transport/transport_api_blacklist.c index 919845c51..1025edef4 100644 --- a/src/transport/transport_api_blacklist.c +++ b/src/transport/transport_api_blacklist.c @@ -56,7 +56,7 @@ struct GNUNET_TRANSPORT_Blacklist /** * Pending handle for the current request. - */ + */ struct GNUNET_CLIENT_TransmitHandle *th; /** @@ -68,7 +68,7 @@ struct GNUNET_TRANSPORT_Blacklist /** * Closure for 'cb'. */ - void *cb_cls; + void *cb_cls; /** * Peer currently under consideration. @@ -108,7 +108,7 @@ query_handler (void *cls, { struct GNUNET_TRANSPORT_Blacklist *br = cls; const struct BlacklistMessage *bm; - + if ( (ntohs(msg->size) != sizeof (struct BlacklistMessage)) || (ntohs(msg->type) != GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY) ) { @@ -118,7 +118,7 @@ query_handler (void *cls, bm = (const struct BlacklistMessage *)msg; GNUNET_break (0 == ntohl (bm->is_allowed)); br->peer = bm->peer; - reply (br); + reply (br); } @@ -276,7 +276,7 @@ GNUNET_TRANSPORT_blacklist (struct GNUNET_SCHEDULER_Handle *sched, GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, &transmit_blacklist_init, - ret); + ret); return ret; } -- cgit v1.2.3