aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_plugin_transport_wlan_dummy.c
diff options
context:
space:
mode:
authorDavid Brodski <david@brodski.eu>2010-12-07 08:26:28 +0000
committerDavid Brodski <david@brodski.eu>2010-12-07 08:26:28 +0000
commit275dea76f25c278583b23c80cedefc3c931f13be (patch)
treee8a8ba41c2c794b429b54644a8bcd25faf1de7f3 /src/transport/test_plugin_transport_wlan_dummy.c
parent197c25b64e8cf36d25914dccc45247cb7e70f4b3 (diff)
downloadgnunet-275dea76f25c278583b23c80cedefc3c931f13be.tar.gz
gnunet-275dea76f25c278583b23c80cedefc3c931f13be.zip
first part of the dummy for wlan plugin tests.
Diffstat (limited to 'src/transport/test_plugin_transport_wlan_dummy.c')
-rw-r--r--src/transport/test_plugin_transport_wlan_dummy.c99
1 files changed, 99 insertions, 0 deletions
diff --git a/src/transport/test_plugin_transport_wlan_dummy.c b/src/transport/test_plugin_transport_wlan_dummy.c
new file mode 100644
index 000000000..4afb24ed4
--- /dev/null
+++ b/src/transport/test_plugin_transport_wlan_dummy.c
@@ -0,0 +1,99 @@
1/*
2 This file is part of GNUnet.
3 (C) 2010 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20/**
21 * @file transport/test_transport_wlan_dummy.c
22 * @brief helper for the testcase for plugin_transport_wlan.c
23 * @author David Brodski
24 */
25
26#include "platform.h"
27#include "gnunet_constants.h"
28#include "gnunet_os_lib.h"
29#include "gnunet_transport_plugin.h"
30#include "transport.h"
31#include "plugin_transport_wlan.h"
32#include "gnunet_common.h"
33#include "gnunet-transport-wlan-helper.h"
34#include "plugin_transport_wlan.h"
35
36#include <stdio.h>
37#include <stdlib.h>
38#include <sys/stat.h>
39
40#define FIFO_FILE1 "MYFIFOin"
41#define FIFO_FILE2 "MYFIFOout"
42
43int
44main(int argc, char *argv[])
45{
46 struct stat st;
47 int erg;
48 int first;
49 FILE *fpin;
50 FILE *fpout;
51 //make the fifos if needed
52 if(stat(FIFO_FILE1,&st) != 0){
53 if(stat(FIFO_FILE2,&st) != 0){
54 perror("FIFO 2 exists, but FIFO 1 not");
55 exit(1);
56 }
57 first = 1;
58 umask(0);
59 erg = mknod(FIFO_FILE1, S_IFIFO|0666, 0);
60 erg = mknod(FIFO_FILE2, S_IFIFO|0666, 0);
61
62 if((fpin = fopen(FIFO_FILE1, "r")) == NULL) {
63 perror("fopen");
64 exit(1);
65 }
66 if((fpout = fopen(FIFO_FILE2, "w")) == NULL) {
67 perror("fopen");
68 exit(1);
69 }
70 } else {
71 first = 0;
72 if(stat(FIFO_FILE2,&st) == 0){
73 perror("FIFO 1 exists, but FIFO 2 not");
74 exit(1);
75 }
76 if((fpout = fopen(FIFO_FILE1, "w")) == NULL) {
77 perror("fopen");
78 exit(1);
79 }
80 if((fpin = fopen(FIFO_FILE2, "r")) == NULL) {
81 perror("fopen");
82 exit(1);
83 }
84
85 }
86 // Write the input to the output
87
88 //clean up
89 if (first == 1){
90 unlink(FIFO_FILE1);
91 unlink(FIFO_FILE2);
92 }
93
94
95 fclose(fpin);
96 fclose(fpout);
97 return(0);
98}
99