aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nat/test_nat.c37
-rw-r--r--src/nat/test_nat_mini.c5
-rw-r--r--src/nat/test_stun.c2
-rw-r--r--src/transport/test_plugin_transport.c7
-rw-r--r--src/transport/test_transport_api_limited_sockets.c11
-rw-r--r--src/transport/test_transport_api_reliability.c11
6 files changed, 48 insertions, 25 deletions
diff --git a/src/nat/test_nat.c b/src/nat/test_nat.c
index fd67473ee..3205e1f05 100644
--- a/src/nat/test_nat.c
+++ b/src/nat/test_nat.c
@@ -54,9 +54,11 @@ static void
54addr_callback (void *cls, int add_remove, const struct sockaddr *addr, 54addr_callback (void *cls, int add_remove, const struct sockaddr *addr,
55 socklen_t addrlen) 55 socklen_t addrlen)
56{ 56{
57 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Address changed: %s `%s' (%u bytes)\n", 57 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
58 add_remove == GNUNET_YES ? "added" : "removed", GNUNET_a2s (addr, 58 "Address changed: %s `%s' (%u bytes)\n",
59 addrlen), 59 add_remove == GNUNET_YES ? "added" : "removed",
60 GNUNET_a2s (addr,
61 addrlen),
60 (unsigned int) addrlen); 62 (unsigned int) addrlen);
61} 63}
62 64
@@ -90,13 +92,17 @@ struct addr_cls
90 * @param name name of the interface 92 * @param name name of the interface
91 * @param isDefault do we think this may be our default interface 93 * @param isDefault do we think this may be our default interface
92 * @param addr address of the interface 94 * @param addr address of the interface
93 * @param addrlen number of bytes in addr 95 * @param addrlen number of bytes in @a addr
94 * @return GNUNET_OK to continue iterating 96 * @return #GNUNET_OK to continue iterating
95 */ 97 */
96static int 98static int
97process_if (void *cls, const char *name, int isDefault, 99process_if (void *cls,
98 const struct sockaddr *addr, const struct sockaddr *broadcast_addr, 100 const char *name,
99 const struct sockaddr *netmask, socklen_t addrlen) 101 int isDefault,
102 const struct sockaddr *addr,
103 const struct sockaddr *broadcast_addr,
104 const struct sockaddr *netmask,
105 socklen_t addrlen)
100{ 106{
101 struct addr_cls *data = cls; 107 struct addr_cls *data = cls;
102 108
@@ -116,7 +122,9 @@ process_if (void *cls, const char *name, int isDefault,
116 * Main function run with scheduler. 122 * Main function run with scheduler.
117 */ 123 */
118static void 124static void
119run (void *cls, char *const *args, const char *cfgfile, 125run (void *cls,
126 char *const *args,
127 const char *cfgfile,
120 const struct GNUNET_CONFIGURATION_Handle *cfg) 128 const struct GNUNET_CONFIGURATION_Handle *cfg)
121{ 129{
122 struct GNUNET_NAT_Handle *nat; 130 struct GNUNET_NAT_Handle *nat;
@@ -167,8 +175,15 @@ main (int argc, char *const argv[])
167 "WARNING", 175 "WARNING",
168 NULL); 176 NULL);
169 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 177 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
170 "Testing NAT library, timeout set to %d seconds\n", TIMEOUT); 178 "Testing NAT library, timeout set to %s\n",
171 GNUNET_PROGRAM_run (3, argv_prog, "test-nat", "nohelp", options, &run, NULL); 179 GNUNET_STRINGS_relative_time_to_string (TIMEOUT,
180 GNUNET_YES));
181 GNUNET_PROGRAM_run (3,
182 argv_prog,
183 "test-nat",
184 "nohelp",
185 options,
186 &run, NULL);
172 return 0; 187 return 0;
173} 188}
174 189
diff --git a/src/nat/test_nat_mini.c b/src/nat/test_nat_mini.c
index f5b63f698..d6ab2a321 100644
--- a/src/nat/test_nat_mini.c
+++ b/src/nat/test_nat_mini.c
@@ -121,8 +121,9 @@ main (int argc, char *const argv[])
121 NULL); 121 NULL);
122 122
123 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 123 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
124 "UPnP test for NAT library, timeout set to %d seconds\n", 124 "UPnP test for NAT library, timeout set to %s\n",
125 TIMEOUT); 125 GNUNET_STRINGS_relative_time_to_string (TIMEOUT,
126 GNUNET_YES));
126 GNUNET_PROGRAM_run (5, argv_prog, "test-nat-mini", "nohelp", options, &run, 127 GNUNET_PROGRAM_run (5, argv_prog, "test-nat-mini", "nohelp", options, &run,
127 NULL); 128 NULL);
128 return 0; 129 return 0;
diff --git a/src/nat/test_stun.c b/src/nat/test_stun.c
index 7fbba1cd6..9d4792cd6 100644
--- a/src/nat/test_stun.c
+++ b/src/nat/test_stun.c
@@ -247,7 +247,7 @@ run (void *cls,
247 } 247 }
248 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 248 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
249 "Service listens on port %u\n", 249 "Service listens on port %u\n",
250 port); 250 (unsigned int) port);
251 rh = GNUNET_NAT_stun_make_request (stun_server, 251 rh = GNUNET_NAT_stun_make_request (stun_server,
252 stun_port, 252 stun_port,
253 lsock4, 253 lsock4,
diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c
index e75cb7c7f..61ea2035f 100644
--- a/src/transport/test_plugin_transport.c
+++ b/src/transport/test_plugin_transport.c
@@ -380,7 +380,8 @@ test_addr_string (void *cls)
380 { 380 {
381 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 381 GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
382 "Plugin creates different address length when converting address->string->address: %u != %u\n", 382 "Plugin creates different address length when converting address->string->address: %u != %u\n",
383 w->address->address_length, s2a_len); 383 (unsigned int) w->address->address_length,
384 s2a_len);
384 } 385 }
385 else if (0 != memcmp (s2a, w->address->address, s2a_len)) 386 else if (0 != memcmp (s2a, w->address->address, s2a_len))
386 { 387 {
@@ -439,7 +440,7 @@ env_notify_address (void *cls,
439 addresses_reported++; 440 addresses_reported++;
440 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 441 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
441 "Adding address of length %u\n", 442 "Adding address of length %u\n",
442 address->address_length); 443 (unsigned int) address->address_length);
443 444
444 for (wtmp = head; NULL != wtmp; wtmp = wtmp->next) 445 for (wtmp = head; NULL != wtmp; wtmp = wtmp->next)
445 { 446 {
@@ -465,7 +466,7 @@ env_notify_address (void *cls,
465 { 466 {
466 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 467 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
467 "Removing address of length %u\n", 468 "Removing address of length %u\n",
468 address->address_length); 469 (unsigned int) address->address_length);
469 w = head; 470 w = head;
470 while (NULL != w) 471 while (NULL != w)
471 { 472 {
diff --git a/src/transport/test_transport_api_limited_sockets.c b/src/transport/test_transport_api_limited_sockets.c
index 0ae807077..1a04ad6fe 100644
--- a/src/transport/test_transport_api_limited_sockets.c
+++ b/src/transport/test_transport_api_limited_sockets.c
@@ -163,7 +163,8 @@ notify_ready (void *cls, size_t size, void *buf)
163 163
164 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 164 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
165 "Transmitting message with %u bytes to peer %s\n", 165 "Transmitting message with %u bytes to peer %s\n",
166 sizeof (struct GNUNET_MessageHeader), GNUNET_i2s (&p->id)); 166 (unsigned int) sizeof (struct GNUNET_MessageHeader),
167 GNUNET_i2s (&p->id));
167 GNUNET_assert (size >= 256); 168 GNUNET_assert (size >= 256);
168 169
169 if (buf != NULL) 170 if (buf != NULL)
@@ -308,10 +309,12 @@ main (int argc, char *argv[])
308 309
309 res = getrlimit (RLIMIT_NOFILE, &r_file_old); 310 res = getrlimit (RLIMIT_NOFILE, &r_file_old);
310 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 311 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
311 "Maximum number of open files was: %u/%u\n", r_file_old.rlim_cur, 312 "Maximum number of open files was: %u/%u\n",
312 r_file_old.rlim_max); 313 (unsigned int) r_file_old.rlim_cur,
314 (unsigned int) r_file_old.rlim_max);
313 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 315 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
314 "Setting maximum number of open files to: %u\n", MAX_FILES); 316 "Setting maximum number of open files to: %u\n",
317 MAX_FILES);
315 r_file_new.rlim_cur = MAX_FILES; 318 r_file_new.rlim_cur = MAX_FILES;
316 r_file_new.rlim_max = r_file_old.rlim_max; 319 r_file_new.rlim_max = r_file_old.rlim_max;
317 res = setrlimit (RLIMIT_NOFILE, &r_file_new); 320 res = setrlimit (RLIMIT_NOFILE, &r_file_new);
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c
index cc2115a48..fe2ac78e0 100644
--- a/src/transport/test_transport_api_reliability.c
+++ b/src/transport/test_transport_api_reliability.c
@@ -318,8 +318,9 @@ set_bit (unsigned int bitIdx)
318 if (bitIdx >= sizeof (bitmap) * 8) 318 if (bitIdx >= sizeof (bitmap) * 8)
319 { 319 {
320 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 320 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
321 "tried to set bit %d of %d(!?!?)\n", 321 "tried to set bit %u of %u(!?!?)\n",
322 bitIdx, sizeof (bitmap) * 8); 322 bitIdx,
323 (unsigned int) sizeof (bitmap) * 8);
323 return GNUNET_SYSERR; 324 return GNUNET_SYSERR;
324 } 325 }
325 arraySlot = bitIdx / 8; 326 arraySlot = bitIdx / 8;
@@ -341,8 +342,10 @@ get_bit (const char *map, unsigned int bit)
341{ 342{
342 if (bit > TOTAL_MSGS) 343 if (bit > TOTAL_MSGS)
343 { 344 {
344 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "get bit %d of %d(!?!?)\n", bit, 345 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
345 sizeof (bitmap) * 8); 346 "get bit %u of %u(!?!?)\n",
347 bit,
348 (unsigned int) sizeof (bitmap) * 8);
346 return 0; 349 return 0;
347 } 350 }
348 return ((map)[bit >> 3] & (1 << (bit & 7))) > 0; 351 return ((map)[bit >> 3] & (1 << (bit & 7))) > 0;