if LINUX
WLAN_BIN = gnunet-transport-wlan-helper
WLAN_BIN_DUMMY = gnunet-transport-wlan-helper-dummy
- WLAN_BIN_SENDER = gnunet_wlan_sender
+ WLAN_BIN_SENDER = gnunet-transport-wlan-sender
WLAN_PLUGIN_LA = libgnunet_plugin_transport_wlan.la
WLAN_API_TEST = test_transport_api_wlan
WLAN_REL_TEST = test_transport_api_reliability_wlan
gnunet_transport_wlan_helper_dummy_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la
-gnunet_wlan_sender_SOURCES = \
- gnunet_wlan_sender.c
-gnunet_wlan_sender_LDADD = \
+gnunet_transport_wlan_sender_SOURCES = \
+ gnunet-transport-wlan-sender.c
+gnunet_transport_wlan_sender_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la
gnunet_transport_SOURCES = \
send_mac_to_plugin (char *buffer, struct MacAddress *mac)
{
- struct Wlan_Helper_Control_Message macmsg;
+ struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg;
memcpy (&macmsg.mac, (char *) mac, sizeof (struct MacAddress));
- macmsg.hdr.size = htons (sizeof (struct Wlan_Helper_Control_Message));
+ macmsg.hdr.size = htons (sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage));
macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
- memcpy (buffer, &macmsg, sizeof (struct Wlan_Helper_Control_Message));
- return sizeof (struct Wlan_Helper_Control_Message);
+ memcpy (buffer, &macmsg, sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage));
+ return sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage);
}
static void
{
/**
- * send buffer
- */
+ * send buffer
+ */
struct SendBuffer write_pout;
+
/**
* file descriptor for the raw socket
*/
static int
send_mac_to_plugin (char *buffer, struct MacAddress *mac)
{
- struct Wlan_Helper_Control_Message macmsg;
+ struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg;
memcpy (&macmsg.mac, (char *) mac, sizeof (struct MacAddress));
- macmsg.hdr.size = htons (sizeof (struct Wlan_Helper_Control_Message));
+ macmsg.hdr.size = htons (sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage));
macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
- memcpy (buffer, &macmsg, sizeof (struct Wlan_Helper_Control_Message));
- return sizeof (struct Wlan_Helper_Control_Message);
+ memcpy (buffer, &macmsg, sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage));
+ return sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage);
}
strncpy (wrq.ifr_name, dev->iface, IFNAMSIZ);
fd = dev->fd_raw;
if (0 > ioctl (fd, SIOCGIWFREQ, &wrq))
- return (-1);
+ return -1;
frequency = wrq.u.freq.m;
if (100000000 < frequency)
n = *(int *) (tmpbuf + 4);
}
- if (n < 8 || n >= caplen)
- return (0);
+ if ( (n < 8) || (n >= caplen) )
+ return 0;
}
break;
rthdr = (struct ieee80211_radiotap_header *) tmpbuf;
if (ieee80211_radiotap_iterator_init (&iterator, rthdr, caplen) < 0)
- return (0);
+ return 0;
/* go through the radiotap arguments we have been given
* by the driver
mac_test (const struct ieee80211_frame *uint8_taIeeeHeader,
const struct HardwareInfos *dev)
{
- if (0 != memcmp (uint8_taIeeeHeader->i_addr3, &mac_bssid, MAC_ADDR_SIZE))
+ if (0 != memcmp (uint8_taIeeeHeader->i_addr3, &mac_bssid_gnunet, MAC_ADDR_SIZE))
return 1;
if (0 == memcmp (uint8_taIeeeHeader->i_addr1, &dev->pl_mac, MAC_ADDR_SIZE))
return 0;
uint8_taIeeeHeader->i_fc[0] = 0x08;
uint8_taIeeeHeader->i_fc[1] = 0x00;
memcpy (uint8_taIeeeHeader->i_addr2, &dev->pl_mac, MAC_ADDR_SIZE);
- memcpy (uint8_taIeeeHeader->i_addr3, &mac_bssid, MAC_ADDR_SIZE);
+ memcpy (uint8_taIeeeHeader->i_addr3, &mac_bssid_gnunet, MAC_ADDR_SIZE);
}
--- /dev/null
+/*
+ This file is part of GNUnet
+ (C) 2011 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * @file transport/gnunet-transport-wlan-sender.c
+ * @brief program to send via WLAN as much as possible (to test physical/theoretical throughput)
+ * @author David Brodski
+ */
+#include "platform.h"
+#include "gnunet_protocols.h"
+#include "plugin_transport_wlan.h"
+
+#define WLAN_MTU 1500
+
+/**
+ * LLC fields for better compatibility
+ */
+#define WLAN_LLC_DSAP_FIELD 0x1f
+#define WLAN_LLC_SSAP_FIELD 0x1f
+
+#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
+
+#define IEEE80211_FC0_VERSION_MASK 0x03
+#define IEEE80211_FC0_VERSION_SHIFT 0
+#define IEEE80211_FC0_VERSION_0 0x00
+#define IEEE80211_FC0_TYPE_MASK 0x0c
+#define IEEE80211_FC0_TYPE_SHIFT 2
+#define IEEE80211_FC0_TYPE_MGT 0x00
+#define IEEE80211_FC0_TYPE_CTL 0x04
+#define IEEE80211_FC0_TYPE_DATA 0x08
+
+
+/*
+ * generic definitions for IEEE 802.11 frames
+ */
+struct ieee80211_frame
+{
+ u_int8_t i_fc[2];
+ u_int8_t i_dur[2];
+ u_int8_t i_addr1[IEEE80211_ADDR_LEN];
+ u_int8_t i_addr2[IEEE80211_ADDR_LEN];
+ u_int8_t i_addr3[IEEE80211_ADDR_LEN];
+ u_int8_t i_seq[2];
+ u_int8_t llc[4];
+} GNUNET_PACKED;
+
+
+/**
+ * function to fill the radiotap header
+ * @param header pointer to the radiotap header
+ * @return GNUNET_YES at success
+ */
+static int
+getRadiotapHeader (struct Radiotap_Send *header)
+{
+ header->rate = 255;
+ header->tx_power = 0;
+ header->antenna = 0;
+
+ return GNUNET_YES;
+}
+
+/**
+ * function to generate the wlan hardware header for one packet
+ * @param Header address to write the header to
+ * @param to_mac_addr pointer to the address of the recipient
+ * @param mac pointer to the mac address to send from (normally overwritten over by helper)
+ * @param size size of the whole packet, needed to calculate the time to send the packet
+ * @return GNUNET_YES if there was no error
+ */
+static int
+getWlanHeader (struct ieee80211_frame *Header, const char *to_mac_addr,
+ const char *mac, unsigned int size)
+{
+ uint16_t *tmp16;
+ const int rate = 11000000;
+
+ Header->i_fc[0] = IEEE80211_FC0_TYPE_DATA;
+ Header->i_fc[1] = 0x00;
+ memcpy (&Header->i_addr3, &mac_bssid_gnunet, sizeof (mac_bssid_gnunet));
+ memcpy (&Header->i_addr2, mac, sizeof (mac_bssid_gnunet));
+ memcpy (&Header->i_addr1, to_mac_addr, sizeof (mac_bssid_gnunet));
+
+ tmp16 = (uint16_t *) Header->i_dur;
+ *tmp16 = (uint16_t) GNUNET_htole16 ((size * 1000000) / rate + 290);
+ Header->llc[0] = WLAN_LLC_DSAP_FIELD;
+ Header->llc[1] = WLAN_LLC_SSAP_FIELD;
+
+ return GNUNET_YES;
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ char msg_buf[WLAN_MTU];
+ struct GNUNET_MessageHeader *msg;
+ struct ieee80211_frame *wlan_header;
+ struct Radiotap_Send *radiotap;
+
+ unsigned int temp[6];
+ char inmac[6];
+ char outmac[6];
+ int pos;
+ long long count;
+ double bytes_per_s;
+ time_t start;
+ time_t akt;
+ int i;
+
+ if (4 != argc)
+ {
+ fprintf (stderr,
+ "This program must be started with the interface and the targets and source mac as argument.\n");
+ 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");
+ return 1;
+ }
+ if (6 !=
+ sscanf (argv[3], "%x-%x-%x-%x-%x-%x", &temp[0], &temp[1], &temp[2],
+ &temp[3], &temp[4], &temp[5]))
+ {
+ 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");
+ return 1;
+ }
+ if (6 !=
+ sscanf (argv[2], "%x-%x-%x-%x-%x-%x", &temp[0], &temp[1], &temp[2],
+ &temp[3], &temp[4], &temp[5]))
+ {
+ 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");
+ return 1;
+ }
+ for (i = 0; i < 6; i++)
+ inmac[i] = temp[i];
+ for (i = 0; i < 6; i++)
+ outmac[i] = temp[i];
+
+ pid_t pid;
+ int commpipe[2]; /* This holds the fd for the input & output of the pipe */
+
+ /* Setup communication pipeline first */
+ if (pipe (commpipe))
+ {
+ fprintf (stderr,
+ "Failed to create pipe: %s\n",
+ STRERROR (errno));
+ exit (1);
+ }
+
+ /* Attempt to fork and check for errors */
+ if ((pid = fork ()) == -1)
+ {
+ fprintf (stderr, "Failed to fork: %s\n",
+ STRERROR (errno));
+ exit (1);
+ }
+
+ if (pid)
+ {
+ /* A positive (non-negative) PID indicates the parent process */
+ close (commpipe[0]); /* Close unused side of pipe (in side) */
+ setvbuf (stdout, (char *) NULL, _IONBF, 0); /* Set non-buffered output on stdout */
+
+
+ msg = (struct GNUNET_MessageHeader *) msg_buf;
+ msg->type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA);
+ msg->size = htons (WLAN_MTU);
+ radiotap = (struct Radiotap_Send *) &msg[1];
+ wlan_header = (struct ieee80211_frame *) &radiotap[1];
+ pos = 0;
+
+ getRadiotapHeader (radiotap);
+ getWlanHeader (wlan_header, outmac, inmac,
+ WLAN_MTU - sizeof (struct GNUNET_MessageHeader));
+
+ start = time (NULL);
+ count = 0;
+ while (1)
+ {
+ pos += write (commpipe[1], msg, WLAN_MTU - pos);
+ if (pos % WLAN_MTU == 0)
+ {
+ pos = 0;
+ count++;
+
+ if (count % 1000 == 0)
+ {
+ akt = time (NULL);
+ bytes_per_s = count * WLAN_MTU / (akt - start);
+ bytes_per_s /= 1024;
+ printf ("send %f kbytes/s\n", bytes_per_s);
+ }
+ }
+
+ }
+ }
+ else
+ {
+ /* A zero PID indicates that this is the child process */
+ (void) close (0);
+ if (-1 == dup2 (commpipe[0], 0)) /* Replace stdin with the in side of the pipe */
+ fprintf (stderr, "dup2 failed: %s\n", strerror (errno));
+ (void) close (commpipe[1]); /* Close unused side of pipe (out side) */
+ /* Replace the child fork with a new process */
+ if (execl
+ ("gnunet-transport-wlan-helper", "gnunet-transport-wlan-helper",
+ argv[1], NULL) == -1)
+ {
+ fprintf (stderr, "Could not start gnunet-transport-wlan-helper!");
+ _exit (1);
+ }
+ }
+ return 0;
+}
+++ /dev/null
-/*
- This file is part of GNUnet
- (C) 2011 Christian Grothoff (and other contributing authors)
-
- GNUnet is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
- */
-
-/**
- * @file transport/gnunet_wlan_sender.c
- * @brief program to send via WLAN as much as possible (to test physical/theoretical throughput)
- * @author David Brodski
- */
-
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <netinet/in.h>
-#include <string.h>
-#include <time.h>
-#include <errno.h>
-#include "gnunet_protocols.h"
-#include "plugin_transport_wlan.h"
-
-#define WLAN_MTU 1500
-
-/**
- * LLC fields for better compatibility
- */
-#define WLAN_LLC_DSAP_FIELD 0x1f
-#define WLAN_LLC_SSAP_FIELD 0x1f
-
-#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
-
-#define IEEE80211_FC0_VERSION_MASK 0x03
-#define IEEE80211_FC0_VERSION_SHIFT 0
-#define IEEE80211_FC0_VERSION_0 0x00
-#define IEEE80211_FC0_TYPE_MASK 0x0c
-#define IEEE80211_FC0_TYPE_SHIFT 2
-#define IEEE80211_FC0_TYPE_MGT 0x00
-#define IEEE80211_FC0_TYPE_CTL 0x04
-#define IEEE80211_FC0_TYPE_DATA 0x08
-
-
-/*
- * generic definitions for IEEE 802.11 frames
- */
-struct ieee80211_frame
-{
- u_int8_t i_fc[2];
- u_int8_t i_dur[2];
- u_int8_t i_addr1[IEEE80211_ADDR_LEN];
- u_int8_t i_addr2[IEEE80211_ADDR_LEN];
- u_int8_t i_addr3[IEEE80211_ADDR_LEN];
- u_int8_t i_seq[2];
- u_int8_t llc[4];
-#if DEBUG_wlan_ip_udp_packets_on_air > 1
- struct iph ip;
- struct udphdr udp;
-#endif
-} GNUNET_PACKED;
-
-/**
- * function to fill the radiotap header
- * @param header pointer to the radiotap header
- * @return GNUNET_YES at success
- */
-static int
-getRadiotapHeader (struct Radiotap_Send *header)
-{
-
-
- header->rate = 255;
- header->tx_power = 0;
- header->antenna = 0;
-
- return GNUNET_YES;
-}
-
-/**
- * function to generate the wlan hardware header for one packet
- * @param Header address to write the header to
- * @param to_mac_addr pointer to the address of the recipient
- * @param mac pointer to the mac address to send from (normally overwritten over by helper)
- * @param size size of the whole packet, needed to calculate the time to send the packet
- * @return GNUNET_YES if there was no error
- */
-static int
-getWlanHeader (struct ieee80211_frame *Header, const char *to_mac_addr,
- const char *mac, unsigned int size)
-{
- uint16_t *tmp16;
- const int rate = 11000000;
-
- Header->i_fc[0] = IEEE80211_FC0_TYPE_DATA;
- Header->i_fc[1] = 0x00;
- memcpy (&Header->i_addr3, &mac_bssid, sizeof (mac_bssid));
- memcpy (&Header->i_addr2, mac, sizeof (mac_bssid));
- memcpy (&Header->i_addr1, to_mac_addr, sizeof (mac_bssid));
-
- tmp16 = (uint16_t *) Header->i_dur;
- *tmp16 = (uint16_t) GNUNET_htole16 ((size * 1000000) / rate + 290);
- Header->llc[0] = WLAN_LLC_DSAP_FIELD;
- Header->llc[1] = WLAN_LLC_SSAP_FIELD;
-
- return GNUNET_YES;
-}
-
-int
-main (int argc, char *argv[])
-{
- char msg_buf[WLAN_MTU];
- struct GNUNET_MessageHeader *msg;
- struct ieee80211_frame *wlan_header;
- struct Radiotap_Send *radiotap;
-
- unsigned int temp[6];
- char inmac[6];
- char outmac[6];
- int pos;
- long long count;
- double bytes_per_s;
- time_t start;
- time_t akt;
- int i;
-
- if (4 != argc)
- {
- fprintf (stderr,
- "This program must be started with the interface and the targets and source mac as argument.\n");
- 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");
- return 1;
- }
- if (6 !=
- sscanf (argv[3], "%x-%x-%x-%x-%x-%x", &temp[0], &temp[1], &temp[2],
- &temp[3], &temp[4], &temp[5]))
- {
- 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");
- return 1;
- }
- if (6 !=
- sscanf (argv[2], "%x-%x-%x-%x-%x-%x", &temp[0], &temp[1], &temp[2],
- &temp[3], &temp[4], &temp[5]))
- {
- 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");
- return 1;
- }
- for (i = 0; i < 6; i++)
- {
- inmac[i] = temp[i];
- }
- for (i = 0; i < 6; i++)
- {
- outmac[i] = temp[i];
- }
-
-
- pid_t pid;
- int commpipe[2]; /* This holds the fd for the input & output of the pipe */
-
- /* Setup communication pipeline first */
- if (pipe (commpipe))
- {
- fprintf (stderr, "Pipe error!\n");
- exit (1);
- }
-
- /* Attempt to fork and check for errors */
- if ((pid = fork ()) == -1)
- {
- fprintf (stderr, "Fork error. Exiting.\n"); /* something went wrong */
- exit (1);
- }
-
- if (pid)
- {
- /* A positive (non-negative) PID indicates the parent process */
- close (commpipe[0]); /* Close unused side of pipe (in side) */
- setvbuf (stdout, (char *) NULL, _IONBF, 0); /* Set non-buffered output on stdout */
-
-
- msg = (struct GNUNET_MessageHeader *) msg_buf;
- msg->type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA);
- msg->size = htons (WLAN_MTU);
- radiotap = (struct Radiotap_Send *) &msg[1];
- wlan_header = (struct ieee80211_frame *) &radiotap[1];
- pos = 0;
-
- getRadiotapHeader (radiotap);
- getWlanHeader (wlan_header, outmac, inmac,
- WLAN_MTU - sizeof (struct GNUNET_MessageHeader));
-
- start = time (NULL);
- count = 0;
- while (1)
- {
- pos += write (commpipe[1], msg, WLAN_MTU - pos);
- if (pos % WLAN_MTU == 0)
- {
- pos = 0;
- count++;
-
- if (count % 1000 == 0)
- {
- akt = time (NULL);
- bytes_per_s = count * WLAN_MTU / (akt - start);
- bytes_per_s /= 1024;
- printf ("send %f kbytes/s\n", bytes_per_s);
- }
- }
-
- }
- }
- else
- {
- /* A zero PID indicates that this is the child process */
- (void) close (0);
- if (-1 == dup2 (commpipe[0], 0)) /* Replace stdin with the in side of the pipe */
- fprintf (stderr, "dup2 failed: %s\n", strerror (errno));
- (void) close (commpipe[1]); /* Close unused side of pipe (out side) */
- /* Replace the child fork with a new process */
- if (execl
- ("gnunet-transport-wlan-helper", "gnunet-transport-wlan-helper",
- argv[1], NULL) == -1)
- {
- fprintf (stderr, "Could not start gnunet-transport-wlan-helper!");
- _exit (1);
- }
- }
- return 0;
-}
#define IEEE80211_FC0_TYPE_CTL 0x04
#define IEEE80211_FC0_TYPE_DATA 0x08
-/*
- * Structure of an internet header, naked of options.
- */
-struct iph
-{
-#if __BYTE_ORDER == __LITTLE_ENDIAN
- unsigned int ip_hl:4; /* header length */
- unsigned int ip_v:4; /* version */
-#endif
-#if __BYTE_ORDER == __BIG_ENDIAN
- unsigned int ip_v:4; /* version */
- unsigned int ip_hl:4; /* header length */
-#endif
- u_int8_t ip_tos; /* type of service */
- u_short ip_len; /* total length */
- u_short ip_id; /* identification */
- u_short ip_off; /* fragment offset field */
-#define IP_RF 0x8000 /* reserved fragment flag */
-#define IP_DF 0x4000 /* dont fragment flag */
-#define IP_MF 0x2000 /* more fragments flag */
-#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
- u_int8_t ip_ttl; /* time to live */
- u_int8_t ip_p; /* protocol */
- u_short ip_sum; /* checksum */
- struct in_addr ip_src, ip_dst; /* source and dest address */
-};
-
-struct udphdr
-{
- u_int16_t source;
- u_int16_t dest;
- u_int16_t len;
- u_int16_t check;
-};
-
/*
* generic definitions for IEEE 802.11 frames
*/
u_int8_t i_addr3[IEEE80211_ADDR_LEN];
u_int8_t i_seq[2];
u_int8_t llc[4];
-#if DEBUG_wlan_ip_udp_packets_on_air > 1
- struct iph ip;
- struct udphdr udp;
-#endif
} GNUNET_PACKED;
/**
Header->i_fc[0] = IEEE80211_FC0_TYPE_DATA;
Header->i_fc[1] = 0x00;
- memcpy (&Header->i_addr3, &mac_bssid, sizeof (mac_bssid));
+ memcpy (&Header->i_addr3, &mac_bssid_gnunet, sizeof (mac_bssid_gnunet));
memcpy (&Header->i_addr2, plugin->mac_address.mac,
sizeof (plugin->mac_address));
memcpy (&Header->i_addr1, to_mac_addr, sizeof (struct MacAddress));
Header->llc[0] = WLAN_LLC_DSAP_FIELD;
Header->llc[1] = WLAN_LLC_SSAP_FIELD;
-#if DEBUG_wlan_ip_udp_packets_on_air > 1
- uint crc = 0;
- uint16_t *x;
- int count;
-
- Header->ip.ip_dst.s_addr = *((uint32_t *) & to_mac_addr->mac[2]);
- Header->ip.ip_src.s_addr = *((uint32_t *) & plugin->mac_address.mac[2]);
- Header->ip.ip_v = 4;
- Header->ip.ip_hl = 5;
- Header->ip.ip_p = 17;
- Header->ip.ip_ttl = 1;
- Header->ip.ip_len = htons (size + 8);
- Header->ip.ip_sum = 0;
- x = (uint16_t *) & Header->ip;
- count = sizeof (struct iph);
- while (count > 1)
- {
- /* This is the inner loop */
- crc += (unsigned short) *x++;
- count -= 2;
- }
- /* Add left-over byte, if any */
- if (count > 0)
- crc += *(unsigned char *) x;
- crc = (crc & 0xffff) + (crc >> 16);
- Header->ip.ip_sum = htons (~(unsigned short) crc);
- Header->udp.len = htons (size - sizeof (struct ieee80211_frame));
-
-#endif
-
return GNUNET_YES;
}
//check for bssid
if (memcmp
- (&(wlanIeeeHeader->i_addr3), &mac_bssid,
+ (&(wlanIeeeHeader->i_addr3), &mac_bssid_gnunet,
sizeof (struct MacAddress)) == 0)
{
//check for broadcast or mac
break;
case GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL:
//TODO more control messages
- if (ntohs (hdr->size) != sizeof (struct Wlan_Helper_Control_Message))
+ if (ntohs (hdr->size) != sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage))
{
GNUNET_break (0);
/* FIXME: restart SUID process */
/**
* Format of a WLAN Control Message.
*/
-struct Wlan_Helper_Control_Message
+struct GNUNET_TRANSPORT_WLAN_HelperControlMessage
{
/**
* Message header. FIXME: type?
/**
* GNUnet bssid
*/
-static const struct MacAddress mac_bssid = {
+static const struct MacAddress mac_bssid_gnunet = {
{0x13, 0x22, 0x33, 0x44, 0x55, 0x66}
};