diff options
Diffstat (limited to 'src/util')
55 files changed, 403 insertions, 403 deletions
diff --git a/src/util/bandwidth.c b/src/util/bandwidth.c index 5caaec03c..79497ad51 100644 --- a/src/util/bandwidth.c +++ b/src/util/bandwidth.c | |||
@@ -254,7 +254,7 @@ GNUNET_BANDWIDTH_tracker_get_delay (struct GNUNET_BANDWIDTH_Tracker *av, | |||
254 | 254 | ||
255 | if (av->available_bytes_per_s__ == 0) | 255 | if (av->available_bytes_per_s__ == 0) |
256 | { | 256 | { |
257 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 257 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
258 | "Tracker %p delay is infinity\n", av); | 258 | "Tracker %p delay is infinity\n", av); |
259 | return GNUNET_TIME_UNIT_FOREVER_REL; | 259 | return GNUNET_TIME_UNIT_FOREVER_REL; |
260 | } | 260 | } |
@@ -270,9 +270,9 @@ GNUNET_BANDWIDTH_tracker_get_delay (struct GNUNET_BANDWIDTH_Tracker *av, | |||
270 | ret.rel_value_us = | 270 | ret.rel_value_us = |
271 | (1000LL * 1000LL * bytes_needed) / | 271 | (1000LL * 1000LL * bytes_needed) / |
272 | (unsigned long long) av->available_bytes_per_s__; | 272 | (unsigned long long) av->available_bytes_per_s__; |
273 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 273 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
274 | "Tracker %p delay for %u bytes is %s\n", | 274 | "Tracker %p delay for %u bytes is %s\n", |
275 | av, (unsigned int) size, | 275 | av, (unsigned int) size, |
276 | GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES)); | 276 | GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES)); |
277 | return ret; | 277 | return ret; |
278 | } | 278 | } |
@@ -321,7 +321,7 @@ GNUNET_BANDWIDTH_tracker_update_quota (struct GNUNET_BANDWIDTH_Tracker *av, | |||
321 | uint32_t new_limit; | 321 | uint32_t new_limit; |
322 | 322 | ||
323 | new_limit = ntohl (bytes_per_second_limit.value__); | 323 | new_limit = ntohl (bytes_per_second_limit.value__); |
324 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 324 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
325 | "Tracker %p bandwidth changed to %u Bps\n", av, | 325 | "Tracker %p bandwidth changed to %u Bps\n", av, |
326 | (unsigned int) new_limit); | 326 | (unsigned int) new_limit); |
327 | update_tracker (av); | 327 | update_tracker (av); |
diff --git a/src/util/bio.c b/src/util/bio.c index 0a1c213f3..2514a266f 100644 --- a/src/util/bio.c +++ b/src/util/bio.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Size for I/O buffers. | 32 | * Size for I/O buffers. |
33 | */ | 33 | */ |
34 | #define BIO_BUFFER_SIZE 65536 | 34 | #define BIO_BUFFER_SIZE 65536 |
35 | 35 | ||
36 | /** | 36 | /** |
@@ -135,7 +135,7 @@ GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, | |||
135 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 135 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
136 | */ | 136 | */ |
137 | int | 137 | int |
138 | GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, | 138 | GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, |
139 | const char *what, | 139 | const char *what, |
140 | void *result, size_t len) | 140 | void *result, size_t len) |
141 | { | 141 | { |
@@ -175,7 +175,7 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, | |||
175 | if (0 == ret) | 175 | if (0 == ret) |
176 | { | 176 | { |
177 | GNUNET_asprintf (&h->emsg, | 177 | GNUNET_asprintf (&h->emsg, |
178 | _("Error reading `%s': %s"), | 178 | _("Error reading `%s': %s"), |
179 | what, | 179 | what, |
180 | _("End of file")); | 180 | _("End of file")); |
181 | return GNUNET_SYSERR; | 181 | return GNUNET_SYSERR; |
@@ -199,10 +199,10 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, | |||
199 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 199 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
200 | */ | 200 | */ |
201 | int | 201 | int |
202 | GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, | 202 | GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, |
203 | const char *file, | 203 | const char *file, |
204 | int line, | 204 | int line, |
205 | void *result, | 205 | void *result, |
206 | size_t len) | 206 | size_t len) |
207 | { | 207 | { |
208 | char what[1024]; | 208 | char what[1024]; |
@@ -225,7 +225,7 @@ GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, | |||
225 | int | 225 | int |
226 | GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, | 226 | GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, |
227 | const char *what, | 227 | const char *what, |
228 | char **result, | 228 | char **result, |
229 | size_t max_length) | 229 | size_t max_length) |
230 | { | 230 | { |
231 | char *buf; | 231 | char *buf; |
@@ -272,7 +272,7 @@ GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, | |||
272 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 272 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
273 | */ | 273 | */ |
274 | int | 274 | int |
275 | GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, | 275 | GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, |
276 | const char *what, | 276 | const char *what, |
277 | struct GNUNET_CONTAINER_MetaData **result) | 277 | struct GNUNET_CONTAINER_MetaData **result) |
278 | { | 278 | { |
@@ -345,9 +345,9 @@ GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, const char *file, | |||
345 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 345 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
346 | */ | 346 | */ |
347 | int | 347 | int |
348 | GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, | 348 | GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, |
349 | const char *file, | 349 | const char *file, |
350 | int line, | 350 | int line, |
351 | int64_t *i) | 351 | int64_t *i) |
352 | { | 352 | { |
353 | int64_t big; | 353 | int64_t big; |
@@ -368,7 +368,7 @@ struct GNUNET_BIO_WriteHandle | |||
368 | * Underlying file handle. | 368 | * Underlying file handle. |
369 | */ | 369 | */ |
370 | struct GNUNET_DISK_FileHandle *fd; | 370 | struct GNUNET_DISK_FileHandle *fd; |
371 | 371 | ||
372 | /** | 372 | /** |
373 | * I/O buffer. Do not free, allocated at the end of the struct. | 373 | * I/O buffer. Do not free, allocated at the end of the struct. |
374 | */ | 374 | */ |
@@ -504,7 +504,7 @@ GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer, | |||
504 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 504 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
505 | */ | 505 | */ |
506 | int | 506 | int |
507 | GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, | 507 | GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, |
508 | const char *s) | 508 | const char *s) |
509 | { | 509 | { |
510 | uint32_t slen; | 510 | uint32_t slen; |
@@ -562,7 +562,7 @@ GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, | |||
562 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 562 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
563 | */ | 563 | */ |
564 | int | 564 | int |
565 | GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, | 565 | GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, |
566 | int32_t i) | 566 | int32_t i) |
567 | { | 567 | { |
568 | int32_t big; | 568 | int32_t big; |
@@ -580,7 +580,7 @@ GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, | |||
580 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 580 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
581 | */ | 581 | */ |
582 | int | 582 | int |
583 | GNUNET_BIO_write_int64 (struct GNUNET_BIO_WriteHandle *h, | 583 | GNUNET_BIO_write_int64 (struct GNUNET_BIO_WriteHandle *h, |
584 | int64_t i) | 584 | int64_t i) |
585 | { | 585 | { |
586 | int64_t big; | 586 | int64_t big; |
diff --git a/src/util/client.c b/src/util/client.c index 30c80bf03..5b753ec74 100644 --- a/src/util/client.c +++ b/src/util/client.c | |||
@@ -251,8 +251,8 @@ try_unixpath (const char *service_name, | |||
251 | struct sockaddr_un s_un; | 251 | struct sockaddr_un s_un; |
252 | 252 | ||
253 | unixpath = NULL; | 253 | unixpath = NULL; |
254 | if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) && | 254 | if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) && |
255 | (0 < strlen (unixpath))) | 255 | (0 < strlen (unixpath))) |
256 | { | 256 | { |
257 | /* We have a non-NULL unixpath, need to validate it */ | 257 | /* We have a non-NULL unixpath, need to validate it */ |
258 | if (strlen (unixpath) >= sizeof (s_un.sun_path)) | 258 | if (strlen (unixpath) >= sizeof (s_un.sun_path)) |
@@ -299,8 +299,8 @@ test_service_configuration (const char *service_name, | |||
299 | #if AF_UNIX | 299 | #if AF_UNIX |
300 | char *unixpath = NULL; | 300 | char *unixpath = NULL; |
301 | 301 | ||
302 | if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) && | 302 | if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) && |
303 | (0 < strlen (unixpath))) | 303 | (0 < strlen (unixpath))) |
304 | ret = GNUNET_OK; | 304 | ret = GNUNET_OK; |
305 | GNUNET_free_non_null (unixpath); | 305 | GNUNET_free_non_null (unixpath); |
306 | #endif | 306 | #endif |
@@ -308,7 +308,7 @@ test_service_configuration (const char *service_name, | |||
308 | if ( (GNUNET_YES == | 308 | if ( (GNUNET_YES == |
309 | GNUNET_CONFIGURATION_have_value (cfg, service_name, "PORT")) && | 309 | GNUNET_CONFIGURATION_have_value (cfg, service_name, "PORT")) && |
310 | (GNUNET_OK == | 310 | (GNUNET_OK == |
311 | GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "PORT", &port)) && | 311 | GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "PORT", &port)) && |
312 | (port <= 65535) && (0 != port) && | 312 | (port <= 65535) && (0 != port) && |
313 | (GNUNET_OK == | 313 | (GNUNET_OK == |
314 | GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "HOSTNAME", | 314 | GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "HOSTNAME", |
@@ -406,7 +406,7 @@ GNUNET_CLIENT_connect (const char *service_name, | |||
406 | struct GNUNET_CLIENT_Connection *client; | 406 | struct GNUNET_CLIENT_Connection *client; |
407 | struct GNUNET_CONNECTION_Handle *connection; | 407 | struct GNUNET_CONNECTION_Handle *connection; |
408 | 408 | ||
409 | if (GNUNET_OK != | 409 | if (GNUNET_OK != |
410 | test_service_configuration (service_name, | 410 | test_service_configuration (service_name, |
411 | cfg)) | 411 | cfg)) |
412 | return NULL; | 412 | return NULL; |
@@ -629,7 +629,7 @@ GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *client, | |||
629 | /** | 629 | /** |
630 | * Handle for a test to check if a service is running. | 630 | * Handle for a test to check if a service is running. |
631 | */ | 631 | */ |
632 | struct GNUNET_CLIENT_TestHandle | 632 | struct GNUNET_CLIENT_TestHandle |
633 | { | 633 | { |
634 | /** | 634 | /** |
635 | * Function to call with the result of the test. | 635 | * Function to call with the result of the test. |
@@ -643,7 +643,7 @@ struct GNUNET_CLIENT_TestHandle | |||
643 | 643 | ||
644 | /** | 644 | /** |
645 | * Client connection we are using for the test, if any. | 645 | * Client connection we are using for the test, if any. |
646 | */ | 646 | */ |
647 | struct GNUNET_CLIENT_Connection *client; | 647 | struct GNUNET_CLIENT_Connection *client; |
648 | 648 | ||
649 | /** | 649 | /** |
@@ -707,7 +707,7 @@ report_result (void *cls, | |||
707 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 707 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
708 | { | 708 | { |
709 | struct GNUNET_CLIENT_TestHandle *th = cls; | 709 | struct GNUNET_CLIENT_TestHandle *th = cls; |
710 | 710 | ||
711 | th->task = GNUNET_SCHEDULER_NO_TASK; | 711 | th->task = GNUNET_SCHEDULER_NO_TASK; |
712 | th->cb (th->cb_cls, th->result); | 712 | th->cb (th->cb_cls, th->result); |
713 | GNUNET_CLIENT_service_test_cancel (th); | 713 | GNUNET_CLIENT_service_test_cancel (th); |
@@ -726,7 +726,7 @@ service_test_report (struct GNUNET_CLIENT_TestHandle *th, | |||
726 | { | 726 | { |
727 | th->result = result; | 727 | th->result = result; |
728 | th->task = GNUNET_SCHEDULER_add_now (&report_result, | 728 | th->task = GNUNET_SCHEDULER_add_now (&report_result, |
729 | th); | 729 | th); |
730 | } | 730 | } |
731 | 731 | ||
732 | 732 | ||
@@ -775,18 +775,18 @@ write_test (void *cls, size_t size, void *buf) | |||
775 | th->th = NULL; | 775 | th->th = NULL; |
776 | if (size < sizeof (struct GNUNET_MessageHeader)) | 776 | if (size < sizeof (struct GNUNET_MessageHeader)) |
777 | { | 777 | { |
778 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 778 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
779 | "Failed to transmit TEST request.\n"); | 779 | "Failed to transmit TEST request.\n"); |
780 | service_test_report (th, GNUNET_NO); | 780 | service_test_report (th, GNUNET_NO); |
781 | return 0; /* client disconnected */ | 781 | return 0; /* client disconnected */ |
782 | } | 782 | } |
783 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 783 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
784 | "Transmitting `%s' request.\n", | 784 | "Transmitting `%s' request.\n", |
785 | "TEST"); | 785 | "TEST"); |
786 | msg = (struct GNUNET_MessageHeader *) buf; | 786 | msg = (struct GNUNET_MessageHeader *) buf; |
787 | msg->type = htons (GNUNET_MESSAGE_TYPE_TEST); | 787 | msg->type = htons (GNUNET_MESSAGE_TYPE_TEST); |
788 | msg->size = htons (sizeof (struct GNUNET_MessageHeader)); | 788 | msg->size = htons (sizeof (struct GNUNET_MessageHeader)); |
789 | GNUNET_CLIENT_receive (th->client, | 789 | GNUNET_CLIENT_receive (th->client, |
790 | &confirm_handler, th, | 790 | &confirm_handler, th, |
791 | GNUNET_TIME_absolute_get_remaining | 791 | GNUNET_TIME_absolute_get_remaining |
792 | (th->test_deadline)); | 792 | (th->test_deadline)); |
@@ -822,7 +822,7 @@ GNUNET_CLIENT_service_test (const char *service, | |||
822 | th->cb = cb; | 822 | th->cb = cb; |
823 | th->cb_cls = cb_cls; | 823 | th->cb_cls = cb_cls; |
824 | th->test_deadline = GNUNET_TIME_relative_to_absolute (timeout); | 824 | th->test_deadline = GNUNET_TIME_relative_to_absolute (timeout); |
825 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 825 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
826 | "Testing if service `%s' is running.\n", | 826 | "Testing if service `%s' is running.\n", |
827 | service); | 827 | service); |
828 | #ifdef AF_UNIX | 828 | #ifdef AF_UNIX |
@@ -874,7 +874,7 @@ GNUNET_CLIENT_service_test (const char *service, | |||
874 | service_test_report (th, GNUNET_YES); | 874 | service_test_report (th, GNUNET_YES); |
875 | return th; | 875 | return th; |
876 | } | 876 | } |
877 | (void) GNUNET_NETWORK_socket_close (sock); | 877 | (void) GNUNET_NETWORK_socket_close (sock); |
878 | /* let's try IP */ | 878 | /* let's try IP */ |
879 | } | 879 | } |
880 | } | 880 | } |
@@ -1026,7 +1026,7 @@ client_delayed_retry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1026 | { | 1026 | { |
1027 | struct GNUNET_CLIENT_TransmitHandle *th = cls; | 1027 | struct GNUNET_CLIENT_TransmitHandle *th = cls; |
1028 | struct GNUNET_TIME_Relative delay; | 1028 | struct GNUNET_TIME_Relative delay; |
1029 | 1029 | ||
1030 | th->reconnect_task = GNUNET_SCHEDULER_NO_TASK; | 1030 | th->reconnect_task = GNUNET_SCHEDULER_NO_TASK; |
1031 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 1031 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
1032 | { | 1032 | { |
@@ -1116,7 +1116,7 @@ client_notify (void *cls, size_t size, void *buf) | |||
1116 | { | 1116 | { |
1117 | GNUNET_CONNECTION_receive_cancel (client->connection); | 1117 | GNUNET_CONNECTION_receive_cancel (client->connection); |
1118 | client->in_receive = GNUNET_NO; | 1118 | client->in_receive = GNUNET_NO; |
1119 | } | 1119 | } |
1120 | GNUNET_CONNECTION_destroy (client->connection); | 1120 | GNUNET_CONNECTION_destroy (client->connection); |
1121 | client->connection = NULL; | 1121 | client->connection = NULL; |
1122 | delay = GNUNET_TIME_relative_min (delay, client->back_off); | 1122 | delay = GNUNET_TIME_relative_min (delay, client->back_off); |
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c index 27dda5e59..5ff92edc3 100644 --- a/src/util/common_allocation.c +++ b/src/util/common_allocation.c | |||
@@ -224,9 +224,9 @@ GNUNET_xfree_ (void *ptr, const char *filename, int linenumber) | |||
224 | { | 224 | { |
225 | const uint64_t baadfood = GNUNET_ntohll (0xBAADF00DBAADF00DLL); | 225 | const uint64_t baadfood = GNUNET_ntohll (0xBAADF00DBAADF00DLL); |
226 | uint64_t *base = ptr; | 226 | uint64_t *base = ptr; |
227 | size_t s = M_SIZE (ptr); | 227 | size_t s = M_SIZE (ptr); |
228 | size_t i; | 228 | size_t i; |
229 | 229 | ||
230 | for (i=0;i<s/8;i++) | 230 | for (i=0;i<s/8;i++) |
231 | base[i] = baadfood; | 231 | base[i] = baadfood; |
232 | memcpy (&base[s/8], &baadfood, s % 8); | 232 | memcpy (&base[s/8], &baadfood, s % 8); |
@@ -258,7 +258,7 @@ GNUNET_xstrdup_ (const char *str, const char *filename, int linenumber) | |||
258 | 258 | ||
259 | #if ! HAVE_STRNLEN | 259 | #if ! HAVE_STRNLEN |
260 | static size_t | 260 | static size_t |
261 | strnlen (const char *s, | 261 | strnlen (const char *s, |
262 | size_t n) | 262 | size_t n) |
263 | { | 263 | { |
264 | const char *e; | 264 | const char *e; |
diff --git a/src/util/common_endian.c b/src/util/common_endian.c index 247e9e876..1fb74600e 100644 --- a/src/util/common_endian.c +++ b/src/util/common_endian.c | |||
@@ -59,8 +59,8 @@ GNUNET_htonll (uint64_t n) | |||
59 | * @param d the value in network byte order | 59 | * @param d the value in network byte order |
60 | * @return the same value in host byte order | 60 | * @return the same value in host byte order |
61 | */ | 61 | */ |
62 | double | 62 | double |
63 | GNUNET_hton_double (double d) | 63 | GNUNET_hton_double (double d) |
64 | { | 64 | { |
65 | double res; | 65 | double res; |
66 | uint64_t *in = (uint64_t *) &d; | 66 | uint64_t *in = (uint64_t *) &d; |
@@ -77,15 +77,15 @@ GNUNET_hton_double (double d) | |||
77 | * @param d the value in network byte order | 77 | * @param d the value in network byte order |
78 | * @return the same value in host byte order | 78 | * @return the same value in host byte order |
79 | */ | 79 | */ |
80 | double | 80 | double |
81 | GNUNET_ntoh_double (double d) | 81 | GNUNET_ntoh_double (double d) |
82 | { | 82 | { |
83 | double res; | 83 | double res; |
84 | uint64_t *in = (uint64_t *) &d; | 84 | uint64_t *in = (uint64_t *) &d; |
85 | uint64_t *out = (uint64_t *) &res; | 85 | uint64_t *out = (uint64_t *) &res; |
86 | 86 | ||
87 | out[0] = GNUNET_ntohll(in[0]); | 87 | out[0] = GNUNET_ntohll(in[0]); |
88 | 88 | ||
89 | return res; | 89 | return res; |
90 | } | 90 | } |
91 | 91 | ||
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 59a2eeb29..93a104c8d 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -294,7 +294,7 @@ GNUNET_abort () | |||
294 | * Rotate logs, deleting the oldest log. | 294 | * Rotate logs, deleting the oldest log. |
295 | * | 295 | * |
296 | * @param new_name new name to add to the rotation | 296 | * @param new_name new name to add to the rotation |
297 | */ | 297 | */ |
298 | static void | 298 | static void |
299 | log_rotate (const char *new_name) | 299 | log_rotate (const char *new_name) |
300 | { | 300 | { |
@@ -313,7 +313,7 @@ log_rotate (const char *new_name) | |||
313 | GNUNET_free (discard); | 313 | GNUNET_free (discard); |
314 | } | 314 | } |
315 | rotation[rotation_off % ROTATION_KEEP] = GNUNET_strdup (new_name); | 315 | rotation[rotation_off % ROTATION_KEEP] = GNUNET_strdup (new_name); |
316 | rotation_off++; | 316 | rotation_off++; |
317 | } | 317 | } |
318 | 318 | ||
319 | 319 | ||
@@ -326,14 +326,14 @@ log_rotate (const char *new_name) | |||
326 | static int | 326 | static int |
327 | setup_log_file (const struct tm *tm) | 327 | setup_log_file (const struct tm *tm) |
328 | { | 328 | { |
329 | static char last_fn[PATH_MAX + 1]; | 329 | static char last_fn[PATH_MAX + 1]; |
330 | char fn[PATH_MAX + 1]; | 330 | char fn[PATH_MAX + 1]; |
331 | int dirwarn; | 331 | int dirwarn; |
332 | int altlog_fd; | 332 | int altlog_fd; |
333 | int dup_return; | 333 | int dup_return; |
334 | FILE *altlog; | 334 | FILE *altlog; |
335 | char *leftsquare; | 335 | char *leftsquare; |
336 | 336 | ||
337 | if (NULL == log_file_name) | 337 | if (NULL == log_file_name) |
338 | return GNUNET_SYSERR; | 338 | return GNUNET_SYSERR; |
339 | if (0 == strftime (fn, sizeof (fn), log_file_name, tm)) | 339 | if (0 == strftime (fn, sizeof (fn), log_file_name, tm)) |
@@ -392,7 +392,7 @@ setup_log_file (const struct tm *tm) | |||
392 | fn); | 392 | fn); |
393 | return GNUNET_SYSERR; | 393 | return GNUNET_SYSERR; |
394 | } | 394 | } |
395 | GNUNET_stderr = altlog; | 395 | GNUNET_stderr = altlog; |
396 | return GNUNET_OK; | 396 | return GNUNET_OK; |
397 | } | 397 | } |
398 | 398 | ||
@@ -665,7 +665,7 @@ parse_all_definitions () | |||
665 | */ | 665 | */ |
666 | int | 666 | int |
667 | GNUNET_log_setup (const char *comp, | 667 | GNUNET_log_setup (const char *comp, |
668 | const char *loglevel, | 668 | const char *loglevel, |
669 | const char *logfile) | 669 | const char *logfile) |
670 | { | 670 | { |
671 | const char *env_logfile; | 671 | const char *env_logfile; |
@@ -831,7 +831,7 @@ flush_bulk (const char *datestr) | |||
831 | * @param check_reset #GNUNET_YES to assert that the log skip counter is currently zero | 831 | * @param check_reset #GNUNET_YES to assert that the log skip counter is currently zero |
832 | */ | 832 | */ |
833 | void | 833 | void |
834 | GNUNET_log_skip (int n, | 834 | GNUNET_log_skip (int n, |
835 | int check_reset) | 835 | int check_reset) |
836 | { | 836 | { |
837 | int ok; | 837 | int ok; |
@@ -872,7 +872,7 @@ GNUNET_get_log_skip () | |||
872 | */ | 872 | */ |
873 | static void | 873 | static void |
874 | mylog (enum GNUNET_ErrorType kind, | 874 | mylog (enum GNUNET_ErrorType kind, |
875 | const char *comp, | 875 | const char *comp, |
876 | const char *message, | 876 | const char *message, |
877 | va_list va) | 877 | va_list va) |
878 | { | 878 | { |
@@ -949,7 +949,7 @@ mylog (enum GNUNET_ErrorType kind, | |||
949 | strftime (date2, DATE_STR_SIZE, "%b %d %H:%M:%S-%%06u", tmptr); | 949 | strftime (date2, DATE_STR_SIZE, "%b %d %H:%M:%S-%%06u", tmptr); |
950 | snprintf (date, sizeof (date), date2, timeofday.tv_usec); | 950 | snprintf (date, sizeof (date), date2, timeofday.tv_usec); |
951 | } | 951 | } |
952 | #endif | 952 | #endif |
953 | VSNPRINTF (buf, size, message, va); | 953 | VSNPRINTF (buf, size, message, va); |
954 | if (NULL != tmptr) | 954 | if (NULL != tmptr) |
955 | (void) setup_log_file (tmptr); | 955 | (void) setup_log_file (tmptr); |
@@ -959,7 +959,7 @@ mylog (enum GNUNET_ErrorType kind, | |||
959 | { | 959 | { |
960 | last_bulk_repeat++; | 960 | last_bulk_repeat++; |
961 | if ( (GNUNET_TIME_absolute_get_duration (last_bulk_time).rel_value_us > | 961 | if ( (GNUNET_TIME_absolute_get_duration (last_bulk_time).rel_value_us > |
962 | BULK_DELAY_THRESHOLD) || | 962 | BULK_DELAY_THRESHOLD) || |
963 | (last_bulk_repeat > BULK_REPEAT_THRESHOLD) ) | 963 | (last_bulk_repeat > BULK_REPEAT_THRESHOLD) ) |
964 | flush_bulk (date); | 964 | flush_bulk (date); |
965 | return; | 965 | return; |
@@ -983,7 +983,7 @@ mylog (enum GNUNET_ErrorType kind, | |||
983 | * @param ... arguments for format string | 983 | * @param ... arguments for format string |
984 | */ | 984 | */ |
985 | void | 985 | void |
986 | GNUNET_log_nocheck (enum GNUNET_ErrorType kind, | 986 | GNUNET_log_nocheck (enum GNUNET_ErrorType kind, |
987 | const char *message, ...) | 987 | const char *message, ...) |
988 | { | 988 | { |
989 | va_list va; | 989 | va_list va; |
@@ -1199,7 +1199,7 @@ GNUNET_a2s (const struct sockaddr *addr, socklen_t addrlen) | |||
1199 | * @param option name of missing option | 1199 | * @param option name of missing option |
1200 | */ | 1200 | */ |
1201 | void | 1201 | void |
1202 | GNUNET_log_config_missing (enum GNUNET_ErrorType kind, | 1202 | GNUNET_log_config_missing (enum GNUNET_ErrorType kind, |
1203 | const char *section, | 1203 | const char *section, |
1204 | const char *option) | 1204 | const char *option) |
1205 | { | 1205 | { |
@@ -1219,7 +1219,7 @@ GNUNET_log_config_missing (enum GNUNET_ErrorType kind, | |||
1219 | * @param required what is required that is invalid about the option | 1219 | * @param required what is required that is invalid about the option |
1220 | */ | 1220 | */ |
1221 | void | 1221 | void |
1222 | GNUNET_log_config_invalid (enum GNUNET_ErrorType kind, | 1222 | GNUNET_log_config_invalid (enum GNUNET_ErrorType kind, |
1223 | const char *section, | 1223 | const char *section, |
1224 | const char *option, | 1224 | const char *option, |
1225 | const char *required) | 1225 | const char *required) |
@@ -1240,7 +1240,7 @@ void __attribute__ ((constructor)) GNUNET_util_cl_init () | |||
1240 | GNInitWinEnv (NULL); | 1240 | GNInitWinEnv (NULL); |
1241 | #endif | 1241 | #endif |
1242 | #if WINDOWS | 1242 | #if WINDOWS |
1243 | if (!InitializeCriticalSectionAndSpinCount (&output_message_cs, 0x00000400)) | 1243 | if (!InitializeCriticalSectionAndSpinCount (&output_message_cs, 0x00000400)) |
1244 | GNUNET_abort (); | 1244 | GNUNET_abort (); |
1245 | #endif | 1245 | #endif |
1246 | } | 1246 | } |
diff --git a/src/util/configuration.c b/src/util/configuration.c index a1150aa9b..1b600b4c8 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c | |||
@@ -183,7 +183,7 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
183 | if (NULL == pos) | 183 | if (NULL == pos) |
184 | { | 184 | { |
185 | line_orig = GNUNET_strndup (&mem[r_bytes], line_size = to_read); | 185 | line_orig = GNUNET_strndup (&mem[r_bytes], line_size = to_read); |
186 | r_bytes += line_size; | 186 | r_bytes += line_size; |
187 | } | 187 | } |
188 | else | 188 | else |
189 | { | 189 | { |
@@ -220,10 +220,10 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
220 | continue; | 220 | continue; |
221 | 221 | ||
222 | /* handle special "@INLINE@" directive */ | 222 | /* handle special "@INLINE@" directive */ |
223 | if (0 == strncasecmp (line, | 223 | if (0 == strncasecmp (line, |
224 | "@INLINE@ ", | 224 | "@INLINE@ ", |
225 | strlen ("@INLINE@ "))) | 225 | strlen ("@INLINE@ "))) |
226 | { | 226 | { |
227 | /* @INLINE@ value */ | 227 | /* @INLINE@ value */ |
228 | value = &line[strlen ("@INLINE@ ")]; | 228 | value = &line[strlen ("@INLINE@ ")]; |
229 | if (GNUNET_YES == allow_inline) | 229 | if (GNUNET_YES == allow_inline) |
@@ -250,19 +250,19 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
250 | value = &line[1]; | 250 | value = &line[1]; |
251 | GNUNET_free (section); | 251 | GNUNET_free (section); |
252 | section = GNUNET_strdup (value); | 252 | section = GNUNET_strdup (value); |
253 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 253 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
254 | "Config section `%s'\n", | 254 | "Config section `%s'\n", |
255 | section); | 255 | section); |
256 | continue; | 256 | continue; |
257 | } | 257 | } |
258 | if (NULL != (eq = strchr (line, '='))) | 258 | if (NULL != (eq = strchr (line, '='))) |
259 | { | 259 | { |
260 | /* tag = value */ | 260 | /* tag = value */ |
261 | tag = GNUNET_strndup (line, eq - line); | 261 | tag = GNUNET_strndup (line, eq - line); |
262 | /* remove tailing whitespace */ | 262 | /* remove tailing whitespace */ |
263 | for (i = strlen (tag) - 1; (i >= 1) && (isspace ((unsigned char) tag[i]));i--) | 263 | for (i = strlen (tag) - 1; (i >= 1) && (isspace ((unsigned char) tag[i]));i--) |
264 | tag[i] = '\0'; | 264 | tag[i] = '\0'; |
265 | 265 | ||
266 | /* Strip whitespace */ | 266 | /* Strip whitespace */ |
267 | value = eq + 1; | 267 | value = eq + 1; |
268 | while (isspace ((unsigned char) value[0])) | 268 | while (isspace ((unsigned char) value[0])) |
@@ -285,14 +285,14 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
285 | } | 285 | } |
286 | /* parse error */ | 286 | /* parse error */ |
287 | LOG (GNUNET_ERROR_TYPE_WARNING, | 287 | LOG (GNUNET_ERROR_TYPE_WARNING, |
288 | _("Syntax error while deserializing in line %u\n"), | 288 | _("Syntax error while deserializing in line %u\n"), |
289 | nr); | 289 | nr); |
290 | ret = GNUNET_SYSERR; | 290 | ret = GNUNET_SYSERR; |
291 | break; | 291 | break; |
292 | } | 292 | } |
293 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Finished deserializing config\n"); | 293 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Finished deserializing config\n"); |
294 | GNUNET_free_non_null (line_orig); | 294 | GNUNET_free_non_null (line_orig); |
295 | GNUNET_free (section); | 295 | GNUNET_free (section); |
296 | GNUNET_assert ( (GNUNET_OK != ret) || (r_bytes == size) ); | 296 | GNUNET_assert ( (GNUNET_OK != ret) || (r_bytes == size) ); |
297 | return ret; | 297 | return ret; |
298 | } | 298 | } |
@@ -323,7 +323,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
323 | if (fn == NULL) | 323 | if (fn == NULL) |
324 | return GNUNET_SYSERR; | 324 | return GNUNET_SYSERR; |
325 | dirty = cfg->dirty; /* back up value! */ | 325 | dirty = cfg->dirty; /* back up value! */ |
326 | if (GNUNET_SYSERR == | 326 | if (GNUNET_SYSERR == |
327 | GNUNET_DISK_file_size (fn, &fs64, GNUNET_YES, GNUNET_YES)) | 327 | GNUNET_DISK_file_size (fn, &fs64, GNUNET_YES, GNUNET_YES)) |
328 | { | 328 | { |
329 | LOG (GNUNET_ERROR_TYPE_WARNING, | 329 | LOG (GNUNET_ERROR_TYPE_WARNING, |
@@ -349,7 +349,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
349 | } | 349 | } |
350 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Deserializing contents of file `%s'\n", fn); | 350 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Deserializing contents of file `%s'\n", fn); |
351 | GNUNET_free (fn); | 351 | GNUNET_free (fn); |
352 | ret = GNUNET_CONFIGURATION_deserialize (cfg, mem, fs, GNUNET_YES); | 352 | ret = GNUNET_CONFIGURATION_deserialize (cfg, mem, fs, GNUNET_YES); |
353 | GNUNET_free (mem); | 353 | GNUNET_free (mem); |
354 | /* restore dirty flag - anything we set in the meantime | 354 | /* restore dirty flag - anything we set in the meantime |
355 | * came from disk */ | 355 | * came from disk */ |
@@ -425,7 +425,7 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
425 | mem = GNUNET_malloc (m_size); | 425 | mem = GNUNET_malloc (m_size); |
426 | sec = cfg->sections; | 426 | sec = cfg->sections; |
427 | c_size = 0; | 427 | c_size = 0; |
428 | *size = c_size; | 428 | *size = c_size; |
429 | while (NULL != sec) | 429 | while (NULL != sec) |
430 | { | 430 | { |
431 | len = GNUNET_asprintf (&cbuf, "[%s]\n", sec->name); | 431 | len = GNUNET_asprintf (&cbuf, "[%s]\n", sec->name); |
@@ -487,9 +487,9 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
487 | } | 487 | } |
488 | cfg_buf = GNUNET_CONFIGURATION_serialize (cfg, &size); | 488 | cfg_buf = GNUNET_CONFIGURATION_serialize (cfg, &size); |
489 | if (size != GNUNET_DISK_fn_write (fn, cfg_buf, size, | 489 | if (size != GNUNET_DISK_fn_write (fn, cfg_buf, size, |
490 | GNUNET_DISK_PERM_USER_READ | 490 | GNUNET_DISK_PERM_USER_READ |
491 | | GNUNET_DISK_PERM_USER_WRITE | 491 | | GNUNET_DISK_PERM_USER_WRITE |
492 | | GNUNET_DISK_PERM_GROUP_READ | 492 | | GNUNET_DISK_PERM_GROUP_READ |
493 | | GNUNET_DISK_PERM_GROUP_WRITE)) | 493 | | GNUNET_DISK_PERM_GROUP_WRITE)) |
494 | { | 494 | { |
495 | GNUNET_free (fn); | 495 | GNUNET_free (fn); |
@@ -1090,7 +1090,7 @@ GNUNET_CONFIGURATION_get_value_filename (const struct | |||
1090 | const char *option, char **value) | 1090 | const char *option, char **value) |
1091 | { | 1091 | { |
1092 | char *tmp; | 1092 | char *tmp; |
1093 | 1093 | ||
1094 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to retrieve filename `%s' in section `%s'\n", option, section); | 1094 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to retrieve filename `%s' in section `%s'\n", option, section); |
1095 | if (GNUNET_OK != | 1095 | if (GNUNET_OK != |
1096 | GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &tmp)) | 1096 | GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &tmp)) |
diff --git a/src/util/connection.c b/src/util/connection.c index e90fa9f51..a429f2f7e 100644 --- a/src/util/connection.c +++ b/src/util/connection.c | |||
@@ -433,7 +433,7 @@ GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access, | |||
433 | connection->addr = uaddr; | 433 | connection->addr = uaddr; |
434 | connection->addrlen = addrlen; | 434 | connection->addrlen = addrlen; |
435 | connection->sock = sock; | 435 | connection->sock = sock; |
436 | LOG (GNUNET_ERROR_TYPE_INFO, | 436 | LOG (GNUNET_ERROR_TYPE_INFO, |
437 | _("Accepting connection from `%s': %p\n"), | 437 | _("Accepting connection from `%s': %p\n"), |
438 | GNUNET_a2s (uaddr, addrlen), connection); | 438 | GNUNET_a2s (uaddr, addrlen), connection); |
439 | return connection; | 439 | return connection; |
@@ -473,7 +473,7 @@ signal_receive_error (struct GNUNET_CONNECTION_Handle *connection, int errcode) | |||
473 | GNUNET_CONNECTION_Receiver receiver; | 473 | GNUNET_CONNECTION_Receiver receiver; |
474 | 474 | ||
475 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 475 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
476 | "Receive encounters error (%s), connection closed (%p)\n", | 476 | "Receive encounters error (%s), connection closed (%p)\n", |
477 | STRERROR (errcode), | 477 | STRERROR (errcode), |
478 | connection); | 478 | connection); |
479 | GNUNET_assert (NULL != (receiver = connection->receiver)); | 479 | GNUNET_assert (NULL != (receiver = connection->receiver)); |
@@ -608,14 +608,14 @@ receive_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | |||
608 | static void | 608 | static void |
609 | connect_success_continuation (struct GNUNET_CONNECTION_Handle *connection) | 609 | connect_success_continuation (struct GNUNET_CONNECTION_Handle *connection) |
610 | { | 610 | { |
611 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 611 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
612 | "Connection to `%s' succeeded! (%p)\n", | 612 | "Connection to `%s' succeeded! (%p)\n", |
613 | GNUNET_a2s (connection->addr, connection->addrlen), connection); | 613 | GNUNET_a2s (connection->addr, connection->addrlen), connection); |
614 | /* trigger jobs that waited for the connection */ | 614 | /* trigger jobs that waited for the connection */ |
615 | if (NULL != connection->receiver) | 615 | if (NULL != connection->receiver) |
616 | { | 616 | { |
617 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 617 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
618 | "Connection succeeded, starting with receiving data (%p)\n", | 618 | "Connection succeeded, starting with receiving data (%p)\n", |
619 | connection); | 619 | connection); |
620 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->read_task); | 620 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->read_task); |
621 | connection->read_task = | 621 | connection->read_task = |
@@ -989,10 +989,10 @@ GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *connection) | |||
989 | if ( (NULL != connection->sock) && | 989 | if ( (NULL != connection->sock) && |
990 | (GNUNET_YES != connection->persist) ) | 990 | (GNUNET_YES != connection->persist) ) |
991 | { | 991 | { |
992 | if ((GNUNET_YES != GNUNET_NETWORK_socket_shutdown (connection->sock, SHUT_RDWR)) && | 992 | if ((GNUNET_YES != GNUNET_NETWORK_socket_shutdown (connection->sock, SHUT_RDWR)) && |
993 | (ENOTCONN != errno) && | 993 | (ENOTCONN != errno) && |
994 | (ECONNRESET != errno) ) | 994 | (ECONNRESET != errno) ) |
995 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "shutdown"); | 995 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "shutdown"); |
996 | } | 996 | } |
997 | if (NULL != connection->sock) | 997 | if (NULL != connection->sock) |
998 | { | 998 | { |
@@ -1286,7 +1286,7 @@ transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1286 | return; | 1286 | return; |
1287 | } | 1287 | } |
1288 | GNUNET_assert (NULL != connection->sock); | 1288 | GNUNET_assert (NULL != connection->sock); |
1289 | if (NULL == tc->write_ready) | 1289 | if (NULL == tc->write_ready) |
1290 | { | 1290 | { |
1291 | /* special circumstances (in particular, PREREQ_DONE after | 1291 | /* special circumstances (in particular, PREREQ_DONE after |
1292 | * connect): not yet ready to write, but no "fatal" error either. | 1292 | * connect): not yet ready to write, but no "fatal" error either. |
@@ -1400,7 +1400,7 @@ GNUNET_CONNECTION_notify_transmit_ready (struct GNUNET_CONNECTION_Handle *connec | |||
1400 | connection->nth.notify_size = size; | 1400 | connection->nth.notify_size = size; |
1401 | connection->nth.transmit_timeout = GNUNET_TIME_relative_to_absolute (timeout); | 1401 | connection->nth.transmit_timeout = GNUNET_TIME_relative_to_absolute (timeout); |
1402 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->nth.timeout_task); | 1402 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->nth.timeout_task); |
1403 | if ((NULL == connection->sock) && | 1403 | if ((NULL == connection->sock) && |
1404 | (NULL == connection->ap_head) && | 1404 | (NULL == connection->ap_head) && |
1405 | (NULL == connection->dns_active)) | 1405 | (NULL == connection->dns_active)) |
1406 | { | 1406 | { |
diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c index f9487f98f..08a083df4 100644 --- a/src/util/container_bloomfilter.c +++ b/src/util/container_bloomfilter.c | |||
@@ -558,8 +558,8 @@ GNUNET_CONTAINER_bloomfilter_load (const char *filename, size_t size, | |||
558 | } | 558 | } |
559 | bf->bitArraySize = size; | 559 | bf->bitArraySize = size; |
560 | bf->addressesPerElement = k; | 560 | bf->addressesPerElement = k; |
561 | if (GNUNET_YES != must_read) | 561 | if (GNUNET_YES != must_read) |
562 | return bf; /* already done! */ | 562 | return bf; /* already done! */ |
563 | /* Read from the file what bits we can */ | 563 | /* Read from the file what bits we can */ |
564 | rbuff = GNUNET_malloc (BUFFSIZE); | 564 | rbuff = GNUNET_malloc (BUFFSIZE); |
565 | pos = 0; | 565 | pos = 0; |
diff --git a/src/util/container_meta_data.c b/src/util/container_meta_data.c index 6e77c40a2..ea1172d56 100644 --- a/src/util/container_meta_data.c +++ b/src/util/container_meta_data.c | |||
@@ -996,7 +996,7 @@ decompress (const char *input, size_t inputSize, size_t outputSize) | |||
996 | uncompress ((Bytef *) output, &olen, (const Bytef *) input, inputSize)) | 996 | uncompress ((Bytef *) output, &olen, (const Bytef *) input, inputSize)) |
997 | return output; | 997 | return output; |
998 | GNUNET_free (output); | 998 | GNUNET_free (output); |
999 | return NULL; | 999 | return NULL; |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | 1002 | ||
diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c index 24eae9f0d..d62f5f366 100644 --- a/src/util/container_multihashmap.c +++ b/src/util/container_multihashmap.c | |||
@@ -67,7 +67,7 @@ struct SmallMapEntry | |||
67 | * If there is a hash collision, we create a linked list. | 67 | * If there is a hash collision, we create a linked list. |
68 | */ | 68 | */ |
69 | struct SmallMapEntry *next; | 69 | struct SmallMapEntry *next; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Key for the entry. | 72 | * Key for the entry. |
73 | */ | 73 | */ |
@@ -162,10 +162,10 @@ struct GNUNET_CONTAINER_MultiHashMapIterator | |||
162 | * @param len initial size (map will grow as needed) | 162 | * @param len initial size (map will grow as needed) |
163 | * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default; | 163 | * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default; |
164 | * GNUNET_YES means that on 'put', the 'key' does not have | 164 | * GNUNET_YES means that on 'put', the 'key' does not have |
165 | * to be copied as the destination of the pointer is | 165 | * to be copied as the destination of the pointer is |
166 | * guaranteed to be life as long as the value is stored in | 166 | * guaranteed to be life as long as the value is stored in |
167 | * the hashmap. This can significantly reduce memory | 167 | * the hashmap. This can significantly reduce memory |
168 | * consumption, but of course is also a recipie for | 168 | * consumption, but of course is also a recipie for |
169 | * heap corruption if the assumption is not true. Only | 169 | * heap corruption if the assumption is not true. Only |
170 | * use this if (1) memory use is important in this case and | 170 | * use this if (1) memory use is important in this case and |
171 | * (2) you have triple-checked that the invariant holds | 171 | * (2) you have triple-checked that the invariant holds |
@@ -331,7 +331,7 @@ GNUNET_CONTAINER_multihashmap_iterate (const struct | |||
331 | struct SmallMapEntry *sme; | 331 | struct SmallMapEntry *sme; |
332 | struct SmallMapEntry *nxt; | 332 | struct SmallMapEntry *nxt; |
333 | 333 | ||
334 | nxt = me.sme; | 334 | nxt = me.sme; |
335 | while (NULL != (sme = nxt)) | 335 | while (NULL != (sme = nxt)) |
336 | { | 336 | { |
337 | nxt = sme->next; | 337 | nxt = sme->next; |
@@ -348,7 +348,7 @@ GNUNET_CONTAINER_multihashmap_iterate (const struct | |||
348 | struct BigMapEntry *bme; | 348 | struct BigMapEntry *bme; |
349 | struct BigMapEntry *nxt; | 349 | struct BigMapEntry *nxt; |
350 | 350 | ||
351 | nxt = me.bme; | 351 | nxt = me.bme; |
352 | while (NULL != (bme = nxt)) | 352 | while (NULL != (bme = nxt)) |
353 | { | 353 | { |
354 | nxt = bme->next; | 354 | nxt = bme->next; |
@@ -379,7 +379,7 @@ GNUNET_CONTAINER_multihashmap_iterate (const struct | |||
379 | */ | 379 | */ |
380 | int | 380 | int |
381 | GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map, | 381 | GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map, |
382 | const struct GNUNET_HashCode *key, | 382 | const struct GNUNET_HashCode *key, |
383 | const void *value) | 383 | const void *value) |
384 | { | 384 | { |
385 | union MapEntry me; | 385 | union MapEntry me; |
@@ -390,7 +390,7 @@ GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map, | |||
390 | i = idx_of (map, key); | 390 | i = idx_of (map, key); |
391 | me = map->map[i]; | 391 | me = map->map[i]; |
392 | if (map->use_small_entries) | 392 | if (map->use_small_entries) |
393 | { | 393 | { |
394 | struct SmallMapEntry *sme; | 394 | struct SmallMapEntry *sme; |
395 | struct SmallMapEntry *p; | 395 | struct SmallMapEntry *p; |
396 | 396 | ||
@@ -459,7 +459,7 @@ GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap | |||
459 | i = idx_of (map, key); | 459 | i = idx_of (map, key); |
460 | me = map->map[i]; | 460 | me = map->map[i]; |
461 | if (map->use_small_entries) | 461 | if (map->use_small_entries) |
462 | { | 462 | { |
463 | struct SmallMapEntry *sme; | 463 | struct SmallMapEntry *sme; |
464 | struct SmallMapEntry *p; | 464 | struct SmallMapEntry *p; |
465 | 465 | ||
@@ -668,7 +668,7 @@ grow (struct GNUNET_CONTAINER_MultiHashMap *map) | |||
668 | */ | 668 | */ |
669 | int | 669 | int |
670 | GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, | 670 | GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, |
671 | const struct GNUNET_HashCode *key, | 671 | const struct GNUNET_HashCode *key, |
672 | void *value, | 672 | void *value, |
673 | enum GNUNET_CONTAINER_MultiHashMapOption opt) | 673 | enum GNUNET_CONTAINER_MultiHashMapOption opt) |
674 | { | 674 | { |
@@ -684,7 +684,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, | |||
684 | { | 684 | { |
685 | struct SmallMapEntry *sme; | 685 | struct SmallMapEntry *sme; |
686 | 686 | ||
687 | for (sme = me.sme; NULL != sme; sme = sme->next) | 687 | for (sme = me.sme; NULL != sme; sme = sme->next) |
688 | if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_HashCode))) | 688 | if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_HashCode))) |
689 | { | 689 | { |
690 | if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) | 690 | if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) |
@@ -697,7 +697,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, | |||
697 | { | 697 | { |
698 | struct BigMapEntry *bme; | 698 | struct BigMapEntry *bme; |
699 | 699 | ||
700 | for (bme = me.bme; NULL != bme; bme = bme->next) | 700 | for (bme = me.bme; NULL != bme; bme = bme->next) |
701 | if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_HashCode))) | 701 | if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_HashCode))) |
702 | { | 702 | { |
703 | if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) | 703 | if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) |
@@ -715,7 +715,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, | |||
715 | if (map->use_small_entries) | 715 | if (map->use_small_entries) |
716 | { | 716 | { |
717 | struct SmallMapEntry *sme; | 717 | struct SmallMapEntry *sme; |
718 | 718 | ||
719 | sme = GNUNET_new (struct SmallMapEntry); | 719 | sme = GNUNET_new (struct SmallMapEntry); |
720 | sme->key = key; | 720 | sme->key = key; |
721 | sme->value = value; | 721 | sme->value = value; |
@@ -725,7 +725,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, | |||
725 | else | 725 | else |
726 | { | 726 | { |
727 | struct BigMapEntry *bme; | 727 | struct BigMapEntry *bme; |
728 | 728 | ||
729 | bme = GNUNET_new (struct BigMapEntry); | 729 | bme = GNUNET_new (struct BigMapEntry); |
730 | bme->key = *key; | 730 | bme->key = *key; |
731 | bme->value = value; | 731 | bme->value = value; |
@@ -761,9 +761,9 @@ GNUNET_CONTAINER_multihashmap_get_multiple (const struct | |||
761 | me = map->map[idx_of (map, key)]; | 761 | me = map->map[idx_of (map, key)]; |
762 | if (map->use_small_entries) | 762 | if (map->use_small_entries) |
763 | { | 763 | { |
764 | struct SmallMapEntry *sme; | 764 | struct SmallMapEntry *sme; |
765 | struct SmallMapEntry *nxt; | 765 | struct SmallMapEntry *nxt; |
766 | 766 | ||
767 | nxt = me.sme; | 767 | nxt = me.sme; |
768 | while (NULL != (sme = nxt)) | 768 | while (NULL != (sme = nxt)) |
769 | { | 769 | { |
@@ -777,9 +777,9 @@ GNUNET_CONTAINER_multihashmap_get_multiple (const struct | |||
777 | } | 777 | } |
778 | else | 778 | else |
779 | { | 779 | { |
780 | struct BigMapEntry *bme; | 780 | struct BigMapEntry *bme; |
781 | struct BigMapEntry *nxt; | 781 | struct BigMapEntry *nxt; |
782 | 782 | ||
783 | nxt = me.bme; | 783 | nxt = me.bme; |
784 | while (NULL != (bme = nxt)) | 784 | while (NULL != (bme = nxt)) |
785 | { | 785 | { |
diff --git a/src/util/container_multihashmap32.c b/src/util/container_multihashmap32.c index 5448a3cde..afb0e3653 100644 --- a/src/util/container_multihashmap32.c +++ b/src/util/container_multihashmap32.c | |||
@@ -350,7 +350,7 @@ GNUNET_CONTAINER_multihashmap32_contains (const struct | |||
350 | int | 350 | int |
351 | GNUNET_CONTAINER_multihashmap32_contains_value (const struct | 351 | GNUNET_CONTAINER_multihashmap32_contains_value (const struct |
352 | GNUNET_CONTAINER_MultiHashMap32 | 352 | GNUNET_CONTAINER_MultiHashMap32 |
353 | *map, | 353 | *map, |
354 | uint32_t key, | 354 | uint32_t key, |
355 | const void *value) | 355 | const void *value) |
356 | { | 356 | { |
@@ -470,7 +470,7 @@ int | |||
470 | GNUNET_CONTAINER_multihashmap32_get_multiple (const struct | 470 | GNUNET_CONTAINER_multihashmap32_get_multiple (const struct |
471 | GNUNET_CONTAINER_MultiHashMap32 | 471 | GNUNET_CONTAINER_MultiHashMap32 |
472 | *map, uint32_t key, | 472 | *map, uint32_t key, |
473 | GNUNET_CONTAINER_HashMapIterator32 | 473 | GNUNET_CONTAINER_HashMapIterator32 |
474 | it, void *it_cls) | 474 | it, void *it_cls) |
475 | { | 475 | { |
476 | int count; | 476 | int count; |
diff --git a/src/util/container_multipeermap.c b/src/util/container_multipeermap.c index 54a1d1635..8ec3a2077 100644 --- a/src/util/container_multipeermap.c +++ b/src/util/container_multipeermap.c | |||
@@ -67,7 +67,7 @@ struct SmallMapEntry | |||
67 | * If there is a hash collision, we create a linked list. | 67 | * If there is a hash collision, we create a linked list. |
68 | */ | 68 | */ |
69 | struct SmallMapEntry *next; | 69 | struct SmallMapEntry *next; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Key for the entry. | 72 | * Key for the entry. |
73 | */ | 73 | */ |
@@ -162,10 +162,10 @@ struct GNUNET_CONTAINER_MultiPeerMapIterator | |||
162 | * @param len initial size (map will grow as needed) | 162 | * @param len initial size (map will grow as needed) |
163 | * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default; | 163 | * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default; |
164 | * GNUNET_YES means that on 'put', the 'key' does not have | 164 | * GNUNET_YES means that on 'put', the 'key' does not have |
165 | * to be copied as the destination of the pointer is | 165 | * to be copied as the destination of the pointer is |
166 | * guaranteed to be life as long as the value is stored in | 166 | * guaranteed to be life as long as the value is stored in |
167 | * the hashmap. This can significantly reduce memory | 167 | * the hashmap. This can significantly reduce memory |
168 | * consumption, but of course is also a recipie for | 168 | * consumption, but of course is also a recipie for |
169 | * heap corruption if the assumption is not true. Only | 169 | * heap corruption if the assumption is not true. Only |
170 | * use this if (1) memory use is important in this case and | 170 | * use this if (1) memory use is important in this case and |
171 | * (2) you have triple-checked that the invariant holds | 171 | * (2) you have triple-checked that the invariant holds |
@@ -331,7 +331,7 @@ GNUNET_CONTAINER_multipeermap_iterate (const struct | |||
331 | struct SmallMapEntry *sme; | 331 | struct SmallMapEntry *sme; |
332 | struct SmallMapEntry *nxt; | 332 | struct SmallMapEntry *nxt; |
333 | 333 | ||
334 | nxt = me.sme; | 334 | nxt = me.sme; |
335 | while (NULL != (sme = nxt)) | 335 | while (NULL != (sme = nxt)) |
336 | { | 336 | { |
337 | nxt = sme->next; | 337 | nxt = sme->next; |
@@ -348,7 +348,7 @@ GNUNET_CONTAINER_multipeermap_iterate (const struct | |||
348 | struct BigMapEntry *bme; | 348 | struct BigMapEntry *bme; |
349 | struct BigMapEntry *nxt; | 349 | struct BigMapEntry *nxt; |
350 | 350 | ||
351 | nxt = me.bme; | 351 | nxt = me.bme; |
352 | while (NULL != (bme = nxt)) | 352 | while (NULL != (bme = nxt)) |
353 | { | 353 | { |
354 | nxt = bme->next; | 354 | nxt = bme->next; |
@@ -379,7 +379,7 @@ GNUNET_CONTAINER_multipeermap_iterate (const struct | |||
379 | */ | 379 | */ |
380 | int | 380 | int |
381 | GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map, | 381 | GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map, |
382 | const struct GNUNET_PeerIdentity *key, | 382 | const struct GNUNET_PeerIdentity *key, |
383 | const void *value) | 383 | const void *value) |
384 | { | 384 | { |
385 | union MapEntry me; | 385 | union MapEntry me; |
@@ -390,7 +390,7 @@ GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map, | |||
390 | i = idx_of (map, key); | 390 | i = idx_of (map, key); |
391 | me = map->map[i]; | 391 | me = map->map[i]; |
392 | if (map->use_small_entries) | 392 | if (map->use_small_entries) |
393 | { | 393 | { |
394 | struct SmallMapEntry *sme; | 394 | struct SmallMapEntry *sme; |
395 | struct SmallMapEntry *p; | 395 | struct SmallMapEntry *p; |
396 | 396 | ||
@@ -459,7 +459,7 @@ GNUNET_CONTAINER_multipeermap_remove_all (struct GNUNET_CONTAINER_MultiPeerMap | |||
459 | i = idx_of (map, key); | 459 | i = idx_of (map, key); |
460 | me = map->map[i]; | 460 | me = map->map[i]; |
461 | if (map->use_small_entries) | 461 | if (map->use_small_entries) |
462 | { | 462 | { |
463 | struct SmallMapEntry *sme; | 463 | struct SmallMapEntry *sme; |
464 | struct SmallMapEntry *p; | 464 | struct SmallMapEntry *p; |
465 | 465 | ||
@@ -668,7 +668,7 @@ grow (struct GNUNET_CONTAINER_MultiPeerMap *map) | |||
668 | */ | 668 | */ |
669 | int | 669 | int |
670 | GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map, | 670 | GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map, |
671 | const struct GNUNET_PeerIdentity *key, | 671 | const struct GNUNET_PeerIdentity *key, |
672 | void *value, | 672 | void *value, |
673 | enum GNUNET_CONTAINER_MultiHashMapOption opt) | 673 | enum GNUNET_CONTAINER_MultiHashMapOption opt) |
674 | { | 674 | { |
@@ -684,7 +684,7 @@ GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map, | |||
684 | { | 684 | { |
685 | struct SmallMapEntry *sme; | 685 | struct SmallMapEntry *sme; |
686 | 686 | ||
687 | for (sme = me.sme; NULL != sme; sme = sme->next) | 687 | for (sme = me.sme; NULL != sme; sme = sme->next) |
688 | if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_PeerIdentity))) | 688 | if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_PeerIdentity))) |
689 | { | 689 | { |
690 | if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) | 690 | if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) |
@@ -697,7 +697,7 @@ GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map, | |||
697 | { | 697 | { |
698 | struct BigMapEntry *bme; | 698 | struct BigMapEntry *bme; |
699 | 699 | ||
700 | for (bme = me.bme; NULL != bme; bme = bme->next) | 700 | for (bme = me.bme; NULL != bme; bme = bme->next) |
701 | if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_PeerIdentity))) | 701 | if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_PeerIdentity))) |
702 | { | 702 | { |
703 | if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) | 703 | if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) |
@@ -715,7 +715,7 @@ GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map, | |||
715 | if (map->use_small_entries) | 715 | if (map->use_small_entries) |
716 | { | 716 | { |
717 | struct SmallMapEntry *sme; | 717 | struct SmallMapEntry *sme; |
718 | 718 | ||
719 | sme = GNUNET_new (struct SmallMapEntry); | 719 | sme = GNUNET_new (struct SmallMapEntry); |
720 | sme->key = key; | 720 | sme->key = key; |
721 | sme->value = value; | 721 | sme->value = value; |
@@ -725,7 +725,7 @@ GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map, | |||
725 | else | 725 | else |
726 | { | 726 | { |
727 | struct BigMapEntry *bme; | 727 | struct BigMapEntry *bme; |
728 | 728 | ||
729 | bme = GNUNET_new (struct BigMapEntry); | 729 | bme = GNUNET_new (struct BigMapEntry); |
730 | bme->key = *key; | 730 | bme->key = *key; |
731 | bme->value = value; | 731 | bme->value = value; |
@@ -760,9 +760,9 @@ GNUNET_CONTAINER_multipeermap_get_multiple (const struct GNUNET_CONTAINER_MultiP | |||
760 | me = map->map[idx_of (map, key)]; | 760 | me = map->map[idx_of (map, key)]; |
761 | if (map->use_small_entries) | 761 | if (map->use_small_entries) |
762 | { | 762 | { |
763 | struct SmallMapEntry *sme; | 763 | struct SmallMapEntry *sme; |
764 | struct SmallMapEntry *nxt; | 764 | struct SmallMapEntry *nxt; |
765 | 765 | ||
766 | nxt = me.sme; | 766 | nxt = me.sme; |
767 | while (NULL != (sme = nxt)) | 767 | while (NULL != (sme = nxt)) |
768 | { | 768 | { |
@@ -776,9 +776,9 @@ GNUNET_CONTAINER_multipeermap_get_multiple (const struct GNUNET_CONTAINER_MultiP | |||
776 | } | 776 | } |
777 | else | 777 | else |
778 | { | 778 | { |
779 | struct BigMapEntry *bme; | 779 | struct BigMapEntry *bme; |
780 | struct BigMapEntry *nxt; | 780 | struct BigMapEntry *nxt; |
781 | 781 | ||
782 | nxt = me.bme; | 782 | nxt = me.bme; |
783 | while (NULL != (bme = nxt)) | 783 | while (NULL != (bme = nxt)) |
784 | { | 784 | { |
diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c index 144cfbd45..34edec3de 100644 --- a/src/util/crypto_ecc.c +++ b/src/util/crypto_ecc.c | |||
@@ -27,14 +27,14 @@ | |||
27 | #include <gcrypt.h> | 27 | #include <gcrypt.h> |
28 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
29 | 29 | ||
30 | #define EXTRA_CHECKS ALLOW_EXTRA_CHECKS | 30 | #define EXTRA_CHECKS ALLOW_EXTRA_CHECKS |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Name of the curve we are using. Note that we have hard-coded | 33 | * Name of the curve we are using. Note that we have hard-coded |
34 | * structs that use 256 bits, so using a bigger curve will require | 34 | * structs that use 256 bits, so using a bigger curve will require |
35 | * changes that break stuff badly. The name of the curve given here | 35 | * changes that break stuff badly. The name of the curve given here |
36 | * must be agreed by all peers and be supported by libgcrypt. | 36 | * must be agreed by all peers and be supported by libgcrypt. |
37 | * | 37 | * |
38 | * NOTE: this will change to Curve25519 before GNUnet 0.10.0. | 38 | * NOTE: this will change to Curve25519 before GNUnet 0.10.0. |
39 | */ | 39 | */ |
40 | #define CURVE "NIST P-256" | 40 | #define CURVE "NIST P-256" |
@@ -73,13 +73,13 @@ key_from_sexp (gcry_mpi_t * array, gcry_sexp_t sexp, const char *topname, | |||
73 | unsigned int idx; | 73 | unsigned int idx; |
74 | 74 | ||
75 | list = gcry_sexp_find_token (sexp, topname, 0); | 75 | list = gcry_sexp_find_token (sexp, topname, 0); |
76 | if (! list) | 76 | if (! list) |
77 | return 1; | 77 | return 1; |
78 | l2 = gcry_sexp_cadr (list); | 78 | l2 = gcry_sexp_cadr (list); |
79 | gcry_sexp_release (list); | 79 | gcry_sexp_release (list); |
80 | list = l2; | 80 | list = l2; |
81 | if (! list) | 81 | if (! list) |
82 | return 2; | 82 | return 2; |
83 | 83 | ||
84 | idx = 0; | 84 | idx = 0; |
85 | for (s = elems; *s; s++, idx++) | 85 | for (s = elems; *s; s++, idx++) |
@@ -136,7 +136,7 @@ adjust (unsigned char *buf, | |||
136 | 136 | ||
137 | /** | 137 | /** |
138 | * Output the given MPI value to the given buffer. | 138 | * Output the given MPI value to the given buffer. |
139 | * | 139 | * |
140 | * @param buf where to output to | 140 | * @param buf where to output to |
141 | * @param size number of bytes in @a buf | 141 | * @param size number of bytes in @a buf |
142 | * @param val value to write to @a buf | 142 | * @param val value to write to @a buf |
@@ -171,7 +171,7 @@ mpi_scan (gcry_mpi_t *result, | |||
171 | int rc; | 171 | int rc; |
172 | 172 | ||
173 | if (0 != (rc = gcry_mpi_scan (result, | 173 | if (0 != (rc = gcry_mpi_scan (result, |
174 | GCRYMPI_FMT_USG, | 174 | GCRYMPI_FMT_USG, |
175 | data, size, &size))) | 175 | data, size, &size))) |
176 | { | 176 | { |
177 | LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_scan", rc); | 177 | LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_scan", rc); |
@@ -203,7 +203,7 @@ decode_private_key (const struct GNUNET_CRYPTO_EccPrivateKey *priv) | |||
203 | gcry_mpi_release (d); | 203 | gcry_mpi_release (d); |
204 | if (0 != rc) | 204 | if (0 != rc) |
205 | { | 205 | { |
206 | LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc); | 206 | LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc); |
207 | GNUNET_assert (0); | 207 | GNUNET_assert (0); |
208 | } | 208 | } |
209 | #if EXTRA_CHECKS | 209 | #if EXTRA_CHECKS |
@@ -224,7 +224,7 @@ decode_private_key (const struct GNUNET_CRYPTO_EccPrivateKey *priv) | |||
224 | * @param q point on curve | 224 | * @param q point on curve |
225 | * @param pub public key struct to initialize | 225 | * @param pub public key struct to initialize |
226 | * @param ctx context to use for ECC operations | 226 | * @param ctx context to use for ECC operations |
227 | */ | 227 | */ |
228 | static void | 228 | static void |
229 | point_to_public_sign_key (gcry_mpi_point_t q, | 229 | point_to_public_sign_key (gcry_mpi_point_t q, |
230 | gcry_ctx_t ctx, | 230 | gcry_ctx_t ctx, |
@@ -232,7 +232,7 @@ point_to_public_sign_key (gcry_mpi_point_t q, | |||
232 | { | 232 | { |
233 | gcry_mpi_t q_x; | 233 | gcry_mpi_t q_x; |
234 | gcry_mpi_t q_y; | 234 | gcry_mpi_t q_y; |
235 | 235 | ||
236 | q_x = gcry_mpi_new (256); | 236 | q_x = gcry_mpi_new (256); |
237 | q_y = gcry_mpi_new (256); | 237 | q_y = gcry_mpi_new (256); |
238 | if (gcry_mpi_ec_get_affine (q_x, q_y, q, ctx)) | 238 | if (gcry_mpi_ec_get_affine (q_x, q_y, q, ctx)) |
@@ -255,7 +255,7 @@ point_to_public_sign_key (gcry_mpi_point_t q, | |||
255 | * @param q point on curve | 255 | * @param q point on curve |
256 | * @param pub public key struct to initialize | 256 | * @param pub public key struct to initialize |
257 | * @param ctx context to use for ECC operations | 257 | * @param ctx context to use for ECC operations |
258 | */ | 258 | */ |
259 | static void | 259 | static void |
260 | point_to_public_encrypt_key (gcry_mpi_point_t q, | 260 | point_to_public_encrypt_key (gcry_mpi_point_t q, |
261 | gcry_ctx_t ctx, | 261 | gcry_ctx_t ctx, |
@@ -263,7 +263,7 @@ point_to_public_encrypt_key (gcry_mpi_point_t q, | |||
263 | { | 263 | { |
264 | gcry_mpi_t q_x; | 264 | gcry_mpi_t q_x; |
265 | gcry_mpi_t q_y; | 265 | gcry_mpi_t q_y; |
266 | 266 | ||
267 | q_x = gcry_mpi_new (256); | 267 | q_x = gcry_mpi_new (256); |
268 | q_y = gcry_mpi_new (256); | 268 | q_y = gcry_mpi_new (256); |
269 | if (gcry_mpi_ec_get_affine (q_x, q_y, q, ctx)) | 269 | if (gcry_mpi_ec_get_affine (q_x, q_y, q, ctx)) |
@@ -346,9 +346,9 @@ GNUNET_CRYPTO_ecc_public_sign_key_to_string (const struct GNUNET_CRYPTO_EccPubli | |||
346 | keylen += 5 - keylen % 5; | 346 | keylen += 5 - keylen % 5; |
347 | keylen /= 5; | 347 | keylen /= 5; |
348 | pubkeybuf = GNUNET_malloc (keylen + 1); | 348 | pubkeybuf = GNUNET_malloc (keylen + 1); |
349 | end = GNUNET_STRINGS_data_to_string ((unsigned char *) pub, | 349 | end = GNUNET_STRINGS_data_to_string ((unsigned char *) pub, |
350 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), | 350 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), |
351 | pubkeybuf, | 351 | pubkeybuf, |
352 | keylen); | 352 | keylen); |
353 | if (NULL == end) | 353 | if (NULL == end) |
354 | { | 354 | { |
@@ -369,7 +369,7 @@ GNUNET_CRYPTO_ecc_public_sign_key_to_string (const struct GNUNET_CRYPTO_EccPubli | |||
369 | * @return #GNUNET_OK on success | 369 | * @return #GNUNET_OK on success |
370 | */ | 370 | */ |
371 | int | 371 | int |
372 | GNUNET_CRYPTO_ecc_public_sign_key_from_string (const char *enc, | 372 | GNUNET_CRYPTO_ecc_public_sign_key_from_string (const char *enc, |
373 | size_t enclen, | 373 | size_t enclen, |
374 | struct GNUNET_CRYPTO_EccPublicSignKey *pub) | 374 | struct GNUNET_CRYPTO_EccPublicSignKey *pub) |
375 | { | 375 | { |
@@ -408,7 +408,7 @@ decode_public_sign_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub) | |||
408 | mpi_scan (&q_x, pub->q_x, sizeof (pub->q_x)); | 408 | mpi_scan (&q_x, pub->q_x, sizeof (pub->q_x)); |
409 | mpi_scan (&q_y, pub->q_y, sizeof (pub->q_y)); | 409 | mpi_scan (&q_y, pub->q_y, sizeof (pub->q_y)); |
410 | q = gcry_mpi_point_new (256); | 410 | q = gcry_mpi_point_new (256); |
411 | gcry_mpi_point_set (q, q_x, q_y, GCRYMPI_CONST_ONE); | 411 | gcry_mpi_point_set (q, q_x, q_y, GCRYMPI_CONST_ONE); |
412 | gcry_mpi_release (q_x); | 412 | gcry_mpi_release (q_x); |
413 | gcry_mpi_release (q_y); | 413 | gcry_mpi_release (q_y); |
414 | 414 | ||
@@ -426,7 +426,7 @@ decode_public_sign_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub) | |||
426 | 426 | ||
427 | /** | 427 | /** |
428 | * @ingroup crypto | 428 | * @ingroup crypto |
429 | * Clear memory that was used to store a private key. | 429 | * Clear memory that was used to store a private key. |
430 | * | 430 | * |
431 | * @param pk location of the key | 431 | * @param pk location of the key |
432 | */ | 432 | */ |
@@ -503,8 +503,8 @@ GNUNET_CRYPTO_ecc_key_get_anonymous () | |||
503 | 503 | ||
504 | if (once) | 504 | if (once) |
505 | return &anonymous; | 505 | return &anonymous; |
506 | mpi_print (anonymous.d, | 506 | mpi_print (anonymous.d, |
507 | sizeof (anonymous.d), | 507 | sizeof (anonymous.d), |
508 | GCRYMPI_CONST_ONE); | 508 | GCRYMPI_CONST_ONE); |
509 | once = 1; | 509 | once = 1; |
510 | return &anonymous; | 510 | return &anonymous; |
@@ -700,7 +700,7 @@ GNUNET_CRYPTO_ecc_key_create_from_configuration (const struct GNUNET_CONFIGURATI | |||
700 | struct GNUNET_CRYPTO_EccPrivateKey *priv; | 700 | struct GNUNET_CRYPTO_EccPrivateKey *priv; |
701 | char *fn; | 701 | char *fn; |
702 | 702 | ||
703 | if (GNUNET_OK != | 703 | if (GNUNET_OK != |
704 | GNUNET_CONFIGURATION_get_value_filename (cfg, "PEER", "PRIVATE_KEY", &fn)) | 704 | GNUNET_CONFIGURATION_get_value_filename (cfg, "PEER", "PRIVATE_KEY", &fn)) |
705 | return NULL; | 705 | return NULL; |
706 | priv = GNUNET_CRYPTO_ecc_key_create_from_file (fn); | 706 | priv = GNUNET_CRYPTO_ecc_key_create_from_file (fn); |
@@ -865,7 +865,7 @@ GNUNET_CRYPTO_ecc_verify (uint32_t purpose, | |||
865 | /* build s-expression for signature */ | 865 | /* build s-expression for signature */ |
866 | mpi_scan (&r, sig->r, sizeof (sig->r)); | 866 | mpi_scan (&r, sig->r, sizeof (sig->r)); |
867 | mpi_scan (&s, sig->s, sizeof (sig->s)); | 867 | mpi_scan (&s, sig->s, sizeof (sig->s)); |
868 | if (0 != (rc = gcry_sexp_build (&sig_sexpr, NULL, | 868 | if (0 != (rc = gcry_sexp_build (&sig_sexpr, NULL, |
869 | "(sig-val(ecdsa(r %m)(s %m)))", | 869 | "(sig-val(ecdsa(r %m)(s %m)))", |
870 | r, s))) | 870 | r, s))) |
871 | { | 871 | { |
@@ -917,7 +917,7 @@ decode_public_encrypt_key (const struct GNUNET_CRYPTO_EccPublicEncryptKey *pub) | |||
917 | mpi_scan (&q_x, pub->q_x, sizeof (pub->q_x)); | 917 | mpi_scan (&q_x, pub->q_x, sizeof (pub->q_x)); |
918 | mpi_scan (&q_y, pub->q_y, sizeof (pub->q_y)); | 918 | mpi_scan (&q_y, pub->q_y, sizeof (pub->q_y)); |
919 | q = gcry_mpi_point_new (256); | 919 | q = gcry_mpi_point_new (256); |
920 | gcry_mpi_point_set (q, q_x, q_y, GCRYMPI_CONST_ONE); | 920 | gcry_mpi_point_set (q, q_x, q_y, GCRYMPI_CONST_ONE); |
921 | gcry_mpi_release (q_x); | 921 | gcry_mpi_release (q_x); |
922 | gcry_mpi_release (q_y); | 922 | gcry_mpi_release (q_y); |
923 | 923 | ||
@@ -945,7 +945,7 @@ int | |||
945 | GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv, | 945 | GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv, |
946 | const struct GNUNET_CRYPTO_EccPublicEncryptKey *pub, | 946 | const struct GNUNET_CRYPTO_EccPublicEncryptKey *pub, |
947 | struct GNUNET_HashCode *key_material) | 947 | struct GNUNET_HashCode *key_material) |
948 | { | 948 | { |
949 | gcry_mpi_point_t result; | 949 | gcry_mpi_point_t result; |
950 | gcry_mpi_point_t q; | 950 | gcry_mpi_point_t q; |
951 | gcry_mpi_t d; | 951 | gcry_mpi_t d; |
@@ -993,7 +993,7 @@ GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv, | |||
993 | 993 | ||
994 | 994 | ||
995 | /** | 995 | /** |
996 | * Derive the 'h' value for key derivation, where | 996 | * Derive the 'h' value for key derivation, where |
997 | * 'h = H(l,P)'. | 997 | * 'h = H(l,P)'. |
998 | * | 998 | * |
999 | * @param pub public key for deriviation | 999 | * @param pub public key for deriviation |
@@ -1001,8 +1001,8 @@ GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv, | |||
1001 | * @param context additional context to use for HKDF of 'h'; | 1001 | * @param context additional context to use for HKDF of 'h'; |
1002 | * typically the name of the subsystem/application | 1002 | * typically the name of the subsystem/application |
1003 | * @return h value | 1003 | * @return h value |
1004 | */ | 1004 | */ |
1005 | static gcry_mpi_t | 1005 | static gcry_mpi_t |
1006 | derive_h (const struct GNUNET_CRYPTO_EccPublicSignKey *pub, | 1006 | derive_h (const struct GNUNET_CRYPTO_EccPublicSignKey *pub, |
1007 | const char *label, | 1007 | const char *label, |
1008 | const char *context) | 1008 | const char *context) |
@@ -1090,7 +1090,7 @@ GNUNET_CRYPTO_ecc_public_key_derive (const struct GNUNET_CRYPTO_EccPublicSignKey | |||
1090 | gcry_mpi_point_t v; | 1090 | gcry_mpi_point_t v; |
1091 | 1091 | ||
1092 | GNUNET_assert (0 == gcry_mpi_ec_new (&ctx, NULL, CURVE)); | 1092 | GNUNET_assert (0 == gcry_mpi_ec_new (&ctx, NULL, CURVE)); |
1093 | 1093 | ||
1094 | /* obtain point 'q' from original public key */ | 1094 | /* obtain point 'q' from original public key */ |
1095 | mpi_scan (&q_x, pub->q_x, sizeof (pub->q_x)); | 1095 | mpi_scan (&q_x, pub->q_x, sizeof (pub->q_x)); |
1096 | mpi_scan (&q_y, pub->q_y, sizeof (pub->q_y)); | 1096 | mpi_scan (&q_y, pub->q_y, sizeof (pub->q_y)); |
diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c index 67cf92d17..cd2ea75bf 100644 --- a/src/util/crypto_hash.c +++ b/src/util/crypto_hash.c | |||
@@ -289,7 +289,7 @@ GNUNET_CRYPTO_hash_from_string2 (const char *enc, | |||
289 | 289 | ||
290 | /** | 290 | /** |
291 | * @ingroup hash | 291 | * @ingroup hash |
292 | * | 292 | * |
293 | * Compute the distance between 2 hashcodes. The computation must be | 293 | * Compute the distance between 2 hashcodes. The computation must be |
294 | * fast, not involve bits[0] or bits[4] (they're used elsewhere), and be | 294 | * fast, not involve bits[0] or bits[4] (they're used elsewhere), and be |
295 | * somewhat consistent. And of course, the result should be a positive | 295 | * somewhat consistent. And of course, the result should be a positive |
@@ -457,7 +457,7 @@ GNUNET_CRYPTO_hash_matching_bits (const struct GNUNET_HashCode * first, | |||
457 | * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2. | 457 | * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2. |
458 | */ | 458 | */ |
459 | int | 459 | int |
460 | GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode *h1, | 460 | GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode *h1, |
461 | const struct GNUNET_HashCode *h2) | 461 | const struct GNUNET_HashCode *h2) |
462 | { | 462 | { |
463 | unsigned int *i1; | 463 | unsigned int *i1; |
@@ -543,8 +543,8 @@ GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key, | |||
543 | const void *salt, size_t salt_len, | 543 | const void *salt, size_t salt_len, |
544 | va_list argp) | 544 | va_list argp) |
545 | { | 545 | { |
546 | GNUNET_CRYPTO_kdf_v (key->key, sizeof (key->key), | 546 | GNUNET_CRYPTO_kdf_v (key->key, sizeof (key->key), |
547 | salt, salt_len, | 547 | salt, salt_len, |
548 | rkey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), | 548 | rkey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), |
549 | argp); | 549 | argp); |
550 | } | 550 | } |
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c index e3388faad..e66c3c71b 100644 --- a/src/util/crypto_random.c +++ b/src/util/crypto_random.c | |||
@@ -279,7 +279,7 @@ entropy_generator (void *cls, const char *what, int printchar, int current, | |||
279 | LOG (GNUNET_ERROR_TYPE_INFO, _("Starting `%s' process to generate entropy\n"), | 279 | LOG (GNUNET_ERROR_TYPE_INFO, _("Starting `%s' process to generate entropy\n"), |
280 | "find"); | 280 | "find"); |
281 | genproc = | 281 | genproc = |
282 | GNUNET_OS_start_process (GNUNET_NO, 0, | 282 | GNUNET_OS_start_process (GNUNET_NO, 0, |
283 | NULL, NULL, "sh", "sh", "-c", | 283 | NULL, NULL, "sh", "sh", "-c", |
284 | "exec find / -mount -type f -exec cp {} /dev/null \\; 2>/dev/null", | 284 | "exec find / -mount -type f -exec cp {} /dev/null \\; 2>/dev/null", |
285 | NULL); | 285 | NULL); |
@@ -298,7 +298,7 @@ killfind () | |||
298 | } | 298 | } |
299 | 299 | ||
300 | 300 | ||
301 | void __attribute__ ((constructor)) | 301 | void __attribute__ ((constructor)) |
302 | GNUNET_CRYPTO_random_init () | 302 | GNUNET_CRYPTO_random_init () |
303 | { | 303 | { |
304 | gcry_error_t rc; | 304 | gcry_error_t rc; |
@@ -319,7 +319,7 @@ GNUNET_CRYPTO_random_init () | |||
319 | if ((rc = gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0))) | 319 | if ((rc = gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0))) |
320 | FPRINTF (stderr, "Failed to set libgcrypt option %s: %s\n", "ENABLE_QUICK_RANDOM", | 320 | FPRINTF (stderr, "Failed to set libgcrypt option %s: %s\n", "ENABLE_QUICK_RANDOM", |
321 | gcry_strerror (rc)); | 321 | gcry_strerror (rc)); |
322 | 322 | ||
323 | #ifdef GCRYCTL_INITIALIZATION_FINISHED | 323 | #ifdef GCRYCTL_INITIALIZATION_FINISHED |
324 | gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); | 324 | gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); |
325 | #endif | 325 | #endif |
@@ -334,7 +334,7 @@ GNUNET_CRYPTO_random_init () | |||
334 | } | 334 | } |
335 | 335 | ||
336 | 336 | ||
337 | void __attribute__ ((destructor)) | 337 | void __attribute__ ((destructor)) |
338 | GNUNET_CRYPTO_random_fini () | 338 | GNUNET_CRYPTO_random_fini () |
339 | { | 339 | { |
340 | gcry_set_progress_handler (NULL, NULL); | 340 | gcry_set_progress_handler (NULL, NULL); |
diff --git a/src/util/crypto_symmetric.c b/src/util/crypto_symmetric.c index 97e2a4cfb..f6810ec5a 100644 --- a/src/util/crypto_symmetric.c +++ b/src/util/crypto_symmetric.c | |||
@@ -39,10 +39,10 @@ | |||
39 | void | 39 | void |
40 | GNUNET_CRYPTO_symmetric_create_session_key (struct GNUNET_CRYPTO_SymmetricSessionKey *key) | 40 | GNUNET_CRYPTO_symmetric_create_session_key (struct GNUNET_CRYPTO_SymmetricSessionKey *key) |
41 | { | 41 | { |
42 | gcry_randomize (key->aes_key, | 42 | gcry_randomize (key->aes_key, |
43 | GNUNET_CRYPTO_AES_KEY_LENGTH, | 43 | GNUNET_CRYPTO_AES_KEY_LENGTH, |
44 | GCRY_STRONG_RANDOM); | 44 | GCRY_STRONG_RANDOM); |
45 | gcry_randomize (key->twofish_key, | 45 | gcry_randomize (key->twofish_key, |
46 | GNUNET_CRYPTO_AES_KEY_LENGTH, | 46 | GNUNET_CRYPTO_AES_KEY_LENGTH, |
47 | GCRY_STRONG_RANDOM); | 47 | GCRY_STRONG_RANDOM); |
48 | } | 48 | } |
@@ -66,12 +66,12 @@ setup_cipher_aes (gcry_cipher_hd_t *handle, | |||
66 | GNUNET_assert (0 == | 66 | GNUNET_assert (0 == |
67 | gcry_cipher_open (handle, GCRY_CIPHER_AES256, | 67 | gcry_cipher_open (handle, GCRY_CIPHER_AES256, |
68 | GCRY_CIPHER_MODE_CFB, 0)); | 68 | GCRY_CIPHER_MODE_CFB, 0)); |
69 | rc = gcry_cipher_setkey (*handle, | 69 | rc = gcry_cipher_setkey (*handle, |
70 | sessionkey->aes_key, | 70 | sessionkey->aes_key, |
71 | sizeof (sessionkey->aes_key)); | 71 | sizeof (sessionkey->aes_key)); |
72 | GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); | 72 | GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); |
73 | rc = gcry_cipher_setiv (*handle, | 73 | rc = gcry_cipher_setiv (*handle, |
74 | iv->aes_iv, | 74 | iv->aes_iv, |
75 | sizeof (iv->aes_iv)); | 75 | sizeof (iv->aes_iv)); |
76 | GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); | 76 | GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); |
77 | return GNUNET_OK; | 77 | return GNUNET_OK; |
@@ -94,13 +94,13 @@ setup_cipher_twofish (gcry_cipher_hd_t *handle, | |||
94 | int rc; | 94 | int rc; |
95 | 95 | ||
96 | GNUNET_assert (0 == | 96 | GNUNET_assert (0 == |
97 | gcry_cipher_open (handle, GCRY_CIPHER_TWOFISH, | 97 | gcry_cipher_open (handle, GCRY_CIPHER_TWOFISH, |
98 | GCRY_CIPHER_MODE_CFB, 0)); | 98 | GCRY_CIPHER_MODE_CFB, 0)); |
99 | rc = gcry_cipher_setkey (*handle, | 99 | rc = gcry_cipher_setkey (*handle, |
100 | sessionkey->twofish_key, | 100 | sessionkey->twofish_key, |
101 | sizeof (sessionkey->twofish_key)); | 101 | sizeof (sessionkey->twofish_key)); |
102 | GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); | 102 | GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); |
103 | rc = gcry_cipher_setiv (*handle, | 103 | rc = gcry_cipher_setiv (*handle, |
104 | iv->twofish_iv, | 104 | iv->twofish_iv, |
105 | sizeof (iv->twofish_iv)); | 105 | sizeof (iv->twofish_iv)); |
106 | GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); | 106 | GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); |
@@ -121,7 +121,7 @@ setup_cipher_twofish (gcry_cipher_hd_t *handle, | |||
121 | * @returns the size of the encrypted block, -1 for errors | 121 | * @returns the size of the encrypted block, -1 for errors |
122 | */ | 122 | */ |
123 | ssize_t | 123 | ssize_t |
124 | GNUNET_CRYPTO_symmetric_encrypt (const void *block, | 124 | GNUNET_CRYPTO_symmetric_encrypt (const void *block, |
125 | size_t len, | 125 | size_t len, |
126 | const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, | 126 | const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, |
127 | const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, | 127 | const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
@@ -157,7 +157,7 @@ GNUNET_CRYPTO_symmetric_encrypt (const void *block, | |||
157 | ssize_t | 157 | ssize_t |
158 | GNUNET_CRYPTO_symmetric_decrypt (const void *block, size_t size, | 158 | GNUNET_CRYPTO_symmetric_decrypt (const void *block, size_t size, |
159 | const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, | 159 | const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, |
160 | const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, | 160 | const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
161 | void *result) | 161 | void *result) |
162 | { | 162 | { |
163 | gcry_cipher_hd_t handle; | 163 | gcry_cipher_hd_t handle; |
@@ -219,13 +219,13 @@ GNUNET_CRYPTO_symmetric_derive_iv_v (struct GNUNET_CRYPTO_SymmetricInitializatio | |||
219 | memcpy (&aes_salt[salt_len], "AES!", 4); | 219 | memcpy (&aes_salt[salt_len], "AES!", 4); |
220 | memcpy (twofish_salt, salt, salt_len); | 220 | memcpy (twofish_salt, salt, salt_len); |
221 | memcpy (&twofish_salt[salt_len], "FISH", 4); | 221 | memcpy (&twofish_salt[salt_len], "FISH", 4); |
222 | GNUNET_CRYPTO_kdf_v (iv->aes_iv, sizeof (iv->aes_iv), | 222 | GNUNET_CRYPTO_kdf_v (iv->aes_iv, sizeof (iv->aes_iv), |
223 | aes_salt, salt_len + 4, | 223 | aes_salt, salt_len + 4, |
224 | skey->aes_key, sizeof (skey->aes_key), | 224 | skey->aes_key, sizeof (skey->aes_key), |
225 | argp); | 225 | argp); |
226 | GNUNET_CRYPTO_kdf_v (iv->twofish_iv, sizeof (iv->twofish_iv), | 226 | GNUNET_CRYPTO_kdf_v (iv->twofish_iv, sizeof (iv->twofish_iv), |
227 | twofish_salt, salt_len + 4, | 227 | twofish_salt, salt_len + 4, |
228 | skey->twofish_key, sizeof (skey->twofish_key), | 228 | skey->twofish_key, sizeof (skey->twofish_key), |
229 | argp); | 229 | argp); |
230 | } | 230 | } |
231 | 231 | ||
diff --git a/src/util/disk.c b/src/util/disk.c index d349aeb8e..69473a13d 100644 --- a/src/util/disk.c +++ b/src/util/disk.c | |||
@@ -410,7 +410,7 @@ mktemp_name (const char *t) | |||
410 | if (NULL == tmpdir) | 410 | if (NULL == tmpdir) |
411 | tmpdir = getenv ("TMP"); | 411 | tmpdir = getenv ("TMP"); |
412 | if (NULL == tmpdir) | 412 | if (NULL == tmpdir) |
413 | tmpdir = getenv ("TEMP"); | 413 | tmpdir = getenv ("TEMP"); |
414 | if (NULL == tmpdir) | 414 | if (NULL == tmpdir) |
415 | tmpdir = "/tmp"; | 415 | tmpdir = "/tmp"; |
416 | GNUNET_asprintf (&tmpl, "%s/%s%s", tmpdir, t, "XXXXXX"); | 416 | GNUNET_asprintf (&tmpl, "%s/%s%s", tmpdir, t, "XXXXXX"); |
@@ -522,7 +522,7 @@ GNUNET_DISK_file_backup (const char *fil) | |||
522 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, | 522 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, |
523 | "rename", | 523 | "rename", |
524 | fil); | 524 | fil); |
525 | GNUNET_free (target); | 525 | GNUNET_free (target); |
526 | } | 526 | } |
527 | 527 | ||
528 | 528 | ||
@@ -795,7 +795,7 @@ GNUNET_DISK_directory_create_for_file (const char *filename) | |||
795 | * @return the number of bytes read on success, #GNUNET_SYSERR on failure | 795 | * @return the number of bytes read on success, #GNUNET_SYSERR on failure |
796 | */ | 796 | */ |
797 | ssize_t | 797 | ssize_t |
798 | GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, | 798 | GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, |
799 | void *result, | 799 | void *result, |
800 | size_t len) | 800 | size_t len) |
801 | { | 801 | { |
@@ -850,7 +850,7 @@ GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, | |||
850 | */ | 850 | */ |
851 | ssize_t | 851 | ssize_t |
852 | GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle *h, | 852 | GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle *h, |
853 | void *result, | 853 | void *result, |
854 | size_t len) | 854 | size_t len) |
855 | { | 855 | { |
856 | if (NULL == h) | 856 | if (NULL == h) |
@@ -921,8 +921,8 @@ GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle *h, | |||
921 | * @return number of bytes read, #GNUNET_SYSERR on failure | 921 | * @return number of bytes read, #GNUNET_SYSERR on failure |
922 | */ | 922 | */ |
923 | ssize_t | 923 | ssize_t |
924 | GNUNET_DISK_fn_read (const char *fn, | 924 | GNUNET_DISK_fn_read (const char *fn, |
925 | void *result, | 925 | void *result, |
926 | size_t len) | 926 | size_t len) |
927 | { | 927 | { |
928 | struct GNUNET_DISK_FileHandle *fh; | 928 | struct GNUNET_DISK_FileHandle *fh; |
@@ -1033,7 +1033,7 @@ GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle * h, | |||
1033 | */ | 1033 | */ |
1034 | ssize_t | 1034 | ssize_t |
1035 | GNUNET_DISK_file_write_blocking (const struct GNUNET_DISK_FileHandle * h, | 1035 | GNUNET_DISK_file_write_blocking (const struct GNUNET_DISK_FileHandle * h, |
1036 | const void *buffer, | 1036 | const void *buffer, |
1037 | size_t n) | 1037 | size_t n) |
1038 | { | 1038 | { |
1039 | if (NULL == h) | 1039 | if (NULL == h) |
@@ -1152,7 +1152,7 @@ GNUNET_DISK_directory_scan (const char *dir_name, | |||
1152 | } | 1152 | } |
1153 | if (!S_ISDIR (istat.st_mode)) | 1153 | if (!S_ISDIR (istat.st_mode)) |
1154 | { | 1154 | { |
1155 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1155 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1156 | _("Expected `%s' to be a directory!\n"), | 1156 | _("Expected `%s' to be a directory!\n"), |
1157 | dir_name); | 1157 | dir_name); |
1158 | GNUNET_free (dname); | 1158 | GNUNET_free (dname); |
@@ -1413,7 +1413,7 @@ GNUNET_DISK_directory_remove (const char *filename) | |||
1413 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 1413 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
1414 | */ | 1414 | */ |
1415 | int | 1415 | int |
1416 | GNUNET_DISK_file_copy (const char *src, | 1416 | GNUNET_DISK_file_copy (const char *src, |
1417 | const char *dst) | 1417 | const char *dst) |
1418 | { | 1418 | { |
1419 | char *buf; | 1419 | char *buf; |
@@ -1684,7 +1684,7 @@ GNUNET_DISK_file_open (const char *fn, | |||
1684 | mode = translate_unix_perms (perm); | 1684 | mode = translate_unix_perms (perm); |
1685 | } | 1685 | } |
1686 | 1686 | ||
1687 | fd = open (expfn, oflags | 1687 | fd = open (expfn, oflags |
1688 | #if O_CLOEXEC | 1688 | #if O_CLOEXEC |
1689 | | O_CLOEXEC | 1689 | | O_CLOEXEC |
1690 | #endif | 1690 | #endif |
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index e1aa94a5c..1d204dd07 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c | |||
@@ -61,12 +61,12 @@ static int ret; | |||
61 | * @param option name of the option | 61 | * @param option name of the option |
62 | * @param value value of the option | 62 | * @param value value of the option |
63 | */ | 63 | */ |
64 | static void | 64 | static void |
65 | print_option (void *cls, const char *section, | 65 | print_option (void *cls, const char *section, |
66 | const char *option, | 66 | const char *option, |
67 | const char *value) | 67 | const char *value) |
68 | { | 68 | { |
69 | fprintf (stdout, | 69 | fprintf (stdout, |
70 | "%s = %s\n", option, value); | 70 | "%s = %s\n", option, value); |
71 | } | 71 | } |
72 | 72 | ||
@@ -136,11 +136,11 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
136 | } | 136 | } |
137 | out = GNUNET_CONFIGURATION_dup (cfg); | 137 | out = GNUNET_CONFIGURATION_dup (cfg); |
138 | GNUNET_CONFIGURATION_set_value_string (out, section, option, value); | 138 | GNUNET_CONFIGURATION_set_value_string (out, section, option, value); |
139 | if (GNUNET_OK != | 139 | if (GNUNET_OK != |
140 | GNUNET_CONFIGURATION_write (out, cfgfile)) | 140 | GNUNET_CONFIGURATION_write (out, cfgfile)) |
141 | ret = 2; | 141 | ret = 2; |
142 | GNUNET_CONFIGURATION_destroy (out); | 142 | GNUNET_CONFIGURATION_destroy (out); |
143 | return; | 143 | return; |
144 | } | 144 | } |
145 | } | 145 | } |
146 | 146 | ||
diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c index 59c0f5fe2..23e562cbe 100644 --- a/src/util/gnunet-ecc.c +++ b/src/util/gnunet-ecc.c | |||
@@ -66,7 +66,7 @@ create_keys (const char *fn) | |||
66 | _("Generating %u keys, please wait"), | 66 | _("Generating %u keys, please wait"), |
67 | make_keys); | 67 | make_keys); |
68 | while (0 < make_keys--) | 68 | while (0 < make_keys--) |
69 | { | 69 | { |
70 | fprintf (stderr, | 70 | fprintf (stderr, |
71 | "."); | 71 | "."); |
72 | if (NULL == (pk = GNUNET_CRYPTO_ecc_key_create ())) | 72 | if (NULL == (pk = GNUNET_CRYPTO_ecc_key_create ())) |
@@ -74,7 +74,7 @@ create_keys (const char *fn) | |||
74 | GNUNET_break (0); | 74 | GNUNET_break (0); |
75 | break; | 75 | break; |
76 | } | 76 | } |
77 | if (GNUNET_TESTING_HOSTKEYFILESIZE != | 77 | if (GNUNET_TESTING_HOSTKEYFILESIZE != |
78 | fwrite (pk, 1, | 78 | fwrite (pk, 1, |
79 | GNUNET_TESTING_HOSTKEYFILESIZE, f)) | 79 | GNUNET_TESTING_HOSTKEYFILESIZE, f)) |
80 | { | 80 | { |
@@ -140,7 +140,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
140 | 140 | ||
141 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (pk, &pub); | 141 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (pk, &pub); |
142 | str = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pub); | 142 | str = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pub); |
143 | fprintf (stdout, | 143 | fprintf (stdout, |
144 | "%s\n", | 144 | "%s\n", |
145 | str); | 145 | str); |
146 | GNUNET_free (str); | 146 | GNUNET_free (str); |
diff --git a/src/util/gnunet-resolver.c b/src/util/gnunet-resolver.c index 72ece9710..e71893873 100644 --- a/src/util/gnunet-resolver.c +++ b/src/util/gnunet-resolver.c | |||
@@ -84,7 +84,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
84 | socklen_t salen; | 84 | socklen_t salen; |
85 | struct sockaddr_in v4; | 85 | struct sockaddr_in v4; |
86 | struct sockaddr_in6 v6; | 86 | struct sockaddr_in6 v6; |
87 | 87 | ||
88 | if (args[0] == NULL) | 88 | if (args[0] == NULL) |
89 | return; | 89 | return; |
90 | if (! reverse) | 90 | if (! reverse) |
@@ -92,7 +92,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
92 | GNUNET_RESOLVER_ip_get (args[0], AF_UNSPEC, GET_TIMEOUT, &print_sockaddr, NULL); | 92 | GNUNET_RESOLVER_ip_get (args[0], AF_UNSPEC, GET_TIMEOUT, &print_sockaddr, NULL); |
93 | return; | 93 | return; |
94 | } | 94 | } |
95 | 95 | ||
96 | sa = NULL; | 96 | sa = NULL; |
97 | memset (&v4, 0, sizeof (v4)); | 97 | memset (&v4, 0, sizeof (v4)); |
98 | v4.sin_family = AF_INET; | 98 | v4.sin_family = AF_INET; |
@@ -120,7 +120,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
120 | } | 120 | } |
121 | if (NULL == sa) | 121 | if (NULL == sa) |
122 | { | 122 | { |
123 | fprintf (stderr, | 123 | fprintf (stderr, |
124 | "`%s' is not a valid IP: %s\n", | 124 | "`%s' is not a valid IP: %s\n", |
125 | args[0], | 125 | args[0], |
126 | strerror (errno)); | 126 | strerror (errno)); |
diff --git a/src/util/gnunet-service-resolver.c b/src/util/gnunet-service-resolver.c index cab13ae57..c8d510770 100644 --- a/src/util/gnunet-service-resolver.c +++ b/src/util/gnunet-service-resolver.c | |||
@@ -213,7 +213,7 @@ get_ip_as_string (struct GNUNET_SERVER_Client *client, | |||
213 | next = cache_head; | 213 | next = cache_head; |
214 | while ( (NULL != (pos = next)) && | 214 | while ( (NULL != (pos = next)) && |
215 | ( (pos->af != af) || | 215 | ( (pos->af != af) || |
216 | (pos->ip_len != ip_len) || | 216 | (pos->ip_len != ip_len) || |
217 | (0 != memcmp (pos->ip, ip, ip_len))) ) | 217 | (0 != memcmp (pos->ip, ip, ip_len))) ) |
218 | { | 218 | { |
219 | next = pos->next; | 219 | next = pos->next; |
@@ -323,7 +323,7 @@ getaddrinfo_resolve (struct GNUNET_SERVER_TransmitContext *tc, | |||
323 | default: | 323 | default: |
324 | /* unsupported, skip */ | 324 | /* unsupported, skip */ |
325 | break; | 325 | break; |
326 | } | 326 | } |
327 | pos = pos->ai_next; | 327 | pos = pos->ai_next; |
328 | } | 328 | } |
329 | freeaddrinfo (result); | 329 | freeaddrinfo (result); |
@@ -364,15 +364,15 @@ gethostbyname2_resolve (struct GNUNET_SERVER_TransmitContext *tc, | |||
364 | { | 364 | { |
365 | case AF_INET: | 365 | case AF_INET: |
366 | GNUNET_assert (hp->h_length == sizeof (struct in_addr)); | 366 | GNUNET_assert (hp->h_length == sizeof (struct in_addr)); |
367 | GNUNET_SERVER_transmit_context_append_data (tc, | 367 | GNUNET_SERVER_transmit_context_append_data (tc, |
368 | hp->h_addr_list[0], | 368 | hp->h_addr_list[0], |
369 | hp->h_length, | 369 | hp->h_length, |
370 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); | 370 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); |
371 | break; | 371 | break; |
372 | case AF_INET6: | 372 | case AF_INET6: |
373 | GNUNET_assert (hp->h_length == sizeof (struct in6_addr)); | 373 | GNUNET_assert (hp->h_length == sizeof (struct in6_addr)); |
374 | GNUNET_SERVER_transmit_context_append_data (tc, | 374 | GNUNET_SERVER_transmit_context_append_data (tc, |
375 | hp->h_addr_list[0], | 375 | hp->h_addr_list[0], |
376 | hp->h_length, | 376 | hp->h_length, |
377 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); | 377 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); |
378 | break; | 378 | break; |
@@ -406,7 +406,7 @@ gethostbyname_resolve (struct GNUNET_SERVER_TransmitContext *tc, | |||
406 | return GNUNET_SYSERR; | 406 | return GNUNET_SYSERR; |
407 | } | 407 | } |
408 | GNUNET_assert (hp->h_length == sizeof (struct in_addr)); | 408 | GNUNET_assert (hp->h_length == sizeof (struct in_addr)); |
409 | GNUNET_SERVER_transmit_context_append_data (tc, | 409 | GNUNET_SERVER_transmit_context_append_data (tc, |
410 | hp->h_addr_list[0], | 410 | hp->h_addr_list[0], |
411 | hp->h_length, | 411 | hp->h_length, |
412 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); | 412 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); |
@@ -482,7 +482,7 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client, | |||
482 | { | 482 | { |
483 | /* IP from hostname */ | 483 | /* IP from hostname */ |
484 | const char *hostname; | 484 | const char *hostname; |
485 | 485 | ||
486 | hostname = (const char *) &msg[1]; | 486 | hostname = (const char *) &msg[1]; |
487 | if (hostname[size - 1] != '\0') | 487 | if (hostname[size - 1] != '\0') |
488 | { | 488 | { |
@@ -521,12 +521,12 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client, | |||
521 | } | 521 | } |
522 | { | 522 | { |
523 | char buf[INET6_ADDRSTRLEN]; | 523 | char buf[INET6_ADDRSTRLEN]; |
524 | 524 | ||
525 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 525 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
526 | "Resolver asked to look up IP address `%s'.\n", | 526 | "Resolver asked to look up IP address `%s'.\n", |
527 | inet_ntop (af, ip, buf, sizeof (buf))); | 527 | inet_ntop (af, ip, buf, sizeof (buf))); |
528 | } | 528 | } |
529 | get_ip_as_string (client, af, ip); | 529 | get_ip_as_string (client, af, ip); |
530 | } | 530 | } |
531 | 531 | ||
532 | 532 | ||
diff --git a/src/util/gnunet-uri.c b/src/util/gnunet-uri.c index 5ca1f4efc..1964aade4 100644 --- a/src/util/gnunet-uri.c +++ b/src/util/gnunet-uri.c | |||
@@ -117,12 +117,12 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
117 | rt = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | 117 | rt = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
118 | GNUNET_DISK_pipe_handle (sigpipe, | 118 | GNUNET_DISK_pipe_handle (sigpipe, |
119 | GNUNET_DISK_PIPE_END_READ), | 119 | GNUNET_DISK_PIPE_END_READ), |
120 | &maint_child_death, NULL); | 120 | &maint_child_death, NULL); |
121 | p = GNUNET_OS_start_process (GNUNET_NO, 0, | 121 | p = GNUNET_OS_start_process (GNUNET_NO, 0, |
122 | NULL, NULL, | 122 | NULL, NULL, |
123 | program, | 123 | program, |
124 | program, | 124 | program, |
125 | args[0], | 125 | args[0], |
126 | NULL); | 126 | NULL); |
127 | GNUNET_free (program); | 127 | GNUNET_free (program); |
128 | if (NULL == p) | 128 | if (NULL == p) |
@@ -176,7 +176,7 @@ main (int argc, char *const *argv) | |||
176 | GNUNET_SIGNAL_handler_uninstall (shc_chld); | 176 | GNUNET_SIGNAL_handler_uninstall (shc_chld); |
177 | shc_chld = NULL; | 177 | shc_chld = NULL; |
178 | GNUNET_DISK_pipe_close (sigpipe); | 178 | GNUNET_DISK_pipe_close (sigpipe); |
179 | sigpipe = NULL; | 179 | sigpipe = NULL; |
180 | GNUNET_free ((void *) argv); | 180 | GNUNET_free ((void *) argv); |
181 | return (GNUNET_OK == ret) ? 0 : 1; | 181 | return (GNUNET_OK == ret) ? 0 : 1; |
182 | } | 182 | } |
diff --git a/src/util/helper.c b/src/util/helper.c index a70d86f18..21f196ebc 100644 --- a/src/util/helper.c +++ b/src/util/helper.c | |||
@@ -49,12 +49,12 @@ struct GNUNET_HELPER_SendHandle | |||
49 | * Message to transmit (allocated at the end of this struct) | 49 | * Message to transmit (allocated at the end of this struct) |
50 | */ | 50 | */ |
51 | const struct GNUNET_MessageHeader *msg; | 51 | const struct GNUNET_MessageHeader *msg; |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * The handle to a helper process. | 54 | * The handle to a helper process. |
55 | */ | 55 | */ |
56 | struct GNUNET_HELPER_Handle *h; | 56 | struct GNUNET_HELPER_Handle *h; |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * Function to call upon completion. | 59 | * Function to call upon completion. |
60 | */ | 60 | */ |
@@ -83,22 +83,22 @@ struct GNUNET_HELPER_Handle | |||
83 | * PipeHandle to receive data from the helper | 83 | * PipeHandle to receive data from the helper |
84 | */ | 84 | */ |
85 | struct GNUNET_DISK_PipeHandle *helper_in; | 85 | struct GNUNET_DISK_PipeHandle *helper_in; |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * PipeHandle to send data to the helper | 88 | * PipeHandle to send data to the helper |
89 | */ | 89 | */ |
90 | struct GNUNET_DISK_PipeHandle *helper_out; | 90 | struct GNUNET_DISK_PipeHandle *helper_out; |
91 | 91 | ||
92 | /** | 92 | /** |
93 | * FileHandle to receive data from the helper | 93 | * FileHandle to receive data from the helper |
94 | */ | 94 | */ |
95 | const struct GNUNET_DISK_FileHandle *fh_from_helper; | 95 | const struct GNUNET_DISK_FileHandle *fh_from_helper; |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * FileHandle to send data to the helper | 98 | * FileHandle to send data to the helper |
99 | */ | 99 | */ |
100 | const struct GNUNET_DISK_FileHandle *fh_to_helper; | 100 | const struct GNUNET_DISK_FileHandle *fh_to_helper; |
101 | 101 | ||
102 | /** | 102 | /** |
103 | * The process id of the helper | 103 | * The process id of the helper |
104 | */ | 104 | */ |
@@ -138,7 +138,7 @@ struct GNUNET_HELPER_Handle | |||
138 | * NULL-terminated list of command-line arguments. | 138 | * NULL-terminated list of command-line arguments. |
139 | */ | 139 | */ |
140 | char **binary_argv; | 140 | char **binary_argv; |
141 | 141 | ||
142 | /** | 142 | /** |
143 | * Task to read from the helper. | 143 | * Task to read from the helper. |
144 | */ | 144 | */ |
@@ -172,7 +172,7 @@ struct GNUNET_HELPER_Handle | |||
172 | * @return #GNUNET_OK on success; #GNUNET_SYSERR on error | 172 | * @return #GNUNET_OK on success; #GNUNET_SYSERR on error |
173 | */ | 173 | */ |
174 | int | 174 | int |
175 | GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h, | 175 | GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h, |
176 | int soft_kill) | 176 | int soft_kill) |
177 | { | 177 | { |
178 | struct GNUNET_HELPER_SendHandle *sh; | 178 | struct GNUNET_HELPER_SendHandle *sh; |
@@ -200,7 +200,7 @@ GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h, | |||
200 | if (NULL == h->helper_proc) | 200 | if (NULL == h->helper_proc) |
201 | return GNUNET_SYSERR; | 201 | return GNUNET_SYSERR; |
202 | if (GNUNET_YES == soft_kill) | 202 | if (GNUNET_YES == soft_kill) |
203 | { | 203 | { |
204 | /* soft-kill only possible with pipes */ | 204 | /* soft-kill only possible with pipes */ |
205 | GNUNET_assert (NULL != h->helper_in); | 205 | GNUNET_assert (NULL != h->helper_in); |
206 | ret = GNUNET_DISK_pipe_close (h->helper_in); | 206 | ret = GNUNET_DISK_pipe_close (h->helper_in); |
@@ -281,7 +281,7 @@ GNUNET_HELPER_wait (struct GNUNET_HELPER_Handle *h) | |||
281 | * stdin; #GNUNET_NO to signal termination by sending SIGTERM to helper | 281 | * stdin; #GNUNET_NO to signal termination by sending SIGTERM to helper |
282 | */ | 282 | */ |
283 | static void | 283 | static void |
284 | stop_helper (struct GNUNET_HELPER_Handle *h, | 284 | stop_helper (struct GNUNET_HELPER_Handle *h, |
285 | int soft_kill) | 285 | int soft_kill) |
286 | { | 286 | { |
287 | if (GNUNET_SCHEDULER_NO_TASK != h->restart_task) | 287 | if (GNUNET_SCHEDULER_NO_TASK != h->restart_task) |
@@ -352,9 +352,9 @@ helper_read (void *cls, | |||
352 | } | 352 | } |
353 | if (0 == t) | 353 | if (0 == t) |
354 | { | 354 | { |
355 | /* this happens if the helper is shut down via a | 355 | /* this happens if the helper is shut down via a |
356 | signal, so it is not a "hard" error */ | 356 | signal, so it is not a "hard" error */ |
357 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 357 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
358 | "Got 0 bytes from helper `%s' (EOF)\n", | 358 | "Got 0 bytes from helper `%s' (EOF)\n", |
359 | h->binary_name); | 359 | h->binary_name); |
360 | if (NULL != h->exp_cb) | 360 | if (NULL != h->exp_cb) |
@@ -370,7 +370,7 @@ helper_read (void *cls, | |||
370 | &restart_task, h); | 370 | &restart_task, h); |
371 | return; | 371 | return; |
372 | } | 372 | } |
373 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 373 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
374 | "Got %u bytes from helper `%s'\n", | 374 | "Got %u bytes from helper `%s'\n", |
375 | (unsigned int) t, | 375 | (unsigned int) t, |
376 | h->binary_name); | 376 | h->binary_name); |
@@ -379,7 +379,7 @@ helper_read (void *cls, | |||
379 | if (GNUNET_SYSERR == | 379 | if (GNUNET_SYSERR == |
380 | GNUNET_SERVER_mst_receive (h->mst, NULL, buf, t, GNUNET_NO, GNUNET_NO)) | 380 | GNUNET_SERVER_mst_receive (h->mst, NULL, buf, t, GNUNET_NO, GNUNET_NO)) |
381 | { | 381 | { |
382 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 382 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
383 | _("Failed to parse inbound message from helper `%s'\n"), | 383 | _("Failed to parse inbound message from helper `%s'\n"), |
384 | h->binary_name); | 384 | h->binary_name); |
385 | if (NULL != h->exp_cb) | 385 | if (NULL != h->exp_cb) |
@@ -387,7 +387,7 @@ helper_read (void *cls, | |||
387 | h->exp_cb (h->cb_cls); | 387 | h->exp_cb (h->cb_cls); |
388 | GNUNET_HELPER_stop (h, GNUNET_NO); | 388 | GNUNET_HELPER_stop (h, GNUNET_NO); |
389 | return; | 389 | return; |
390 | } | 390 | } |
391 | stop_helper (h, GNUNET_NO); | 391 | stop_helper (h, GNUNET_NO); |
392 | /* Restart the helper */ | 392 | /* Restart the helper */ |
393 | h->restart_task = | 393 | h->restart_task = |
@@ -414,7 +414,7 @@ start_helper (struct GNUNET_HELPER_Handle *h) | |||
414 | stop_helper (h, GNUNET_NO); | 414 | stop_helper (h, GNUNET_NO); |
415 | h->restart_task = | 415 | h->restart_task = |
416 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 416 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
417 | &restart_task, h); | 417 | &restart_task, h); |
418 | return; | 418 | return; |
419 | } | 419 | } |
420 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 420 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -425,7 +425,7 @@ start_helper (struct GNUNET_HELPER_Handle *h) | |||
425 | h->fh_to_helper = | 425 | h->fh_to_helper = |
426 | GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE); | 426 | GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE); |
427 | h->helper_proc = | 427 | h->helper_proc = |
428 | GNUNET_OS_start_process_vap (h->with_control_pipe, GNUNET_OS_INHERIT_STD_ERR, | 428 | GNUNET_OS_start_process_vap (h->with_control_pipe, GNUNET_OS_INHERIT_STD_ERR, |
429 | h->helper_in, h->helper_out, | 429 | h->helper_in, h->helper_out, |
430 | h->binary_name, | 430 | h->binary_name, |
431 | h->binary_argv); | 431 | h->binary_argv); |
@@ -435,15 +435,15 @@ start_helper (struct GNUNET_HELPER_Handle *h) | |||
435 | stop_helper (h, GNUNET_NO); | 435 | stop_helper (h, GNUNET_NO); |
436 | h->restart_task = | 436 | h->restart_task = |
437 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 437 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
438 | &restart_task, h); | 438 | &restart_task, h); |
439 | return; | 439 | return; |
440 | } | 440 | } |
441 | GNUNET_DISK_pipe_close_end (h->helper_out, GNUNET_DISK_PIPE_END_WRITE); | 441 | GNUNET_DISK_pipe_close_end (h->helper_out, GNUNET_DISK_PIPE_END_WRITE); |
442 | GNUNET_DISK_pipe_close_end (h->helper_in, GNUNET_DISK_PIPE_END_READ); | 442 | GNUNET_DISK_pipe_close_end (h->helper_in, GNUNET_DISK_PIPE_END_READ); |
443 | if (NULL != h->mst) | 443 | if (NULL != h->mst) |
444 | h->read_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | 444 | h->read_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
445 | h->fh_from_helper, | 445 | h->fh_from_helper, |
446 | &helper_read, | 446 | &helper_read, |
447 | h); | 447 | h); |
448 | } | 448 | } |
449 | 449 | ||
@@ -558,7 +558,7 @@ GNUNET_HELPER_destroy (struct GNUNET_HELPER_Handle *h) | |||
558 | * stdin; #GNUNET_NO to signal termination by sending SIGTERM to helper | 558 | * stdin; #GNUNET_NO to signal termination by sending SIGTERM to helper |
559 | */ | 559 | */ |
560 | void | 560 | void |
561 | GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h, | 561 | GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h, |
562 | int soft_kill) | 562 | int soft_kill) |
563 | { | 563 | { |
564 | h->exp_cb = NULL; | 564 | h->exp_cb = NULL; |
@@ -591,7 +591,7 @@ helper_write (void *cls, | |||
591 | h->write_task = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, | 591 | h->write_task = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, |
592 | h->fh_to_helper, &helper_write, h); | 592 | h->fh_to_helper, &helper_write, h); |
593 | return; | 593 | return; |
594 | } | 594 | } |
595 | if (NULL == (sh = h->sh_head)) | 595 | if (NULL == (sh = h->sh_head)) |
596 | { | 596 | { |
597 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 597 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -600,7 +600,7 @@ helper_write (void *cls, | |||
600 | } | 600 | } |
601 | buf = (const char*) sh->msg; | 601 | buf = (const char*) sh->msg; |
602 | t = GNUNET_DISK_file_write (h->fh_to_helper, | 602 | t = GNUNET_DISK_file_write (h->fh_to_helper, |
603 | &buf[sh->wpos], | 603 | &buf[sh->wpos], |
604 | ntohs (sh->msg->size) - sh->wpos); | 604 | ntohs (sh->msg->size) - sh->wpos); |
605 | if (-1 == t) | 605 | if (-1 == t) |
606 | { | 606 | { |
@@ -640,8 +640,8 @@ helper_write (void *cls, | |||
640 | } | 640 | } |
641 | if (NULL != h->sh_head) | 641 | if (NULL != h->sh_head) |
642 | h->write_task = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, | 642 | h->write_task = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, |
643 | h->fh_to_helper, | 643 | h->fh_to_helper, |
644 | &helper_write, | 644 | &helper_write, |
645 | h); | 645 | h); |
646 | } | 646 | } |
647 | 647 | ||
@@ -655,12 +655,12 @@ helper_write (void *cls, | |||
655 | * @param cont continuation to run once the message is out (#GNUNET_OK on succees, #GNUNET_NO | 655 | * @param cont continuation to run once the message is out (#GNUNET_OK on succees, #GNUNET_NO |
656 | * if the helper process died, #GNUNET_SYSERR during #GNUNET_HELPER_destroy). | 656 | * if the helper process died, #GNUNET_SYSERR during #GNUNET_HELPER_destroy). |
657 | * @param cont_cls closure for @a cont | 657 | * @param cont_cls closure for @a cont |
658 | * @return NULL if the message was dropped, | 658 | * @return NULL if the message was dropped, |
659 | * otherwise handle to cancel *cont* (actual transmission may | 659 | * otherwise handle to cancel *cont* (actual transmission may |
660 | * not be abortable) | 660 | * not be abortable) |
661 | */ | 661 | */ |
662 | struct GNUNET_HELPER_SendHandle * | 662 | struct GNUNET_HELPER_SendHandle * |
663 | GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h, | 663 | GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h, |
664 | const struct GNUNET_MessageHeader *msg, | 664 | const struct GNUNET_MessageHeader *msg, |
665 | int can_drop, | 665 | int can_drop, |
666 | GNUNET_HELPER_Continuation cont, | 666 | GNUNET_HELPER_Continuation cont, |
@@ -686,10 +686,10 @@ GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h, | |||
686 | sh); | 686 | sh); |
687 | if (GNUNET_SCHEDULER_NO_TASK == h->write_task) | 687 | if (GNUNET_SCHEDULER_NO_TASK == h->write_task) |
688 | h->write_task = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, | 688 | h->write_task = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, |
689 | h->fh_to_helper, | 689 | h->fh_to_helper, |
690 | &helper_write, | 690 | &helper_write, |
691 | h); | 691 | h); |
692 | 692 | ||
693 | return sh; | 693 | return sh; |
694 | } | 694 | } |
695 | 695 | ||
diff --git a/src/util/mq.c b/src/util/mq.c index 733329a2c..c4f9e0d0b 100644 --- a/src/util/mq.c +++ b/src/util/mq.c | |||
@@ -192,7 +192,7 @@ GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq, const struct GNUNET_Messa | |||
192 | handled = GNUNET_YES; | 192 | handled = GNUNET_YES; |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | if (GNUNET_NO == handled) | 196 | if (GNUNET_NO == handled) |
197 | LOG (GNUNET_ERROR_TYPE_WARNING, "no handler for message of type %d\n", ntohs (mh->type)); | 197 | LOG (GNUNET_ERROR_TYPE_WARNING, "no handler for message of type %d\n", ntohs (mh->type)); |
198 | } | 198 | } |
@@ -233,7 +233,7 @@ GNUNET_MQ_discard (struct GNUNET_MQ_Envelope *mqm) | |||
233 | /** | 233 | /** |
234 | * Send a message with the give message queue. | 234 | * Send a message with the give message queue. |
235 | * May only be called once per message. | 235 | * May only be called once per message. |
236 | * | 236 | * |
237 | * @param mq message queue | 237 | * @param mq message queue |
238 | * @param ev the envelope with the message to send. | 238 | * @param ev the envelope with the message to send. |
239 | */ | 239 | */ |
@@ -242,7 +242,7 @@ GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev) | |||
242 | { | 242 | { |
243 | GNUNET_assert (NULL != mq); | 243 | GNUNET_assert (NULL != mq); |
244 | GNUNET_assert (NULL == ev->parent_queue); | 244 | GNUNET_assert (NULL == ev->parent_queue); |
245 | 245 | ||
246 | /* is the implementation busy? queue it! */ | 246 | /* is the implementation busy? queue it! */ |
247 | if (NULL != mq->current_envelope) | 247 | if (NULL != mq->current_envelope) |
248 | { | 248 | { |
@@ -465,7 +465,7 @@ server_client_destroy_impl (struct GNUNET_MQ_Handle *mq, | |||
465 | void *impl_state) | 465 | void *impl_state) |
466 | { | 466 | { |
467 | struct ServerClientSocketState *state = impl_state; | 467 | struct ServerClientSocketState *state = impl_state; |
468 | 468 | ||
469 | GNUNET_assert (NULL != mq); | 469 | GNUNET_assert (NULL != mq); |
470 | GNUNET_assert (NULL != state); | 470 | GNUNET_assert (NULL != state); |
471 | GNUNET_SERVER_client_drop (state->client); | 471 | GNUNET_SERVER_client_drop (state->client); |
@@ -483,7 +483,7 @@ server_client_send_impl (struct GNUNET_MQ_Handle *mq, | |||
483 | 483 | ||
484 | GNUNET_MQ_impl_send_commit (mq); | 484 | GNUNET_MQ_impl_send_commit (mq); |
485 | 485 | ||
486 | state->th = | 486 | state->th = |
487 | GNUNET_SERVER_notify_transmit_ready (state->client, ntohs (msg->size), | 487 | GNUNET_SERVER_notify_transmit_ready (state->client, ntohs (msg->size), |
488 | GNUNET_TIME_UNIT_FOREVER_REL, | 488 | GNUNET_TIME_UNIT_FOREVER_REL, |
489 | &transmit_queued, mq); | 489 | &transmit_queued, mq); |
@@ -522,7 +522,7 @@ handle_client_message (void *cls, | |||
522 | struct ClientConnectionState *state; | 522 | struct ClientConnectionState *state; |
523 | 523 | ||
524 | state = mq->impl_state; | 524 | state = mq->impl_state; |
525 | 525 | ||
526 | if (NULL == msg) | 526 | if (NULL == msg) |
527 | { | 527 | { |
528 | GNUNET_MQ_inject_error (mq, GNUNET_MQ_ERROR_READ); | 528 | GNUNET_MQ_inject_error (mq, GNUNET_MQ_ERROR_READ); |
@@ -600,8 +600,8 @@ connection_client_send_impl (struct GNUNET_MQ_Handle *mq, | |||
600 | 600 | ||
601 | GNUNET_MQ_impl_send_commit (mq); | 601 | GNUNET_MQ_impl_send_commit (mq); |
602 | 602 | ||
603 | state->th = | 603 | state->th = |
604 | GNUNET_CLIENT_notify_transmit_ready (state->connection, ntohs (msg->size), | 604 | GNUNET_CLIENT_notify_transmit_ready (state->connection, ntohs (msg->size), |
605 | GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_NO, | 605 | GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_NO, |
606 | &connection_client_transmit_queued, mq); | 606 | &connection_client_transmit_queued, mq); |
607 | } | 607 | } |
diff --git a/src/util/network.c b/src/util/network.c index 309c3a26d..a921998e9 100644 --- a/src/util/network.c +++ b/src/util/network.c | |||
@@ -118,7 +118,7 @@ GNUNET_NETWORK_shorten_unixpath (char *unixpath) | |||
118 | struct GNUNET_CRYPTO_HashAsciiEncoded ae; | 118 | struct GNUNET_CRYPTO_HashAsciiEncoded ae; |
119 | size_t upm; | 119 | size_t upm; |
120 | 120 | ||
121 | upm = sizeof (dummy.sun_path); | 121 | upm = sizeof (dummy.sun_path); |
122 | slen = strlen (unixpath); | 122 | slen = strlen (unixpath); |
123 | if (slen < upm) | 123 | if (slen < upm) |
124 | return unixpath; /* no shortening required */ | 124 | return unixpath; /* no shortening required */ |
@@ -243,7 +243,7 @@ socket_set_nosigpipe (const struct GNUNET_NETWORK_Handle *h) | |||
243 | int abs_value = 1; | 243 | int abs_value = 1; |
244 | 244 | ||
245 | if (0 != | 245 | if (0 != |
246 | setsockopt (h->fd, SOL_SOCKET, SO_NOSIGPIPE, | 246 | setsockopt (h->fd, SOL_SOCKET, SO_NOSIGPIPE, |
247 | (const void *) &abs_value, | 247 | (const void *) &abs_value, |
248 | sizeof (abs_value))) | 248 | sizeof (abs_value))) |
249 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt"); | 249 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt"); |
@@ -270,7 +270,7 @@ socket_set_nodelay (const struct GNUNET_NETWORK_Handle *h) | |||
270 | const char *abs_value = "1"; | 270 | const char *abs_value = "1"; |
271 | 271 | ||
272 | if (0 != | 272 | if (0 != |
273 | setsockopt (h->fd, IPPROTO_TCP, TCP_NODELAY, | 273 | setsockopt (h->fd, IPPROTO_TCP, TCP_NODELAY, |
274 | (const void *) abs_value, | 274 | (const void *) abs_value, |
275 | sizeof (abs_value))) | 275 | sizeof (abs_value))) |
276 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt"); | 276 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt"); |
@@ -325,7 +325,7 @@ initialize_network_handle (struct GNUNET_NETWORK_Handle *h, | |||
325 | #ifdef DARWIN | 325 | #ifdef DARWIN |
326 | socket_set_nosigpipe (h); | 326 | socket_set_nosigpipe (h); |
327 | #endif | 327 | #endif |
328 | if ( (type == SOCK_STREAM) | 328 | if ( (type == SOCK_STREAM) |
329 | #ifdef AF_UNIX | 329 | #ifdef AF_UNIX |
330 | && (af != AF_UNIX) | 330 | && (af != AF_UNIX) |
331 | #endif | 331 | #endif |
@@ -345,7 +345,7 @@ initialize_network_handle (struct GNUNET_NETWORK_Handle *h, | |||
345 | */ | 345 | */ |
346 | struct GNUNET_NETWORK_Handle * | 346 | struct GNUNET_NETWORK_Handle * |
347 | GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc, | 347 | GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc, |
348 | struct sockaddr *address, | 348 | struct sockaddr *address, |
349 | socklen_t *address_len) | 349 | socklen_t *address_len) |
350 | { | 350 | { |
351 | struct GNUNET_NETWORK_Handle *ret; | 351 | struct GNUNET_NETWORK_Handle *ret; |
@@ -358,7 +358,7 @@ GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc, | |||
358 | int gsn = getsockname (desc->fd, &name, &namelen); | 358 | int gsn = getsockname (desc->fd, &name, &namelen); |
359 | 359 | ||
360 | if (gsn == 0) | 360 | if (gsn == 0) |
361 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 361 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
362 | "Accepting connection on `%s'\n", | 362 | "Accepting connection on `%s'\n", |
363 | GNUNET_a2s (&name, namelen)); | 363 | GNUNET_a2s (&name, namelen)); |
364 | } | 364 | } |
@@ -414,8 +414,8 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc, | |||
414 | const int on = 1; | 414 | const int on = 1; |
415 | 415 | ||
416 | if (desc->af == AF_INET6) | 416 | if (desc->af == AF_INET6) |
417 | if (setsockopt (desc->fd, IPPROTO_IPV6, IPV6_V6ONLY, | 417 | if (setsockopt (desc->fd, IPPROTO_IPV6, IPV6_V6ONLY, |
418 | (const void *) &on, | 418 | (const void *) &on, |
419 | sizeof (on))) | 419 | sizeof (on))) |
420 | LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt"); | 420 | LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt"); |
421 | } | 421 | } |
@@ -424,9 +424,9 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc, | |||
424 | #ifndef WINDOWS | 424 | #ifndef WINDOWS |
425 | { | 425 | { |
426 | const int on = 1; | 426 | const int on = 1; |
427 | 427 | ||
428 | /* This is required here for TCP sockets, but only on UNIX */ | 428 | /* This is required here for TCP sockets, but only on UNIX */ |
429 | if ((SOCK_STREAM == desc->type) | 429 | if ((SOCK_STREAM == desc->type) |
430 | && (0 != setsockopt (desc->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)))) | 430 | && (0 != setsockopt (desc->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)))) |
431 | LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt"); | 431 | LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt"); |
432 | } | 432 | } |
@@ -1437,7 +1437,7 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, | |||
1437 | tv.tv_usec = | 1437 | tv.tv_usec = |
1438 | (timeout.rel_value_us - | 1438 | (timeout.rel_value_us - |
1439 | (tv.tv_sec * GNUNET_TIME_UNIT_SECONDS.rel_value_us)); | 1439 | (tv.tv_sec * GNUNET_TIME_UNIT_SECONDS.rel_value_us)); |
1440 | return select (nfds, | 1440 | return select (nfds, |
1441 | (NULL != rfds) ? &rfds->sds : NULL, | 1441 | (NULL != rfds) ? &rfds->sds : NULL, |
1442 | (NULL != wfds) ? &wfds->sds : NULL, | 1442 | (NULL != wfds) ? &wfds->sds : NULL, |
1443 | (NULL != efds) ? &efds->sds : NULL, | 1443 | (NULL != efds) ? &efds->sds : NULL, |
diff --git a/src/util/os_installation.c b/src/util/os_installation.c index 06eb4ed60..98ac7b989 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c | |||
@@ -741,16 +741,16 @@ GNUNET_OS_check_helper_binary (const char *binary, int check_suid, const char *p | |||
741 | char parameters[512]; | 741 | char parameters[512]; |
742 | PROCESS_INFORMATION proc; | 742 | PROCESS_INFORMATION proc; |
743 | DWORD exit_value; | 743 | DWORD exit_value; |
744 | 744 | ||
745 | GNUNET_snprintf (parameters, | 745 | GNUNET_snprintf (parameters, |
746 | sizeof (parameters), | 746 | sizeof (parameters), |
747 | "-d %s", params); | 747 | "-d %s", params); |
748 | memset (&start, 0, sizeof (start)); | 748 | memset (&start, 0, sizeof (start)); |
749 | start.cb = sizeof (start); | 749 | start.cb = sizeof (start); |
750 | memset (&proc, 0, sizeof (proc)); | 750 | memset (&proc, 0, sizeof (proc)); |
751 | 751 | ||
752 | 752 | ||
753 | // Start the child process. | 753 | // Start the child process. |
754 | if ( ! (CreateProcess( p, // current windows (2k3 and up can handle / instead of \ in paths)) | 754 | if ( ! (CreateProcess( p, // current windows (2k3 and up can handle / instead of \ in paths)) |
755 | parameters, // execute dryrun/priviliege checking mode | 755 | parameters, // execute dryrun/priviliege checking mode |
756 | NULL, // Process handle not inheritable | 756 | NULL, // Process handle not inheritable |
@@ -758,12 +758,12 @@ GNUNET_OS_check_helper_binary (const char *binary, int check_suid, const char *p | |||
758 | FALSE, // Set handle inheritance to FALSE | 758 | FALSE, // Set handle inheritance to FALSE |
759 | CREATE_DEFAULT_ERROR_MODE, // No creation flags | 759 | CREATE_DEFAULT_ERROR_MODE, // No creation flags |
760 | NULL, // Use parent's environment block | 760 | NULL, // Use parent's environment block |
761 | NULL, // Use parent's starting directory | 761 | NULL, // Use parent's starting directory |
762 | &start, // Pointer to STARTUPINFO structure | 762 | &start, // Pointer to STARTUPINFO structure |
763 | &proc ) // Pointer to PROCESS_INFORMATION structure | 763 | &proc ) // Pointer to PROCESS_INFORMATION structure |
764 | )) | 764 | )) |
765 | { | 765 | { |
766 | LOG (GNUNET_ERROR_TYPE_ERROR, | 766 | LOG (GNUNET_ERROR_TYPE_ERROR, |
767 | _("CreateProcess failed for binary %s (%d).\n"), | 767 | _("CreateProcess failed for binary %s (%d).\n"), |
768 | p, GetLastError()); | 768 | p, GetLastError()); |
769 | return GNUNET_SYSERR; | 769 | return GNUNET_SYSERR; |
@@ -771,17 +771,17 @@ GNUNET_OS_check_helper_binary (const char *binary, int check_suid, const char *p | |||
771 | 771 | ||
772 | // Wait until child process exits. | 772 | // Wait until child process exits. |
773 | WaitForSingleObject( proc.hProcess, INFINITE ); | 773 | WaitForSingleObject( proc.hProcess, INFINITE ); |
774 | 774 | ||
775 | if ( ! GetExitCodeProcess (proc.hProcess, &exit_value)){ | 775 | if ( ! GetExitCodeProcess (proc.hProcess, &exit_value)){ |
776 | LOG (GNUNET_ERROR_TYPE_ERROR, | 776 | LOG (GNUNET_ERROR_TYPE_ERROR, |
777 | _("GetExitCodeProcess failed for binary %s (%d).\n"), | 777 | _("GetExitCodeProcess failed for binary %s (%d).\n"), |
778 | p, GetLastError() ); | 778 | p, GetLastError() ); |
779 | return GNUNET_SYSERR; | 779 | return GNUNET_SYSERR; |
780 | } | 780 | } |
781 | // Close process and thread handles. | 781 | // Close process and thread handles. |
782 | CloseHandle( proc.hProcess ); | 782 | CloseHandle( proc.hProcess ); |
783 | CloseHandle( proc.hThread ); | 783 | CloseHandle( proc.hThread ); |
784 | 784 | ||
785 | if (!exit_value) | 785 | if (!exit_value) |
786 | return GNUNET_YES; | 786 | return GNUNET_YES; |
787 | #endif | 787 | #endif |
diff --git a/src/util/os_network.c b/src/util/os_network.c index 4d9155ae2..f0f66918e 100644 --- a/src/util/os_network.c +++ b/src/util/os_network.c | |||
@@ -250,7 +250,7 @@ GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor proc, | |||
250 | 250 | ||
251 | pass_netmask = (struct sockaddr *) &netmask6; | 251 | pass_netmask = (struct sockaddr *) &netmask6; |
252 | } | 252 | } |
253 | 253 | ||
254 | if (GNUNET_OK != | 254 | if (GNUNET_OK != |
255 | proc (proc_cls, ifc, 0 == strcmp (ifc, GNUNET_DEFAULT_INTERFACE), | 255 | proc (proc_cls, ifc, 0 == strcmp (ifc, GNUNET_DEFAULT_INTERFACE), |
256 | (const struct sockaddr *) &a6, | 256 | (const struct sockaddr *) &a6, |
diff --git a/src/util/os_priority.c b/src/util/os_priority.c index 7a6d93858..d499ed985 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c | |||
@@ -80,7 +80,7 @@ parent_control_handler (void *cls, | |||
80 | char sig; | 80 | char sig; |
81 | char *pipe_fd; | 81 | char *pipe_fd; |
82 | ssize_t ret; | 82 | ssize_t ret; |
83 | 83 | ||
84 | LOG (GNUNET_ERROR_TYPE_DEBUG, "`%s' invoked because of %d\n", __FUNCTION__, | 84 | LOG (GNUNET_ERROR_TYPE_DEBUG, "`%s' invoked because of %d\n", __FUNCTION__, |
85 | tc->reason); | 85 | tc->reason); |
86 | if (0 != (tc->reason & | 86 | if (0 != (tc->reason & |
@@ -275,7 +275,7 @@ GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig) | |||
275 | #else | 275 | #else |
276 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending signal %d to pid: %u via system call\n", sig, proc->pid); | 276 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending signal %d to pid: %u via system call\n", sig, proc->pid); |
277 | return PLIBC_KILL (proc->pid, sig); | 277 | return PLIBC_KILL (proc->pid, sig); |
278 | #endif | 278 | #endif |
279 | } | 279 | } |
280 | } | 280 | } |
281 | 281 | ||
@@ -753,7 +753,7 @@ start_process (int pipe_control, | |||
753 | 753 | ||
754 | if (GNUNET_SYSERR == GNUNET_OS_check_helper_binary (filename, GNUNET_NO, NULL)) | 754 | if (GNUNET_SYSERR == GNUNET_OS_check_helper_binary (filename, GNUNET_NO, NULL)) |
755 | return NULL; /* not executable */ | 755 | return NULL; /* not executable */ |
756 | 756 | ||
757 | /* Search in prefix dir (hopefully - the directory from which | 757 | /* Search in prefix dir (hopefully - the directory from which |
758 | * the current module was loaded), bindir and libdir, then in PATH | 758 | * the current module was loaded), bindir and libdir, then in PATH |
759 | */ | 759 | */ |
@@ -902,7 +902,7 @@ start_process (int pipe_control, | |||
902 | else | 902 | else |
903 | SetHandleInformation (stdih, HANDLE_FLAG_INHERIT, 0); | 903 | SetHandleInformation (stdih, HANDLE_FLAG_INHERIT, 0); |
904 | } | 904 | } |
905 | 905 | ||
906 | 906 | ||
907 | stdoh = GetStdHandle (STD_OUTPUT_HANDLE); | 907 | stdoh = GetStdHandle (STD_OUTPUT_HANDLE); |
908 | GetHandleInformation (stdoh, &stdof); | 908 | GetHandleInformation (stdoh, &stdof); |
@@ -1054,7 +1054,7 @@ start_process (int pipe_control, | |||
1054 | 1054 | ||
1055 | if ((NULL == pipe_stdin) && (stdih)) | 1055 | if ((NULL == pipe_stdin) && (stdih)) |
1056 | SetHandleInformation (stdih, HANDLE_FLAG_INHERIT, stdif); | 1056 | SetHandleInformation (stdih, HANDLE_FLAG_INHERIT, stdif); |
1057 | 1057 | ||
1058 | 1058 | ||
1059 | if ((NULL == pipe_stdout) && (stdoh)) | 1059 | if ((NULL == pipe_stdout) && (stdoh)) |
1060 | SetHandleInformation (stdoh, HANDLE_FLAG_INHERIT, stdof); | 1060 | SetHandleInformation (stdoh, HANDLE_FLAG_INHERIT, stdof); |
@@ -1116,7 +1116,7 @@ start_process (int pipe_control, | |||
1116 | wrote = GNUNET_DISK_file_write (lsocks_write_fd, &count, sizeof (count)); | 1116 | wrote = GNUNET_DISK_file_write (lsocks_write_fd, &count, sizeof (count)); |
1117 | if (sizeof (count) != wrote) | 1117 | if (sizeof (count) != wrote) |
1118 | { | 1118 | { |
1119 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1119 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1120 | "Failed to write %u count bytes to the child: %u\n", | 1120 | "Failed to write %u count bytes to the child: %u\n", |
1121 | sizeof (count), GetLastError ()); | 1121 | sizeof (count), GetLastError ()); |
1122 | break; | 1122 | break; |
@@ -1127,8 +1127,8 @@ start_process (int pipe_control, | |||
1127 | /* Get a socket duplication info */ | 1127 | /* Get a socket duplication info */ |
1128 | if (SOCKET_ERROR == WSADuplicateSocketA (lsocks[i], gnunet_proc->pid, &pi)) | 1128 | if (SOCKET_ERROR == WSADuplicateSocketA (lsocks[i], gnunet_proc->pid, &pi)) |
1129 | { | 1129 | { |
1130 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1130 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1131 | "Failed to duplicate an socket[%llu]: %u\n", i, | 1131 | "Failed to duplicate an socket[%llu]: %u\n", i, |
1132 | GetLastError ()); | 1132 | GetLastError ()); |
1133 | break; | 1133 | break; |
1134 | } | 1134 | } |
@@ -1144,8 +1144,8 @@ start_process (int pipe_control, | |||
1144 | wrote = GNUNET_DISK_file_write (lsocks_write_fd, &size, sizeof (size)); | 1144 | wrote = GNUNET_DISK_file_write (lsocks_write_fd, &size, sizeof (size)); |
1145 | if (sizeof (size) != wrote) | 1145 | if (sizeof (size) != wrote) |
1146 | { | 1146 | { |
1147 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1147 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1148 | "Failed to write %u size[%llu] bytes to the child: %u\n", | 1148 | "Failed to write %u size[%llu] bytes to the child: %u\n", |
1149 | sizeof (size), i, GetLastError ()); | 1149 | sizeof (size), i, GetLastError ()); |
1150 | break; | 1150 | break; |
1151 | } | 1151 | } |
@@ -1153,8 +1153,8 @@ start_process (int pipe_control, | |||
1153 | wrote = GNUNET_DISK_file_write (lsocks_write_fd, &pi, sizeof (pi)); | 1153 | wrote = GNUNET_DISK_file_write (lsocks_write_fd, &pi, sizeof (pi)); |
1154 | if (sizeof (pi) != wrote) | 1154 | if (sizeof (pi) != wrote) |
1155 | { | 1155 | { |
1156 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1156 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1157 | "Failed to write %u socket[%llu] bytes to the child: %u\n", | 1157 | "Failed to write %u socket[%llu] bytes to the child: %u\n", |
1158 | sizeof (pi), i, GetLastError ()); | 1158 | sizeof (pi), i, GetLastError ()); |
1159 | break; | 1159 | break; |
1160 | } | 1160 | } |
@@ -1207,7 +1207,7 @@ GNUNET_OS_start_process_vap (int pipe_control, | |||
1207 | enum GNUNET_OS_InheritStdioFlags std_inheritance, | 1207 | enum GNUNET_OS_InheritStdioFlags std_inheritance, |
1208 | struct GNUNET_DISK_PipeHandle *pipe_stdin, | 1208 | struct GNUNET_DISK_PipeHandle *pipe_stdin, |
1209 | struct GNUNET_DISK_PipeHandle *pipe_stdout, | 1209 | struct GNUNET_DISK_PipeHandle *pipe_stdout, |
1210 | const char *filename, | 1210 | const char *filename, |
1211 | char *const argv[]) | 1211 | char *const argv[]) |
1212 | { | 1212 | { |
1213 | return start_process (pipe_control, | 1213 | return start_process (pipe_control, |
@@ -1328,7 +1328,7 @@ GNUNET_OS_start_process_v (int pipe_control, | |||
1328 | /** | 1328 | /** |
1329 | * Retrieve the status of a process, waiting on him if dead. | 1329 | * Retrieve the status of a process, waiting on him if dead. |
1330 | * Nonblocking version. | 1330 | * Nonblocking version. |
1331 | * | 1331 | * |
1332 | * @param proc process ID | 1332 | * @param proc process ID |
1333 | * @param type status type | 1333 | * @param type status type |
1334 | * @param code return code/signal number | 1334 | * @param code return code/signal number |
@@ -1441,7 +1441,7 @@ GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc) | |||
1441 | 1441 | ||
1442 | while ( (pid != (ret = waitpid (pid, NULL, 0))) && | 1442 | while ( (pid != (ret = waitpid (pid, NULL, 0))) && |
1443 | (EINTR == errno) ) ; | 1443 | (EINTR == errno) ) ; |
1444 | if (pid != ret) | 1444 | if (pid != ret) |
1445 | { | 1445 | { |
1446 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "waitpid"); | 1446 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "waitpid"); |
1447 | return GNUNET_SYSERR; | 1447 | return GNUNET_SYSERR; |
diff --git a/src/util/peer.c b/src/util/peer.c index 08062e364..fa376d333 100644 --- a/src/util/peer.c +++ b/src/util/peer.c | |||
@@ -144,7 +144,7 @@ GNUNET_PEER_intern (const struct GNUNET_PeerIdentity *pid) | |||
144 | table[ret]->rc = 1; | 144 | table[ret]->rc = 1; |
145 | table[ret]->pid = ret; | 145 | table[ret]->pid = ret; |
146 | GNUNET_break (GNUNET_OK == | 146 | GNUNET_break (GNUNET_OK == |
147 | GNUNET_CONTAINER_multipeermap_put (map, | 147 | GNUNET_CONTAINER_multipeermap_put (map, |
148 | &table[ret]->id, | 148 | &table[ret]->id, |
149 | table[ret], | 149 | table[ret], |
150 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 150 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
diff --git a/src/util/perf_malloc.c b/src/util/perf_malloc.c index 1a6ae4a7c..d3510ab82 100644 --- a/src/util/perf_malloc.c +++ b/src/util/perf_malloc.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include <gauger.h> | 28 | #include <gauger.h> |
29 | 29 | ||
30 | static uint64_t | 30 | static uint64_t |
31 | perfMalloc () | 31 | perfMalloc () |
32 | { | 32 | { |
33 | size_t i; | 33 | size_t i; |
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index b35398619..46ac52586 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c | |||
@@ -332,7 +332,7 @@ handle_response (void *cls, const struct GNUNET_MessageHeader *msg) | |||
332 | struct GNUNET_RESOLVER_RequestHandle *rh = cls; | 332 | struct GNUNET_RESOLVER_RequestHandle *rh = cls; |
333 | uint16_t size; | 333 | uint16_t size; |
334 | 334 | ||
335 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 335 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
336 | "Receiving response from DNS service\n"); | 336 | "Receiving response from DNS service\n"); |
337 | if (NULL == msg) | 337 | if (NULL == msg) |
338 | { | 338 | { |
@@ -920,7 +920,7 @@ GNUNET_RESOLVER_hostname_resolve (int af, | |||
920 | return NULL; | 920 | return NULL; |
921 | } | 921 | } |
922 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 922 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
923 | "Resolving our hostname `%s'\n", | 923 | "Resolving our hostname `%s'\n", |
924 | hostname); | 924 | hostname); |
925 | return GNUNET_RESOLVER_ip_get (hostname, af, timeout, callback, cls); | 925 | return GNUNET_RESOLVER_ip_get (hostname, af, timeout, callback, cls); |
926 | } | 926 | } |
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index a38bebf84..8652ee297 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -383,7 +383,7 @@ is_ready (struct Task *task, struct GNUNET_TIME_Absolute now, | |||
383 | reason |= GNUNET_SCHEDULER_REASON_WRITE_READY; | 383 | reason |= GNUNET_SCHEDULER_REASON_WRITE_READY; |
384 | if (reason == 0) | 384 | if (reason == 0) |
385 | return GNUNET_NO; /* not ready */ | 385 | return GNUNET_NO; /* not ready */ |
386 | reason |= GNUNET_SCHEDULER_REASON_PREREQ_DONE; | 386 | reason |= GNUNET_SCHEDULER_REASON_PREREQ_DONE; |
387 | task->reason = reason; | 387 | task->reason = reason; |
388 | return GNUNET_YES; | 388 | return GNUNET_YES; |
389 | } | 389 | } |
@@ -442,7 +442,7 @@ check_ready (const struct GNUNET_NETWORK_FDSet *rs, | |||
442 | pos = pending; | 442 | pos = pending; |
443 | while (pos != NULL) | 443 | while (pos != NULL) |
444 | { | 444 | { |
445 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 445 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
446 | "Checking readiness of task: %llu / %p\n", | 446 | "Checking readiness of task: %llu / %p\n", |
447 | pos->id, pos->callback_cls); | 447 | pos->id, pos->callback_cls); |
448 | next = pos->next; | 448 | next = pos->next; |
@@ -568,7 +568,7 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws) | |||
568 | if (GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value_us > | 568 | if (GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value_us > |
569 | DELAY_THRESHOLD.rel_value_us) | 569 | DELAY_THRESHOLD.rel_value_us) |
570 | { | 570 | { |
571 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 571 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
572 | "Task %llu took %s to be scheduled\n", | 572 | "Task %llu took %s to be scheduled\n", |
573 | (unsigned long long) pos->id, | 573 | (unsigned long long) pos->id, |
574 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (pos->start_time), GNUNET_YES)); | 574 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (pos->start_time), GNUNET_YES)); |
@@ -587,7 +587,7 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws) | |||
587 | (pos->write_fd != -1) && | 587 | (pos->write_fd != -1) && |
588 | (!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd))) | 588 | (!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd))) |
589 | GNUNET_abort (); // added to ready in previous select loop! | 589 | GNUNET_abort (); // added to ready in previous select loop! |
590 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 590 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
591 | "Running task: %llu / %p\n", pos->id, | 591 | "Running task: %llu / %p\n", pos->id, |
592 | pos->callback_cls); | 592 | pos->callback_cls); |
593 | pos->callback (pos->callback_cls, &tc); | 593 | pos->callback (pos->callback_cls, &tc); |
@@ -1052,7 +1052,7 @@ GNUNET_SCHEDULER_TaskIdentifier | |||
1052 | GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, | 1052 | GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, |
1053 | GNUNET_SCHEDULER_Task task, void *task_cls) | 1053 | GNUNET_SCHEDULER_Task task, void *task_cls) |
1054 | { | 1054 | { |
1055 | return GNUNET_SCHEDULER_add_select (prio, | 1055 | return GNUNET_SCHEDULER_add_select (prio, |
1056 | GNUNET_TIME_UNIT_ZERO, NULL, NULL, task, | 1056 | GNUNET_TIME_UNIT_ZERO, NULL, NULL, task, |
1057 | task_cls); | 1057 | task_cls); |
1058 | } | 1058 | } |
@@ -1175,7 +1175,7 @@ GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, | |||
1175 | * to run) might get to run first. Just as with delays, clients must | 1175 | * to run) might get to run first. Just as with delays, clients must |
1176 | * not rely on any particular order of execution between tasks | 1176 | * not rely on any particular order of execution between tasks |
1177 | * scheduled concurrently. | 1177 | * scheduled concurrently. |
1178 | * | 1178 | * |
1179 | * The task will be run with the DEFAULT priority. | 1179 | * The task will be run with the DEFAULT priority. |
1180 | * | 1180 | * |
1181 | * @param task main function of the task | 1181 | * @param task main function of the task |
@@ -1250,7 +1250,7 @@ GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, | |||
1250 | */ | 1250 | */ |
1251 | #ifndef MINGW | 1251 | #ifndef MINGW |
1252 | static GNUNET_SCHEDULER_TaskIdentifier | 1252 | static GNUNET_SCHEDULER_TaskIdentifier |
1253 | add_without_sets (struct GNUNET_TIME_Relative delay, | 1253 | add_without_sets (struct GNUNET_TIME_Relative delay, |
1254 | enum GNUNET_SCHEDULER_Priority priority, | 1254 | enum GNUNET_SCHEDULER_Priority priority, |
1255 | int rfd, int wfd, | 1255 | int rfd, int wfd, |
1256 | GNUNET_SCHEDULER_Task task, void *task_cls) | 1256 | GNUNET_SCHEDULER_Task task, void *task_cls) |
@@ -1396,7 +1396,7 @@ GNUNET_SCHEDULER_add_read_net_with_priority (struct GNUNET_TIME_Relative delay, | |||
1396 | GNUNET_NETWORK_fdset_destroy (rs); | 1396 | GNUNET_NETWORK_fdset_destroy (rs); |
1397 | return ret; | 1397 | return ret; |
1398 | #else | 1398 | #else |
1399 | return add_without_sets (delay, | 1399 | return add_without_sets (delay, |
1400 | priority, | 1400 | priority, |
1401 | GNUNET_NETWORK_get_fd (rfd), -1, task, | 1401 | GNUNET_NETWORK_get_fd (rfd), -1, task, |
1402 | task_cls); | 1402 | task_cls); |
@@ -1441,7 +1441,7 @@ GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, | |||
1441 | return ret; | 1441 | return ret; |
1442 | #else | 1442 | #else |
1443 | GNUNET_assert (GNUNET_NETWORK_get_fd (wfd) >= 0); | 1443 | GNUNET_assert (GNUNET_NETWORK_get_fd (wfd) >= 0); |
1444 | return add_without_sets (delay, | 1444 | return add_without_sets (delay, |
1445 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 1445 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
1446 | -1, GNUNET_NETWORK_get_fd (wfd), task, | 1446 | -1, GNUNET_NETWORK_get_fd (wfd), task, |
1447 | task_cls); | 1447 | task_cls); |
@@ -1486,7 +1486,7 @@ GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay, | |||
1486 | int fd; | 1486 | int fd; |
1487 | 1487 | ||
1488 | GNUNET_DISK_internal_file_handle_ (rfd, &fd, sizeof (int)); | 1488 | GNUNET_DISK_internal_file_handle_ (rfd, &fd, sizeof (int)); |
1489 | return add_without_sets (delay, | 1489 | return add_without_sets (delay, |
1490 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 1490 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
1491 | fd, -1, task, task_cls); | 1491 | fd, -1, task, task_cls); |
1492 | 1492 | ||
@@ -1532,7 +1532,7 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay, | |||
1532 | 1532 | ||
1533 | GNUNET_DISK_internal_file_handle_ (wfd, &fd, sizeof (int)); | 1533 | GNUNET_DISK_internal_file_handle_ (wfd, &fd, sizeof (int)); |
1534 | GNUNET_assert (fd >= 0); | 1534 | GNUNET_assert (fd >= 0); |
1535 | return add_without_sets (delay, | 1535 | return add_without_sets (delay, |
1536 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 1536 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
1537 | -1, fd, task, task_cls); | 1537 | -1, fd, task, task_cls); |
1538 | 1538 | ||
diff --git a/src/util/server.c b/src/util/server.c index dce03bdcf..e00b2ffb8 100644 --- a/src/util/server.c +++ b/src/util/server.c | |||
@@ -368,7 +368,7 @@ GNUNET_SERVER_client_get_user_context_ (struct GNUNET_SERVER_Client *client, | |||
368 | * @param ptr pointer to user context | 368 | * @param ptr pointer to user context |
369 | * @param size number of bytes in user context struct (for verification only) | 369 | * @param size number of bytes in user context struct (for verification only) |
370 | */ | 370 | */ |
371 | void | 371 | void |
372 | GNUNET_SERVER_client_set_user_context_ (struct GNUNET_SERVER_Client *client, | 372 | GNUNET_SERVER_client_set_user_context_ (struct GNUNET_SERVER_Client *client, |
373 | void *ptr, | 373 | void *ptr, |
374 | size_t size) | 374 | size_t size) |
@@ -977,7 +977,7 @@ GNUNET_SERVER_inject (struct GNUNET_SERVER_Handle *server, | |||
977 | (GNUNET_SCHEDULER_NO_TASK == sender->warn_task) ) | 977 | (GNUNET_SCHEDULER_NO_TASK == sender->warn_task) ) |
978 | { | 978 | { |
979 | GNUNET_break (0 != type); /* type should never be 0 here, as we don't use 0 */ | 979 | GNUNET_break (0 != type); /* type should never be 0 here, as we don't use 0 */ |
980 | sender->warn_start = GNUNET_TIME_absolute_get (); | 980 | sender->warn_start = GNUNET_TIME_absolute_get (); |
981 | sender->warn_task = | 981 | sender->warn_task = |
982 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, | 982 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, |
983 | &warn_no_receive_done, sender); | 983 | &warn_no_receive_done, sender); |
@@ -1061,7 +1061,7 @@ process_mst (struct GNUNET_SERVER_Client *client, int ret) | |||
1061 | } | 1061 | } |
1062 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1062 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1063 | "Server leaves instant processing loop: ret = %d, server = %p, shutdown = %d, suspended = %u\n", | 1063 | "Server leaves instant processing loop: ret = %d, server = %p, shutdown = %d, suspended = %u\n", |
1064 | ret, client->server, | 1064 | ret, client->server, |
1065 | client->shutdown_now, | 1065 | client->shutdown_now, |
1066 | client->suspended); | 1066 | client->suspended); |
1067 | if (GNUNET_NO == ret) | 1067 | if (GNUNET_NO == ret) |
@@ -1367,7 +1367,7 @@ GNUNET_SERVER_disconnect_notify (struct GNUNET_SERVER_Handle *server, | |||
1367 | */ | 1367 | */ |
1368 | void | 1368 | void |
1369 | GNUNET_SERVER_connect_notify (struct GNUNET_SERVER_Handle *server, | 1369 | GNUNET_SERVER_connect_notify (struct GNUNET_SERVER_Handle *server, |
1370 | GNUNET_SERVER_ConnectCallback callback, | 1370 | GNUNET_SERVER_ConnectCallback callback, |
1371 | void *callback_cls) | 1371 | void *callback_cls) |
1372 | { | 1372 | { |
1373 | struct NotifyList *n; | 1373 | struct NotifyList *n; |
@@ -1419,7 +1419,7 @@ GNUNET_SERVER_disconnect_notify_cancel (struct GNUNET_SERVER_Handle *server, | |||
1419 | */ | 1419 | */ |
1420 | void | 1420 | void |
1421 | GNUNET_SERVER_connect_notify_cancel (struct GNUNET_SERVER_Handle *server, | 1421 | GNUNET_SERVER_connect_notify_cancel (struct GNUNET_SERVER_Handle *server, |
1422 | GNUNET_SERVER_ConnectCallback callback, | 1422 | GNUNET_SERVER_ConnectCallback callback, |
1423 | void *callback_cls) | 1423 | void *callback_cls) |
1424 | { | 1424 | { |
1425 | struct NotifyList *pos; | 1425 | struct NotifyList *pos; |
@@ -1453,7 +1453,7 @@ destroy_connection (void *cls, | |||
1453 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 1453 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
1454 | { | 1454 | { |
1455 | struct GNUNET_CONNECTION_Handle *connection = cls; | 1455 | struct GNUNET_CONNECTION_Handle *connection = cls; |
1456 | 1456 | ||
1457 | GNUNET_CONNECTION_destroy (connection); | 1457 | GNUNET_CONNECTION_destroy (connection); |
1458 | } | 1458 | } |
1459 | 1459 | ||
@@ -1489,7 +1489,7 @@ GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client) | |||
1489 | GNUNET_CONNECTION_receive_cancel (client->connection); | 1489 | GNUNET_CONNECTION_receive_cancel (client->connection); |
1490 | client->receive_pending = GNUNET_NO; | 1490 | client->receive_pending = GNUNET_NO; |
1491 | } | 1491 | } |
1492 | client->shutdown_now = GNUNET_YES; | 1492 | client->shutdown_now = GNUNET_YES; |
1493 | client->reference_count++; /* make sure nobody else clean up client... */ | 1493 | client->reference_count++; /* make sure nobody else clean up client... */ |
1494 | if ( (NULL != client->mst) && | 1494 | if ( (NULL != client->mst) && |
1495 | (NULL != server) ) | 1495 | (NULL != server) ) |
@@ -1656,7 +1656,7 @@ GNUNET_SERVER_client_persist_ (struct GNUNET_SERVER_Client *client) | |||
1656 | * serious error) | 1656 | * serious error) |
1657 | */ | 1657 | */ |
1658 | void | 1658 | void |
1659 | GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, | 1659 | GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, |
1660 | int success) | 1660 | int success) |
1661 | { | 1661 | { |
1662 | if (NULL == client) | 1662 | if (NULL == client) |
diff --git a/src/util/server_nc.c b/src/util/server_nc.c index d11025680..d6625eefb 100644 --- a/src/util/server_nc.c +++ b/src/util/server_nc.c | |||
@@ -268,7 +268,7 @@ GNUNET_SERVER_notification_context_add (struct GNUNET_SERVER_NotificationContext | |||
268 | 268 | ||
269 | for (cl = nc->clients_head; NULL != cl; cl = cl->next) | 269 | for (cl = nc->clients_head; NULL != cl; cl = cl->next) |
270 | if (cl->client == client) | 270 | if (cl->client == client) |
271 | return; /* already present */ | 271 | return; /* already present */ |
272 | cl = GNUNET_malloc (sizeof (struct ClientList)); | 272 | cl = GNUNET_malloc (sizeof (struct ClientList)); |
273 | GNUNET_CONTAINER_DLL_insert (nc->clients_head, | 273 | GNUNET_CONTAINER_DLL_insert (nc->clients_head, |
274 | nc->clients_tail, | 274 | nc->clients_tail, |
diff --git a/src/util/service.c b/src/util/service.c index cab8a8aef..d8ca5eba6 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -101,7 +101,7 @@ GNUNET_SPEEDUP_stop_ (void); | |||
101 | * with a semicolon). The network must be given in dotted-decimal | 101 | * with a semicolon). The network must be given in dotted-decimal |
102 | * notation. The netmask can be given in CIDR notation (/16) or | 102 | * notation. The netmask can be given in CIDR notation (/16) or |
103 | * in dotted-decimal (/255.255.0.0). | 103 | * in dotted-decimal (/255.255.0.0). |
104 | * | 104 | * |
105 | * @param routeList a string specifying the forbidden networks | 105 | * @param routeList a string specifying the forbidden networks |
106 | * @return the converted list, NULL if the synatx is flawed | 106 | * @return the converted list, NULL if the synatx is flawed |
107 | */ | 107 | */ |
@@ -254,7 +254,7 @@ parse_ipv4_specification (const char *routeList) | |||
254 | * with a semicolon). The network must be given in colon-hex | 254 | * with a semicolon). The network must be given in colon-hex |
255 | * notation. The netmask must be given in CIDR notation (/16) or | 255 | * notation. The netmask must be given in CIDR notation (/16) or |
256 | * can be omitted to specify a single host. | 256 | * can be omitted to specify a single host. |
257 | * | 257 | * |
258 | * @param routeListX a string specifying the forbidden networks | 258 | * @param routeListX a string specifying the forbidden networks |
259 | * @return the converted list, NULL if the synatx is flawed | 259 | * @return the converted list, NULL if the synatx is flawed |
260 | */ | 260 | */ |
@@ -659,18 +659,18 @@ check_access (void *cls, const struct GNUNET_CONNECTION_Credentials *uc, | |||
659 | #ifndef WINDOWS | 659 | #ifndef WINDOWS |
660 | case AF_UNIX: | 660 | case AF_UNIX: |
661 | ret = GNUNET_OK; /* always OK for now */ | 661 | ret = GNUNET_OK; /* always OK for now */ |
662 | if (GNUNET_YES == sctx->match_uid) | 662 | if (GNUNET_YES == sctx->match_uid) |
663 | { | 663 | { |
664 | /* UID match required */ | 664 | /* UID match required */ |
665 | ret = (NULL != uc) && ( (0 == uc->uid) || (uc->uid == geteuid ()) ); | 665 | ret = (NULL != uc) && ( (0 == uc->uid) || (uc->uid == geteuid ()) ); |
666 | } | 666 | } |
667 | else if ( (GNUNET_YES == sctx->match_gid) && | 667 | else if ( (GNUNET_YES == sctx->match_gid) && |
668 | ( (NULL == uc) || | 668 | ( (NULL == uc) || |
669 | ( (0 != uc->uid) && | 669 | ( (0 != uc->uid) && |
670 | (uc->uid != geteuid ()) ) ) ) | 670 | (uc->uid != geteuid ()) ) ) ) |
671 | { | 671 | { |
672 | /* group match required and UID does not match */ | 672 | /* group match required and UID does not match */ |
673 | if (NULL == uc) | 673 | if (NULL == uc) |
674 | { | 674 | { |
675 | /* no credentials, group match not possible */ | 675 | /* no credentials, group match not possible */ |
676 | ret = GNUNET_NO; | 676 | ret = GNUNET_NO; |
@@ -718,7 +718,7 @@ check_access (void *cls, const struct GNUNET_CONNECTION_Credentials *uc, | |||
718 | if (GNUNET_OK != ret) | 718 | if (GNUNET_OK != ret) |
719 | { | 719 | { |
720 | LOG (GNUNET_ERROR_TYPE_WARNING, | 720 | LOG (GNUNET_ERROR_TYPE_WARNING, |
721 | _("Access from `%s' denied to service `%s'\n"), | 721 | _("Access from `%s' denied to service `%s'\n"), |
722 | GNUNET_a2s (addr, addrlen), | 722 | GNUNET_a2s (addr, addrlen), |
723 | sctx->service_name); | 723 | sctx->service_name); |
724 | } | 724 | } |
@@ -750,9 +750,9 @@ get_pid_file_name (struct GNUNET_SERVICE_Context *sctx) | |||
750 | * Parse an IPv4 access control list. | 750 | * Parse an IPv4 access control list. |
751 | * | 751 | * |
752 | * @param ret location where to write the ACL (set) | 752 | * @param ret location where to write the ACL (set) |
753 | * @param sctx service context to use to get the configuration | 753 | * @param sctx service context to use to get the configuration |
754 | * @param option name of the ACL option to parse | 754 | * @param option name of the ACL option to parse |
755 | * @return GNUNET_SYSERR on parse error, GNUNET_OK on success (including | 755 | * @return GNUNET_SYSERR on parse error, GNUNET_OK on success (including |
756 | * no ACL configured) | 756 | * no ACL configured) |
757 | */ | 757 | */ |
758 | static int | 758 | static int |
@@ -763,7 +763,7 @@ process_acl4 (struct IPv4NetworkSet **ret, struct GNUNET_SERVICE_Context *sctx, | |||
763 | 763 | ||
764 | if (!GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->service_name, option)) | 764 | if (!GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->service_name, option)) |
765 | { | 765 | { |
766 | *ret = NULL; | 766 | *ret = NULL; |
767 | return GNUNET_OK; | 767 | return GNUNET_OK; |
768 | } | 768 | } |
769 | GNUNET_break (GNUNET_OK == | 769 | GNUNET_break (GNUNET_OK == |
@@ -787,9 +787,9 @@ process_acl4 (struct IPv4NetworkSet **ret, struct GNUNET_SERVICE_Context *sctx, | |||
787 | * Parse an IPv6 access control list. | 787 | * Parse an IPv6 access control list. |
788 | * | 788 | * |
789 | * @param ret location where to write the ACL (set) | 789 | * @param ret location where to write the ACL (set) |
790 | * @param sctx service context to use to get the configuration | 790 | * @param sctx service context to use to get the configuration |
791 | * @param option name of the ACL option to parse | 791 | * @param option name of the ACL option to parse |
792 | * @return GNUNET_SYSERR on parse error, GNUNET_OK on success (including | 792 | * @return GNUNET_SYSERR on parse error, GNUNET_OK on success (including |
793 | * no ACL configured) | 793 | * no ACL configured) |
794 | */ | 794 | */ |
795 | static int | 795 | static int |
@@ -1825,7 +1825,7 @@ shutdown: | |||
1825 | #if HAVE_MALLINFO | 1825 | #if HAVE_MALLINFO |
1826 | { | 1826 | { |
1827 | char *counter; | 1827 | char *counter; |
1828 | 1828 | ||
1829 | if ( (GNUNET_YES == | 1829 | if ( (GNUNET_YES == |
1830 | GNUNET_CONFIGURATION_have_value (sctx.cfg, service_name, | 1830 | GNUNET_CONFIGURATION_have_value (sctx.cfg, service_name, |
1831 | "GAUGER_HEAP")) && | 1831 | "GAUGER_HEAP")) && |
@@ -1835,11 +1835,11 @@ shutdown: | |||
1835 | &counter)) ) | 1835 | &counter)) ) |
1836 | { | 1836 | { |
1837 | struct mallinfo mi; | 1837 | struct mallinfo mi; |
1838 | 1838 | ||
1839 | mi = mallinfo (); | 1839 | mi = mallinfo (); |
1840 | GAUGER (service_name, counter, mi.usmblks, "blocks"); | 1840 | GAUGER (service_name, counter, mi.usmblks, "blocks"); |
1841 | GNUNET_free (counter); | 1841 | GNUNET_free (counter); |
1842 | } | 1842 | } |
1843 | } | 1843 | } |
1844 | #endif | 1844 | #endif |
1845 | GNUNET_SPEEDUP_stop_ (); | 1845 | GNUNET_SPEEDUP_stop_ (); |
@@ -1944,7 +1944,7 @@ GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Context *sctx) | |||
1944 | #if HAVE_MALLINFO | 1944 | #if HAVE_MALLINFO |
1945 | { | 1945 | { |
1946 | char *counter; | 1946 | char *counter; |
1947 | 1947 | ||
1948 | if ( (GNUNET_YES == | 1948 | if ( (GNUNET_YES == |
1949 | GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->service_name, | 1949 | GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->service_name, |
1950 | "GAUGER_HEAP")) && | 1950 | "GAUGER_HEAP")) && |
@@ -1954,11 +1954,11 @@ GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Context *sctx) | |||
1954 | &counter)) ) | 1954 | &counter)) ) |
1955 | { | 1955 | { |
1956 | struct mallinfo mi; | 1956 | struct mallinfo mi; |
1957 | 1957 | ||
1958 | mi = mallinfo (); | 1958 | mi = mallinfo (); |
1959 | GAUGER (sctx->service_name, counter, mi.usmblks, "blocks"); | 1959 | GAUGER (sctx->service_name, counter, mi.usmblks, "blocks"); |
1960 | GNUNET_free (counter); | 1960 | GNUNET_free (counter); |
1961 | } | 1961 | } |
1962 | } | 1962 | } |
1963 | #endif | 1963 | #endif |
1964 | if (GNUNET_SCHEDULER_NO_TASK != sctx->shutdown_task) | 1964 | if (GNUNET_SCHEDULER_NO_TASK != sctx->shutdown_task) |
diff --git a/src/util/speedup.c b/src/util/speedup.c index 2482decea..52ac3287c 100644 --- a/src/util/speedup.c +++ b/src/util/speedup.c | |||
@@ -40,14 +40,14 @@ static void | |||
40 | do_speedup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 40 | do_speedup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
41 | { | 41 | { |
42 | static long long current_offset; | 42 | static long long current_offset; |
43 | 43 | ||
44 | speedup_task = GNUNET_SCHEDULER_NO_TASK; | 44 | speedup_task = GNUNET_SCHEDULER_NO_TASK; |
45 | if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) | 45 | if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) |
46 | return; | 46 | return; |
47 | current_offset += delta.rel_value_us; | 47 | current_offset += delta.rel_value_us; |
48 | GNUNET_TIME_set_offset (current_offset); | 48 | GNUNET_TIME_set_offset (current_offset); |
49 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 49 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
50 | "Speeding up execution time by %s\n", | 50 | "Speeding up execution time by %s\n", |
51 | GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_NO)); | 51 | GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_NO)); |
52 | speedup_task = GNUNET_SCHEDULER_add_delayed (interval, &do_speedup, NULL); | 52 | speedup_task = GNUNET_SCHEDULER_add_delayed (interval, &do_speedup, NULL); |
53 | } | 53 | } |
@@ -95,7 +95,7 @@ GNUNET_SPEEDUP_stop_ ( ) | |||
95 | GNUNET_SCHEDULER_cancel (speedup_task); | 95 | GNUNET_SCHEDULER_cancel (speedup_task); |
96 | speedup_task = GNUNET_SCHEDULER_NO_TASK; | 96 | speedup_task = GNUNET_SCHEDULER_NO_TASK; |
97 | } | 97 | } |
98 | if ( (0 != interval.rel_value_us) && | 98 | if ( (0 != interval.rel_value_us) && |
99 | (0 != delta.rel_value_us) ) | 99 | (0 != delta.rel_value_us) ) |
100 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 100 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
101 | "Stopped execution speed up\n"); | 101 | "Stopped execution speed up\n"); |
diff --git a/src/util/strings.c b/src/util/strings.c index 3d061fb57..d0e8fddc7 100644 --- a/src/util/strings.c +++ b/src/util/strings.c | |||
@@ -381,8 +381,8 @@ GNUNET_STRINGS_fancy_time_to_absolute (const char *fancy_time, | |||
381 | */ | 381 | */ |
382 | char * | 382 | char * |
383 | GNUNET_STRINGS_conv (const char *input, | 383 | GNUNET_STRINGS_conv (const char *input, |
384 | size_t len, | 384 | size_t len, |
385 | const char *input_charset, | 385 | const char *input_charset, |
386 | const char *output_charset) | 386 | const char *output_charset) |
387 | { | 387 | { |
388 | char *ret; | 388 | char *ret; |
@@ -391,10 +391,10 @@ GNUNET_STRINGS_conv (const char *input, | |||
391 | size_t u8_string_length; | 391 | size_t u8_string_length; |
392 | size_t encoded_string_length; | 392 | size_t encoded_string_length; |
393 | 393 | ||
394 | u8_string = u8_conv_from_encoding (input_charset, | 394 | u8_string = u8_conv_from_encoding (input_charset, |
395 | iconveh_error, | 395 | iconveh_error, |
396 | input, len, | 396 | input, len, |
397 | NULL, NULL, | 397 | NULL, NULL, |
398 | &u8_string_length); | 398 | &u8_string_length); |
399 | if (NULL == u8_string) | 399 | if (NULL == u8_string) |
400 | { | 400 | { |
@@ -409,9 +409,9 @@ GNUNET_STRINGS_conv (const char *input, | |||
409 | free (u8_string); | 409 | free (u8_string); |
410 | return ret; | 410 | return ret; |
411 | } | 411 | } |
412 | encoded_string = u8_conv_to_encoding (output_charset, iconveh_error, | 412 | encoded_string = u8_conv_to_encoding (output_charset, iconveh_error, |
413 | u8_string, u8_string_length, | 413 | u8_string, u8_string_length, |
414 | NULL, NULL, | 414 | NULL, NULL, |
415 | &encoded_string_length); | 415 | &encoded_string_length); |
416 | free (u8_string); | 416 | free (u8_string); |
417 | if (NULL == encoded_string) | 417 | if (NULL == encoded_string) |
@@ -644,14 +644,14 @@ GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta, | |||
644 | return _("forever"); | 644 | return _("forever"); |
645 | if (0 == delta.rel_value_us) | 645 | if (0 == delta.rel_value_us) |
646 | return _("0 ms"); | 646 | return _("0 ms"); |
647 | if ( ( (GNUNET_YES == do_round) && | 647 | if ( ( (GNUNET_YES == do_round) && |
648 | (dval > 5 * 1000) ) || | 648 | (dval > 5 * 1000) ) || |
649 | (0 == (dval % 1000) )) | 649 | (0 == (dval % 1000) )) |
650 | { | 650 | { |
651 | dval = dval / 1000; | 651 | dval = dval / 1000; |
652 | unit = _( /* time unit */ "ms"); | 652 | unit = _( /* time unit */ "ms"); |
653 | if ( ( (GNUNET_YES == do_round) && | 653 | if ( ( (GNUNET_YES == do_round) && |
654 | (dval > 5 * 1000) ) || | 654 | (dval > 5 * 1000) ) || |
655 | (0 == (dval % 1000) )) | 655 | (0 == (dval % 1000) )) |
656 | { | 656 | { |
657 | dval = dval / 1000; | 657 | dval = dval / 1000; |
@@ -663,7 +663,7 @@ GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta, | |||
663 | dval = dval / 60; | 663 | dval = dval / 60; |
664 | unit = _( /* time unit */ "m"); | 664 | unit = _( /* time unit */ "m"); |
665 | if ( ( (GNUNET_YES == do_round) && | 665 | if ( ( (GNUNET_YES == do_round) && |
666 | (dval > 5 * 60) ) || | 666 | (dval > 5 * 60) ) || |
667 | (0 == (dval % 60) )) | 667 | (0 == (dval % 60) )) |
668 | { | 668 | { |
669 | dval = dval / 60; | 669 | dval = dval / 60; |
@@ -756,7 +756,7 @@ getValue__ (unsigned char a) | |||
756 | * Convert binary data to ASCII encoding. The ASCII encoding is rather | 756 | * Convert binary data to ASCII encoding. The ASCII encoding is rather |
757 | * GNUnet specific. It was chosen such that it only uses characters | 757 | * GNUnet specific. It was chosen such that it only uses characters |
758 | * in [0-9A-V], can be produced without complex arithmetics and uses a | 758 | * in [0-9A-V], can be produced without complex arithmetics and uses a |
759 | * small number of characters. | 759 | * small number of characters. |
760 | * Does not append 0-terminator, but returns a pointer to the place where | 760 | * Does not append 0-terminator, but returns a pointer to the place where |
761 | * it should be placed, if needed. | 761 | * it should be placed, if needed. |
762 | * | 762 | * |
@@ -771,7 +771,7 @@ char * | |||
771 | GNUNET_STRINGS_data_to_string (const void *data, size_t size, char *out, size_t out_size) | 771 | GNUNET_STRINGS_data_to_string (const void *data, size_t size, char *out, size_t out_size) |
772 | { | 772 | { |
773 | /** | 773 | /** |
774 | * 32 characters for encoding | 774 | * 32 characters for encoding |
775 | */ | 775 | */ |
776 | static char *encTable__ = "0123456789ABCDEFGHIJKLMNOPQRSTUV"; | 776 | static char *encTable__ = "0123456789ABCDEFGHIJKLMNOPQRSTUV"; |
777 | unsigned int wpos; | 777 | unsigned int wpos; |
@@ -1040,7 +1040,7 @@ GNUNET_STRINGS_path_is_absolute (const char *filename, int can_be_uri, | |||
1040 | 1040 | ||
1041 | /** | 1041 | /** |
1042 | * Perform 'checks' on 'filename' | 1042 | * Perform 'checks' on 'filename' |
1043 | * | 1043 | * |
1044 | * @param filename file to check | 1044 | * @param filename file to check |
1045 | * @param checks checks to perform | 1045 | * @param checks checks to perform |
1046 | * @return GNUNET_YES if all checks pass, GNUNET_NO if at least one of them | 1046 | * @return GNUNET_YES if all checks pass, GNUNET_NO if at least one of them |
@@ -1081,7 +1081,7 @@ GNUNET_STRINGS_check_filename (const char *filename, | |||
1081 | /** | 1081 | /** |
1082 | * Tries to convert 'zt_addr' string to an IPv6 address. | 1082 | * Tries to convert 'zt_addr' string to an IPv6 address. |
1083 | * The string is expected to have the format "[ABCD::01]:80". | 1083 | * The string is expected to have the format "[ABCD::01]:80". |
1084 | * | 1084 | * |
1085 | * @param zt_addr 0-terminated string. May be mangled by the function. | 1085 | * @param zt_addr 0-terminated string. May be mangled by the function. |
1086 | * @param addrlen length of zt_addr (not counting 0-terminator). | 1086 | * @param addrlen length of zt_addr (not counting 0-terminator). |
1087 | * @param r_buf a buffer to fill. Initially gets filled with zeroes, | 1087 | * @param r_buf a buffer to fill. Initially gets filled with zeroes, |
@@ -1090,7 +1090,7 @@ GNUNET_STRINGS_check_filename (const char *filename, | |||
1090 | * case the contents of r_buf are undefined. | 1090 | * case the contents of r_buf are undefined. |
1091 | */ | 1091 | */ |
1092 | int | 1092 | int |
1093 | GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, | 1093 | GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, |
1094 | uint16_t addrlen, | 1094 | uint16_t addrlen, |
1095 | struct sockaddr_in6 *r_buf) | 1095 | struct sockaddr_in6 *r_buf) |
1096 | { | 1096 | { |
@@ -1100,7 +1100,7 @@ GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, | |||
1100 | unsigned int port; | 1100 | unsigned int port; |
1101 | 1101 | ||
1102 | if (addrlen < 6) | 1102 | if (addrlen < 6) |
1103 | return GNUNET_SYSERR; | 1103 | return GNUNET_SYSERR; |
1104 | memcpy (zbuf, zt_addr, addrlen); | 1104 | memcpy (zbuf, zt_addr, addrlen); |
1105 | if ('[' != zbuf[0]) | 1105 | if ('[' != zbuf[0]) |
1106 | { | 1106 | { |
@@ -1152,7 +1152,7 @@ GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, | |||
1152 | /** | 1152 | /** |
1153 | * Tries to convert 'zt_addr' string to an IPv4 address. | 1153 | * Tries to convert 'zt_addr' string to an IPv4 address. |
1154 | * The string is expected to have the format "1.2.3.4:80". | 1154 | * The string is expected to have the format "1.2.3.4:80". |
1155 | * | 1155 | * |
1156 | * @param zt_addr 0-terminated string. May be mangled by the function. | 1156 | * @param zt_addr 0-terminated string. May be mangled by the function. |
1157 | * @param addrlen length of zt_addr (not counting 0-terminator). | 1157 | * @param addrlen length of zt_addr (not counting 0-terminator). |
1158 | * @param r_buf a buffer to fill. | 1158 | * @param r_buf a buffer to fill. |
@@ -1191,7 +1191,7 @@ GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr, uint16_t addrlen, | |||
1191 | /** | 1191 | /** |
1192 | * Tries to convert 'addr' string to an IP (v4 or v6) address. | 1192 | * Tries to convert 'addr' string to an IP (v4 or v6) address. |
1193 | * Will automatically decide whether to treat 'addr' as v4 or v6 address. | 1193 | * Will automatically decide whether to treat 'addr' as v4 or v6 address. |
1194 | * | 1194 | * |
1195 | * @param addr a string, may not be 0-terminated. | 1195 | * @param addr a string, may not be 0-terminated. |
1196 | * @param addrlen number of bytes in addr (if addr is 0-terminated, | 1196 | * @param addrlen number of bytes in addr (if addr is 0-terminated, |
1197 | * 0-terminator should not be counted towards addrlen). | 1197 | * 0-terminator should not be counted towards addrlen). |
@@ -1200,7 +1200,7 @@ GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr, uint16_t addrlen, | |||
1200 | * case the contents of r_buf are undefined. | 1200 | * case the contents of r_buf are undefined. |
1201 | */ | 1201 | */ |
1202 | int | 1202 | int |
1203 | GNUNET_STRINGS_to_address_ip (const char *addr, | 1203 | GNUNET_STRINGS_to_address_ip (const char *addr, |
1204 | uint16_t addrlen, | 1204 | uint16_t addrlen, |
1205 | struct sockaddr_storage *r_buf) | 1205 | struct sockaddr_storage *r_buf) |
1206 | { | 1206 | { |
diff --git a/src/util/test_common_logging_runtime_loglevels.c b/src/util/test_common_logging_runtime_loglevels.c index c608d59c5..7d8834082 100644 --- a/src/util/test_common_logging_runtime_loglevels.c +++ b/src/util/test_common_logging_runtime_loglevels.c | |||
@@ -96,7 +96,7 @@ end_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
96 | static char * | 96 | static char * |
97 | read_output_line (int phase_from1, int phase_to1, int phase_from2, | 97 | read_output_line (int phase_from1, int phase_to1, int phase_from2, |
98 | int phase_to2, char c, const char *expect_level, | 98 | int phase_to2, char c, const char *expect_level, |
99 | long delay_morethan, long delay_lessthan, int phase, | 99 | long delay_morethan, long delay_lessthan, int phase, |
100 | char *p, | 100 | char *p, |
101 | int *len, long *delay, char level[8]) | 101 | int *len, long *delay, char level[8]) |
102 | { | 102 | { |
diff --git a/src/util/test_configuration.c b/src/util/test_configuration.c index 2d2806956..e68740e7f 100644 --- a/src/util/test_configuration.c +++ b/src/util/test_configuration.c | |||
@@ -37,7 +37,7 @@ enum | |||
37 | ADD_NEW_ENTRY, | 37 | ADD_NEW_ENTRY, |
38 | REMOVE_SECTION, | 38 | REMOVE_SECTION, |
39 | REMOVE_ENTRY, | 39 | REMOVE_ENTRY, |
40 | COMPARE, | 40 | COMPARE, |
41 | 41 | ||
42 | }; | 42 | }; |
43 | 43 | ||
@@ -236,14 +236,14 @@ checkDiffs (struct GNUNET_CONFIGURATION_Handle *cfgDefault, int option) | |||
236 | GNUNET_CONFIGURATION_iterate (cfg, diffsCallBack, &cbData); | 236 | GNUNET_CONFIGURATION_iterate (cfg, diffsCallBack, &cbData); |
237 | if (1 == (ret = cbData.status)) | 237 | if (1 == (ret = cbData.status)) |
238 | { | 238 | { |
239 | FPRINTF (stderr, "%s", | 239 | FPRINTF (stderr, "%s", |
240 | "Incorrect Configuration Diffs: Diffs may contain data not actually edited\n"); | 240 | "Incorrect Configuration Diffs: Diffs may contain data not actually edited\n"); |
241 | goto housekeeping; | 241 | goto housekeeping; |
242 | } | 242 | } |
243 | cbData.cfgDiffs = cfg; | 243 | cbData.cfgDiffs = cfg; |
244 | GNUNET_CONFIGURATION_iterate (cfgDiffs, diffsCallBack, &cbData); | 244 | GNUNET_CONFIGURATION_iterate (cfgDiffs, diffsCallBack, &cbData); |
245 | if ((ret = cbData.status) == 1) | 245 | if ((ret = cbData.status) == 1) |
246 | FPRINTF (stderr, "%s", | 246 | FPRINTF (stderr, "%s", |
247 | "Incorrect Configuration Diffs: Data may be missing in diffs\n"); | 247 | "Incorrect Configuration Diffs: Data may be missing in diffs\n"); |
248 | 248 | ||
249 | housekeeping: | 249 | housekeeping: |
diff --git a/src/util/test_crypto_ecc.c b/src/util/test_crypto_ecc.c index ff944ce0e..c89568bb9 100644 --- a/src/util/test_crypto_ecc.c +++ b/src/util/test_crypto_ecc.c | |||
@@ -108,7 +108,7 @@ testDeriveSignVerify () | |||
108 | return GNUNET_SYSERR; | 108 | return GNUNET_SYSERR; |
109 | } | 109 | } |
110 | if (GNUNET_SYSERR == | 110 | if (GNUNET_SYSERR == |
111 | GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_TEST, | 111 | GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_TEST, |
112 | &purp, &sig, | 112 | &purp, &sig, |
113 | &dpub)) | 113 | &dpub)) |
114 | { | 114 | { |
@@ -117,7 +117,7 @@ testDeriveSignVerify () | |||
117 | return GNUNET_SYSERR; | 117 | return GNUNET_SYSERR; |
118 | } | 118 | } |
119 | if (GNUNET_SYSERR != | 119 | if (GNUNET_SYSERR != |
120 | GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_TEST, | 120 | GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_TEST, |
121 | &purp, &sig, | 121 | &purp, &sig, |
122 | &pkey)) | 122 | &pkey)) |
123 | { | 123 | { |
@@ -280,7 +280,7 @@ main (int argc, char *argv[]) | |||
280 | if (0 != failure_count) | 280 | if (0 != failure_count) |
281 | { | 281 | { |
282 | fprintf (stderr, | 282 | fprintf (stderr, |
283 | "\n\n%d TESTS FAILED!\n\n", | 283 | "\n\n%d TESTS FAILED!\n\n", |
284 | failure_count); | 284 | failure_count); |
285 | return -1; | 285 | return -1; |
286 | } | 286 | } |
diff --git a/src/util/test_crypto_symmetric.c b/src/util/test_crypto_symmetric.c index 1754a835a..42bf10ffd 100644 --- a/src/util/test_crypto_symmetric.c +++ b/src/util/test_crypto_symmetric.c | |||
@@ -95,8 +95,8 @@ verifyCrypto () | |||
95 | }; | 95 | }; |
96 | unsigned char encrresult[] = | 96 | unsigned char encrresult[] = |
97 | { | 97 | { |
98 | 155, 88, 106, 174, 124, 172, 47, 149, 85, 15, 208, 176, 65, 124, 155, | 98 | 155, 88, 106, 174, 124, 172, 47, 149, 85, 15, 208, 176, 65, 124, 155, |
99 | 74, 215, 25, 177, 231, 162, 109, 165, 4, 133, 165, 93, 44, 213, 77, | 99 | 74, 215, 25, 177, 231, 162, 109, 165, 4, 133, 165, 93, 44, 213, 77, |
100 | 206, 204, 1 | 100 | 206, 204, 1 |
101 | }; | 101 | }; |
102 | 102 | ||
@@ -109,7 +109,7 @@ verifyCrypto () | |||
109 | GNUNET_CRYPTO_symmetric_encrypt (plain, GNUNET_CRYPTO_AES_KEY_LENGTH, &key, | 109 | GNUNET_CRYPTO_symmetric_encrypt (plain, GNUNET_CRYPTO_AES_KEY_LENGTH, &key, |
110 | (const struct | 110 | (const struct |
111 | GNUNET_CRYPTO_SymmetricInitializationVector *) | 111 | GNUNET_CRYPTO_SymmetricInitializationVector *) |
112 | "testtesttesttesttesttesttesttest", | 112 | "testtesttesttesttesttesttesttest", |
113 | result)) | 113 | result)) |
114 | { | 114 | { |
115 | printf ("Wrong return value from encrypt block.\n"); | 115 | printf ("Wrong return value from encrypt block.\n"); |
diff --git a/src/util/test_mq.c b/src/util/test_mq.c index f98fcd235..6fcef89c5 100644 --- a/src/util/test_mq.c +++ b/src/util/test_mq.c | |||
@@ -42,7 +42,7 @@ test1 () | |||
42 | { | 42 | { |
43 | struct GNUNET_MQ_Envelope *mqm; | 43 | struct GNUNET_MQ_Envelope *mqm; |
44 | struct MyMessage *mm; | 44 | struct MyMessage *mm; |
45 | 45 | ||
46 | mm = NULL; | 46 | mm = NULL; |
47 | mqm = NULL; | 47 | mqm = NULL; |
48 | 48 | ||
diff --git a/src/util/test_os_start_process.c b/src/util/test_os_start_process.c index 2b1d9070c..8e701750b 100644 --- a/src/util/test_os_start_process.c +++ b/src/util/test_os_start_process.c | |||
@@ -37,12 +37,12 @@ static int ok; | |||
37 | static struct GNUNET_OS_Process *proc; | 37 | static struct GNUNET_OS_Process *proc; |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Pipe to write to started processes stdin (on write end) | 40 | * Pipe to write to started processes stdin (on write end) |
41 | */ | 41 | */ |
42 | static struct GNUNET_DISK_PipeHandle *hello_pipe_stdin; | 42 | static struct GNUNET_DISK_PipeHandle *hello_pipe_stdin; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Pipe to read from started processes stdout (on read end) | 45 | * Pipe to read from started processes stdout (on read end) |
46 | */ | 46 | */ |
47 | static struct GNUNET_DISK_PipeHandle *hello_pipe_stdout; | 47 | static struct GNUNET_DISK_PipeHandle *hello_pipe_stdout; |
48 | 48 | ||
@@ -204,7 +204,7 @@ check_kill () | |||
204 | fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); | 204 | fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); |
205 | proc = | 205 | proc = |
206 | GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn, | 206 | GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn, |
207 | "gnunet-service-resolver", "-", NULL); | 207 | "gnunet-service-resolver", "-", NULL); |
208 | sleep (1); /* give process time to start, so we actually use the pipe-kill mechanism! */ | 208 | sleep (1); /* give process time to start, so we actually use the pipe-kill mechanism! */ |
209 | GNUNET_free (fn); | 209 | GNUNET_free (fn); |
210 | if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) | 210 | if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) |
@@ -235,7 +235,7 @@ check_instant_kill () | |||
235 | fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); | 235 | fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); |
236 | proc = | 236 | proc = |
237 | GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn, | 237 | GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn, |
238 | "gnunet-service-resolver", "-", NULL); | 238 | "gnunet-service-resolver", "-", NULL); |
239 | if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) | 239 | if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) |
240 | { | 240 | { |
241 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 241 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
diff --git a/src/util/test_peer.c b/src/util/test_peer.c index 51f759867..c2cd49315 100644 --- a/src/util/test_peer.c +++ b/src/util/test_peer.c | |||
@@ -43,7 +43,7 @@ generatePeerIdList () | |||
43 | for (i = 0; i < NUMBER_OF_PEERS; i++) | 43 | for (i = 0; i < NUMBER_OF_PEERS; i++) |
44 | { | 44 | { |
45 | gcry_randomize (&pidArr[i], | 45 | gcry_randomize (&pidArr[i], |
46 | sizeof (struct GNUNET_PeerIdentity), | 46 | sizeof (struct GNUNET_PeerIdentity), |
47 | GCRY_STRONG_RANDOM); | 47 | GCRY_STRONG_RANDOM); |
48 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 48 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
49 | "Peer %d: %s\n", i, GNUNET_i2s (&pidArr[i])); | 49 | "Peer %d: %s\n", i, GNUNET_i2s (&pidArr[i])); |
diff --git a/src/util/test_plugin.c b/src/util/test_plugin.c index e819e678a..135447da8 100644 --- a/src/util/test_plugin.c +++ b/src/util/test_plugin.c | |||
@@ -53,7 +53,7 @@ main (int argc, char *argv[]) | |||
53 | ret = GNUNET_PLUGIN_load ("libgnunet_plugin_test", "in"); | 53 | ret = GNUNET_PLUGIN_load ("libgnunet_plugin_test", "in"); |
54 | if (ret == NULL) | 54 | if (ret == NULL) |
55 | return 1; | 55 | return 1; |
56 | if (0 != strcmp (ret, "Hello")) | 56 | if (0 != strcmp (ret, "Hello")) |
57 | return 2; | 57 | return 2; |
58 | ret = GNUNET_PLUGIN_unload ("libgnunet_plugin_test", "out"); | 58 | ret = GNUNET_PLUGIN_unload ("libgnunet_plugin_test", "out"); |
59 | if (ret == NULL) | 59 | if (ret == NULL) |
diff --git a/src/util/test_resolver_api.c b/src/util/test_resolver_api.c index ea18629f4..bcbaf4f04 100644 --- a/src/util/test_resolver_api.c +++ b/src/util/test_resolver_api.c | |||
@@ -353,7 +353,7 @@ main (int argc, char *argv[]) | |||
353 | int ok = 1 + 2 + 4 + 8; | 353 | int ok = 1 + 2 + 4 + 8; |
354 | char *fn; | 354 | char *fn; |
355 | struct GNUNET_OS_Process *proc; | 355 | struct GNUNET_OS_Process *proc; |
356 | char *const argvx[] = { | 356 | char *const argvx[] = { |
357 | "test-resolver-api", "-c", "test_resolver_api_data.conf", NULL | 357 | "test-resolver-api", "-c", "test_resolver_api_data.conf", NULL |
358 | }; | 358 | }; |
359 | struct GNUNET_GETOPT_CommandLineOption options[] = | 359 | struct GNUNET_GETOPT_CommandLineOption options[] = |
@@ -363,9 +363,9 @@ main (int argc, char *argv[]) | |||
363 | "WARNING", | 363 | "WARNING", |
364 | NULL); | 364 | NULL); |
365 | fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); | 365 | fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); |
366 | proc = GNUNET_OS_start_process (GNUNET_YES, | 366 | proc = GNUNET_OS_start_process (GNUNET_YES, |
367 | GNUNET_OS_INHERIT_STD_OUT_AND_ERR, | 367 | GNUNET_OS_INHERIT_STD_OUT_AND_ERR, |
368 | NULL, NULL, fn, | 368 | NULL, NULL, fn, |
369 | "gnunet-service-resolver", | 369 | "gnunet-service-resolver", |
370 | "-c", "test_resolver_api_data.conf", NULL); | 370 | "-c", "test_resolver_api_data.conf", NULL); |
371 | GNUNET_assert (NULL != proc); | 371 | GNUNET_assert (NULL != proc); |
diff --git a/src/util/test_scheduler_delay.c b/src/util/test_scheduler_delay.c index ce96213c7..66fc95d0a 100644 --- a/src/util/test_scheduler_delay.c +++ b/src/util/test_scheduler_delay.c | |||
@@ -76,7 +76,7 @@ main (int argc, char *argv[]) | |||
76 | GNUNET_log_setup ("test-scheduler-delay", "WARNING", NULL); | 76 | GNUNET_log_setup ("test-scheduler-delay", "WARNING", NULL); |
77 | target = GNUNET_TIME_absolute_get (); | 77 | target = GNUNET_TIME_absolute_get (); |
78 | GNUNET_SCHEDULER_run (&test_task, NULL); | 78 | GNUNET_SCHEDULER_run (&test_task, NULL); |
79 | FPRINTF (stdout, | 79 | FPRINTF (stdout, |
80 | "Sleep precision: %llu microseconds (average delta). ", | 80 | "Sleep precision: %llu microseconds (average delta). ", |
81 | cumDelta / (MAXV / INCR)); | 81 | cumDelta / (MAXV / INCR)); |
82 | if (cumDelta <= 500 * MAXV / INCR) | 82 | if (cumDelta <= 500 * MAXV / INCR) |
diff --git a/src/util/test_server_mst_interrupt.c b/src/util/test_server_mst_interrupt.c index cfd891522..4cc5e95b4 100644 --- a/src/util/test_server_mst_interrupt.c +++ b/src/util/test_server_mst_interrupt.c | |||
@@ -50,8 +50,8 @@ main (int argc, char *argv[]) | |||
50 | msg[0].size = htons (sizeof (msg)); | 50 | msg[0].size = htons (sizeof (msg)); |
51 | msg[0].type = htons (sizeof (GNUNET_MESSAGE_TYPE_DUMMY)); | 51 | msg[0].type = htons (sizeof (GNUNET_MESSAGE_TYPE_DUMMY)); |
52 | mst = GNUNET_SERVER_mst_create(mst_cb, NULL); | 52 | mst = GNUNET_SERVER_mst_create(mst_cb, NULL); |
53 | GNUNET_SERVER_mst_receive (mst, &id, | 53 | GNUNET_SERVER_mst_receive (mst, &id, |
54 | (const char *) &msg, 2 * sizeof (msg), | 54 | (const char *) &msg, 2 * sizeof (msg), |
55 | GNUNET_NO, GNUNET_NO); | 55 | GNUNET_NO, GNUNET_NO); |
56 | /* If we reach this line, it did not crash */ | 56 | /* If we reach this line, it did not crash */ |
57 | return 0; | 57 | return 0; |
diff --git a/src/util/test_service.c b/src/util/test_service.c index eee0cecc1..728db0a8f 100644 --- a/src/util/test_service.c +++ b/src/util/test_service.c | |||
@@ -154,7 +154,7 @@ check () | |||
154 | 154 | ||
155 | 155 | ||
156 | static void | 156 | static void |
157 | ready6 (void *cls, | 157 | ready6 (void *cls, |
158 | int result) | 158 | int result) |
159 | { | 159 | { |
160 | const struct GNUNET_CONFIGURATION_Handle *cfg = cls; | 160 | const struct GNUNET_CONFIGURATION_Handle *cfg = cls; |
@@ -236,7 +236,7 @@ check_start_stop () | |||
236 | GNUNET_assert (GNUNET_OK == | 236 | GNUNET_assert (GNUNET_OK == |
237 | GNUNET_PROGRAM_run (3, argv, "test-service-program", "no help", | 237 | GNUNET_PROGRAM_run (3, argv, "test-service-program", "no help", |
238 | options, &start_stop_main, &ret)); | 238 | options, &start_stop_main, &ret)); |
239 | 239 | ||
240 | GNUNET_break (0 == ret); | 240 | GNUNET_break (0 == ret); |
241 | return ret; | 241 | return ret; |
242 | } | 242 | } |
diff --git a/src/util/test_speedup.c b/src/util/test_speedup.c index a2e6bb29c..2b540af4b 100644 --- a/src/util/test_speedup.c +++ b/src/util/test_speedup.c | |||
@@ -58,14 +58,14 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
58 | } | 58 | } |
59 | end = GNUNET_TIME_absolute_get(); | 59 | end = GNUNET_TIME_absolute_get(); |
60 | fprintf (stderr, "\n"); | 60 | fprintf (stderr, "\n"); |
61 | fflush(stdout); | 61 | fflush(stdout); |
62 | } | 62 | } |
63 | 63 | ||
64 | 64 | ||
65 | /** | 65 | /** |
66 | * | 66 | * |
67 | */ | 67 | */ |
68 | static void | 68 | static void |
69 | check (void *cls, char *const *args, | 69 | check (void *cls, char *const *args, |
70 | const char *cfgfile, | 70 | const char *cfgfile, |
71 | const struct GNUNET_CONFIGURATION_Handle * | 71 | const struct GNUNET_CONFIGURATION_Handle * |
@@ -90,7 +90,7 @@ main (int argc, char *argv[]) | |||
90 | time_t start_real; | 90 | time_t start_real; |
91 | time_t end_real; | 91 | time_t end_real; |
92 | struct GNUNET_TIME_Relative delta; | 92 | struct GNUNET_TIME_Relative delta; |
93 | 93 | ||
94 | start_real = time (NULL); | 94 | start_real = time (NULL); |
95 | start = GNUNET_TIME_absolute_get(); | 95 | start = GNUNET_TIME_absolute_get(); |
96 | GNUNET_PROGRAM_run ((sizeof (argvn) / sizeof (char *)) - 1, argvn, "test-speedup", | 96 | GNUNET_PROGRAM_run ((sizeof (argvn) / sizeof (char *)) - 1, argvn, "test-speedup", |
@@ -101,19 +101,19 @@ main (int argc, char *argv[]) | |||
101 | 101 | ||
102 | if (delta.rel_value_us > ((end_real - start_real) * 1500LL * 1000LL)) | 102 | if (delta.rel_value_us > ((end_real - start_real) * 1500LL * 1000LL)) |
103 | { | 103 | { |
104 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 104 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
105 | "Execution time in GNUnet time: %s\n", | 105 | "Execution time in GNUnet time: %s\n", |
106 | GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_YES)); | 106 | GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_YES)); |
107 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 107 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
108 | "Execution time in system time: %llu ms\n", | 108 | "Execution time in system time: %llu ms\n", |
109 | (unsigned long long) ((end_real - start_real) * 1000LL)); | 109 | (unsigned long long) ((end_real - start_real) * 1000LL)); |
110 | return 0; | 110 | return 0; |
111 | } | 111 | } |
112 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 112 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
113 | "Execution time in GNUnet time: %s\n", | 113 | "Execution time in GNUnet time: %s\n", |
114 | GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_YES)); | 114 | GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_YES)); |
115 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 115 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
116 | "Execution time in system time: %llu ms\n", | 116 | "Execution time in system time: %llu ms\n", |
117 | (unsigned long long) ((end_real - start_real) * 1000LL)); | 117 | (unsigned long long) ((end_real - start_real) * 1000LL)); |
118 | return 1; | 118 | return 1; |
119 | } | 119 | } |
diff --git a/src/util/test_strings.c b/src/util/test_strings.c index f6f872211..26ca5dc6a 100644 --- a/src/util/test_strings.c +++ b/src/util/test_strings.c | |||
@@ -99,7 +99,7 @@ main (int argc, char *argv[]) | |||
99 | } | 99 | } |
100 | b = GNUNET_STRINGS_to_utf8 ("TEST", 4, "ASCII"); | 100 | b = GNUNET_STRINGS_to_utf8 ("TEST", 4, "ASCII"); |
101 | WANT ("TEST", b); | 101 | WANT ("TEST", b); |
102 | 102 | ||
103 | at = GNUNET_TIME_UNIT_FOREVER_ABS; | 103 | at = GNUNET_TIME_UNIT_FOREVER_ABS; |
104 | bc = GNUNET_STRINGS_absolute_time_to_string (at); | 104 | bc = GNUNET_STRINGS_absolute_time_to_string (at); |
105 | GNUNET_assert (GNUNET_OK == | 105 | GNUNET_assert (GNUNET_OK == |
diff --git a/src/util/test_strings_to_data.c b/src/util/test_strings_to_data.c index 125101e55..a0521cf70 100644 --- a/src/util/test_strings_to_data.c +++ b/src/util/test_strings_to_data.c | |||
@@ -34,7 +34,7 @@ main (int argc, char *argv[]) | |||
34 | char dst[128]; | 34 | char dst[128]; |
35 | unsigned int i; | 35 | unsigned int i; |
36 | int ret = 0; | 36 | int ret = 0; |
37 | 37 | ||
38 | GNUNET_log_setup ("util", "DEBUG", NULL); | 38 | GNUNET_log_setup ("util", "DEBUG", NULL); |
39 | for (i=0;i<sizeof(src);i++) | 39 | for (i=0;i<sizeof(src);i++) |
40 | { | 40 | { |
@@ -44,7 +44,7 @@ main (int argc, char *argv[]) | |||
44 | end = GNUNET_STRINGS_data_to_string (&src, i, buf, sizeof (buf)); | 44 | end = GNUNET_STRINGS_data_to_string (&src, i, buf, sizeof (buf)); |
45 | GNUNET_assert (NULL != end); | 45 | GNUNET_assert (NULL != end); |
46 | end[0] = '\0'; | 46 | end[0] = '\0'; |
47 | if (GNUNET_OK != | 47 | if (GNUNET_OK != |
48 | GNUNET_STRINGS_string_to_data (buf, strlen (buf), dst, i)) | 48 | GNUNET_STRINGS_string_to_data (buf, strlen (buf), dst, i)) |
49 | { | 49 | { |
50 | fprintf (stderr, "%u failed decode (%u bytes)\n", i, (unsigned int) strlen (buf)); | 50 | fprintf (stderr, "%u failed decode (%u bytes)\n", i, (unsigned int) strlen (buf)); |
diff --git a/src/util/time.c b/src/util/time.c index 6b1b43062..19f3e488f 100644 --- a/src/util/time.c +++ b/src/util/time.c | |||
@@ -50,7 +50,7 @@ GNUNET_TIME_set_offset (long long offset) | |||
50 | * | 50 | * |
51 | * @return the offset we currently skew the locale time by | 51 | * @return the offset we currently skew the locale time by |
52 | */ | 52 | */ |
53 | long long | 53 | long long |
54 | GNUNET_TIME_get_offset () | 54 | GNUNET_TIME_get_offset () |
55 | { | 55 | { |
56 | return timestamp_offset; | 56 | return timestamp_offset; |
@@ -579,10 +579,10 @@ GNUNET_TIME_get_current_year () | |||
579 | /** | 579 | /** |
580 | * Convert an expiration time to the respective year (rounds) | 580 | * Convert an expiration time to the respective year (rounds) |
581 | * | 581 | * |
582 | * @param at absolute time | 582 | * @param at absolute time |
583 | * @return year a year (after 1970), 0 on error | 583 | * @return year a year (after 1970), 0 on error |
584 | */ | 584 | */ |
585 | unsigned int | 585 | unsigned int |
586 | GNUNET_TIME_time_to_year (struct GNUNET_TIME_Absolute at) | 586 | GNUNET_TIME_time_to_year (struct GNUNET_TIME_Absolute at) |
587 | { | 587 | { |
588 | struct tm *t; | 588 | struct tm *t; |
diff --git a/src/util/win.c b/src/util/win.c index 88763c9b2..299d1c070 100644 --- a/src/util/win.c +++ b/src/util/win.c | |||
@@ -45,7 +45,7 @@ int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows); | |||
45 | ULONG Length; \ | 45 | ULONG Length; \ |
46 | DWORD Flags; \ | 46 | DWORD Flags; \ |
47 | }; \ | 47 | }; \ |
48 | }; | 48 | }; |
49 | 49 | ||
50 | #define _IP_ADAPTER_UNICAST_ADDRESS_BASE \ | 50 | #define _IP_ADAPTER_UNICAST_ADDRESS_BASE \ |
51 | SOCKET_ADDRESS Address; \ | 51 | SOCKET_ADDRESS Address; \ |
@@ -106,7 +106,7 @@ typedef enum _NET_IF_CONNECTION_TYPE { | |||
106 | NET_IF_CONNECTION_DEDICATED = 1, | 106 | NET_IF_CONNECTION_DEDICATED = 1, |
107 | NET_IF_CONNECTION_PASSIVE, | 107 | NET_IF_CONNECTION_PASSIVE, |
108 | NET_IF_CONNECTION_DEMAND, | 108 | NET_IF_CONNECTION_DEMAND, |
109 | NET_IF_CONNECTION_MAXIMUM | 109 | NET_IF_CONNECTION_MAXIMUM |
110 | } NET_IF_CONNECTION_TYPE, *PNET_IF_CONNECTION_TYPE; | 110 | } NET_IF_CONNECTION_TYPE, *PNET_IF_CONNECTION_TYPE; |
111 | 111 | ||
112 | typedef enum { | 112 | typedef enum { |
@@ -116,7 +116,7 @@ typedef enum { | |||
116 | TUNNEL_TYPE_6TO4, | 116 | TUNNEL_TYPE_6TO4, |
117 | TUNNEL_TYPE_ISATAP, | 117 | TUNNEL_TYPE_ISATAP, |
118 | TUNNEL_TYPE_TEREDO, | 118 | TUNNEL_TYPE_TEREDO, |
119 | TUNNEL_TYPE_IPHTTPS | 119 | TUNNEL_TYPE_IPHTTPS |
120 | } TUNNEL_TYPE, *PTUNNEL_TYPE; | 120 | } TUNNEL_TYPE, *PTUNNEL_TYPE; |
121 | #endif | 121 | #endif |
122 | 122 | ||
@@ -209,7 +209,7 @@ typedef struct _IP_ADAPTER_ADDRESSES##suffix { \ | |||
209 | _IP_ADAPTER_ADDRESSES_BASE \ | 209 | _IP_ADAPTER_ADDRESSES_BASE \ |
210 | addition \ | 210 | addition \ |
211 | } IP_ADAPTER_ADDRESSES##suffix, *PIP_ADAPTER_ADDRESSES##suffix; | 211 | } IP_ADAPTER_ADDRESSES##suffix, *PIP_ADAPTER_ADDRESSES##suffix; |
212 | 212 | ||
213 | 213 | ||
214 | /* _IP_ADAPTER_ADDRESSES_DEFINE(,) defined in w32api headers */ | 214 | /* _IP_ADAPTER_ADDRESSES_DEFINE(,) defined in w32api headers */ |
215 | _IP_ADAPTER_ADDRESSES_DEFINE(_XPSP1,_IP_ADAPTER_ADDRESSES_ADD_XPSP1) | 215 | _IP_ADAPTER_ADDRESSES_DEFINE(_XPSP1,_IP_ADAPTER_ADDRESSES_ADD_XPSP1) |