aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-05-31 21:03:50 +0000
committerChristian Grothoff <christian@grothoff.org>2012-05-31 21:03:50 +0000
commitadc1b1fe5b4e1a000d20e29dd605e0060545c0ab (patch)
tree4b1e6185ca2044b4c7998340545ae7e3c7e6e774 /src/transport
parentbc071cd50ad7d58e7ce2e6e5d535eedb084b3361 (diff)
downloadgnunet-adc1b1fe5b4e1a000d20e29dd605e0060545c0ab.tar.gz
gnunet-adc1b1fe5b4e1a000d20e29dd605e0060545c0ab.zip
-fixing compiler warnings on FreeBSD
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/test_transport_api.c35
-rw-r--r--src/transport/test_transport_api_blacklisting.c18
2 files changed, 19 insertions, 34 deletions
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c
index ceba9c3c7..f944fac61 100644
--- a/src/transport/test_transport_api.c
+++ b/src/transport/test_transport_api.c
@@ -37,8 +37,6 @@
37#include "transport.h" 37#include "transport.h"
38#include "transport-testing.h" 38#include "transport-testing.h"
39 39
40#define VERBOSE GNUNET_NO
41#define VERBOSE_ARM GNUNET_NO
42 40
43#define START_ARM GNUNET_YES 41#define START_ARM GNUNET_YES
44 42
@@ -52,9 +50,9 @@
52 */ 50 */
53#define TIMEOUT_TRANSMIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) 51#define TIMEOUT_TRANSMIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
54 52
55#define MSIZE 2600 53#define TEST_MESSAGE_SIZE 2600
56 54
57#define MTYPE 12345 55#define TEST_MESSAGE_TYPE 12345
58 56
59static char *test_source; 57static char *test_source;
60 58
@@ -88,11 +86,6 @@ static char *cfg_file_p1;
88 86
89static char *cfg_file_p2; 87static char *cfg_file_p2;
90 88
91#if VERBOSE
92#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
93#else
94#define OKPP do { ok++; } while (0)
95#endif
96 89
97static void 90static void
98end () 91end ()
@@ -188,8 +181,8 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
188 GNUNET_i2s (&t->id)); 181 GNUNET_i2s (&t->id));
189 GNUNET_free (ps); 182 GNUNET_free (ps);
190 183
191 if ((MTYPE == ntohs (message->type)) && 184 if ((TEST_MESSAGE_TYPE == ntohs (message->type)) &&
192 (MSIZE == ntohs (message->size))) 185 (TEST_MESSAGE_SIZE == ntohs (message->size)))
193 { 186 {
194 ok = 0; 187 ok = 0;
195 end (); 188 end ();
@@ -222,13 +215,13 @@ notify_ready (void *cls, size_t size, void *buf)
222 return 0; 215 return 0;
223 } 216 }
224 217
225 GNUNET_assert (size >= MSIZE); 218 GNUNET_assert (size >= TEST_MESSAGE_SIZE);
226 if (buf != NULL) 219 if (buf != NULL)
227 { 220 {
228 memset (buf, '\0', MSIZE); 221 memset (buf, '\0', TEST_MESSAGE_SIZE);
229 hdr = buf; 222 hdr = buf;
230 hdr->size = htons (MSIZE); 223 hdr->size = htons (TEST_MESSAGE_SIZE);
231 hdr->type = htons (MTYPE); 224 hdr->type = htons (TEST_MESSAGE_TYPE);
232 } 225 }
233 226
234 char *ps = GNUNET_strdup (GNUNET_i2s (&p2->id)); 227 char *ps = GNUNET_strdup (GNUNET_i2s (&p2->id));
@@ -238,7 +231,7 @@ notify_ready (void *cls, size_t size, void *buf)
238 GNUNET_i2s (&p->id)); 231 GNUNET_i2s (&p->id));
239 GNUNET_free (ps); 232 GNUNET_free (ps);
240 233
241 return MSIZE; 234 return TEST_MESSAGE_SIZE;
242} 235}
243 236
244 237
@@ -256,7 +249,7 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
256 p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s); 249 p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s);
257 GNUNET_free (receiver_s); 250 GNUNET_free (receiver_s);
258 s_sending = GNUNET_YES; 251 s_sending = GNUNET_YES;
259 th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, MSIZE, 0, 252 th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, 0,
260 TIMEOUT_TRANSMIT, &notify_ready, 253 TIMEOUT_TRANSMIT, &notify_ready,
261 p1); 254 p1);
262} 255}
@@ -384,9 +377,6 @@ check ()
384 static char *const argv[] = { "test-transport-api", 377 static char *const argv[] = { "test-transport-api",
385 "-c", 378 "-c",
386 "test_transport_api_data.conf", 379 "test_transport_api_data.conf",
387#if VERBOSE
388 "-L", "DEBUG",
389#endif
390 NULL 380 NULL
391 }; 381 };
392 static struct GNUNET_GETOPT_CommandLineOption options[] = { 382 static struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -416,13 +406,8 @@ main (int argc, char *argv[])
416 &test_plugin); 406 &test_plugin);
417 407
418 GNUNET_log_setup (test_name, 408 GNUNET_log_setup (test_name,
419#if VERBOSE
420 "DEBUG",
421#else
422 "WARNING", 409 "WARNING",
423#endif
424 NULL); 410 NULL);
425
426 tth = GNUNET_TRANSPORT_TESTING_init (); 411 tth = GNUNET_TRANSPORT_TESTING_init ();
427 412
428 GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p1, 1); 413 GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p1, 1);
diff --git a/src/transport/test_transport_api_blacklisting.c b/src/transport/test_transport_api_blacklisting.c
index f8f6040a9..909ea57d4 100644
--- a/src/transport/test_transport_api_blacklisting.c
+++ b/src/transport/test_transport_api_blacklisting.c
@@ -61,9 +61,9 @@ struct GNUNET_TRANSPORT_TESTING_handle *tth;
61 */ 61 */
62#define TIMEOUT_TRANSMIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) 62#define TIMEOUT_TRANSMIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
63 63
64#define MSIZE 2600 64#define TEST_MESSAGE_SIZE 2600
65 65
66#define MTYPE 12345 66#define TEST_MESSAGE_TYPE 12345
67 67
68 68
69static int ok; 69static int ok;
@@ -212,8 +212,8 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
212 GNUNET_i2s (&t->id)); 212 GNUNET_i2s (&t->id));
213 GNUNET_free (ps); 213 GNUNET_free (ps);
214 214
215 if ((MTYPE == ntohs (message->type)) && 215 if ((TEST_MESSAGE_TYPE == ntohs (message->type)) &&
216 (MSIZE == ntohs (message->size))) 216 (TEST_MESSAGE_SIZE == ntohs (message->size)))
217 { 217 {
218 ok = 0; 218 ok = 0;
219 shutdown_task = GNUNET_SCHEDULER_add_now(&end, NULL); 219 shutdown_task = GNUNET_SCHEDULER_add_now(&end, NULL);
@@ -249,13 +249,13 @@ notify_ready (void *cls, size_t size, void *buf)
249 return 0; 249 return 0;
250 } 250 }
251 251
252 GNUNET_assert (size >= MSIZE); 252 GNUNET_assert (size >= TEST_MESSAGE_SIZE);
253 253
254 if (buf != NULL) 254 if (buf != NULL)
255 { 255 {
256 hdr = buf; 256 hdr = buf;
257 hdr->size = htons (MSIZE); 257 hdr->size = htons (TEST_MESSAGE_SIZE);
258 hdr->type = htons (MTYPE); 258 hdr->type = htons (TEST_MESSAGE_TYPE);
259 } 259 }
260 260
261 char *ps = GNUNET_strdup (GNUNET_i2s (&p2->id)); 261 char *ps = GNUNET_strdup (GNUNET_i2s (&p2->id));
@@ -265,7 +265,7 @@ notify_ready (void *cls, size_t size, void *buf)
265 GNUNET_i2s (&p->id)); 265 GNUNET_i2s (&p->id));
266 GNUNET_free (ps); 266 GNUNET_free (ps);
267 267
268 return MSIZE; 268 return TEST_MESSAGE_SIZE;
269} 269}
270 270
271static void 271static void
@@ -282,7 +282,7 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
282 p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s); 282 p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s);
283 GNUNET_free (receiver_s); 283 GNUNET_free (receiver_s);
284 284
285 th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, MSIZE, 0, 285 th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, 0,
286 TIMEOUT_TRANSMIT, &notify_ready, 286 TIMEOUT_TRANSMIT, &notify_ready,
287 p1); 287 p1);
288} 288}