aboutsummaryrefslogtreecommitdiff
path: root/src/transport/wlan
diff options
context:
space:
mode:
authorDavid Brodski <david@brodski.eu>2011-04-06 00:47:00 +0000
committerDavid Brodski <david@brodski.eu>2011-04-06 00:47:00 +0000
commitd99bd9118c9e6328f4a476457d3f86e7b8cd11b0 (patch)
tree2bdce97b2e0f15af26c82e546cac67f6a73baa68 /src/transport/wlan
parent8de8a462ddd6c327f7134763a8e89b523e8ffa6b (diff)
downloadgnunet-d99bd9118c9e6328f4a476457d3f86e7b8cd11b0.tar.gz
gnunet-d99bd9118c9e6328f4a476457d3f86e7b8cd11b0.zip
reliability test and fragmentation are working now
Diffstat (limited to 'src/transport/wlan')
-rw-r--r--src/transport/wlan/loopback_helper.c51
1 files changed, 35 insertions, 16 deletions
diff --git a/src/transport/wlan/loopback_helper.c b/src/transport/wlan/loopback_helper.c
index 8f56bc8d6..ec9096d6f 100644
--- a/src/transport/wlan/loopback_helper.c
+++ b/src/transport/wlan/loopback_helper.c
@@ -1,5 +1,3 @@
1
2
3#include <sys/socket.h> 1#include <sys/socket.h>
4#include <sys/ioctl.h> 2#include <sys/ioctl.h>
5#include <sys/types.h> 3#include <sys/types.h>
@@ -52,7 +50,8 @@ stdin_send(void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
52 //unsigned char * from_start; 50 //unsigned char * from_start;
53 unsigned char * to_start; 51 unsigned char * to_start;
54 52
55 sendsize = ntohs(hdr->size) - sizeof(struct Radiotap_Send); 53 sendsize = ntohs(hdr->size) - sizeof(struct Radiotap_Send)
54 + sizeof(struct Radiotap_rx);
56 55
57 if (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA != ntohs(hdr->type)) 56 if (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA != ntohs(hdr->type))
58 { 57 {
@@ -73,16 +72,17 @@ stdin_send(void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
73 to_data = to_radiotap + sizeof(struct Radiotap_rx); 72 to_data = to_radiotap + sizeof(struct Radiotap_rx);
74 73
75 from_data = ((unsigned char *) hdr) + sizeof(struct Radiotap_Send) 74 from_data = ((unsigned char *) hdr) + sizeof(struct Radiotap_Send)
76 + sizeof(struct GNUNET_MessageHeader); 75 + sizeof(struct GNUNET_MessageHeader);
77
78 76
79 memcpy(to_start, &newheader, sizeof(struct GNUNET_MessageHeader)); 77 memcpy(to_start, &newheader, sizeof(struct GNUNET_MessageHeader));
80 write_pout->size += sizeof(struct GNUNET_MessageHeader); 78 write_pout->size += sizeof(struct GNUNET_MessageHeader);
81 79
82 write_pout->size += sizeof(struct Radiotap_rx); 80 write_pout->size += sizeof(struct Radiotap_rx);
83 81
84 memcpy(to_data, from_data, sendsize - sizeof(struct GNUNET_MessageHeader)); 82 memcpy(to_data, from_data, ntohs(hdr->size) - sizeof(struct Radiotap_Send)
85 write_pout->size += sendsize - sizeof(struct GNUNET_MessageHeader); 83 - sizeof(struct GNUNET_MessageHeader));
84 write_pout->size += ntohs(hdr->size) - sizeof(struct Radiotap_Send)
85 - sizeof(struct GNUNET_MessageHeader);
86} 86}
87 87
88static void 88static void
@@ -130,8 +130,20 @@ testmode(int argc, char *argv[])
130 } 130 }
131 131
132 umask(0); 132 umask(0);
133 //unlink(FIFO_FILE1);
134 //unlink(FIFO_FILE2);
133 erg = mknod(FIFO_FILE1, S_IFIFO | 0666, 0); 135 erg = mknod(FIFO_FILE1, S_IFIFO | 0666, 0);
136 if (0 != erg)
137 {
138 fprintf(stderr, "Error at mknode1 \n");
139 //exit(1);
140 }
134 erg = mknod(FIFO_FILE2, S_IFIFO | 0666, 0); 141 erg = mknod(FIFO_FILE2, S_IFIFO | 0666, 0);
142 if (0 != erg)
143 {
144 fprintf(stderr, "Error at mknode2 \n");
145 //exit(1);
146 }
135 147
136 } 148 }
137 else 149 else
@@ -153,12 +165,13 @@ testmode(int argc, char *argv[])
153 if (NULL == fpin) 165 if (NULL == fpin)
154 { 166 {
155 fprintf(stderr, "fopen of read FIFO_FILE1\n"); 167 fprintf(stderr, "fopen of read FIFO_FILE1\n");
156 exit(1); 168 goto end2;
157 } 169 }
158 if (NULL == (fpout = fopen(FIFO_FILE2, "w"))) 170 fpout = fopen(FIFO_FILE2, "w");
171 if (NULL == fpout)
159 { 172 {
160 fprintf(stderr, "fopen of write FIFO_FILE2\n"); 173 fprintf(stderr, "fopen of write FIFO_FILE2\n");
161 exit(1); 174 goto end1;
162 } 175 }
163 176
164 } 177 }
@@ -166,17 +179,20 @@ testmode(int argc, char *argv[])
166 { 179 {
167 first = 0; 180 first = 0;
168 //fprintf(stderr, "Second\n"); 181 //fprintf(stderr, "Second\n");
169 if (NULL == (fpout = fopen(FIFO_FILE1, "w"))) 182 fpout = fopen(FIFO_FILE1, "w");
183 if (NULL == fpout)
170 { 184 {
171 fprintf(stderr, "fopen of write FIFO_FILE1\n"); 185 fprintf(stderr, "fopen of write FIFO_FILE1\n");
172 exit(1); 186 goto end1;
173 } 187 }
174 if (NULL == (fpin = fopen(FIFO_FILE2, "r"))) 188 fpin = fopen(FIFO_FILE2, "r");
189 if (NULL == fpin)
175 { 190 {
176 fprintf(stderr, "fopen of read FIFO_FILE2\n"); 191 fprintf(stderr, "fopen of read FIFO_FILE2\n");
177 exit(1); 192 goto end1;
178 } 193 }
179 194
195
180 } 196 }
181 197
182 fdpin = fileno(fpin); 198 fdpin = fileno(fpin);
@@ -426,8 +442,11 @@ testmode(int argc, char *argv[])
426 } 442 }
427 443
428 //clean up 444 //clean up
429 fclose(fpout); 445
430 fclose(fpin); 446 GNUNET_SERVER_mst_destroy(stdin_mst);
447 GNUNET_SERVER_mst_destroy(file_in_mst);
448 end1: fclose(fpout);
449 end2: fclose(fpin);
431 450
432 if (1 == first) 451 if (1 == first)
433 { 452 {