diff options
-rw-r--r-- | src/transport/Makefile.am | 11 | ||||
-rw-r--r-- | src/transport/gnunet-transport-wlan-helper.c | 205 | ||||
-rw-r--r-- | src/transport/plugin_transport_wlan.c | 78 | ||||
-rw-r--r-- | src/transport/test_plugin_transport_wlan_dummy.c | 6 | ||||
-rw-r--r-- | src/transport/test_transport_api.c | 14 | ||||
-rw-r--r-- | src/transport/test_transport_api_wlan_peer1.conf | 105 | ||||
-rw-r--r-- | src/transport/test_transport_api_wlan_peer2.conf | 105 |
7 files changed, 484 insertions, 40 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index f1f72b689..5d766b7a9 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am | |||
@@ -81,6 +81,7 @@ gnunet_nat_server_SOURCES = \ | |||
81 | gnunet_transport_wlan_helper_SOURCES = \ | 81 | gnunet_transport_wlan_helper_SOURCES = \ |
82 | gnunet-transport-wlan-helper.c | 82 | gnunet-transport-wlan-helper.c |
83 | gnunet_transport_wlan_helper_LDADD = \ | 83 | gnunet_transport_wlan_helper_LDADD = \ |
84 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
84 | -lpcap | 85 | -lpcap |
85 | 86 | ||
86 | test_plugin_transport_wlan_SOURCES = \ | 87 | test_plugin_transport_wlan_SOURCES = \ |
@@ -208,6 +209,7 @@ check_PROGRAMS = \ | |||
208 | $(HTTP_API_TEST) \ | 209 | $(HTTP_API_TEST) \ |
209 | $(HTTPS_PLUGIN_TEST) \ | 210 | $(HTTPS_PLUGIN_TEST) \ |
210 | $(HTTPS_API_TEST) \ | 211 | $(HTTPS_API_TEST) \ |
212 | test_transport_api_wlan \ | ||
211 | test_transport_api_multi \ | 213 | test_transport_api_multi \ |
212 | test_transport_api_reliability_tcp \ | 214 | test_transport_api_reliability_tcp \ |
213 | test_transport_api_reliability_tcp_nat \ | 215 | test_transport_api_reliability_tcp_nat \ |
@@ -233,6 +235,7 @@ TESTS = \ | |||
233 | $(HTTP_API_TEST) \ | 235 | $(HTTP_API_TEST) \ |
234 | $(HTTPS_PLUGIN_TEST) \ | 236 | $(HTTPS_PLUGIN_TEST) \ |
235 | $(HTTPS_API_TEST) \ | 237 | $(HTTPS_API_TEST) \ |
238 | test_transport_api_wlan \ | ||
236 | test_transport_api_multi \ | 239 | test_transport_api_multi \ |
237 | test_transport_api_reliability_tcp \ | 240 | test_transport_api_reliability_tcp \ |
238 | test_transport_api_reliability_tcp_nat \ | 241 | test_transport_api_reliability_tcp_nat \ |
@@ -328,6 +331,12 @@ test_transport_api_reliability_https_LDADD = \ | |||
328 | $(top_builddir)/src/transport/libgnunettransport.la \ | 331 | $(top_builddir)/src/transport/libgnunettransport.la \ |
329 | $(top_builddir)/src/util/libgnunetutil.la | 332 | $(top_builddir)/src/util/libgnunetutil.la |
330 | 333 | ||
334 | test_transport_api_wlan_SOURCES = \ | ||
335 | test_transport_api.c | ||
336 | test_transport_api_wlan_LDADD = \ | ||
337 | $(top_builddir)/src/transport/libgnunettransport.la \ | ||
338 | $(top_builddir)/src/util/libgnunetutil.la | ||
339 | |||
331 | test_quota_compliance_tcp_SOURCES = \ | 340 | test_quota_compliance_tcp_SOURCES = \ |
332 | test_quota_compliance.c | 341 | test_quota_compliance.c |
333 | test_quota_compliance_tcp_LDADD = \ | 342 | test_quota_compliance_tcp_LDADD = \ |
@@ -422,6 +431,8 @@ EXTRA_DIST = \ | |||
422 | test_transport_api_http_peer2.conf \ | 431 | test_transport_api_http_peer2.conf \ |
423 | test_transport_api_https_peer1.conf \ | 432 | test_transport_api_https_peer1.conf \ |
424 | test_transport_api_https_peer2.conf \ | 433 | test_transport_api_https_peer2.conf \ |
434 | test_transport_api_wlan_peer1.conf \ | ||
435 | test_transport_api_wlan_peer2.conf \ | ||
425 | test_transport_api_multi_peer1.conf \ | 436 | test_transport_api_multi_peer1.conf \ |
426 | test_transport_api_multi_peer2.conf \ | 437 | test_transport_api_multi_peer2.conf \ |
427 | test_transport_api_rel_http_peer1.conf \ | 438 | test_transport_api_rel_http_peer1.conf \ |
diff --git a/src/transport/gnunet-transport-wlan-helper.c b/src/transport/gnunet-transport-wlan-helper.c index 87c140825..4332e9a0d 100644 --- a/src/transport/gnunet-transport-wlan-helper.c +++ b/src/transport/gnunet-transport-wlan-helper.c | |||
@@ -27,11 +27,23 @@ | |||
27 | * This program serves as the mediator between the wlan interface and | 27 | * This program serves as the mediator between the wlan interface and |
28 | * gnunet | 28 | * gnunet |
29 | */ | 29 | */ |
30 | #include "gnunet-transport-wlan-helper.h" | 30 | |
31 | |||
32 | #include "platform.h" | ||
33 | #include "gnunet_constants.h" | ||
34 | #include "gnunet_os_lib.h" | ||
35 | #include "gnunet_transport_plugin.h" | ||
36 | #include "transport.h" | ||
31 | #include "plugin_transport_wlan.h" | 37 | #include "plugin_transport_wlan.h" |
38 | #include "gnunet_common.h" | ||
39 | #include "gnunet-transport-wlan-helper.h" | ||
32 | #include "ieee80211_radiotap.h" | 40 | #include "ieee80211_radiotap.h" |
33 | |||
34 | #include <pcap.h> | 41 | #include <pcap.h> |
42 | #include <stdio.h> | ||
43 | #include <stdlib.h> | ||
44 | #include <sys/stat.h> | ||
45 | |||
46 | |||
35 | 47 | ||
36 | 48 | ||
37 | 49 | ||
@@ -380,11 +392,200 @@ int ieee80211_radiotap_iterator_next( | |||
380 | return -ENOENT; | 392 | return -ENOENT; |
381 | } | 393 | } |
382 | 394 | ||
395 | #define FIFO_FILE1 "MYFIFOin" | ||
396 | #define FIFO_FILE2 "MYFIFOout" | ||
397 | #define MAXLINE 5000 | ||
398 | |||
399 | int closeprog = 0; | ||
400 | |||
401 | void sigfunc(int sig) | ||
402 | { | ||
403 | |||
404 | if(sig != SIGINT || sig != SIGTERM || sig != SIGKILL) | ||
405 | return; | ||
406 | else | ||
407 | { | ||
408 | closeprog = 1; | ||
409 | } | ||
410 | } | ||
411 | |||
412 | |||
413 | |||
414 | int | ||
415 | testmode(int argc, char *argv[]) | ||
416 | { | ||
417 | struct stat st; | ||
418 | int erg; | ||
419 | int first; | ||
420 | FILE *fpin; | ||
421 | FILE *fpout; | ||
422 | pid_t pid; | ||
423 | |||
424 | signal(SIGINT,sigfunc); | ||
425 | signal(SIGTERM,sigfunc); | ||
426 | signal(SIGKILL,sigfunc); | ||
427 | |||
428 | //make the fifos if needed | ||
429 | if (stat(FIFO_FILE1, &st) != 0) | ||
430 | { | ||
431 | if (stat(FIFO_FILE2, &st) != 0) | ||
432 | { | ||
433 | perror("FIFO 2 exists, but FIFO 1 not"); | ||
434 | exit(1); | ||
435 | } | ||
436 | first = 1; | ||
437 | umask(0); | ||
438 | erg = mknod(FIFO_FILE1, S_IFIFO | 0666, 0); | ||
439 | erg = mknod(FIFO_FILE2, S_IFIFO | 0666, 0); | ||
440 | |||
441 | if ((fpin = fopen(FIFO_FILE1, "r")) == NULL) | ||
442 | { | ||
443 | perror("fopen"); | ||
444 | exit(1); | ||
445 | } | ||
446 | if ((fpout = fopen(FIFO_FILE2, "w")) == NULL) | ||
447 | { | ||
448 | perror("fopen"); | ||
449 | exit(1); | ||
450 | } | ||
451 | } | ||
452 | else | ||
453 | { | ||
454 | first = 0; | ||
455 | if (stat(FIFO_FILE2, &st) == 0) | ||
456 | { | ||
457 | perror("FIFO 1 exists, but FIFO 2 not"); | ||
458 | exit(1); | ||
459 | } | ||
460 | if ((fpout = fopen(FIFO_FILE1, "w")) == NULL) | ||
461 | { | ||
462 | perror("fopen"); | ||
463 | exit(1); | ||
464 | } | ||
465 | if ((fpin = fopen(FIFO_FILE2, "r")) == NULL) | ||
466 | { | ||
467 | perror("fopen"); | ||
468 | exit(1); | ||
469 | } | ||
470 | |||
471 | } | ||
472 | |||
473 | // fork | ||
474 | |||
475 | if ((pid = fork()) < 0) | ||
476 | { | ||
477 | perror("FORK ERROR"); | ||
478 | |||
479 | //clean up | ||
480 | if (first == 1) | ||
481 | { | ||
482 | unlink(FIFO_FILE1); | ||
483 | unlink(FIFO_FILE2); | ||
484 | } | ||
485 | fclose(fpin); | ||
486 | fclose(fpout); | ||
487 | return -3; | ||
488 | } | ||
489 | else if (pid == 0) // CHILD PROCESS | ||
490 | { | ||
491 | int rv = 0; | ||
492 | int readc = 0; | ||
493 | int pos = 0; | ||
494 | char line[MAXLINE]; | ||
495 | |||
496 | while (closeprog == 0) | ||
497 | { | ||
498 | readc = 0; | ||
499 | |||
500 | while (readc < sizeof( struct RadiotapHeader) + sizeof(struct GNUNET_MessageHeader)){ | ||
501 | if ((rv = read(STDIN_FILENO, line, MAXLINE)) < 0) | ||
502 | { | ||
503 | perror("READ ERROR FROM STDIN"); | ||
504 | } | ||
505 | readc += rv; | ||
506 | } | ||
507 | |||
508 | pos = 0; | ||
509 | |||
510 | fwrite(&line[pos], 1, sizeof(struct GNUNET_MessageHeader), fpout); | ||
511 | |||
512 | pos += sizeof(struct GNUNET_MessageHeader); | ||
513 | |||
514 | //do not send radiotap header | ||
515 | pos += sizeof( struct RadiotapHeader); | ||
516 | |||
517 | while (pos < readc) | ||
518 | { | ||
519 | pos += fwrite(&line[pos], 1, readc - pos, fpout); | ||
520 | } | ||
521 | } | ||
522 | |||
523 | |||
524 | //clean up | ||
525 | fclose(fpout); | ||
526 | } | ||
527 | else // PARENT PROCESS | ||
528 | { | ||
529 | int rv = 0; | ||
530 | ssize_t pos = 0; | ||
531 | char line[MAXLINE]; | ||
532 | struct Wlan_Helper_Control_Message macmsg; | ||
533 | |||
534 | |||
535 | //Send random mac address | ||
536 | macmsg.mac.mac[0] = 0x13; | ||
537 | macmsg.mac.mac[1] = 0x22; | ||
538 | macmsg.mac.mac[2] = 0x33; | ||
539 | macmsg.mac.mac[3] = 0x44; | ||
540 | macmsg.mac.mac[4] = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 255); | ||
541 | macmsg.mac.mac[5] = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 255); | ||
542 | macmsg.hdr.size = sizeof(struct Wlan_Helper_Control_Message); | ||
543 | |||
544 | pos = 0; | ||
545 | while (pos < sizeof(struct Wlan_Helper_Control_Message)) | ||
546 | { | ||
547 | pos += write(STDOUT_FILENO, &macmsg + pos, sizeof(struct Wlan_Helper_Control_Message) - pos); | ||
548 | } | ||
549 | |||
550 | while (closeprog == 0) | ||
551 | { | ||
552 | if ((rv = fread(line, 1, MAXLINE, fpin)) < 0) | ||
553 | { | ||
554 | perror("READ ERROR FROM fpin"); | ||
555 | } | ||
556 | |||
557 | pos = 0; | ||
558 | while (pos < rv) | ||
559 | { | ||
560 | pos += write(STDOUT_FILENO, &line[pos], rv - pos); | ||
561 | } | ||
562 | } | ||
563 | |||
564 | |||
565 | //clean up | ||
566 | fclose(fpin); | ||
567 | |||
568 | if (first == 1) | ||
569 | { | ||
570 | unlink(FIFO_FILE1); | ||
571 | unlink(FIFO_FILE2); | ||
572 | } | ||
573 | } | ||
574 | |||
575 | // Write the input to the output | ||
576 | |||
577 | return (0); | ||
578 | } | ||
383 | 579 | ||
384 | 580 | ||
385 | int | 581 | int |
386 | main(int argc, char *argv[]) | 582 | main(int argc, char *argv[]) |
387 | { | 583 | { |
584 | if ((argc==3) && (strstr(argv[2],"1"))) | ||
585 | { | ||
586 | return testmode(argc, argv); | ||
587 | } | ||
588 | |||
388 | u8 u8aSendBuffer[500]; | 589 | u8 u8aSendBuffer[500]; |
389 | char szErrbuf[PCAP_ERRBUF_SIZE]; | 590 | char szErrbuf[PCAP_ERRBUF_SIZE]; |
390 | int nCaptureHeaderLength = 0, n80211HeaderLength = 0, nLinkEncap = 0; | 591 | int nCaptureHeaderLength = 0, n80211HeaderLength = 0, nLinkEncap = 0; |
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index 8a4201863..d3c7d2150 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -1992,7 +1992,7 @@ wlan_plugin_helper_read (void *cls, | |||
1992 | * @return GNUNET_YES if process was started, GNUNET_SYSERR on error | 1992 | * @return GNUNET_YES if process was started, GNUNET_SYSERR on error |
1993 | */ | 1993 | */ |
1994 | static int | 1994 | static int |
1995 | wlan_transport_start_wlan_helper(struct Plugin *plugin) | 1995 | wlan_transport_start_wlan_helper(struct Plugin *plugin, int testmode) |
1996 | { | 1996 | { |
1997 | 1997 | ||
1998 | plugin->server_stdout = GNUNET_DISK_pipe(GNUNET_YES, GNUNET_NO, GNUNET_YES); | 1998 | plugin->server_stdout = GNUNET_DISK_pipe(GNUNET_YES, GNUNET_NO, GNUNET_YES); |
@@ -2010,7 +2010,7 @@ wlan_transport_start_wlan_helper(struct Plugin *plugin) | |||
2010 | /* Start the server process */ | 2010 | /* Start the server process */ |
2011 | plugin->server_proc = GNUNET_OS_start_process(plugin->server_stdin, | 2011 | plugin->server_proc = GNUNET_OS_start_process(plugin->server_stdin, |
2012 | plugin->server_stdout, "gnunet-transport-wlan-helper", | 2012 | plugin->server_stdout, "gnunet-transport-wlan-helper", |
2013 | "gnunet-transport-wlan-helper", plugin->interface, NULL); | 2013 | plugin->interface, testmode, NULL); |
2014 | if (plugin->server_proc == NULL) | 2014 | if (plugin->server_proc == NULL) |
2015 | { | 2015 | { |
2016 | #if DEBUG_wlan | 2016 | #if DEBUG_wlan |
@@ -2038,6 +2038,27 @@ wlan_transport_start_wlan_helper(struct Plugin *plugin) | |||
2038 | } | 2038 | } |
2039 | 2039 | ||
2040 | 2040 | ||
2041 | /** | ||
2042 | * Exit point from the plugin. | ||
2043 | */ | ||
2044 | //TODO doxigen | ||
2045 | //FIXME cleanup | ||
2046 | void * | ||
2047 | libgnunet_plugin_transport_wlan_done (void *cls) | ||
2048 | { | ||
2049 | struct GNUNET_TRANSPORT_PluginFunctions *api = cls; | ||
2050 | struct Plugin *plugin = api->cls; | ||
2051 | |||
2052 | GNUNET_assert(cls !=NULL); | ||
2053 | |||
2054 | if (plugin->consoltoken != NULL) | ||
2055 | GNUNET_SERVER_mst_destroy(plugin->consoltoken); | ||
2056 | |||
2057 | GNUNET_free_non_null(plugin->interface); | ||
2058 | GNUNET_free (plugin); | ||
2059 | GNUNET_free (api); | ||
2060 | return NULL; | ||
2061 | } | ||
2041 | 2062 | ||
2042 | /** | 2063 | /** |
2043 | * Entry point for the plugin. | 2064 | * Entry point for the plugin. |
@@ -2048,21 +2069,15 @@ wlan_transport_start_wlan_helper(struct Plugin *plugin) | |||
2048 | void * | 2069 | void * |
2049 | libgnunet_plugin_transport_wlan_init (void *cls) | 2070 | libgnunet_plugin_transport_wlan_init (void *cls) |
2050 | { | 2071 | { |
2051 | struct GNUNET_SERVICE_Context *service; | 2072 | //struct GNUNET_SERVICE_Context *service; |
2052 | struct GNUNET_TRANSPORT_PluginEnvironment *env = cls; | 2073 | struct GNUNET_TRANSPORT_PluginEnvironment *env = cls; |
2053 | struct GNUNET_TRANSPORT_PluginFunctions *api; | 2074 | struct GNUNET_TRANSPORT_PluginFunctions *api; |
2054 | struct Plugin *plugin; | 2075 | struct Plugin *plugin; |
2076 | int testmode; | ||
2055 | 2077 | ||
2056 | GNUNET_assert(cls !=NULL); | 2078 | GNUNET_assert(cls !=NULL); |
2057 | 2079 | ||
2058 | service = GNUNET_SERVICE_start ("transport-wlan", env->cfg); | 2080 | fprintf(stderr,"HERE"); |
2059 | if (service == NULL){ | ||
2060 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
2061 | _("Failed to start service for `%s' transport plugin.\n"), | ||
2062 | "wlan"); | ||
2063 | return NULL; | ||
2064 | } | ||
2065 | |||
2066 | plugin = GNUNET_malloc (sizeof (struct Plugin)); | 2081 | plugin = GNUNET_malloc (sizeof (struct Plugin)); |
2067 | plugin->env = env; | 2082 | plugin->env = env; |
2068 | plugin->pendingsessions = 0; | 2083 | plugin->pendingsessions = 0; |
@@ -2071,7 +2086,25 @@ libgnunet_plugin_transport_wlan_init (void *cls) | |||
2071 | plugin->server_read_task = GNUNET_SCHEDULER_NO_TASK; | 2086 | plugin->server_read_task = GNUNET_SCHEDULER_NO_TASK; |
2072 | plugin->server_write_delay_task = GNUNET_SCHEDULER_NO_TASK; | 2087 | plugin->server_write_delay_task = GNUNET_SCHEDULER_NO_TASK; |
2073 | 2088 | ||
2074 | wlan_transport_start_wlan_helper(plugin); | 2089 | testmode = GNUNET_NO; |
2090 | if (GNUNET_CONFIGURATION_have_value (env->cfg, | ||
2091 | "transport-wlan", "TESTMODE")) | ||
2092 | { | ||
2093 | testmode = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, | ||
2094 | "transport-wlan","TESTMODE"); | ||
2095 | } | ||
2096 | |||
2097 | if (GNUNET_CONFIGURATION_have_value (env->cfg, | ||
2098 | "transport-wlan", "INTERFACE")) | ||
2099 | { | ||
2100 | if (GNUNET_CONFIGURATION_get_value_string (env->cfg, | ||
2101 | "transport-wlan","INTERFACE", &(plugin->interface)) != GNUNET_YES){ | ||
2102 | libgnunet_plugin_transport_wlan_done(plugin); | ||
2103 | return NULL; | ||
2104 | } | ||
2105 | } | ||
2106 | |||
2107 | wlan_transport_start_wlan_helper(plugin, testmode); | ||
2075 | plugin->consoltoken = GNUNET_SERVER_mst_create(&wlan_process_helper,plugin); | 2108 | plugin->consoltoken = GNUNET_SERVER_mst_create(&wlan_process_helper,plugin); |
2076 | 2109 | ||
2077 | //plugin->sessions = GNUNET_malloc (sizeof (struct Sessionqueue)); | 2110 | //plugin->sessions = GNUNET_malloc (sizeof (struct Sessionqueue)); |
@@ -2091,25 +2124,4 @@ libgnunet_plugin_transport_wlan_init (void *cls) | |||
2091 | return api; | 2124 | return api; |
2092 | } | 2125 | } |
2093 | 2126 | ||
2094 | |||
2095 | /** | ||
2096 | * Exit point from the plugin. | ||
2097 | */ | ||
2098 | //TODO doxigen | ||
2099 | //FIXME cleanup | ||
2100 | void * | ||
2101 | libgnunet_plugin_transport_wlan_done (void *cls) | ||
2102 | { | ||
2103 | struct GNUNET_TRANSPORT_PluginFunctions *api = cls; | ||
2104 | struct Plugin *plugin = api->cls; | ||
2105 | |||
2106 | GNUNET_assert(cls !=NULL); | ||
2107 | |||
2108 | GNUNET_SERVER_mst_destroy(plugin->consoltoken); | ||
2109 | |||
2110 | GNUNET_free (plugin); | ||
2111 | GNUNET_free (api); | ||
2112 | return NULL; | ||
2113 | } | ||
2114 | |||
2115 | /* end of plugin_transport_wlan.c */ | 2127 | /* end of plugin_transport_wlan.c */ |
diff --git a/src/transport/test_plugin_transport_wlan_dummy.c b/src/transport/test_plugin_transport_wlan_dummy.c index b4fd46610..53b957eca 100644 --- a/src/transport/test_plugin_transport_wlan_dummy.c +++ b/src/transport/test_plugin_transport_wlan_dummy.c | |||
@@ -58,7 +58,7 @@ void sigfunc(int sig) | |||
58 | int | 58 | int |
59 | main(int argc, char *argv[]) | 59 | main(int argc, char *argv[]) |
60 | { | 60 | { |
61 | struct stat st; | 61 | struct stat st,st2; |
62 | int erg; | 62 | int erg; |
63 | int first; | 63 | int first; |
64 | FILE *fpin; | 64 | FILE *fpin; |
@@ -72,7 +72,7 @@ main(int argc, char *argv[]) | |||
72 | //make the fifos if needed | 72 | //make the fifos if needed |
73 | if (stat(FIFO_FILE1, &st) != 0) | 73 | if (stat(FIFO_FILE1, &st) != 0) |
74 | { | 74 | { |
75 | if (stat(FIFO_FILE2, &st) != 0) | 75 | if (stat(FIFO_FILE2, &st2) != 0) |
76 | { | 76 | { |
77 | perror("FIFO 2 exists, but FIFO 1 not"); | 77 | perror("FIFO 2 exists, but FIFO 1 not"); |
78 | exit(1); | 78 | exit(1); |
@@ -96,7 +96,7 @@ main(int argc, char *argv[]) | |||
96 | else | 96 | else |
97 | { | 97 | { |
98 | first = 0; | 98 | first = 0; |
99 | if (stat(FIFO_FILE2, &st) == 0) | 99 | if (stat(FIFO_FILE2, &st2) == 0) |
100 | { | 100 | { |
101 | perror("FIFO 1 exists, but FIFO 2 not"); | 101 | perror("FIFO 1 exists, but FIFO 2 not"); |
102 | exit(1); | 102 | exit(1); |
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index c115d1e5d..2d0b42008 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include "gnunet_transport_service.h" | 36 | #include "gnunet_transport_service.h" |
37 | #include "transport.h" | 37 | #include "transport.h" |
38 | 38 | ||
39 | #define VERBOSE GNUNET_NO | 39 | #define VERBOSE GNUNET_YES |
40 | 40 | ||
41 | #define VERBOSE_ARM GNUNET_NO | 41 | #define VERBOSE_ARM GNUNET_NO |
42 | 42 | ||
@@ -84,6 +84,8 @@ static int is_https; | |||
84 | 84 | ||
85 | static int is_multi_protocol; | 85 | static int is_multi_protocol; |
86 | 86 | ||
87 | static int is_wlan; | ||
88 | |||
87 | static GNUNET_SCHEDULER_TaskIdentifier die_task; | 89 | static GNUNET_SCHEDULER_TaskIdentifier die_task; |
88 | 90 | ||
89 | static char * key_file_p1; | 91 | static char * key_file_p1; |
@@ -397,6 +399,11 @@ run (void *cls, | |||
397 | setup_peer (&p1, "test_transport_api_https_peer1.conf"); | 399 | setup_peer (&p1, "test_transport_api_https_peer1.conf"); |
398 | setup_peer (&p2, "test_transport_api_https_peer2.conf"); | 400 | setup_peer (&p2, "test_transport_api_https_peer2.conf"); |
399 | } | 401 | } |
402 | else if (is_wlan) | ||
403 | { | ||
404 | setup_peer (&p1, "test_transport_api_wlan_peer1.conf"); | ||
405 | setup_peer (&p2, "test_transport_api_wlan_peer2.conf"); | ||
406 | } | ||
400 | GNUNET_assert(p1.th != NULL); | 407 | GNUNET_assert(p1.th != NULL); |
401 | GNUNET_assert(p2.th != NULL); | 408 | GNUNET_assert(p2.th != NULL); |
402 | 409 | ||
@@ -635,12 +642,15 @@ main (int argc, char *argv[]) | |||
635 | { | 642 | { |
636 | is_http = GNUNET_YES; | 643 | is_http = GNUNET_YES; |
637 | } | 644 | } |
645 | else if (strstr(argv[0], "wlan") != NULL) | ||
646 | { | ||
647 | is_wlan = GNUNET_YES; | ||
648 | } | ||
638 | else if (strstr(argv[0], "multi") != NULL) | 649 | else if (strstr(argv[0], "multi") != NULL) |
639 | { | 650 | { |
640 | is_multi_protocol = GNUNET_YES; | 651 | is_multi_protocol = GNUNET_YES; |
641 | } | 652 | } |
642 | 653 | ||
643 | |||
644 | ret = check (); | 654 | ret = check (); |
645 | if (is_multi_protocol) | 655 | if (is_multi_protocol) |
646 | { | 656 | { |
diff --git a/src/transport/test_transport_api_wlan_peer1.conf b/src/transport/test_transport_api_wlan_peer1.conf new file mode 100644 index 000000000..c273d9482 --- /dev/null +++ b/src/transport/test_transport_api_wlan_peer1.conf | |||
@@ -0,0 +1,105 @@ | |||
1 | [fs] | ||
2 | AUTOSTART = NO | ||
3 | |||
4 | [datastore] | ||
5 | AUTOSTART = NO | ||
6 | |||
7 | [core] | ||
8 | AUTOSTART = NO | ||
9 | |||
10 | [transport-wlan] | ||
11 | INTERFACE = wlan0 | ||
12 | TESTMODE = YES | ||
13 | |||
14 | [hostlist] | ||
15 | HTTP-PROXY = | ||
16 | SERVERS = http://gnunet.org:8080/ | ||
17 | OPTIONS = -b | ||
18 | BINARY = gnunet-daemon-hostlist | ||
19 | CONFIG = $DEFAULTCONFIG | ||
20 | HOME = $SERVICEHOME | ||
21 | HOSTNAME = localhost | ||
22 | HTTPPORT = 8080 | ||
23 | |||
24 | [topology] | ||
25 | BINARY = gnunet-daemon-topology | ||
26 | CONFIG = $DEFAULTCONFIG | ||
27 | FRIENDS = $SERVICEHOME/friends | ||
28 | TARGET-CONNECTION-COUNT = 16 | ||
29 | AUTOCONNECT = YES | ||
30 | FRIENDS-ONLY = NO | ||
31 | MINIMUM-FRIENDS = 0 | ||
32 | |||
33 | [transport] | ||
34 | PLUGINS = wlan | ||
35 | DEBUG = YES | ||
36 | ACCEPT_FROM6 = ::1; | ||
37 | ACCEPT_FROM = 127.0.0.1; | ||
38 | NEIGHBOUR_LIMIT = 50 | ||
39 | BINARY = gnunet-service-transport | ||
40 | CONFIG = $DEFAULTCONFIG | ||
41 | HOME = $SERVICEHOME | ||
42 | HOSTNAME = localhost | ||
43 | PORT = 12365 | ||
44 | UNIXPATH = /tmp/gnunet-p1-service-transport.sock | ||
45 | #PREFIX = xterm -T transport2 -e gdb --command=cmd --args | ||
46 | #PREFIX = valgrind --leak-check=full | ||
47 | #PREFIX = valgrind --tool=massif | ||
48 | |||
49 | [peerinfo] | ||
50 | TRUST = $SERVICEHOME/data/credit/ | ||
51 | HOSTS = $SERVICEHOME/data/hosts/ | ||
52 | ACCEPT_FROM6 = ::1; | ||
53 | ACCEPT_FROM = 127.0.0.1; | ||
54 | BINARY = gnunet-service-peerinfo | ||
55 | CONFIG = $DEFAULTCONFIG | ||
56 | HOME = $SERVICEHOME | ||
57 | HOSTNAME = localhost | ||
58 | PORT = 12369 | ||
59 | UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock | ||
60 | |||
61 | [resolver] | ||
62 | ACCEPT_FROM6 = ::1; | ||
63 | ACCEPT_FROM = 127.0.0.1; | ||
64 | BINARY = gnunet-service-resolver | ||
65 | CONFIG = $DEFAULTCONFIG | ||
66 | HOME = $SERVICEHOME | ||
67 | HOSTNAME = localhost | ||
68 | PORT = 12364 | ||
69 | UNIXPATH = /tmp/gnunet-p1-service-resolver.sock | ||
70 | |||
71 | [statistics] | ||
72 | ACCEPT_FROM6 = ::1; | ||
73 | ACCEPT_FROM = 127.0.0.1; | ||
74 | BINARY = gnunet-service-statistics | ||
75 | CONFIG = $DEFAULTCONFIG | ||
76 | HOME = $SERVICEHOME | ||
77 | HOSTNAME = localhost | ||
78 | PORT = 12367 | ||
79 | UNIXPATH = /tmp/gnunet-p1-service-statistics.sock | ||
80 | |||
81 | [arm] | ||
82 | DEFAULTSERVICES = | ||
83 | ACCEPT_FROM6 = ::1; | ||
84 | ACCEPT_FROM = 127.0.0.1; | ||
85 | BINARY = gnunet-service-arm | ||
86 | #CONFIG = $DEFAULTCONFIG | ||
87 | HOME = $SERVICEHOME | ||
88 | HOSTNAME = localhost | ||
89 | PORT = 12366 | ||
90 | UNIXPATH = /tmp/gnunet-p1-service-arm.sock | ||
91 | |||
92 | [TESTING] | ||
93 | WEAKRANDOM = YES | ||
94 | |||
95 | [gnunetd] | ||
96 | HOSTKEY = $SERVICEHOME/.hostkey | ||
97 | |||
98 | [PATHS] | ||
99 | SERVICEHOME = /tmp/test-gnunetd-transport-peer-1/ | ||
100 | |||
101 | |||
102 | [dht] | ||
103 | AUTOSTART = NO | ||
104 | |||
105 | |||
diff --git a/src/transport/test_transport_api_wlan_peer2.conf b/src/transport/test_transport_api_wlan_peer2.conf new file mode 100644 index 000000000..7ed039f79 --- /dev/null +++ b/src/transport/test_transport_api_wlan_peer2.conf | |||
@@ -0,0 +1,105 @@ | |||
1 | [fs] | ||
2 | AUTOSTART = NO | ||
3 | |||
4 | [datastore] | ||
5 | AUTOSTART = NO | ||
6 | |||
7 | [core] | ||
8 | AUTOSTART = NO | ||
9 | |||
10 | [transport-wlan] | ||
11 | INTERFACE = wlan1 | ||
12 | TESTMODE = YES | ||
13 | |||
14 | [hostlist] | ||
15 | HTTP-PROXY = | ||
16 | SERVERS = http://gnunet.org:8080/ | ||
17 | OPTIONS = -b | ||
18 | BINARY = gnunet-daemon-hostlist | ||
19 | CONFIG = $DEFAULTCONFIG | ||
20 | HOME = $SERVICEHOME | ||
21 | HOSTNAME = localhost | ||
22 | HTTPPORT = 8080 | ||
23 | |||
24 | [topology] | ||
25 | BINARY = gnunet-daemon-topology | ||
26 | CONFIG = $DEFAULTCONFIG | ||
27 | FRIENDS = $SERVICEHOME/friends | ||
28 | TARGET-CONNECTION-COUNT = 16 | ||
29 | AUTOCONNECT = YES | ||
30 | FRIENDS-ONLY = NO | ||
31 | MINIMUM-FRIENDS = 0 | ||
32 | |||
33 | [transport] | ||
34 | PLUGINS = wlan | ||
35 | DEBUG = YES | ||
36 | ACCEPT_FROM6 = ::1; | ||
37 | ACCEPT_FROM = 127.0.0.1; | ||
38 | NEIGHBOUR_LIMIT = 50 | ||
39 | BINARY = gnunet-service-transport | ||
40 | CONFIG = $DEFAULTCONFIG | ||
41 | HOME = $SERVICEHOME | ||
42 | HOSTNAME = localhost | ||
43 | PORT = 22365 | ||
44 | UNIXPATH = /tmp/gnunet-p2-service-transport.sock | ||
45 | #PREFIX = xterm -T transport1 -e gdb --command=cmd --args | ||
46 | #PREFIX = valgrind --leak-check=full | ||
47 | #PREFIX = valgrind --tool=massif | ||
48 | |||
49 | [peerinfo] | ||
50 | TRUST = $SERVICEHOME/data/credit/ | ||
51 | HOSTS = $SERVICEHOME/data/hosts/ | ||
52 | ACCEPT_FROM6 = ::1; | ||
53 | ACCEPT_FROM = 127.0.0.1; | ||
54 | BINARY = gnunet-service-peerinfo | ||
55 | CONFIG = $DEFAULTCONFIG | ||
56 | HOME = $SERVICEHOME | ||
57 | HOSTNAME = localhost | ||
58 | PORT = 22369 | ||
59 | UNIXPATH = /tmp/gnunet-p2-service-peerinfo.sock | ||
60 | |||
61 | [resolver] | ||
62 | ACCEPT_FROM6 = ::1; | ||
63 | ACCEPT_FROM = 127.0.0.1; | ||
64 | BINARY = gnunet-service-resolver | ||
65 | CONFIG = $DEFAULTCONFIG | ||
66 | HOME = $SERVICEHOME | ||
67 | HOSTNAME = localhost | ||
68 | PORT = 22364 | ||
69 | UNIXPATH = /tmp/gnunet-p2-service-resolver.sock | ||
70 | |||
71 | [statistics] | ||
72 | ACCEPT_FROM6 = ::1; | ||
73 | ACCEPT_FROM = 127.0.0.1; | ||
74 | BINARY = gnunet-service-statistics | ||
75 | CONFIG = $DEFAULTCONFIG | ||
76 | HOME = $SERVICEHOME | ||
77 | HOSTNAME = localhost | ||
78 | PORT = 22367 | ||
79 | UNIXPATH = /tmp/gnunet-p2-service-statistics.sock | ||
80 | |||
81 | [arm] | ||
82 | DEFAULTSERVICES = | ||
83 | ACCEPT_FROM6 = ::1; | ||
84 | ACCEPT_FROM = 127.0.0.1; | ||
85 | BINARY = gnunet-service-arm | ||
86 | CONFIG = $DEFAULTCONFIG | ||
87 | HOME = $SERVICEHOME | ||
88 | HOSTNAME = localhost | ||
89 | PORT = 22366 | ||
90 | UNIXPATH = /tmp/gnunet-p2-service-arm.sock | ||
91 | |||
92 | [TESTING] | ||
93 | WEAKRANDOM = YES | ||
94 | |||
95 | [gnunetd] | ||
96 | HOSTKEY = $SERVICEHOME/.hostkey | ||
97 | |||
98 | [PATHS] | ||
99 | SERVICEHOME = /tmp/test-gnunetd-transport-peer-2/ | ||
100 | |||
101 | |||
102 | [dht] | ||
103 | AUTOSTART = NO | ||
104 | |||
105 | |||