aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/transport/gnunet-transport-wlan-helper.c131
-rw-r--r--src/transport/gnunet_wlan_sender.c119
-rw-r--r--src/transport/plugin_transport_wlan.c12
-rw-r--r--src/transport/plugin_transport_wlan.h26
4 files changed, 142 insertions, 146 deletions
diff --git a/src/transport/gnunet-transport-wlan-helper.c b/src/transport/gnunet-transport-wlan-helper.c
index 7df94b68b..f2be1cc18 100644
--- a/src/transport/gnunet-transport-wlan-helper.c
+++ b/src/transport/gnunet-transport-wlan-helper.c
@@ -28,6 +28,10 @@
28 * gnunet 28 * gnunet
29 */ 29 */
30 30
31/**
32 * parts taken from aircrack-ng, parts changend.
33 */
34
31#define _GNU_SOURCE 35#define _GNU_SOURCE
32#include <sys/socket.h> 36#include <sys/socket.h>
33#include <sys/ioctl.h> 37#include <sys/ioctl.h>
@@ -92,40 +96,6 @@
92 96
93#define MAC_ADDR_SIZE 6 97#define MAC_ADDR_SIZE 6
94 98
95//Part taken from file ieee80211.h
96/*-
97 * Copyright (c) 2001 Atsushi Onoe
98 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
99 * All rights reserved.
100 *
101 * Redistribution and use in source and binary forms, with or without
102 * modification, are permitted provided that the following conditions
103 * are met:
104 * 1. Redistributions of source code must retain the above copyright
105 * notice, this list of conditions and the following disclaimer.
106 * 2. Redistributions in binary form must reproduce the above copyright
107 * notice, this list of conditions and the following disclaimer in the
108 * documentation and/or other materials provided with the distribution.
109 * 3. The name of the author may not be used to endorse or promote products
110 * derived from this software without specific prior written permission.
111 *
112 * Alternatively, this software may be distributed under the terms of the
113 * GNU General Public License ("GPL") version 2 as published by the Free
114 * Software Foundation.
115 *
116 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
117 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
118 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
119 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
120 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
121 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
122 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
123 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
124 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
125 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
126 *
127 * $FreeBSD: src/sys/net80211/ieee80211.h,v 1.12 2006/12/01 18:40:51 imp Exp $
128 */
129 99
130#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */ 100#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
131 101
@@ -144,13 +114,21 @@ struct ieee80211_frame
144 /* see below */ 114 /* see below */
145} GNUNET_PACKED; 115} GNUNET_PACKED;
146 116
147// End taken part 117/**
148 118 * struct for storing the information of the hardware
119 */
149struct Hardware_Infos 120struct Hardware_Infos
150{ 121{
151 122
123 /**
124 * send buffer
125 */
152 struct sendbuf write_pout; 126 struct sendbuf write_pout;
127 /**
128 * file descriptor for the raw socket
129 */
153 int fd_raw; 130 int fd_raw;
131
154 int arptype_in; 132 int arptype_in;
155 133
156 /** 134 /**
@@ -173,6 +151,12 @@ int
173getChannelFromFrequency (int frequency); 151getChannelFromFrequency (int frequency);
174 152
175// FIXME: make nice... 153// FIXME: make nice...
154/**
155 * function to calculate the crc, the start of the calculation
156 * @param buf buffer to calc the crc
157 * @param len len of the buffer
158 * @return crc sum
159 */
176static unsigned long 160static unsigned long
177calc_crc_osdep (unsigned char *buf, int len) 161calc_crc_osdep (unsigned char *buf, int len)
178{ 162{
@@ -187,7 +171,12 @@ calc_crc_osdep (unsigned char *buf, int len)
187/* CRC checksum verification routine */ 171/* CRC checksum verification routine */
188 172
189// FIXME: make nice... 173// FIXME: make nice...
190// fixme doxigen 174/**
175 * Function to check crc of the wlan packet
176 * @param buf buffer of the packet
177 * @param len len of the data
178 * @return crc sum of the data
179 */
191static int 180static int
192check_crc_buf_osdep (unsigned char *buf, int len) 181check_crc_buf_osdep (unsigned char *buf, int len)
193{ 182{
@@ -204,7 +193,11 @@ check_crc_buf_osdep (unsigned char *buf, int len)
204 193
205 194
206// FIXME: make nice... 195// FIXME: make nice...
207//fixme doxigen 196/**
197 * function to get the channel of a specific wlan card
198 * @param dev pointer to the dev struct of the card
199 * @return channel number
200 */
208static int 201static int
209linux_get_channel (struct Hardware_Infos *dev) 202linux_get_channel (struct Hardware_Infos *dev)
210{ 203{
@@ -236,7 +229,14 @@ linux_get_channel (struct Hardware_Infos *dev)
236 229
237 230
238// FIXME: make nice... 231// FIXME: make nice...
239//FIXME doxigen 232/**
233 * function to read from a wlan card
234 * @param dev pointer to the struct of the wlan card
235 * @param buf buffer to read to
236 * @param buf_size size of the buffer
237 * @param ri radiotap_rx info
238 * @return size read from the buffer
239 */
240static ssize_t 240static ssize_t
241linux_read (struct Hardware_Infos *dev, unsigned char *buf, /* FIXME: void*? */ 241linux_read (struct Hardware_Infos *dev, unsigned char *buf, /* FIXME: void*? */
242 size_t buf_size, struct Radiotap_rx *ri) 242 size_t buf_size, struct Radiotap_rx *ri)
@@ -420,8 +420,9 @@ linux_read (struct Hardware_Infos *dev, unsigned char *buf, /* FIXME: void*?
420 return caplen; 420 return caplen;
421} 421}
422 422
423//FIXME doxigen
424/** 423/**
424 * function to open the device for read/write
425 * @param dev pointer to the device struct
425 * @return 0 on success 426 * @return 0 on success
426 */ 427 */
427static int 428static int
@@ -535,6 +536,9 @@ openraw (struct Hardware_Infos *dev)
535} 536}
536 537
537/** 538/**
539 * function to prepare the helper, e.g. sockets, device...
540 * @param dev struct for the device
541 * @param iface name of the interface
538 * @return 0 on success 542 * @return 0 on success
539 */ 543 */
540static int 544static int
@@ -615,7 +619,12 @@ mac_set (struct ieee80211_frame *u8aIeeeHeader,
615 619
616} 620}
617 621
618//FIXME: doxigen 622/**
623 * function to process the data from the stdin
624 * @param cls pointer to the device struct
625 * @param client not used
626 * @param hdr pointer to the start of the packet
627 */
619static void 628static void
620stdin_send_hw (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) 629stdin_send_hw (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
621{ 630{
@@ -676,6 +685,12 @@ stdin_send_hw (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
676} 685}
677 686
678#if 0 687#if 0
688/**
689 * Function to make test packets with special options
690 * @param buf buffer to write the data to
691 * @param dev device to send the data from
692 * @return size of packet (what should be send)
693 */
679static int 694static int
680maketest (unsigned char *buf, struct Hardware_Infos *dev) 695maketest (unsigned char *buf, struct Hardware_Infos *dev)
681{ 696{
@@ -756,27 +771,11 @@ maketest (unsigned char *buf, struct Hardware_Infos *dev)
756 771
757 772
758/** 773/**
759 * function to create GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL message for plugin 774 * Function to start the hardware for the wlan helper
760 * @param buffer pointer to buffer for the message 775 * @param argc number of arguments
761 * @param mac pointer to the mac address 776 * @param argv arguments
762 * @return number of bytes written 777 * @return returns one on error
763 */ 778 */
764// FIXME: use 'struct MacAddress' for 'mac' (everywhere in this file)
765/*
766static int
767send_mac_to_plugin (char *buffer, struct MacAddress * mac)
768{
769 struct Wlan_Helper_Control_Message macmsg;
770
771 macmsg.hdr.size = htons (sizeof (struct Wlan_Helper_Control_Message));
772 macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
773 memcpy (macmsg.mac, mac, sizeof (struct MacAddress));
774 memcpy (buffer, &macmsg, sizeof (struct Wlan_Helper_Control_Message));
775 return sizeof (struct Wlan_Helper_Control_Message);
776}
777*/
778
779//FIXME: doxigen
780static int 779static int
781hardwaremode (int argc, char *argv[]) 780hardwaremode (int argc, char *argv[])
782{ 781{
@@ -938,6 +937,12 @@ hardwaremode (int argc, char *argv[])
938 return 1; 937 return 1;
939} 938}
940 939
940/**
941 * main function of the helper
942 * @param argc number of arguments
943 * @param argv arguments
944 * @return 0 on success, 1 on error
945 */
941int 946int
942main (int argc, char *argv[]) 947main (int argc, char *argv[])
943{ 948{
@@ -974,6 +979,8 @@ main (int argc, char *argv[])
974 979
975/** 980/**
976 * Return the frequency in Mhz from a channel number 981 * Return the frequency in Mhz from a channel number
982 * @param channel number of the channel
983 * @return frequency of the channel
977 */ 984 */
978int 985int
979getFrequencyFromChannel (int channel) 986getFrequencyFromChannel (int channel)
@@ -1013,6 +1020,8 @@ getFrequencyFromChannel (int channel)
1013 1020
1014/** 1021/**
1015 * Return the channel from the frequency (in Mhz) 1022 * Return the channel from the frequency (in Mhz)
1023 * @param frequency of the channel
1024 * @return number of the channel
1016 */ 1025 */
1017int 1026int
1018getChannelFromFrequency (int frequency) 1027getChannelFromFrequency (int frequency)
diff --git a/src/transport/gnunet_wlan_sender.c b/src/transport/gnunet_wlan_sender.c
index a400136da..ad777a7e5 100644
--- a/src/transport/gnunet_wlan_sender.c
+++ b/src/transport/gnunet_wlan_sender.c
@@ -1,40 +1,40 @@
1/*
2 This file is part of GNUnet
3 (C) 2011 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 */
1 20
2#include <sys/types.h> 21/**
3#include <unistd.h> 22 * @file transport/gnunet_wlan_sender.c
4#include <stdio.h> 23 * @brief program to send via WLAN as much as possible
5#include <stdlib.h> 24 * @author David Brodski
6 25 */
7#define WLAN_MTU 1500
8 26
9#include <sys/socket.h>
10#include <sys/ioctl.h>
11#include <sys/types.h>
12#include <unistd.h> 27#include <unistd.h>
13#include <sys/wait.h>
14#include <sys/time.h>
15#include <sys/stat.h>
16#include <netpacket/packet.h>
17#include <linux/if_ether.h>
18#include <linux/if.h>
19#include <linux/wireless.h>
20#include <netinet/in.h>
21#include <linux/if_tun.h>
22#include <stdio.h> 28#include <stdio.h>
23#include <stdlib.h> 29#include <stdlib.h>
30#include <netinet/in.h>
24#include <string.h> 31#include <string.h>
25#include <stdarg.h>
26#include <fcntl.h>
27#include <errno.h>
28#include <dirent.h>
29//#include <sys/utsname.h>
30#include <sys/param.h>
31
32#include <time.h> 32#include <time.h>
33
34
35#include "gnunet/gnunet_protocols.h" 33#include "gnunet/gnunet_protocols.h"
36#include "plugin_transport_wlan.h" 34#include "plugin_transport_wlan.h"
37 35
36#define WLAN_MTU 1500
37
38/** 38/**
39 * LLC fields for better compatibility 39 * LLC fields for better compatibility
40 */ 40 */
@@ -73,8 +73,6 @@ struct ieee80211_frame
73 73
74/** 74/**
75 * function to fill the radiotap header 75 * function to fill the radiotap header
76 * @param plugin pointer to the plugin struct
77 * @param endpoint pointer to the endpoint
78 * @param header pointer to the radiotap header 76 * @param header pointer to the radiotap header
79 * @return GNUNET_YES at success 77 * @return GNUNET_YES at success
80 */ 78 */
@@ -93,8 +91,8 @@ getRadiotapHeader ( struct Radiotap_Send *header)
93/** 91/**
94 * function to generate the wlan hardware header for one packet 92 * function to generate the wlan hardware header for one packet
95 * @param Header address to write the header to 93 * @param Header address to write the header to
96 * @param to_mac_addr address of the recipient 94 * @param to_mac_addr pointer to the address of the recipient
97 * @param plugin pointer to the plugin struct 95 * @param mac pointer to the mac address to send from (normally overwritten over by helper)
98 * @param size size of the whole packet, needed to calculate the time to send the packet 96 * @param size size of the whole packet, needed to calculate the time to send the packet
99 * @return GNUNET_YES if there was no error 97 * @return GNUNET_YES if there was no error
100 */ 98 */
@@ -118,45 +116,15 @@ getWlanHeader (struct ieee80211_frame *Header,
118 Header->llc[0] = WLAN_LLC_DSAP_FIELD; 116 Header->llc[0] = WLAN_LLC_DSAP_FIELD;
119 Header->llc[1] = WLAN_LLC_SSAP_FIELD; 117 Header->llc[1] = WLAN_LLC_SSAP_FIELD;
120 118
121#if DEBUG_wlan_ip_udp_packets_on_air > 1
122 uint crc = 0;
123 uint16_t *x;
124 int count;
125
126 Header->ip.ip_dst.s_addr = *((uint32_t *) & to_mac_addr->mac[2]);
127 Header->ip.ip_src.s_addr = *((uint32_t *) & plugin->mac_address.mac[2]);
128 Header->ip.ip_v = 4;
129 Header->ip.ip_hl = 5;
130 Header->ip.ip_p = 17;
131 Header->ip.ip_ttl = 1;
132 Header->ip.ip_len = htons (size + 8);
133 Header->ip.ip_sum = 0;
134 x = (uint16_t *) & Header->ip;
135 count = sizeof (struct iph);
136 while (count > 1)
137 {
138 /* This is the inner loop */
139 crc += (unsigned short) *x++;
140 count -= 2;
141 }
142 /* Add left-over byte, if any */
143 if (count > 0)
144 crc += *(unsigned char *) x;
145 crc = (crc & 0xffff) + (crc >> 16);
146 Header->ip.ip_sum = htons (~(unsigned short) crc);
147 Header->udp.len = htons (size - sizeof (struct ieee80211_frame));
148
149#endif
150
151 return GNUNET_YES; 119 return GNUNET_YES;
152} 120}
153 121
154int main(int argc, char *argv[]){ 122int main(int argc, char *argv[]){
155 struct GNUNET_MessageHeader *msg; 123 struct GNUNET_MessageHeader *msg;
156 struct GNUNET_MessageHeader *msg2;
157 struct ieee80211_frame *wlan_header; 124 struct ieee80211_frame *wlan_header;
158 struct Radiotap_Send *radiotap; 125 struct Radiotap_Send *radiotap;
159 126
127 unsigned int temp[6];
160 char inmac[6]; 128 char inmac[6];
161 char outmac[6]; 129 char outmac[6];
162 int pos; 130 int pos;
@@ -164,19 +132,19 @@ int main(int argc, char *argv[]){
164 double bytes_per_s; 132 double bytes_per_s;
165 time_t start; 133 time_t start;
166 time_t akt; 134 time_t akt;
135 int i;
167 136
168 if (4 != argc) { 137 if (4 != argc) {
169 fprintf( 138 fprintf(
170 stderr, 139 stderr,
171 "This program must be started with the interface and the targets and source mac as argument.\nThis program was compiled at ----- %s ----\n", 140 "This program must be started with the interface and the targets and source mac as argument.\nThis program was compiled at ----- %s ----\n",
172 __TIMESTAMP__); 141 __TIMESTAMP__);
173 fprintf(stderr, "Usage: interface-name mac-target mac-source\n" "\n"); 142 fprintf(stderr, "Usage: interface-name mac-target mac-source\n" "e.g. mon0 11-22-33-44-55-66 12-34-56-78-90-ab\n");
174 return 1; 143 return 1;
175 } 144 }
176 145
177 146
178 pid_t pid; 147 pid_t pid;
179 int rv;
180 int commpipe[2]; /* This holds the fd for the input & output of the pipe */ 148 int commpipe[2]; /* This holds the fd for the input & output of the pipe */
181 149
182 /* Setup communication pipeline first */ 150 /* Setup communication pipeline first */
@@ -193,12 +161,17 @@ int main(int argc, char *argv[]){
193 161
194 if(pid){ 162 if(pid){
195 /* A positive (non-negative) PID indicates the parent process */ 163 /* A positive (non-negative) PID indicates the parent process */
196 //dup2(commpipe[1],1); /* Replace stdout with out side of the pipe */
197 close(commpipe[0]); /* Close unused side of pipe (in side) */ 164 close(commpipe[0]); /* Close unused side of pipe (in side) */
198 setvbuf(stdout,(char*)NULL,_IONBF,0); /* Set non-buffered output on stdout */ 165 setvbuf(stdout,(char*)NULL,_IONBF,0); /* Set non-buffered output on stdout */
199 166
200 sscanf(argv[3], "%x-%x-%x-%x-%x-%x", &inmac[0],&inmac[1],&inmac[2],&inmac[3],&inmac[4],&inmac[5]); 167 sscanf(argv[3], "%x-%x-%x-%x-%x-%x", &temp[0],&temp[1],&temp[2],&temp[3],&temp[4],&temp[5]);
201 sscanf(argv[2], "%x-%x-%x-%x-%x-%x", &outmac[0],&outmac[1],&outmac[2],&outmac[3],&outmac[4],&outmac[5]); 168 for (i = 0; i < 6; i++){
169 inmac[i] = temp[i];
170 }
171 sscanf(argv[2], "%x-%x-%x-%x-%x-%x", &temp[0],&temp[1],&temp[2],&temp[3],&temp[4],&temp[5]);
172 for (i = 0; i < 6; i++){
173 outmac[i] = temp[i];
174 }
202 175
203 msg = malloc(WLAN_MTU); 176 msg = malloc(WLAN_MTU);
204 msg->type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA); 177 msg->type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA);
@@ -226,16 +199,6 @@ int main(int argc, char *argv[]){
226 } 199 }
227 200
228 } 201 }
229 /*
230 sleep(2);
231 printf("Hello\n");
232 sleep(2);
233 printf("Goodbye\n");
234 sleep(2);
235 printf("exit\n");
236 */
237 //wait(&rv); /* Wait for child process to end */
238 //fprintf(stderr,"Child exited with a %d value\n",rv);
239 } 202 }
240 else{ 203 else{
241 /* A zero PID indicates that this is the child process */ 204 /* A zero PID indicates that this is the child process */
@@ -243,7 +206,7 @@ int main(int argc, char *argv[]){
243 close(commpipe[1]); /* Close unused side of pipe (out side) */ 206 close(commpipe[1]); /* Close unused side of pipe (out side) */
244 /* Replace the child fork with a new process */ 207 /* Replace the child fork with a new process */
245 if(execl("gnunet-transport-wlan-helper","gnunet-transport-wlan-helper", argv[1], NULL) == -1){ 208 if(execl("gnunet-transport-wlan-helper","gnunet-transport-wlan-helper", argv[1], NULL) == -1){
246 fprintf(stderr,"execl Error!"); 209 fprintf(stderr,"Could not start gnunet-transport-wlan-helper!");
247 exit(1); 210 exit(1);
248 } 211 }
249 } 212 }
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index de735b971..2763b5082 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors) 3 (C) 2010 2011 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published
@@ -1234,6 +1234,7 @@ free_fragment_message (struct Plugin *plugin, struct FragmentMessage *fm)
1234 (session->mac->fragment_messages_out_count)--; 1234 (session->mac->fragment_messages_out_count)--;
1235 session->fragment_messages_out_count--; 1235 session->fragment_messages_out_count--;
1236 plugin->pending_Fragment_Messages--; 1236 plugin->pending_Fragment_Messages--;
1237 GNUNET_STATISTICS_set(plugin->env->stats, _("# wlan pending fragments"), plugin->pending_Fragment_Messages, GNUNET_NO);
1237 GNUNET_CONTAINER_DLL_remove (endpoint->sending_messages_head, 1238 GNUNET_CONTAINER_DLL_remove (endpoint->sending_messages_head,
1238 endpoint->sending_messages_tail, fm); 1239 endpoint->sending_messages_tail, fm);
1239 GNUNET_FRAGMENT_context_destroy (fm->fragcontext); 1240 GNUNET_FRAGMENT_context_destroy (fm->fragcontext);
@@ -1396,7 +1397,7 @@ add_message_for_send (void *cls, const struct GNUNET_MessageHeader *hdr)
1396 uint16_t size; 1397 uint16_t size;
1397 1398
1398#if DEBUG_wlan_retransmission > 1 1399#if DEBUG_wlan_retransmission > 1
1399 GNUNET_loHELLO_BEACON_SCALING_FACTORg_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, 1400 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
1400 "Adding fragment of message %p to send, session %p, endpoint %p, type %u\n", 1401 "Adding fragment of message %p to send, session %p, endpoint %p, type %u\n",
1401 fm, fm->session, endpoint, hdr->type); 1402 fm, fm->session, endpoint, hdr->type);
1402#endif 1403#endif
@@ -1933,6 +1934,7 @@ check_fragment_queue (struct Plugin *plugin)
1933 session->mac->fragment_messages_out_count++; 1934 session->mac->fragment_messages_out_count++;
1934 session->fragment_messages_out_count++; 1935 session->fragment_messages_out_count++;
1935 plugin->pending_Fragment_Messages++; 1936 plugin->pending_Fragment_Messages++;
1937 GNUNET_STATISTICS_set(plugin->env->stats, _("# wlan pending fragments"), plugin->pending_Fragment_Messages, GNUNET_NO);
1936 1938
1937 fm = GNUNET_malloc (sizeof (struct FragmentMessage)); 1939 fm = GNUNET_malloc (sizeof (struct FragmentMessage));
1938 fm->session = session; 1940 fm->session = session;
@@ -2704,7 +2706,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
2704 * @param cls the plugin handle 2706 * @param cls the plugin handle
2705 * @param session_light pointer to the struct holding known informations 2707 * @param session_light pointer to the struct holding known informations
2706 * @param hdr hdr of the GNUNET_MessageHeader 2708 * @param hdr hdr of the GNUNET_MessageHeader
2707 * @param rxinfo pointer to the radiotap informations got with this packet 2709 * @param rxinfo pointer to the radiotap informations got with this packet FIXME: give ATS for info
2708 */ 2710 */
2709static void 2711static void
2710wlan_data_helper (void *cls, struct Session_light *session_light, 2712wlan_data_helper (void *cls, struct Session_light *session_light,
@@ -3059,7 +3061,7 @@ wlan_process_helper (void *cls, void *client,
3059 memcpy (&session_light->addr, &(wlanIeeeHeader->i_addr2), 3061 memcpy (&session_light->addr, &(wlanIeeeHeader->i_addr2),
3060 sizeof (struct MacAddress)); 3062 sizeof (struct MacAddress));
3061 //session_light->session = search_session(plugin,session_light->addr); 3063 //session_light->session = search_session(plugin,session_light->addr);
3062 GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan messaged for this client received"), 1, GNUNET_NO); 3064 GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan messages for this client received"), 1, GNUNET_NO);
3063 3065
3064 pos = 0; 3066 pos = 0;
3065 while (pos < datasize) 3067 while (pos < datasize)
@@ -3067,7 +3069,7 @@ wlan_process_helper (void *cls, void *client,
3067 temp_hdr = (struct GNUNET_MessageHeader *) &wlanIeeeHeader[1] + pos; 3069 temp_hdr = (struct GNUNET_MessageHeader *) &wlanIeeeHeader[1] + pos;
3068 if (ntohs(temp_hdr->size) <= datasize + pos) 3070 if (ntohs(temp_hdr->size) <= datasize + pos)
3069 { 3071 {
3070 GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan messaged inside WLAN_HELPER_DATA received"), 1, GNUNET_NO); 3072 GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan messages inside WLAN_HELPER_DATA received"), 1, GNUNET_NO);
3071 wlan_data_helper (plugin, session_light, temp_hdr, rxinfo); 3073 wlan_data_helper (plugin, session_light, temp_hdr, rxinfo);
3072 } 3074 }
3073 else 3075 else
diff --git a/src/transport/plugin_transport_wlan.h b/src/transport/plugin_transport_wlan.h
index aa6a8aa52..628ec85c2 100644
--- a/src/transport/plugin_transport_wlan.h
+++ b/src/transport/plugin_transport_wlan.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors) 3 (C) 2010, 2011 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published
@@ -133,18 +133,40 @@ struct Radiotap_Send
133#define has_channel 4 133#define has_channel 4
134 134
135/** 135/**
136 * struct to represent infos gathered form the radiotap fields 136 * struct to represent infos gathered form the radiotap fields, see RadiotapHeader for more Infos
137 */ 137 */
138 138
139struct Radiotap_rx 139struct Radiotap_rx
140{ 140{
141 uint32_t ri_present; 141 uint32_t ri_present;
142 /**
143 * IEEE80211_RADIOTAP_TSFT
144 */
142 uint64_t ri_mactime; 145 uint64_t ri_mactime;
146 /**
147 * from radiotap
148 * either IEEE80211_RADIOTAP_DBM_ANTSIGNAL
149 * or IEEE80211_RADIOTAP_DB_ANTSIGNAL
150 */
143 int32_t ri_power; 151 int32_t ri_power;
152 /**
153 * either IEEE80211_RADIOTAP_DBM_ANTNOISE
154 * or IEEE80211_RADIOTAP_DB_ANTNOISE
155 */
144 int32_t ri_noise; 156 int32_t ri_noise;
157 /**
158 * IEEE80211_RADIOTAP_CHANNEL
159 */
145 uint32_t ri_channel; 160 uint32_t ri_channel;
161
146 uint32_t ri_freq; 162 uint32_t ri_freq;
163 /**
164 * IEEE80211_RADIOTAP_RATE * 50000
165 */
147 uint32_t ri_rate; 166 uint32_t ri_rate;
167 /**
168 * IEEE80211_RADIOTAP_ANTENNA
169 */
148 uint32_t ri_antenna; 170 uint32_t ri_antenna;
149}; 171};
150 172