diff options
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/Makefile.am | 25 | ||||
-rw-r--r-- | src/transport/gnunet-helper-transport-bluetooth.c | 20 | ||||
-rw-r--r-- | src/transport/gnunet-helper-transport-wlan.c | 48 |
3 files changed, 85 insertions, 8 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index e77220d50..bbf51058e 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am | |||
@@ -92,6 +92,19 @@ if LINUX | |||
92 | WLAN_QUOTA_TEST = test_quota_compliance_wlan \ | 92 | WLAN_QUOTA_TEST = test_quota_compliance_wlan \ |
93 | test_quota_compliance_wlan_asymmetric | 93 | test_quota_compliance_wlan_asymmetric |
94 | endif | 94 | endif |
95 | if XBSD | ||
96 | WLAN_BIN = gnunet-helper-transport-wlan | ||
97 | WLAN_BIN_DUMMY = gnunet-helper-transport-wlan-dummy | ||
98 | WLAN_BIN_SENDER = gnunet-transport-wlan-sender | ||
99 | WLAN_BIN_RECEIVER = gnunet-transport-wlan-receiver | ||
100 | WLAN_PLUGIN_LA = libgnunet_plugin_transport_wlan.la | ||
101 | WLAN_PLUGIN_TEST = test_plugin_wlan | ||
102 | WLAN_API_TEST = test_transport_api_wlan | ||
103 | WLAN_TIMEOUT_TEST = test_transport_api_timeout_wlan | ||
104 | WLAN_REL_TEST = test_transport_api_reliability_wlan | ||
105 | WLAN_QUOTA_TEST = test_quota_compliance_wlan \ | ||
106 | test_quota_compliance_wlan_asymmetric | ||
107 | endif | ||
95 | 108 | ||
96 | if LINUX | 109 | if LINUX |
97 | if HAVE_LIBBLUETOOTH | 110 | if HAVE_LIBBLUETOOTH |
@@ -105,6 +118,18 @@ if HAVE_LIBBLUETOOTH | |||
105 | test_quota_compliance_bluetooth_asymmetric | 118 | test_quota_compliance_bluetooth_asymmetric |
106 | endif | 119 | endif |
107 | endif | 120 | endif |
121 | if XBSD | ||
122 | if HAVE_LIBBLUETOOTH | ||
123 | BT_BIN = gnunet-helper-transport-bluetooth | ||
124 | BT_PLUGIN_LA = libgnunet_plugin_transport_bluetooth.la | ||
125 | BT_PLUGIN_TEST = test_plugin_bluetooth | ||
126 | BT_API_TEST = test_transport_api_bluetooth | ||
127 | BT_TIMEOUT_TEST = test_transport_api_timeout_bluetooth | ||
128 | BT_REL_TEST = test_transport_api_reliability_bluetooth | ||
129 | BT_QUOTA_TEST = test_quota_compliance_bluetooth \ | ||
130 | test_quota_compliance_bluetooth_asymmetric | ||
131 | endif | ||
132 | endif | ||
108 | 133 | ||
109 | # end of HAVE_EXPERIMENTAL | 134 | # end of HAVE_EXPERIMENTAL |
110 | endif | 135 | endif |
diff --git a/src/transport/gnunet-helper-transport-bluetooth.c b/src/transport/gnunet-helper-transport-bluetooth.c index 4923e6428..d16cec981 100644 --- a/src/transport/gnunet-helper-transport-bluetooth.c +++ b/src/transport/gnunet-helper-transport-bluetooth.c | |||
@@ -21,18 +21,31 @@ | |||
21 | */ | 21 | */ |
22 | #include "gnunet_config.h" | 22 | #include "gnunet_config.h" |
23 | 23 | ||
24 | #include <sys/param.h> | ||
25 | #if defined(__linux__) | ||
24 | #include <bluetooth/bluetooth.h> | 26 | #include <bluetooth/bluetooth.h> |
25 | #include <bluetooth/hci.h> | 27 | #include <bluetooth/hci.h> |
26 | #include <bluetooth/hci_lib.h> | 28 | #include <bluetooth/hci_lib.h> |
27 | #include <bluetooth/rfcomm.h> | 29 | #include <bluetooth/rfcomm.h> |
28 | #include <bluetooth/sdp.h> | 30 | #include <bluetooth/sdp.h> |
29 | #include <bluetooth/sdp_lib.h> | 31 | #include <bluetooth/sdp_lib.h> |
32 | #endif | ||
33 | #if defined(BSD) && defined(__NetBSD__) | ||
34 | #include <netbt/bluetooth.h> | ||
35 | #include <netbt/hci.h> | ||
36 | #include <netbt/l2cap.h> | ||
37 | #include <netbt/rfcomm.h> | ||
38 | #endif | ||
30 | #include <errno.h> | 39 | #include <errno.h> |
40 | #if defined(__linux__) | ||
31 | #include <linux/if.h> | 41 | #include <linux/if.h> |
42 | #endif | ||
43 | #if defined(BSD) | ||
44 | #include <net/if.h> | ||
45 | #endif | ||
32 | #include <stdio.h> | 46 | #include <stdio.h> |
33 | #include <stdlib.h> | 47 | #include <stdlib.h> |
34 | #include <sys/ioctl.h> | 48 | #include <sys/ioctl.h> |
35 | #include <sys/param.h> | ||
36 | #include <sys/socket.h> | 49 | #include <sys/socket.h> |
37 | #include <sys/stat.h> | 50 | #include <sys/stat.h> |
38 | #include <sys/types.h> | 51 | #include <sys/types.h> |
@@ -166,7 +179,7 @@ static struct SendBuffer write_pout; | |||
166 | static struct SendBuffer write_std; | 179 | static struct SendBuffer write_std; |
167 | 180 | ||
168 | 181 | ||
169 | /* ****** this are the same functions as the ones used in gnunet-helper-transport-wlan.c ****** */ | 182 | /* ****** these are the same functions as the ones used in gnunet-helper-transport-wlan.c ****** */ |
170 | 183 | ||
171 | /** | 184 | /** |
172 | * To what multiple do we align messages? 8 byte should suffice for everyone | 185 | * To what multiple do we align messages? 8 byte should suffice for everyone |
@@ -615,7 +628,8 @@ register_service (struct HardwareInfos *dev, int rc_channel) | |||
615 | * 5. set the name, provider and description | 628 | * 5. set the name, provider and description |
616 | * 6. register the service record to the local SDP server | 629 | * 6. register the service record to the local SDP server |
617 | * 7. cleanup | 630 | * 7. cleanup |
618 | */uint8_t svc_uuid_int[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 631 | */ |
632 | uint8_t svc_uuid_int[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
619 | dev->pl_mac.mac[5], dev->pl_mac.mac[4], | 633 | dev->pl_mac.mac[5], dev->pl_mac.mac[4], |
620 | dev->pl_mac.mac[3], | 634 | dev->pl_mac.mac[3], |
621 | dev->pl_mac.mac[2], dev->pl_mac.mac[1], | 635 | dev->pl_mac.mac[2], dev->pl_mac.mac[1], |
diff --git a/src/transport/gnunet-helper-transport-wlan.c b/src/transport/gnunet-helper-transport-wlan.c index 83ade115b..b77f09851 100644 --- a/src/transport/gnunet-helper-transport-wlan.c +++ b/src/transport/gnunet-helper-transport-wlan.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010, 2011, 2012 GNUnet e.V. | 3 | Copyright (C) 2010, 2011, 2012 GNUnet e.V. |
4 | Copyright (c) 2007, 2008, Andy Green <andy@warmcat.com> | 4 | Copyright (C) 2007, 2008, Andy Green <andy@warmcat.com> |
5 | Copyright Copyright (C) 2009 Thomas d'Otreppe | 5 | Copyright (C) 2009 Thomas d'Otreppe |
6 | 6 | ||
7 | GNUnet is free software: you can redistribute it and/or modify it | 7 | GNUnet is free software: you can redistribute it and/or modify it |
8 | under the terms of the GNU Affero General Public License as published | 8 | under the terms of the GNU Affero General Public License as published |
@@ -110,6 +110,7 @@ | |||
110 | * parts taken from aircrack-ng, parts changend. | 110 | * parts taken from aircrack-ng, parts changend. |
111 | */ | 111 | */ |
112 | #include "gnunet_config.h" | 112 | #include "gnunet_config.h" |
113 | #include <sys/param.h> | ||
113 | #include <sys/socket.h> | 114 | #include <sys/socket.h> |
114 | #include <sys/ioctl.h> | 115 | #include <sys/ioctl.h> |
115 | #include <sys/types.h> | 116 | #include <sys/types.h> |
@@ -117,12 +118,26 @@ | |||
117 | #include <sys/wait.h> | 118 | #include <sys/wait.h> |
118 | #include <sys/time.h> | 119 | #include <sys/time.h> |
119 | #include <sys/stat.h> | 120 | #include <sys/stat.h> |
121 | #ifdef AF_LINK | ||
122 | #include <net/if_dl.h> | ||
123 | #endif | ||
124 | #ifdef AF_PACKET | ||
120 | #include <netpacket/packet.h> | 125 | #include <netpacket/packet.h> |
126 | #endif | ||
127 | #if defined(__linux__) | ||
121 | #include <linux/if_ether.h> | 128 | #include <linux/if_ether.h> |
122 | #include <linux/if.h> | 129 | #include <linux/if.h> |
123 | #include <linux/wireless.h> | 130 | #include <linux/wireless.h> |
131 | #endif | ||
132 | #if defined(BSD) | ||
133 | #include <net/if.h> | ||
134 | #include <net/if_ether.h> | ||
135 | #include <net80211/ieee80211_node.h> | ||
136 | #endif | ||
124 | #include <netinet/in.h> | 137 | #include <netinet/in.h> |
125 | #include <linux/if_tun.h> | 138 | #ifdef IF_TUN_HDR |
139 | #include IF_TUN_HDR | ||
140 | #endif | ||
126 | #include <stdio.h> | 141 | #include <stdio.h> |
127 | #include <stdlib.h> | 142 | #include <stdlib.h> |
128 | #include <string.h> | 143 | #include <string.h> |
@@ -130,7 +145,6 @@ | |||
130 | #include <fcntl.h> | 145 | #include <fcntl.h> |
131 | #include <errno.h> | 146 | #include <errno.h> |
132 | #include <dirent.h> | 147 | #include <dirent.h> |
133 | #include <sys/param.h> | ||
134 | #include <unistd.h> | 148 | #include <unistd.h> |
135 | #include <stdint.h> | 149 | #include <stdint.h> |
136 | 150 | ||
@@ -1661,7 +1675,12 @@ open_device_raw (struct HardwareInfos *dev) | |||
1661 | struct ifreq ifr; | 1675 | struct ifreq ifr; |
1662 | struct iwreq wrq; | 1676 | struct iwreq wrq; |
1663 | struct packet_mreq mr; | 1677 | struct packet_mreq mr; |
1678 | #ifdef AF_PACKET | ||
1664 | struct sockaddr_ll sll; | 1679 | struct sockaddr_ll sll; |
1680 | #endif | ||
1681 | #ifdef AF_LINK | ||
1682 | struct sockaddr_dl sll; | ||
1683 | #endif | ||
1665 | 1684 | ||
1666 | /* find the interface index */ | 1685 | /* find the interface index */ |
1667 | memset (&ifr, 0, sizeof(ifr)); | 1686 | memset (&ifr, 0, sizeof(ifr)); |
@@ -1675,9 +1694,16 @@ open_device_raw (struct HardwareInfos *dev) | |||
1675 | 1694 | ||
1676 | /* lookup the hardware type */ | 1695 | /* lookup the hardware type */ |
1677 | memset (&sll, 0, sizeof(sll)); | 1696 | memset (&sll, 0, sizeof(sll)); |
1697 | #if defined(AF_PACKET) | ||
1678 | sll.sll_family = AF_PACKET; | 1698 | sll.sll_family = AF_PACKET; |
1679 | sll.sll_ifindex = ifr.ifr_ifindex; | 1699 | sll.sll_ifindex = ifr.ifr_ifindex; |
1680 | sll.sll_protocol = htons (ETH_P_ALL); | 1700 | sll.sll_protocol = htons (ETH_P_ALL); |
1701 | #endif | ||
1702 | #if defined(AF_LINK) | ||
1703 | sll.sdl_family = AF_LINK; | ||
1704 | sll.sdl_index = ifr.ifr_ifindex; | ||
1705 | sll.sdl_protocol = htons (ETH_P_ALL); | ||
1706 | #endif | ||
1681 | if (-1 == ioctl (dev->fd_raw, SIOCGIFHWADDR, &ifr)) | 1707 | if (-1 == ioctl (dev->fd_raw, SIOCGIFHWADDR, &ifr)) |
1682 | { | 1708 | { |
1683 | fprintf (stderr, "ioctl(SIOCGIFHWADDR) on interface `%.*s' failed: %s\n", | 1709 | fprintf (stderr, "ioctl(SIOCGIFHWADDR) on interface `%.*s' failed: %s\n", |
@@ -1760,10 +1786,22 @@ open_device_raw (struct HardwareInfos *dev) | |||
1760 | 1786 | ||
1761 | /* enable promiscuous mode */ | 1787 | /* enable promiscuous mode */ |
1762 | memset (&mr, 0, sizeof(mr)); | 1788 | memset (&mr, 0, sizeof(mr)); |
1789 | #ifdef AF_PACKET | ||
1763 | mr.mr_ifindex = sll.sll_ifindex; | 1790 | mr.mr_ifindex = sll.sll_ifindex; |
1791 | #endif | ||
1792 | #ifdef AF_LINK | ||
1793 | mr.mr_ifindex = sll.sdl_index; | ||
1794 | #endif | ||
1764 | mr.mr_type = PACKET_MR_PROMISC; | 1795 | mr.mr_type = PACKET_MR_PROMISC; |
1765 | if (0 != | 1796 | if (0 != |
1766 | setsockopt (dev->fd_raw, SOL_PACKET, PACKET_ADD_MEMBERSHIP, &mr, | 1797 | setsockopt (dev->fd_raw, SOL_PACKET, |
1798 | #ifdef AF_PACKET | ||
1799 | PACKET_ADD_MEMBERSHIP, | ||
1800 | #endif | ||
1801 | #ifdef AF_LINK | ||
1802 | SIOCADDMULTI, | ||
1803 | #endif | ||
1804 | &mr, | ||
1767 | sizeof(mr))) | 1805 | sizeof(mr))) |
1768 | { | 1806 | { |
1769 | fprintf (stderr, | 1807 | fprintf (stderr, |