diff options
author | David Brodski <david@brodski.eu> | 2011-09-13 06:59:16 +0000 |
---|---|---|
committer | David Brodski <david@brodski.eu> | 2011-09-13 06:59:16 +0000 |
commit | 0e5be9c9ffb67542bd41257a7a2fe2384f448106 (patch) | |
tree | 8fe49efb4976db3374b7ee5eecae121125671673 /src/transport/wlan | |
parent | 05680649d9fe7b4a6fc54031cada1aeca0e55db1 (diff) | |
download | gnunet-0e5be9c9ffb67542bd41257a7a2fe2384f448106.tar.gz gnunet-0e5be9c9ffb67542bd41257a7a2fe2384f448106.zip |
Big cleanup, less source files
Diffstat (limited to 'src/transport/wlan')
-rw-r--r-- | src/transport/wlan/helper_common.c | 79 | ||||
-rw-r--r-- | src/transport/wlan/helper_common.h | 14 | ||||
-rw-r--r-- | src/transport/wlan/loopback_helper.h | 6 |
3 files changed, 18 insertions, 81 deletions
diff --git a/src/transport/wlan/helper_common.c b/src/transport/wlan/helper_common.c index d4b1204f6..6a7a5da09 100644 --- a/src/transport/wlan/helper_common.c +++ b/src/transport/wlan/helper_common.c | |||
@@ -34,90 +34,15 @@ | |||
34 | * @return number of bytes written | 34 | * @return number of bytes written |
35 | */ | 35 | */ |
36 | int | 36 | int |
37 | send_mac_to_plugin (char *buffer, uint8_t * mac) | 37 | send_mac_to_plugin (char *buffer, struct MacAddress * mac) |
38 | { | 38 | { |
39 | 39 | ||
40 | struct Wlan_Helper_Control_Message macmsg; | 40 | struct Wlan_Helper_Control_Message macmsg; |
41 | 41 | ||
42 | memcpy (macmsg.mac.mac, mac, sizeof (struct MacAddress)); | 42 | memcpy (&macmsg.mac,(char *) mac, sizeof (struct MacAddress)); |
43 | macmsg.hdr.size = htons (sizeof (struct Wlan_Helper_Control_Message)); | 43 | macmsg.hdr.size = htons (sizeof (struct Wlan_Helper_Control_Message)); |
44 | macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); | 44 | macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); |
45 | 45 | ||
46 | memcpy (buffer, &macmsg, sizeof (struct Wlan_Helper_Control_Message)); | 46 | memcpy (buffer, &macmsg, sizeof (struct Wlan_Helper_Control_Message)); |
47 | return sizeof (struct Wlan_Helper_Control_Message); | 47 | return sizeof (struct Wlan_Helper_Control_Message); |
48 | } | 48 | } |
49 | |||
50 | /* | ||
51 | * Copyright (c) 2008, Thomas d'Otreppe | ||
52 | * | ||
53 | * Common OSdep stuff | ||
54 | * | ||
55 | * This program is free software; you can redistribute it and/or modify | ||
56 | * it under the terms of the GNU General Public License as published by | ||
57 | * the Free Software Foundation; either version 2 of the License, or | ||
58 | * (at your option) any later version. | ||
59 | * | ||
60 | * This program is distributed in the hope that it will be useful, | ||
61 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
62 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
63 | * GNU General Public License for more details. | ||
64 | * | ||
65 | * You should have received a copy of the GNU General Public License | ||
66 | * along with this program; if not, write to the Free Software | ||
67 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
68 | */ | ||
69 | |||
70 | /** | ||
71 | * Return the frequency in Mhz from a channel number | ||
72 | */ | ||
73 | int | ||
74 | getFrequencyFromChannel (int channel) | ||
75 | { | ||
76 | static int frequencies[] = { | ||
77 | -1, // No channel 0 | ||
78 | 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, | ||
79 | 2472, 2484, | ||
80 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // Nothing from channel 15 to 34 (exclusive) | ||
81 | 5170, 5175, 5180, 5185, 5190, 5195, 5200, 5205, 5210, 5215, 5220, 5225, | ||
82 | 5230, 5235, 5240, 5245, | ||
83 | 5250, 5255, 5260, 5265, 5270, 5275, 5280, 5285, 5290, 5295, 5300, 5305, | ||
84 | 5310, 5315, 5320, 5325, | ||
85 | 5330, 5335, 5340, 5345, 5350, 5355, 5360, 5365, 5370, 5375, 5380, 5385, | ||
86 | 5390, 5395, 5400, 5405, | ||
87 | 5410, 5415, 5420, 5425, 5430, 5435, 5440, 5445, 5450, 5455, 5460, 5465, | ||
88 | 5470, 5475, 5480, 5485, | ||
89 | 5490, 5495, 5500, 5505, 5510, 5515, 5520, 5525, 5530, 5535, 5540, 5545, | ||
90 | 5550, 5555, 5560, 5565, | ||
91 | 5570, 5575, 5580, 5585, 5590, 5595, 5600, 5605, 5610, 5615, 5620, 5625, | ||
92 | 5630, 5635, 5640, 5645, | ||
93 | 5650, 5655, 5660, 5665, 5670, 5675, 5680, 5685, 5690, 5695, 5700, 5705, | ||
94 | 5710, 5715, 5720, 5725, | ||
95 | 5730, 5735, 5740, 5745, 5750, 5755, 5760, 5765, 5770, 5775, 5780, 5785, | ||
96 | 5790, 5795, 5800, 5805, | ||
97 | 5810, 5815, 5820, 5825, 5830, 5835, 5840, 5845, 5850, 5855, 5860, 5865, | ||
98 | 5870, 5875, 5880, 5885, | ||
99 | 5890, 5895, 5900, 5905, 5910, 5915, 5920, 5925, 5930, 5935, 5940, 5945, | ||
100 | 5950, 5955, 5960, 5965, | ||
101 | 5970, 5975, 5980, 5985, 5990, 5995, 6000, 6005, 6010, 6015, 6020, 6025, | ||
102 | 6030, 6035, 6040, 6045, | ||
103 | 6050, 6055, 6060, 6065, 6070, 6075, 6080, 6085, 6090, 6095, 6100 | ||
104 | }; | ||
105 | |||
106 | return (channel > 0 && channel <= 221) ? frequencies[channel] : -1; | ||
107 | } | ||
108 | |||
109 | /** | ||
110 | * Return the channel from the frequency (in Mhz) | ||
111 | */ | ||
112 | int | ||
113 | getChannelFromFrequency (int frequency) | ||
114 | { | ||
115 | if (frequency >= 2412 && frequency <= 2472) | ||
116 | return (frequency - 2407) / 5; | ||
117 | else if (frequency == 2484) | ||
118 | return 14; | ||
119 | else if (frequency >= 5000 && frequency <= 6100) | ||
120 | return (frequency - 5000) / 5; | ||
121 | else | ||
122 | return -1; | ||
123 | } | ||
diff --git a/src/transport/wlan/helper_common.h b/src/transport/wlan/helper_common.h index 3c33887d1..9d53176c6 100644 --- a/src/transport/wlan/helper_common.h +++ b/src/transport/wlan/helper_common.h | |||
@@ -9,10 +9,16 @@ | |||
9 | #define HELPER_COMMON_H_ | 9 | #define HELPER_COMMON_H_ |
10 | 10 | ||
11 | int | 11 | int |
12 | getFrequencyFromChannel (int channel); | ||
13 | int | ||
14 | getChannelFromFrequency (int frequency); | ||
15 | int | ||
16 | send_mac_to_plugin (char *buffer, uint8_t * mac); | 12 | send_mac_to_plugin (char *buffer, uint8_t * mac); |
17 | 13 | ||
14 | |||
15 | #define MAXLINE 4096 | ||
16 | |||
17 | struct sendbuf | ||
18 | { | ||
19 | unsigned int pos; | ||
20 | unsigned int size; | ||
21 | char buf[MAXLINE * 2]; | ||
22 | }; | ||
23 | |||
18 | #endif /* HELPER_COMMON_H_ */ | 24 | #endif /* HELPER_COMMON_H_ */ |
diff --git a/src/transport/wlan/loopback_helper.h b/src/transport/wlan/loopback_helper.h index 81cc66f22..5da3d834e 100644 --- a/src/transport/wlan/loopback_helper.h +++ b/src/transport/wlan/loopback_helper.h | |||
@@ -17,4 +17,10 @@ | |||
17 | int | 17 | int |
18 | testmode (int argc, char *argv[]); | 18 | testmode (int argc, char *argv[]); |
19 | 19 | ||
20 | |||
21 | #define FIFO_FILE1 "/tmp/test-transport/api-wlan-p1/WLAN_FIFO_in" | ||
22 | #define FIFO_FILE2 "/tmp/test-transport/api-wlan-p1/WLAN_FIFO_out" | ||
23 | |||
24 | extern int closeprog; | ||
25 | |||
20 | #endif /* LOOPBACK_HELPER_H_ */ | 26 | #endif /* LOOPBACK_HELPER_H_ */ |