35 #define WLAN_LLC_DSAP_FIELD 0x1f
36 #define WLAN_LLC_SSAP_FIELD 0x1f
38 #define IEEE80211_ADDR_LEN 6
40 #define IEEE80211_FC0_VERSION_MASK 0x03
41 #define IEEE80211_FC0_VERSION_SHIFT 0
42 #define IEEE80211_FC0_VERSION_0 0x00
43 #define IEEE80211_FC0_TYPE_MASK 0x0c
44 #define IEEE80211_FC0_TYPE_SHIFT 2
45 #define IEEE80211_FC0_TYPE_MGT 0x00
46 #define IEEE80211_FC0_TYPE_CTL 0x04
47 #define IEEE80211_FC0_TYPE_DATA 0x08
83 const int rate = 11000000;
88 Header->
addr1 = *to_mac_addr;
99 main (
int argc,
char *argv[])
103 unsigned int temp[6];
107 unsigned long long count;
121 "This program must be started with the interface and the targets and source mac as argument.\n");
123 "Usage: interface-name mac-DST mac-SRC\n"
124 "e.g. mon0 11-22-33-44-55-66 12-34-56-78-90-ab\n");
127 if (6 != sscanf (argv[2],
137 "Usage: interface-name mac-DST mac-SRC\n"
138 "e.g. mon0 11-22-33-44-55-66 12-34-56-78-90-ab\n");
141 for (i = 0; i < 6; i++)
142 outmac.
mac[i] = temp[i];
143 if (6 != sscanf (argv[3],
153 "Usage: interface-name mac-DST mac-SRC\n"
154 "e.g. mon0 11-22-33-44-55-66 12-34-56-78-90-ab\n");
157 for (i = 0; i < 6; i++)
158 inmac.
mac[i] = temp[i];
164 fprintf (stderr,
"Failed to create pipe: %s\n", strerror (errno));
169 fprintf (stderr,
"Failed to create pipe: %s\n", strerror (errno));
174 if ((
pid = fork ()) == -1)
176 fprintf (stderr,
"Failed to fork: %s\n", strerror (errno));
179 memset (msg_buf, 0x42,
sizeof(msg_buf));
183 if (0 != close (commpipe[0]))
184 fprintf (stderr,
"Failed to close fd: %s\n", strerror (errno));
190 if (0 != close (macpipe[1]))
191 fprintf (stderr,
"Failed to close fd: %s\n", strerror (errno));
192 if (
sizeof(hcm) != read (macpipe[0], &hcm,
sizeof(hcm)))
193 fprintf (stderr,
"Failed to read hcm...\n");
195 "Got MAC %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\n",
212 fprintf (stderr,
"write failed: %s\n", strerror (errno));
217 if (akt -
start > 30)
219 bytes_per_s = count / (akt -
start);
221 printf (
"send %f kbytes/s\n", bytes_per_s);
233 dup2 (commpipe[0], 0))
234 fprintf (stderr,
"dup2 failed: %s\n", strerror (errno));
236 dup2 (macpipe[1], 1))
237 fprintf (stderr,
"dup2 failed: %s\n", strerror (errno));
238 (void) close (commpipe[1]);
239 (void) close (macpipe[0]);
241 if (execlp (
"gnunet-helper-transport-wlan",
242 "gnunet-helper-transport-wlan",
246 fprintf (stderr,
"Could not start gnunet-helper-transport-wlan!");
static int ret
Return value of the commandline.
static int start
Set if we are to start default services (including ARM).
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
int main(int argc, char *argv[])
#define WLAN_LLC_DSAP_FIELD
LLC fields for better compatibility.
static int getRadiotapHeader(struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *header, uint16_t size)
function to fill the radiotap header
#define IEEE80211_FC0_TYPE_DATA
static int getWlanHeader(struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *Header, const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr, const struct GNUNET_TRANSPORT_WLAN_MacAddress *mac, unsigned int size)
function to generate the wlan hardware header for one packet
#define WLAN_LLC_SSAP_FIELD
Constants for network protocols.
#define GNUNET_htole16(x)
#define GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER
Type of data messages from the plugin to the gnunet-wlan-helper.
static unsigned int size
Size of the "table".
header for transport plugin and the helper for wlan
static GNUNET_NETWORK_STRUCT_END const struct GNUNET_TRANSPORT_WLAN_MacAddress mac_bssid_gnunet
GNUnet bssid.
Format of a WLAN Control Message.
struct GNUNET_TRANSPORT_WLAN_MacAddress mac
MAC Address of the local WLAN interface.
generic definitions for IEEE 802.11 frames
uint16_t frame_control
802.11 Frame Control field.
struct GNUNET_TRANSPORT_WLAN_MacAddress addr1
Address 1: destination address in ad-hoc mode or AP, BSSID if station,.
uint16_t duration
Microseconds to reserve link (duration), 0 by default.
u_int8_t llc[4]
Link layer control (LLC).
struct GNUNET_TRANSPORT_WLAN_MacAddress addr3
Address 3: BSSID in ad-hoc mode, Destination if station, source if AP.
struct GNUNET_TRANSPORT_WLAN_MacAddress addr2
Address 2: source address if in ad-hoc-mode or station, BSSID if AP.
Message from the plugin to the WLAN helper: send the given message with the given connection paramete...
uint16_t tx_power
Transmit power expressed as unitless distance from max power set at factory calibration.
uint8_t rate
wlan send rate
struct GNUNET_MessageHeader header
Type is 'GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER'.
struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame frame
IEEE Frame to transmit (the sender MAC address will be overwritten by the helper as it does not trust...
uint8_t antenna
Antenna; the first antenna is 0.